:root {
  /* palette */
  --navy: #0B2A6F;
  --navy-2: #12357F;
  --ink: #13224A;
  --ink-2: #3A4A72;
  --muted: #6B7A9C;
  --line: #DCE5F3;
  --line-2: #E9EFF8;
  --blue: #1E6BFF;
  --blue-2: #1557D6;
  --azure: #3DA5FF;
  --sky: #CFE5FF;
  --sky-2: #EAF4FF;
  --sky-3: #F4F9FF;
  --milk: #FBF9F4;
  --paper: #FFFEFB;
  --paper-2: #FBF8F1;
  --green: #22A06B;
  --green-soft: #DDF3E8;
  --yellow: #FFC53D;
  --yellow-2: #F2A100;
  --yellow-soft: #FFF2CC;
  --coral: #FF7A6B;
  --coral-soft: #FFE9E5;
  --violet: #6C63FF;

  /* subjects */
  --kaz: #3B5BFF;
  --kaz-soft: #E8ECFF;
  --math: #0E9BE8;
  --math-soft: #E1F3FD;
  --sci: #22A06B;
  --sci-soft: #DDF3E8;
  --think: #E9A200;
  --think-soft: #FFF2CC;

  /* status */
  --st-none: #A9B6CF;
  --st-draft: #3DA5FF;
  --st-sent: #1E6BFF;
  --st-checked: #22A06B;
  --st-redo: #FF7A6B;

  /* type */
  --font-display: "Geologica", "Onest", system-ui, sans-serif;
  --font-ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;

  /* shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --sh-1: 0 1px 2px rgba(19, 34, 74, .06), 0 2px 8px rgba(19, 34, 74, .05);
  --sh-2: 0 4px 14px rgba(19, 34, 74, .08), 0 1px 3px rgba(19, 34, 74, .06);
  --sh-3: 0 18px 50px -12px rgba(11, 42, 111, .28), 0 6px 18px -6px rgba(11, 42, 111, .18);
  --sh-blue: 0 10px 30px -8px rgba(30, 107, 255, .55);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--milk);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- buttons ---------- */
.btn {
  --bg: var(--blue);
  --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  border: 0; border-radius: 999px;
  padding: .78em 1.35em;
  background: var(--bg); color: var(--fg);
  font-weight: 650; font-size: 1rem; line-height: 1.1; letter-spacing: .005em;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s, color .2s, opacity .2s;
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn-primary { box-shadow: var(--sh-blue); background: linear-gradient(180deg, #3A80FF, #1E6BFF 55%, #1A5FE6); }
.btn-primary:hover { box-shadow: 0 14px 34px -8px rgba(30, 107, 255, .65); }
.btn-ghost { --bg: transparent; --fg: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { --bg: var(--sky-3); box-shadow: inset 0 0 0 1.5px var(--sky); }
.btn-soft { --bg: var(--sky-2); --fg: var(--blue-2); }
.btn-soft:hover { --bg: var(--sky); }
.btn-yellow { --bg: linear-gradient(180deg, #FFD566, #FFC53D); --fg: #3D2A00; box-shadow: 0 10px 26px -10px rgba(242, 161, 0, .7); }
.btn-green { --bg: var(--green); box-shadow: 0 10px 26px -10px rgba(34, 160, 107, .7); }
.btn-danger { --bg: var(--coral-soft); --fg: #B4382B; }
.btn-sm { font-size: .88rem; padding: .55em 1em; }
.btn-xs { font-size: .8rem; padding: .42em .8em; }
.btn-lg { font-size: 1.12rem; padding: .95em 1.7em; }
.btn-icon { padding: .6em; border-radius: 999px; }

.chip {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .3em .75em; border-radius: 999px;
  font-size: .78rem; font-weight: 650; letter-spacing: .01em;
  background: var(--sky-2); color: var(--blue-2);
}

/* status pills */
.pill {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .32em .75em .32em .6em; border-radius: 999px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
  background: #EEF2F8; color: #5B6B8C;
}
.pill::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; }
.pill.st-none { background: #EEF2F8; color: #6B7A9C; }
.pill.st-draft { background: #E4F2FF; color: #1781DB; }
.pill.st-sent { background: #E3ECFF; color: #1557D6; }
.pill.st-checked { background: #DDF3E8; color: #13834F; }
.pill.st-redo { background: #FFE9E5; color: #C6402F; }

/* form fields */
.field { display: grid; gap: .4rem; }
.field > span { font-size: .82rem; font-weight: 650; color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  padding: .72em .9em;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:hover, .textarea:hover, .select:hover { border-color: #C5D4EC; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 14%, transparent);
}
.textarea { resize: vertical; min-height: 5.5em; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 440px); }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: .7em;
  background: rgba(19, 34, 74, .94); color: #fff;
  padding: .8em 1.05em; border-radius: 14px;
  box-shadow: var(--sh-3);
  font-size: .93rem; font-weight: 500;
  animation: toastIn .35s var(--ease) both;
}
.toast.ok { background: #0F6B47; }
.toast.err { background: #A23426; }
.toast.out { animation: toastOut .3s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
