@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "IRANSansX", Tahoma, "Segoe UI", Arial, sans-serif;
  background: #fff;
  color: #28312c;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.login-card {
  width: min(420px, calc(100% - 36px));
  margin: auto;
  padding: 36px;
  border: 1px solid #e7eae6;
  border-radius: 14px;
  background: #fff;
}
.card-icon { display: block; width: 48px; height: 48px; margin-bottom: 18px; }
.login-card h1 { font-size: 23px; line-height: 1.5; margin: 0 0 7px; }
.login-card p { margin: 0 0 27px; color: #78837a; font-size: 14px; line-height: 1.8; }
.login-card label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 9px; }
.login-card input { width: 100%; height: 44px; padding: 0 13px; border: 1px solid #d7ddd7; border-radius: 7px; outline: none; background: #fff; }
.login-card input:focus { border-color: #6a9979; box-shadow: 0 0 0 3px #e7f1e9; }
.primary-button { width: 100%; height: 44px; margin-top: 13px; border: 0; border-radius: 7px; background: #3b7450; color: #fff; font-weight: 700; }
.primary-button:hover { background: #2f6242; }
.login-card .error-message { margin: 14px 0 0; color: #b14b44; }

.note-screen { flex: 1; min-height: 100dvh; display: flex; flex-direction: column; }
.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid #eceeeb;
  background: #fff;
}
.toolbar-tools, .toolbar-meta { display: flex; align-items: center; gap: 4px; }
.toolbar-meta { gap: 20px; }
.tool-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #46544a;
  font-size: 18px;
  line-height: 1;
}
.tool-button:hover, .tool-button:focus-visible { background: #f0f3ef; outline: none; }
.bold-button { font-family: Arial, sans-serif; font-weight: 800; }
.save-status { color: #839088; font-size: 12px; white-space: nowrap; }
.save-status.error { color: #b34a42; }
.delete-button { padding: 7px 0; border: 0; background: transparent; color: #8d9890; font-size: 12px; }
.delete-button:hover { color: #a44d46; }
.delete-button:disabled { opacity: .5; cursor: default; }
.view-link { font-size: 12px; color: #78837a; text-decoration: none; }

.editor {
  flex: 1;
  width: 100%;
  min-height: calc(100dvh - 52px);
  padding: 44px clamp(24px, 5vw, 88px) 80px;
  outline: none;
  background: #fff;
  font-size: 18px;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.editor:empty::before { content: attr(data-placeholder); color: #acb5ad; pointer-events: none; }
.editor p, .editor div { margin: 0 0 .45em; }
.editor ul, .editor ol { margin: .45em 0 .8em; padding-inline-start: 1.75em; }
.editor ul { list-style-type: disc; }
.editor ol { list-style-type: decimal; }
.editor [data-list-style="disc"] { list-style-type: disc; }
.editor [data-list-style="circle"] { list-style-type: circle; }
.editor [data-list-style="square"] { list-style-type: square; }
.editor [data-list-style="decimal"] { list-style-type: decimal; }
.editor [data-list-style="lower-alpha"] { list-style-type: lower-alpha; }
.editor [data-list-style="upper-alpha"] { list-style-type: upper-alpha; }
.editor [data-list-style="lower-roman"] { list-style-type: lower-roman; }
.editor [data-list-style="upper-roman"] { list-style-type: upper-roman; }
.editor li { padding-inline-start: .15em; }
.editor ul[data-list-style="check"] { list-style: none; padding-inline-start: 0; }
.editor ul[data-list-style="check"] > li { position: relative; padding-inline-start: 1.75em; }
.check-toggle {
  position: absolute;
  inset-inline-start: 0;
  top: .36em;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  padding: 0;
  border: 1.5px solid #9aaba0;
  border-radius: 5px;
  background: #fff;
  color: #fff;
  line-height: 1;
}
.check-toggle:hover, .check-toggle:focus-visible { border-color: #3b7450; outline: none; box-shadow: 0 0 0 3px #e4efe7; }
.editor li[data-checked="true"] > .check-toggle { border-color: #3b7450; background: #3b7450; }
.editor li[data-checked="true"] > .check-toggle::after { content: "✓"; font: 700 15px Arial, sans-serif; }
.editor h1, .editor h2, .editor h3 { line-height: 1.5; margin: .8em 0 .35em; }
.editor h1 { font-size: 1.65em; }
.editor h2 { font-size: 1.35em; }
.editor h3 { font-size: 1.15em; }
.editor blockquote { margin: .5em 0; padding-inline-start: 1em; border-inline-start: 2px solid #d8dfd8; color: #66736a; }

@media (max-width: 640px) {
  .note-screen { min-width: 0; width: 100%; }
  .toolbar { height: calc(46px + env(safe-area-inset-top)); gap: 6px; padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); }
  .toolbar-tools { flex: none; gap: 0; }
  .tool-button { width: 30px; height: 40px; padding: 0; }
  .toolbar-meta { flex: 1; min-width: 0; justify-content: flex-end; gap: 8px; }
  .save-status { max-width: 70px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .delete-button, .view-link { flex: none; font-size: 10px; min-height: 40px; display: inline-flex; align-items: center; }
  button, .view-link { touch-action: manipulation; }
  .editor { min-width: 0; padding: 20px max(14px, env(safe-area-inset-right)) calc(44px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); font-size: 16px; }
  .editor ul[data-list-style="check"] > li { min-height: 34px; padding-inline-start: 2em; }
  .check-toggle { width: 24px; height: 24px; }
  .check-toggle::before { content: ""; position: absolute; inset: -5px; }
  .login-card { padding: 26px 22px; }
  .login-card input { font-size: 16px; }
}
