/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  background: #0f0f1a;
  color: #e8e8f0;
  min-height: 100dvh;
  overscroll-behavior: none;
}
button { cursor: pointer; font: inherit; border: none; background: none; }
input  { font: inherit; }

/* ── Shell ── */
.shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  background: #141428;
  border-bottom: 1px solid #2a2a45;
  flex-shrink: 0;
}
.logo {
  width: 34px; height: 34px;
  background: #0d7c8a;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: white;
  flex-shrink: 0;
}
.app-title { font-size: 15px; font-weight: 800; color: #e8e8f0; line-height: 1.1; }
.app-sub   { font-size: 11px; color: #7a7a9a; }

/* ── Nav ── */
.nav-bar {
  display: flex;
  background: #141428;
  border-top: 1px solid #2a2a45;
  flex-shrink: 0;
  order: 10;
}
.nav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px 10px;
  font-size: 11px; font-weight: 600;
  color: #5a5a7a;
  gap: 3px;
  transition: color 150ms;
  border-top: 2px solid transparent;
}
.nav-btn .nav-icon { font-size: 20px; }
.nav-btn.active { color: #0d9db0; border-top-color: #0d9db0; }

/* ── Pages ── */
.page { display: none; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.page.active { display: flex; flex-direction: column; }

/* ── TRAINER PAGE ── */
#page-trainer { padding: 12px; gap: 10px; }

/* Session bar */
.session-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1a1a30;
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid #2a2a45;
  flex-wrap: wrap;
}
.s-stat { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.s-num  { font-size: 22px; font-weight: 900; line-height: 1; }
.s-lbl  { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: #5a5a7a; font-weight: 700; }
.streak { margin-left: auto; background: linear-gradient(135deg,#f97316,#ef4444); 
          color: white; font-size: 13px; font-weight: 800;
          padding: 4px 10px; border-radius: 999px; }

/* Question card */
.question-card {
  background: #1a1a30;
  border-radius: 16px;
  border: 2px solid #2a2a45;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 250ms;
}
.case-badge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.case-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
  color: white;
}
.case-q { font-size: 12px; color: #7a7a9a; font-style: italic; }

.word-display { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.word-tr  { font-size: clamp(2rem,10vw,3rem); font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.word-ru  { font-size: 14px; color: #7a7a9a; }
.word-cat {
  font-size: 11px; background: #2a2a45; color: #7a7a9a;
  padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.task-prompt { font-size: 13px; color: #9a9ab0; }

/* Input */
.input-area { display: flex; flex-direction: column; gap: 10px; }
.answer-input {
  width: 100%; padding: 14px 16px;
  font-size: 20px; font-weight: 700;
  border: 2px solid #2a2a45;
  border-radius: 12px;
  background: #0f0f1a; color: #e8e8f0;
  outline: none; transition: border-color 180ms;
}
.answer-input:focus { border-color: #0d7c8a; box-shadow: 0 0 0 3px rgba(13,124,138,.2); }
.btn-row { display: flex; gap: 10px; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center;
  padding: 13px 20px; border-radius: 12px;
  font-size: 15px; font-weight: 800;
  transition: transform 80ms, background 150ms;
  border: none; cursor: pointer;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: .4; }
.btn-primary { background: #0d7c8a; color: white; flex: 1; }
.btn-primary:hover { background: #0a6270; }
.btn-ghost   { background: #2a2a45; color: #9a9ab0; }
.btn-full    { width: 100%; }
.btn-danger  { background: transparent; border: 1.5px solid #ef4444; color: #ef4444; }

/* Result */
.result-area {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: 12px;
}
.res-ok   { background: rgba(34,197,94,.08);  border: 1.5px solid #22c55e; }
.res-fail { background: rgba(239,68,68,.08);   border: 1.5px solid #ef4444; }
.res-top  { display: flex; align-items: flex-start; gap: 10px; }
.res-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.res-verdict { font-size: 17px; font-weight: 900; }
.res-verdict.ok   { color: #22c55e; }
.res-verdict.fail { color: #ef4444; }
.res-your    { font-size: 13px; color: #7a7a9a; margin-top: 2px; }
.res-correct { font-size: 14px; margin-top: 4px; }
.rule-box {
  background: #141428; border-left: 3px solid #0d7c8a;
  padding: 10px 12px; border-radius: 0 8px 8px 0;
  font-size: 13px; line-height: 1.5;
}

/* Cheatsheet */
.cheatsheet { background: #1a1a30; border-radius: 12px; border: 1px solid #2a2a45; padding: 12px; }
.cheat-title { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #5a5a7a; font-weight: 700; margin-bottom: 8px; }
.cheatsheet-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.cheat-item {
  background: #141428; border-radius: 8px; padding: 7px 8px;
  display: flex; flex-direction: column; gap: 2px;
  border: 1.5px solid transparent;
}
.cheat-active { background: rgba(13,124,138,.1); }
.cheat-case   { font-size: 9px; font-weight: 800; text-transform: uppercase; padding: 2px 6px; border-radius: 999px; color: white; width: fit-content; }
.cheat-form   { font-size: 14px; font-weight: 800; }
.cheat-suf    { font-size: 11px; color: #f59e0b; font-weight: 700; }
.cheat-tap    { font-size: 9px; color: #5a5a7a; text-align: center; }
.cheat-hidden .cheat-form,
.cheat-hidden .cheat-suf { visibility: hidden; height: 0; margin: 0; overflow: hidden; }
.cheat-hidden .cheat-tap { visibility: visible; }
.cheat-item:not(.cheat-hidden) .cheat-tap { display: none; }

/* ── STATS PAGE ── */
#page-stats { padding: 16px; gap: 16px; }
.page-title { font-size: 22px; font-weight: 900; }

.summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.sum-card {
  background: #1a1a30; border-radius: 14px; border: 1px solid #2a2a45;
  padding: 14px 10px; text-align: center;
}
.sum-num { font-size: 26px; font-weight: 900; display: block; }
.sum-lbl { font-size: 11px; color: #5a5a7a; font-weight: 600; }

.section-title { font-size: 13px; font-weight: 800; color: #7a7a9a;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }

.case-bars   { display: flex; flex-direction: column; gap: 10px; }
.bar-row     { display: flex; align-items: center; gap: 8px; }
.bar-label   { font-size: 10px; font-weight: 800; color: white; padding: 3px 7px;
  border-radius: 999px; flex-shrink: 0; min-width: 42px; text-align: center; }
.bar-track   { flex: 1; height: 8px; background: #2a2a45; border-radius: 999px; overflow: hidden; }
.bar-fill    { height: 100%; border-radius: 999px; transition: width 500ms cubic-bezier(.16,1,.3,1); }
.bar-pct     { font-size: 12px; font-weight: 800; min-width: 32px; text-align: right; color: #9a9ab0; }
.bar-meta    { font-size: 11px; color: #5a5a7a; min-width: 36px; }

.history-list { display: flex; flex-direction: column; gap: 5px; }
.hist-row {
  display: flex; align-items: center; gap: 8px;
  background: #1a1a30; border-radius: 10px; padding: 9px 12px;
  border-left: 3px solid transparent; font-size: 13px;
}
.h-ok   { border-left-color: #22c55e; }
.h-fail { border-left-color: #ef4444; }
.hist-word { font-weight: 800; flex: 1; }
.hist-case { font-size: 10px; font-weight: 800; color: white; padding: 2px 6px; border-radius: 999px; }
.hist-note { font-size: 12px; color: #5a5a7a; margin-left: auto; }
.empty     { color: #5a5a7a; font-style: italic; padding: 16px 0; }

/* ── REFERENCE PAGE ── */
#page-ref { padding: 16px; gap: 16px; }

.vowel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vowel-box  {
  border-radius: 12px; padding: 10px 12px;
  border: 2px solid;
}
.vowel-box-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.vowel-pills { display: flex; gap: 6px; }
.vpill { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; color: white; }

.case-cards-ref { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ref-card {
  background: #1a1a30; border-radius: 12px; padding: 12px;
  border-top: 3px solid;
}
.ref-card-name  { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ref-card-tr    { font-size: 10px; color: #5a5a7a; font-style: italic; }
.ref-card-suf   { font-size: 16px; font-weight: 900; margin: 4px 0; }
.ref-card-q     { font-size: 11px; color: #7a7a9a; }
.ref-card-ex    { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.ref-ex         { font-size: 11px; color: #5a5a7a; }
.ref-ex b       { color: #e8e8f0; }

.harmony-table  { width: 100%; border-collapse: collapse; font-size: 12px; }
.harmony-table th {
  background: #1a1a30; padding: 7px 6px; text-align: center;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: #5a5a7a;
  border-bottom: 1px solid #2a2a45;
}
.harmony-table td {
  padding: 7px 6px; text-align: center;
  border-bottom: 1px solid #1f1f35;
}
.harmony-table tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.ht-vowel { font-size: 18px; font-weight: 900; }

.buf-grid { display: flex; flex-direction: column; gap: 7px; }
.buf-item {
  background: #1a1a30; border-radius: 10px; padding: 10px 12px;
  border-left: 3px solid #0d7c8a;
}
.buf-rule { font-size: 13px; font-weight: 700; }
.buf-ex   { font-size: 12px; color: #5a5a7a; margin-top: 2px; font-style: italic; }

/* ── Colors ── */
.c-ok   { color: #22c55e; }
.c-warn { color: #f59e0b; }
.c-err  { color: #ef4444; }

/* ── My Words ── */
.add-word-form {
  background: #1a1a2e;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.add-word-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.add-input {
  width: 100%;
  padding: 12px 14px;
  background: #0f0f1a;
  border: 1.5px solid #2a2a4a;
  border-radius: 10px;
  color: #e8e8f0;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
}
.add-input:focus { border-color: #0d7c8a; }
.add-word-msg {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
  text-align: center;
}
.add-word-msg.ok  { color: #2ecc71; }
.add-word-msg.err { color: #e74c3c; }

.my-words-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.my-word-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a2e;
  border-radius: 10px;
  padding: 12px 14px;
  gap: 10px;
}
.my-word-tr { font-size: 16px; font-weight: 700; color: #e8e8f0; }
.my-word-ru { font-size: 13px; color: #8888aa; flex: 1; }
.my-word-del {
  background: rgba(231,76,60,.15);
  color: #e74c3c;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.my-word-del:active { background: rgba(231,76,60,.35); }
.my-words-empty {
  text-align: center;
  color: #5a5a7a;
  font-size: 14px;
  padding: 24px 0;
}

/* ── Sentences ── */
.sent-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.sent-lvl {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  background: #1a1a2e;
  color: #8888aa;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  transition: all .2s;
}
.sent-lvl.active {
  background: #0d7c8a;
  color: #fff;
}
.sent-ru-label {
  font-size: 12px;
  color: #8888aa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.sent-ru {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 14px;
}
.sent-hint-btn {
  background: rgba(13,124,138,.15);
  color: #0d7c8a;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  display: inline-block;
}
.sent-hint-btn:active { background: rgba(13,124,138,.3); }

/* Pronoun hint */
.pronoun-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pronoun-btn {
  background: rgba(168,85,247,.15);
  color: #a855f7;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}
.pronoun-btn:active { background: rgba(168,85,247,.3); }
.pronoun-val {
  background: rgba(168,85,247,.12);
  border-left: 3px solid #a855f7;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #c084fc;
}
.sent-hint {
  background: rgba(13,124,138,.1);
  border-left: 3px solid #0d7c8a;
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #0d7c8a;
  margin-bottom: 14px;
}
.c-skip { color: #8888aa; }

/* Nav with 5 items */
.nav-bar {
  display: flex;
}
.nav-btn {
  flex: 1;
  min-width: 0;
}
.nav-btn .nav-icon {
  font-size: 18px;
}

/* ─── REF INSIGHT BLOCK ──────────────────────────────────────────────────────── */
.ref-insight {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}
.ref-insight-title {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 8px;
}
.ref-insight-body {
  font-size: 13px;
  color: #a0aec0;
  line-height: 1.6;
}
.ref-insight-body b { color: #e2e8f0; }
.ref-roles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.ref-role {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.05);
  border-left: 3px solid #555;
  border-radius: 0 8px 8px 0;
  padding: 7px 10px;
  font-size: 13px;
  color: #cbd5e0;
}
.ref-role-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.ref-suf-chip {
  background: rgba(192,57,43,.2);
  color: #fc8181;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: monospace;
}
.ref-min-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}
.ref-min-table tr {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ref-min-table td {
  padding: 5px 4px;
  vertical-align: middle;
  color: #cbd5e0;
}
.rmt-badge {
  display: inline-block;
  color: #fff;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.rmt-suf {
  font-family: monospace;
  color: #f6ad55;
  white-space: nowrap;
  padding: 0 6px;
}
.rmt-q {
  color: #90cdf4;
  white-space: nowrap;
}
.rmt-note {
  color: #718096;
  font-size: 11px;
}
.rmt-note i { font-style: normal; color: #a0aec0; }
.rmt-note b { color: #f6ad55; }
.ref-insight-tip {
  margin-top: 10px;
  background: rgba(26,122,138,.15);
  border-left: 3px solid #1A7A8A;
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  font-size: 12px;
  color: #81e6d9;
}

/* ─── ALGORITHM BLOCK ─────────────────────────────────────────────────────────── */
.ref-algo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.ref-algo-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ref-algo-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.ref-algo-qs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.ref-algo-q {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #a0aec0;
}
.ref-q-chip {
  display: inline-block;
  color: #fff;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.ref-algo-example {
  margin-top: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 12px;
}
.ref-algo-ex-title {
  font-size: 12px;
  color: #718096;
  margin-bottom: 8px;
}
.ref-algo-ex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.ref-ex-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  color: #e2e8f0;
}
.ref-algo-ex-result {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255,255,255,0.06);
  border-radius: 7px;
  padding: 8px 12px;
  letter-spacing: 0.3px;
}

/* ─── TEMPLATES BLOCK ─────────────────────────────────────────────────────────── */
.ref-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.ref-tpl {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 9px 11px;
}
.ref-tpl-head {
  font-size: 12px;
  color: #a0aec0;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ref-tpl-formula {
  font-size: 13px;
  color: #e2e8f0;
  margin-bottom: 3px;
}
.ref-formula-chip {
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  padding: 1px 7px;
  font-family: monospace;
  font-size: 13px;
  color: #f6ad55;
}
.ref-tpl-ex {
  font-size: 12px;
  color: #718096;
}
.ref-tpl-ex i { font-style: normal; color: #90cdf4; }
.ref-tpl-ex b { color: #f59e0b; }

/* ─── EAR BLOCK ───────────────────────────────────────────────────────────────── */
.ref-ear-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}
.ref-ear-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #a0aec0;
}
.ref-ear-chip {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 9px;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 90px;
  text-align: center;
}

/* ─── CATEGORY FILTER ─────────────────────────────────────────────────────────── */
.cat-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 10px;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.cat-filter::-webkit-scrollbar { display: none; }
.cat-btn {
  background: rgba(255,255,255,0.08);
  color: #a0aec0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
  font-family: inherit;
  text-transform: capitalize;
}
.cat-btn.active {
  background: #0d7c8a;
  color: #fff;
  border-color: #0d7c8a;
}
.cat-btn:active {
  transform: scale(0.95);
}

/* ─── MODE SWITCH ─────────────────────────────────────────────────────────────── */
.mode-switch {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
  gap: 2px;
}
.mode-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #7b8ca8;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
}
.mode-btn.active {
  background: #0d7c8a;
  color: #fff;
  box-shadow: 0 2px 8px rgba(13,124,138,.4);
}

/* ─── DIALOG CARD ─────────────────────────────────────────────────────────────── */
.dlg-topic-badge {
  display: inline-block;
  background: #0d7c8a;
  color: #fff;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 10px;
}
.dlg-q-label {
  font-size: 12px;
  color: #7b8ca8;
  margin-bottom: 4px;
}
.dlg-question {
  font-size: 18px;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 4px;
}
.dlg-q-tr {
  font-size: 15px;
  color: #0d7c8a;
  font-weight: 700;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: rgba(13,124,138,.1);
  border-radius: 8px;
  border-left: 3px solid #0d7c8a;
}

/* ── How-to instruction tabs ─────────────────── */
.ref-howto-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.ref-howto-tab {
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(255,255,255,.12);
  color: #a0aec0;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ref-howto-tab.active {
  background: rgba(13,124,138,.25);
  border-color: #0d7c8a;
  color: #81e6d9;
}
.ref-howto-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  font-size: 13.5px;
  color: #cbd5e0;
  line-height: 1.5;
}
.ref-howto-num {
  min-width: 22px;
  height: 22px;
  background: #0d7c8a;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.ref-howto-tip {
  background: rgba(246,173,85,.1);
  border-left: 3px solid #f6ad55;
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: #fbd38d;
  margin-top: 4px;
}

/* ── Cheat toggle button ──────────────────────────────── */
.cheat-toggle-btn {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(255,255,255,.12);
  color: #a0aec0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
  margin-bottom: 6px;
}
.cheat-toggle-btn:active {
  background: rgba(13,124,138,.2);
  color: #81e6d9;
}


.sent-open-block{
  margin:10px 0 12px;
  padding:12px 14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
}
.sent-open-title{
  font-size:12px;
  opacity:.75;
  margin-bottom:4px;
}
.sent-open-val{
  font-size:16px;
  font-weight:700;
  line-height:1.35;
}


.affix-root{color:var(--text);font-weight:700}.affix-suffix{color:#e14b84;font-weight:800}.affix-word{display:inline-flex;gap:0;align-items:baseline}.sent-affix .affix-suffix,.cheat-form .affix-suffix,.task-prompt .affix-suffix{background:rgba(225,75,132,.12);padding:0 2px;border-radius:6px}

/* — Toast Notifications — */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2a2a2a;
  color: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  font-size: 16px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #4CAF50;
}

.toast.error {
  background: #f44336;
}

.toast.info {
  background: #2196F3;
}

/* — Flashcard Mode — */
.flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  min-height: 80vh;
}

.flashcard-card {
  width: 90%;
  max-width: 500px;
  height: 300px;
  perspective: 1000px;
    position: relative;
  margin: 20px 0;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flashcard-card { transform-style: preserve-3d; cursor: pointer; transition: transform 0.6s; }

.card-front, .card-back {
  position: absolute;
  width: 100%;
    height: 100%;
  backface-visibility: hidden;
  display: flex;
    flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  padding: 16px;
  font-size: 14px;
  font-weight: bold;
  color: white;
  text-align: center;
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.fc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fc-cat { font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.2); padding: 3px 8px; border-radius: 12px; }
.fc-fav-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: white; line-height: 1; }
.fc-word { font-size: 28px; font-weight: 900; flex: 1; display: flex; align-items: center; justify-content: center; }
.fc-hint { font-size: 12px; opacity: 0.7; text-align: center; margin-top: auto; padding-top: 8px; }
.fc-tr { font-size: 28px; font-weight: 900; text-align: center; margin-bottom: 12px; }
.fc-forms { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.fc-form { font-size: 12px; }
.fc-case { font-weight: 700; opacity: 0.8; }

.fc-controls {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.fc-controls button {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #667eea;
  color: white;
  transition: all 0.3s;
}

.fc-controls button:hover {
  background: #764ba2;
  transform: translateY(-2px);
}

/* — Timer Mode — */
#page-timer { padding: 16px; gap: 12px; } #page-flashcard { padding: 16px; gap: 12px; } .timer-container {
  text-align: center;
  padding: 20px;
}

.timer-display {
  font-size: 64px;
  font-weight: bold;
  color: #667eea;
  margin: 20px 0;
  font-family: 'Courier New', monospace;
}

.timer-display.warning {
  color: #f5576c;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 20px 0;
  font-size: 20px;
}

.timer-stat {
  background: #1a1a30; color: #e8e8f0;
  padding: 15px 25px;
  border-radius: 8px;
  font-weight: bold;
}

/* — Favorite Button — */
.favorite-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  margin-left: 10px;
  transition: transform 0.2s;
}

.favorite-btn:hover {
  transform: scale(1.2);
}

.favorite-btn.active {
  animation: heartBeat 0.5s;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(1.1); }
}

/* — Achievements — */
.achievement-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  text-align: center;
  z-index: 2000;
  transition: transform 0.5s;
}

.achievement-popup.show {
  transform: translate(-50%, -50%) scale(1);
}

.achievement-popup h2 {
  font-size: 32px;
  margin: 0 0 10px 0;
}

/* — Animations — */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.option {
  animation: slideIn 0.3s ease;
}

.option:nth-child(1) { animation-delay: 0.1s; }
.option:nth-child(2) { animation-delay: 0.2s; }
.option:nth-child(3) { animation-delay: 0.3s; }
.option:nth-child(4) { animation-delay: 0.4s; }

/* — Streak Display — */
.streak-display {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ffd93d 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 999;
}

.streak-display::before {
  content: '🔥';
  margin-right: 8px;
}


/* ───────────────────────────────────────────────────────────────────────────────
   FLASHCARD
   ─────────────────────────────────────────────────────────────────────────────── */

.flashcard-card {
  width: 320px;
  height: 200px;
  perspective: 1000px;
  margin: 30px auto;
  cursor: pointer;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  transition: transform 0.6s;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.card-front {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: rotateY(0deg);
}

.card-back {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  transform: rotateY(180deg);
}

#flashcard.flipped .card-front {
  transform: rotateY(-180deg);
}

#flashcard.flipped .card-back {
  transform: rotateY(0deg);
}

.card-content {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
}

.card-counter {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #888;
}

/* ───────────────────────────────────────────────────────────────────────────────
   TIMER
   ─────────────────────────────────────────────────────────────────────────────── */

.question-card {
  background: #2a2d3a;
  border-radius: 16px;
  padding: 30px;
  margin: 20px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question-text {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  text-align: center;
}

.timer-input {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  border: 2px solid #444;
  border-radius: 12px;
  background: #1e2029;
  color: #fff;
  margin: 20px 0;
  text-align: center;
}

.timer-input:focus {
  outline: none;
  border-color: #667eea; } /* ─── Timer & Flashcard Page IDs ─── */ #timer-time { font-size: 48px; font-weight: 900; color: #0d9db0; display: block; text-align: center; letter-spacing: -.02em; } #timer-score { font-size: 20px; font-weight: 700; color: #9a9ab0; display: block; text-align: center; margin-top: -8px; } #timer-word-ru { font-size: 22px; font-weight: 800; color: #e8e8f0; display: block; text-align: center; margin-top: 12px; } #timer-word-tr { font-size: 16px; color: #7a7a9a; display: block; text-align: center; } #timer-case-name { font-size: 13px; background: #1a1a30; border: 1px solid #2a2a45; color: #0d9db0; padding: 4px 12px; border-radius: 999px; display: inline-block; margin: 8px auto; } #page-timer .page-title { display: flex; align-items: center; gap: 8px; } .timer-display-row { display: flex; flex-direction: column; align-items: center; background: #1a1a30; border-radius: 16px; border: 1px solid #2a2a45; padding: 20px; margin-bottom: 12px; } /* remove duplicate brace */ .timer-input:focus { outline: none;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
