/* Español — mobile-first styles */

:root {
  --bg: #fff8ef;
  --surface: #ffffff;
  --surface-2: #fbefe0;
  --ink: #2a2118;
  --ink-soft: #7a6a5a;
  --line: #ecdcc7;
  --primary: #d9482b;        /* rojo */
  --primary-dark: #a83219;
  --sun: #f4b223;            /* amarillo */
  --sun-dark: #c98700;
  --ok: #3a9d5d;
  --ok-dark: #2a7444;
  --ok-bg: #e3f5e8;
  --almost: #c98700;
  --almost-bg: #fdf1d3;
  --bad: #d63d4b;
  --bad-dark: #a62533;
  --bad-bg: #fde5e7;
  --blue: #2563a8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 0 rgba(90, 60, 30, 0.08), 0 8px 24px rgba(90, 60, 30, 0.07);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1612;
    --surface: #262019;
    --surface-2: #30281f;
    --ink: #f6ece0;
    --ink-soft: #b9a895;
    --line: #3e3328;
    --primary: #f0613f;
    --primary-dark: #b23b20;
    --ok-bg: #1f3a28;
    --almost-bg: #3d3115;
    --bad-bg: #42202a;
    --shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
#app { max-width: 600px; margin: 0 auto; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.2; }
h2, h3 { margin: 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 24px; height: 24px; display: block; }

.screen {
  padding: max(16px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.screen.center { min-height: 80dvh; align-items: center; justify-content: center; text-align: center; }
.top { display: flex; align-items: center; gap: 12px; }
.top h1 { flex: 1; font-size: 1.3rem; }
.section-title { font-size: 1rem; color: var(--ink-soft); margin-top: 8px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px; border-radius: 16px; border: 0;
  font-weight: 800; font-size: 1rem; letter-spacing: .02em; cursor: pointer;
  text-transform: uppercase; transition: transform .06s ease, filter .15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(3px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); text-transform: none; font-weight: 700; }
.btn-right { background: var(--ok); color: #fff; box-shadow: 0 4px 0 var(--ok-dark); }
.btn-wrong { background: var(--bad); color: #fff; box-shadow: 0 4px 0 var(--bad-dark); }
.btn-wide { width: 100%; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-2 .btn { font-size: .9rem; padding: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft); background: transparent; border: 0; cursor: pointer; flex: none;
}
.icon-btn:active { background: var(--surface-2); }
.linkish { background: none; border: 0; color: var(--blue); font-weight: 700; padding: 10px 4px; cursor: pointer; text-align: center; }
.linkish.danger { color: var(--bad); }
.badge { background: var(--primary); color: #fff; border-radius: 999px; padding: 2px 9px; font-size: .8rem; font-weight: 800; }
.badge.alt { background: var(--sun); color: #3b2a00; }
.warn { background: var(--almost-bg); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; }

/* ---------- login */
.login { min-height: 90dvh; justify-content: center; align-items: stretch; text-align: center; }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 2.2rem; font-weight: 900; }
.logo-mark {
  width: 64px; height: 64px; border-radius: 20px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 2.4rem; box-shadow: 0 5px 0 var(--primary-dark);
}
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login-form input, .settings select {
  min-height: 52px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 1.05rem;
}
.login-form input:focus { outline: none; border-color: var(--blue); }
.form-error { color: var(--bad); min-height: 1.2em; font-weight: 700; }

/* ---------- home */
.home .top { align-items: flex-start; }
.home .top > div:first-child { flex: 1; }
.hello { font-size: 1.45rem; font-weight: 900; }
.home-stats { display: flex; align-items: center; gap: 8px; }
.chip-stat { font-weight: 900; font-size: 1.1rem; padding: 6px 10px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.xp-ring .ring { width: 46px; height: 46px; }
.ring { position: relative; width: 56px; height: 56px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 7; }
.ring-fg { fill: none; stroke: var(--sun); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: .8rem; }

.hero-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, var(--primary), #e8732b); color: #fff; border-radius: 22px;
  padding: 22px 20px; box-shadow: 0 5px 0 var(--primary-dark), var(--shadow);
}
.hero-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--primary-dark); }
.hero-title { font-size: 1.6rem; font-weight: 900; }
.hero-sub { opacity: .92; font-weight: 600; font-size: .95rem; }
.hero-go { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: none; }
.mini-card {
  display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; font-weight: 800; box-shadow: var(--shadow); border: 2px solid var(--line);
}
.modules { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 480px) { .modules { grid-template-columns: 1fr 1fr; } }
.module-card {
  position: relative; display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 2px solid var(--line);
}
.module-card:active, .unit-card:active { transform: translateY(2px); }
.module-icon { font-size: 1.9rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 14px; flex: none; }
.module-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.module-title { font-weight: 800; }
.module-meta { font-size: .8rem; }
.module-card .badge { position: absolute; top: 10px; right: 10px; }

.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ok); border-radius: 999px; transition: width .4s ease; }
.bar.bar-lesson { height: 14px; }
.bar.bar-lesson .bar-fill { background: var(--ok); }

/* ---------- module / unit */
.units { display: flex; flex-direction: column; gap: 10px; }
.unit-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border: 2px solid var(--line); }
.unit-main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.unit-title { font-weight: 800; }
.unit-desc { font-size: .85rem; }
.unit-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.unit-progress { display: flex; flex-direction: column; gap: 6px; }
.unit-actions { display: flex; flex-direction: column; gap: 10px; }
.source { margin-top: -6px; }
.item-list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-text { flex: 1; min-width: 0; }
.item-es { font-weight: 800; }
.item-ru { color: var(--ink-soft); font-size: .92rem; }
.item-note { font-size: .8rem; white-space: pre-line; }
.speaker-placeholder { width: 40px; flex: none; }
.dots { display: flex; gap: 3px; flex: none; }
.dot-s { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dot-s.on { background: var(--ok); }
.level { display: inline-block; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 1px 8px; margin-top: 4px; }
.level-1 { background: var(--ok-bg); color: var(--ok-dark); }
.level-2 { background: var(--almost-bg); color: #7a5300; }
.level-3 { background: var(--bad-bg); color: var(--bad-dark); }

/* ---------- speaker */
.speaker {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--blue); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 3px 0 #17406f;
}
.speaker:active { transform: translateY(2px); box-shadow: 0 1px 0 #17406f; }
.speaker.big { width: 96px; height: 96px; border-radius: 26px; }
.speaker.big .ico { width: 48px; height: 48px; }
.speaker.slow { background: var(--surface-2); color: var(--blue); box-shadow: 0 3px 0 var(--line); }
.speaker.pulse { animation: pulse .5s ease; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- lesson */
.lesson { display: flex; flex-direction: column; min-height: 100dvh; }
.lesson-head { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 6px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.lesson-progress { flex: 1; }
.lesson-xp { font-weight: 900; color: var(--sun-dark); font-size: .9rem; min-width: 52px; text-align: right; }
.lesson-body { flex: 1; padding: 8px 16px 24px; }
.exercise { display: flex; flex-direction: column; gap: 16px; animation: slidein .25s ease; }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.instruction { font-size: 1.3rem; font-weight: 900; }
.prompt { display: flex; flex-direction: column; gap: 6px; }
.prompt.audio { flex-direction: row; justify-content: center; align-items: flex-end; gap: 14px; padding: 18px 0; }
.prompt-row { display: flex; align-items: center; gap: 12px; }
.prompt-text { font-size: 1.45rem; font-weight: 800; line-height: 1.25; }
.prompt-text.big { font-size: 2.6rem; letter-spacing: .02em; }
.prompt-text .dot { color: var(--ink-soft); margin: 0 .35em; }
.prompt-text .gap { color: var(--primary); }
.prompt-sub { color: var(--ink-soft); font-size: .95rem; }

.options { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 420px) { .options:not(.long) { grid-template-columns: 1fr 1fr; } }
.option {
  display: flex; align-items: center; gap: 12px; text-align: left; min-height: 58px; padding: 12px 14px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--line);
  cursor: pointer; font-size: 1.05rem; font-weight: 700;
}
.option:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.option-key { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; color: var(--ink-soft); flex: none; }
.option.selected { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, var(--surface)); box-shadow: 0 3px 0 var(--blue); }
.option.right { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 3px 0 var(--ok); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 3px 0 var(--bad); }
.option:disabled { cursor: default; }

.answer-input {
  width: 100%; min-height: 56px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  font-size: 1.2rem; font-weight: 700; resize: none;
}
.answer-input:focus, .gap-input:focus, .table-input:focus { outline: none; border-color: var(--blue); }
.answer-input.correct, .gap-input.correct, .table-input.correct { border-color: var(--ok); background: var(--ok-bg); }
.answer-input.almost, .gap-input.almost, .table-input.almost { border-color: var(--almost); background: var(--almost-bg); }
.answer-input.wrong, .gap-input.wrong, .table-input.wrong { border-color: var(--bad); background: var(--bad-bg); }
.accents { display: flex; flex-wrap: wrap; gap: 6px; }
.accent { min-width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 1.1rem; cursor: pointer; box-shadow: 0 2px 0 var(--line); }
.accent:active { transform: translateY(2px); box-shadow: none; }
.dunno { align-self: flex-start; color: var(--ink-soft); }

.tiles-answer {
  min-height: 112px; border-bottom: 2px solid var(--line); border-top: 2px solid var(--line);
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 12px 0;
  background-image: repeating-linear-gradient(transparent 0 55px, var(--line) 55px 57px);
}
.tiles-answer.correct { border-color: var(--ok); }
.tiles-answer.wrong { border-color: var(--bad); }
.tiles-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 6px; }
.tile-slot { display: inline-flex; min-width: 36px; min-height: 46px; border-radius: 14px; background: var(--surface-2); }
.tile {
  min-height: 46px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
  font-size: 1.1rem; font-weight: 700; box-shadow: 0 3px 0 var(--line); cursor: pointer;
}
.tile:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

.cloze { font-size: 1.3rem; font-weight: 700; line-height: 2.2; }
.gap-btn {
  min-width: 70px; min-height: 40px; padding: 2px 12px; margin: 0 2px; border-radius: 12px; border: 2px dashed var(--line);
  background: var(--surface); font-weight: 800; color: var(--blue); cursor: pointer; vertical-align: middle;
}
.gap-btn.empty { color: var(--ink-soft); font-weight: 600; font-size: .9rem; }
.gap-btn.current { border-color: var(--blue); border-style: solid; }
.gap-btn.correct { border: 2px solid var(--ok); background: var(--ok-bg); color: var(--ok-dark); }
.gap-btn.almost { border: 2px solid var(--almost); background: var(--almost-bg); }
.gap-btn.wrong { border: 2px solid var(--bad); background: var(--bad-bg); color: var(--bad-dark); }
.gap-input {
  min-height: 40px; padding: 2px 8px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface);
  font-weight: 800; font-size: 1.1rem; text-align: center; vertical-align: middle; max-width: 60vw;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { min-height: 46px; min-width: 56px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 1.05rem; box-shadow: 0 3px 0 var(--line); cursor: pointer; }
.chip:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

.conj-table { display: flex; flex-direction: column; gap: 8px; }
.conj-row { display: grid; grid-template-columns: 9.5em 1fr; align-items: center; gap: 8px; position: relative; }
.conj-person { color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.table-input { min-height: 46px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 1.05rem; width: 100%; }
.conj-fix { grid-column: 2; color: var(--ok-dark); font-weight: 800; font-size: .9rem; margin-top: -4px; }

.intro-label { align-self: flex-start; background: var(--sun); color: #3b2a00; font-weight: 900; border-radius: 999px; padding: 3px 12px; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.intro-card { background: var(--surface); border-radius: 22px; padding: 22px 18px; box-shadow: var(--shadow); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.intro-es-row { display: flex; align-items: center; gap: 12px; }
.intro-es { font-size: 1.9rem; font-weight: 900; line-height: 1.15; }
.intro-ru { font-size: 1.2rem; color: var(--ink-soft); font-weight: 700; }
.intro-note { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: .95rem; white-space: pre-line; }
.intro-table { display: grid; grid-template-columns: 1fr; gap: 4px; margin-top: 4px; }
.intro-row { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.intro-forms { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--surface-2); border-radius: 999px; padding: 3px 10px; font-weight: 800; }

.flash { position: relative; min-height: 240px; width: 100%; border: 0; background: none; padding: 0; cursor: pointer; perspective: 1200px; }
.flash-face {
  position: absolute; inset: 0; border-radius: 24px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; backface-visibility: hidden;
  transition: transform .45s cubic-bezier(.3,.7,.3,1);
}
.flash-face.back { transform: rotateY(180deg); background: var(--surface-2); }
.flash.flipped .front { transform: rotateY(-180deg); }
.flash.flipped .back { transform: rotateY(0); }
.flash-text { font-size: 1.7rem; font-weight: 900; text-align: center; }
.flash-hint { text-align: center; font-size: .85rem; }
.flash-grades { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; visibility: hidden; }
.flash-grades.show { visibility: visible; }

.lesson-foot {
  position: sticky; bottom: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--bg);
  border-top: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; z-index: 5;
}
.lesson-foot.correct { background: var(--ok-bg); border-color: transparent; }
.lesson-foot.almost { background: var(--almost-bg); border-color: transparent; }
.lesson-foot.wrong { background: var(--bad-bg); border-color: transparent; }
.lesson-foot.correct .btn-primary { background: var(--ok); box-shadow: 0 4px 0 var(--ok-dark); }
.lesson-foot.almost .btn-primary { background: var(--almost); box-shadow: 0 4px 0 #8f6000; }
.lesson-foot.wrong .btn-primary { background: var(--bad); box-shadow: 0 4px 0 var(--bad-dark); }
.feedback:empty { display: none; }
.feedback { display: flex; flex-direction: column; gap: 6px; animation: rise .2s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fb-title { font-weight: 900; font-size: 1.25rem; display: flex; align-items: center; justify-content: space-between; }
.correct .fb-title { color: var(--ok-dark); }
.almost .fb-title { color: #7a5300; }
.wrong .fb-title { color: var(--bad-dark); }
.fb-xp { font-size: .9rem; color: var(--sun-dark); }
.fb-answer { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.fb-answer .speaker { width: 38px; height: 38px; border-radius: 12px; }
.fb-sub { color: var(--ink-soft); }
.fb-note { font-size: .92rem; color: var(--ink-soft); white-space: pre-line; }
.override { align-self: flex-start; padding: 2px 0; font-size: .9rem; }

/* ---------- dialog */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); animation: rise .2s ease; }
.bubble.npc { align-self: flex-start; background: var(--surface); border: 2px solid var(--line); border-bottom-left-radius: 6px; cursor: pointer; }
.bubble.me { align-self: flex-end; background: color-mix(in srgb, var(--blue) 12%, var(--surface)); border: 2px solid color-mix(in srgb, var(--blue) 35%, var(--line)); border-bottom-right-radius: 6px; }
.bubble.me.correct { background: var(--ok-bg); border-color: var(--ok); }
.bubble.me.almost { background: var(--almost-bg); border-color: var(--almost); }
.bubble.me.wrong { background: var(--bad-bg); border-color: var(--bad); }
.bubble.pending { border-style: dashed; box-shadow: none; }
.bubble-row { display: flex; align-items: center; gap: 10px; }
.bubble-row .speaker { width: 34px; height: 34px; border-radius: 10px; }
.bubble-row .speaker .ico { width: 20px; height: 20px; }
.bubble-es { font-weight: 800; font-size: 1.08rem; }
.bubble-ru { color: var(--ink-soft); font-size: .9rem; margin-top: 4px; }
.bubble-ru.hidden { filter: blur(5px); user-select: none; }
.bubble-hint { color: var(--ink-soft); }
.bubble-hint b { color: var(--ink); }
.bubble-given { color: var(--bad-dark); text-decoration: line-through; font-size: .9rem; margin-bottom: 4px; }
.chat-input { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.chat-input .tiles-answer { min-height: 60px; background-image: none; }

/* ---------- finish / profile */
.big-emoji { font-size: 4rem; }
.finish h1 { font-size: 2rem; }
.stats-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
@media (min-width: 480px) { .stats-row { grid-template-columns: repeat(4, 1fr); } .profile-stats .stats-row { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--surface); border-radius: 16px; padding: 12px 8px; box-shadow: var(--shadow); text-align: center; border: 2px solid var(--line); }
.stat-num { font-size: 1.35rem; font-weight: 900; }
.stat-label { font-size: .78rem; color: var(--ink-soft); }
.finish-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 10px; }
.profile-stats { display: flex; flex-direction: column; gap: 10px; }
.history { display: flex; align-items: flex-end; gap: 3px; height: 90px; background: var(--surface); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.hbar { flex: 1; background: var(--line); border-radius: 4px 4px 0 0; min-height: 3px; }
.hbar.goal { background: var(--sun); }
.settings { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.settings select { min-height: 42px; padding: 6px 10px; font-size: .95rem; }
.setting input[type=range] { width: 140px; }
.switch { appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(22px); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; transition: all .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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