/* ═══════════════════════════════════════════
   Eesti Numbrid — Styles
   ═══════════════════════════════════════════ */


/* ── Variables ── */

:root {
  --bg: #0b1118;
  --bg-2: #101824;
  --surface: rgba(16, 26, 40, .88);
  --surface-2: rgba(22, 34, 52, .96);
  --surface-3: rgba(255, 255, 255, .05);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #f0f6ff;
  --text-dim: #8aa0be;
  --accent: #f59e0b;
  --accent-2: #f97316;
  --success: #3ddc97;
  --danger: #ff6b7a;
  --warning: #ffcc66;
  --shadow: 0 24px 60px rgba(0, 0, 0, .35);
  --radius: 20px;
  --radius-sm: 14px;
  --maxw: 460px;
}


/* ── Reset ── */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0b1320;
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}


/* ── Layout ── */

.container {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 14px 18px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

.screen.active {
  display: flex;
}

#studyScreen.active {
  min-height: auto;
  padding-bottom: 40px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}


/* ── Start screen / Hero ── */

.hero {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
  padding: 36px 12px;
}

.hero-badge {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
  font-size: .78rem;
  font-weight: 600;
}

.start-logo {
  width: 86px;
  height: 86px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 900;
  font-family: 'DM Mono', monospace;
  background: linear-gradient(135deg, rgba(245, 158, 11, .24), rgba(249, 115, 22, .18));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 18px 40px rgba(0, 0, 0, .24);
}

.start-title {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -.03em;
}

.start-title span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.start-desc {
  color: var(--text-dim);
  line-height: 1.4;
  max-width: 340px;
  font-size: .98rem;
}

.start-points {
  width: 100%;
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.start-point {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  text-align: left;
}

.start-point-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
}

.start-point span {
  font-size: .92rem;
  color: var(--text);
}

.start-info {
  color: var(--text-dim);
  font-size: .76rem;
  font-family: 'DM Mono', monospace;
}


/* ── Buttons ── */

.btn {
  border: none;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, filter .2s, opacity .2s, box-shadow .2s, border-color .2s;
}

.btn:active {
  transform: scale(.98);
}

.btn-primary {
  width: 100%;
  padding: 16px 20px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px rgba(245, 158, 11, .22);
  font-size: 1rem;
}

.btn-secondary {
  width: 100%;
  padding: 14px 18px;
  color: var(--text);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  font-size: .97rem;
}

.btn-ghost {
  padding: 16px 20px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 700;
}


/* ── Header ── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-title h2 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.header-title p {
  font-size: .75rem;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}


/* ── Stats bar ── */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-card {
  padding: 12px 8px;
  border-radius: 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.stat-card .label {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.stat-card .value {
  margin-top: 5px;
  font-size: 1.05rem;
  font-weight: 800;
}

.correct { color: var(--success); }
.wrong   { color: var(--danger); }
.streak  { color: var(--warning); }


/* ── Progress bar ── */

.progress-shell {
  padding: 14px;
  border-radius: 18px;
  margin-bottom: 14px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.progress-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.progress-left strong {
  font-size: .92rem;
  font-weight: 800;
}

.progress-left span,
.progress-right {
  color: var(--text-dim);
  font-size: .75rem;
  font-family: 'DM Mono', monospace;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .45s cubic-bezier(.22, 1, .36, 1);
  box-shadow: 0 0 24px rgba(245, 158, 11, .35);
}


/* ── Question card ── */

.question-card {
  padding: 18px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
}

.question-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  color: #d0f0e8;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .24);
}

.q-text {
  font-size: 1.22rem;
  line-height: 1.42;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

.q-ru {
  font-size: .95rem;
  color: #d0dff0;
  margin-bottom: 12px;
  padding: 14px 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .03));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .07);
  line-height: 1.55;
}

.q-hint-text {
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}


/* ── Choice options ── */

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.option-btn {
  width: 100%;
  padding: 15px 16px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform .15s, border-color .2s, background .2s, opacity .2s, box-shadow .2s;
}

.option-btn:active {
  transform: scale(.985);
}

.option-btn.correct-answer {
  border-color: rgba(61, 220, 151, .38);
  background: rgba(61, 220, 151, .12);
  box-shadow: 0 0 0 1px rgba(61, 220, 151, .14) inset;
}

.option-btn.wrong-answer {
  border-color: rgba(255, 107, 122, .38);
  background: rgba(255, 107, 122, .1);
  box-shadow: 0 0 0 1px rgba(255, 107, 122, .12) inset;
}

.option-btn.dimmed {
  opacity: .35;
}

.option-btn:disabled {
  cursor: default;
}


/* ── Build (word chips) ── */

.build-target {
  min-height: 64px;
  padding: 12px;
  background: rgba(255, 255, 255, .04);
  border: 2px dashed rgba(255, 255, 255, .12);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  transition: border-color .2s, background .2s;
}

.build-target.correct {
  border-color: rgba(61, 220, 151, .45);
  background: rgba(61, 220, 151, .08);
}

.build-target.wrong {
  border-color: rgba(255, 107, 122, .45);
  background: rgba(255, 107, 122, .08);
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.word-chip {
  padding: 10px 13px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: 'DM Mono', monospace;
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform .15s, opacity .2s, background .2s, border-color .2s;
  user-select: none;
}

.word-chip:active {
  transform: scale(.97);
}

.word-chip.used {
  opacity: .25;
  pointer-events: none;
}

.word-chip.in-target {
  background: linear-gradient(135deg, rgba(245, 158, 11, .22), rgba(249, 115, 22, .18));
  border-color: rgba(245, 158, 11, .32);
}


/* ── Typing & submit buttons ── */

.build-submit,
.typing-submit,
.next-btn {
  width: 100%;
  padding: 15px 16px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(245, 158, 11, .2);
}

.build-submit:disabled,
.typing-submit:disabled {
  opacity: .45;
  cursor: default;
  box-shadow: none;
}

.typing-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.typing-input {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, .045);
  border: 1.5px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.typing-input::placeholder {
  color: #6a809c;
}

.typing-input:focus {
  border-color: rgba(245, 158, 11, .55);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .12);
}

.typing-input.correct {
  border-color: rgba(61, 220, 151, .45);
  background: rgba(61, 220, 151, .08);
}

.typing-input.wrong {
  border-color: rgba(255, 107, 122, .45);
  background: rgba(255, 107, 122, .08);
}

.transform-source {
  font-size: 1.02rem;
  font-weight: 800;
  color: #e0f6ff;
  font-family: 'DM Mono', monospace;
  padding: 14px 15px;
  background: linear-gradient(180deg, rgba(245, 158, 11, .15), rgba(249, 115, 22, .08));
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, .2);
  margin-bottom: 12px;
  text-align: center;
}

.correct-reveal {
  font-size: .86rem;
  color: #d0e8f4;
  font-family: 'DM Mono', monospace;
  padding: 10px 0 0;
  text-align: center;
  line-height: 1.55;
}

.next-btn {
  display: none;
  margin-top: 30px;
}


/* ── Results screen ── */

.result-screen {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 28px 10px;
}

.result-card {
  width: 100%;
  padding: 24px 18px;
  border-radius: 26px;
}

.result-emoji {
  font-size: 3.2rem;
}

.result-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: 15px;
}

.result-subtitle {
  color: var(--text-dim);
  line-height: 1.6;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.result-stat {
  padding: 16px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
}

.result-stat .big {
  font-size: 1.4rem;
  font-weight: 700;
}

.result-stat .small {
  font-size: .72rem;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.result-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .06);
}

.result-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
}

.result-percent {
  margin-top: 12px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: .8rem;
}


/* ── Modals ── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  background: rgba(5, 8, 13, .6);
  backdrop-filter: blur(10px);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(100%, 420px);
  padding: 22px 18px;
  border-radius: 24px;
}

.modal h3 {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 10px;
  text-align: center;
}

.modal p {
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 16px;
}

.modal-actions {
  display: grid;
  gap: 10px;
}


/* ── FAQ modal scrollbar ── */

#faqModal .modal {
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, .25) transparent;
}

#faqModal .modal::-webkit-scrollbar {
  width: 5px;
}

#faqModal .modal::-webkit-scrollbar-track {
  background: transparent;
  margin: 16px 0;
}

#faqModal .modal::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, .2);
  border-radius: 99px;
}

#faqModal .modal::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, .4);
}

#faqModal .modal::-webkit-scrollbar-thumb:active {
  background: rgba(245, 158, 11, .55);
}


/* ── Toast ── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(80px);
  min-width: 220px;
  max-width: calc(100vw - 28px);
  background: rgba(11, 17, 24, .92);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: .88rem;
  font-weight: 700;
  z-index: 100;
  transition: transform .28s cubic-bezier(.22, 1, .36, 1), opacity .28s;
  opacity: 0;
  pointer-events: none;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}


/* ── Study mode ── */

.study-section {
  margin-bottom: 20px;
}

.study-section-title {
  font-size: .82rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 10px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.study-tab {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
  flex-shrink: 0;
}

.study-tab:active {
  transform: scale(.96);
}

.study-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, .18), rgba(249, 115, 22, .12));
  border-color: rgba(245, 158, 11, .35);
  color: var(--text);
  box-shadow: 0 0 20px rgba(245, 158, 11, .1);
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.study-card {
  padding: 14px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .15s, border-color .2s, background .2s;
  text-align: center;
  user-select: none;
}

.study-card:active {
  transform: scale(.96);
}

.study-card.playing {
  border-color: rgba(245, 158, 11, .4);
  background: rgba(245, 158, 11, .08);
}

.study-card .sc-num {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  font-family: 'DM Mono', monospace;
}

.study-card .sc-et {
  font-size: .95rem;
  font-weight: 700;
  margin-top: 4px;
}

.study-card .sc-ru {
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.study-card .sc-ord {
  font-size: .78rem;
  color: var(--accent-2);
  margin-top: 4px;
  font-style: italic;
}

.study-note {
  padding: 14px;
  border-radius: 14px;
  margin-top: 16px;
  background: rgba(245, 158, 11, .06);
  border: 1px solid rgba(245, 158, 11, .15);
  margin-bottom: 16px;
  font-size: .85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.study-note strong {
  color: var(--text);
  font-weight: 700;
}

.study-sentence-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.study-sentence {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .15s, border-color .2s;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
}

.study-sentence:active {
  transform: scale(.98);
}

.study-sentence.playing {
  border-color: rgba(245, 158, 11, .4);
}

.study-sentence .ss-et {
  font-size: .88rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}

.study-sentence .ss-ru {
  font-size: .78rem;
  color: var(--text-dim);
  text-align: right;
  flex-shrink: 0;
}


/* ── Drill overlay ── */

.drill-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
  background: rgba(5, 8, 13, .75);
  backdrop-filter: blur(14px);
}

.drill-overlay.show {
  display: flex;
}

.drill-card {
  width: min(100%, 400px);
  padding: 28px 22px;
  border-radius: 28px;
  text-align: center;
  position: relative;
}

.drill-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.drill-close:hover {
  color: var(--text);
}

.drill-word {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  margin: 16px 0;
  letter-spacing: .05em;
  line-height: 1.3;
}

.drill-hint {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.drill-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.drill-ru {
  font-size: .9rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.drill-timer {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .08);
  margin: 16px 0;
  overflow: hidden;
}

.drill-timer-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width linear;
}

.drill-input {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, .05);
  border: 2px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color .2s, background .2s;
}

.drill-input:focus {
  border-color: rgba(245, 158, 11, .5);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .1);
}

.drill-input.correct {
  border-color: rgba(61, 220, 151, .5);
  background: rgba(61, 220, 151, .08);
}

.drill-input.wrong {
  border-color: rgba(255, 107, 122, .5);
  background: rgba(255, 107, 122, .08);
}

.drill-streak-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}

.drill-streak-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .1);
  transition: all .3s;
}

.drill-streak-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(245, 158, 11, .4);
}

.drill-success {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--success);
  margin: 20px 0;
}


/* ── Animations ── */

@keyframes drillPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.drill-word.pulse {
  animation: drillPulse .6s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.animate-in {
  animation: fadeInUp .34s cubic-bezier(.22, 1, .36, 1);
}

.shake {
  animation: shake .34s ease;
}


/* ── Responsive ── */

@media (max-width: 420px) {
  .container {
    padding: 14px 12px 20px;
  }

  .stats {
    gap: 6px;
  }

  .stat-card {
    padding: 10px 6px;
  }

  .q-text {
    font-size: 1.12rem;
  }

  .option-btn,
  .typing-input,
  .typing-submit,
  .build-submit,
  .next-btn {
    font-size: .97rem;
  }
}