/* Οδύσσεια — визуальный язык аттической керамики.
   Тёмная тема — краснофигурный стиль (глина по чёрному лаку),
   светлая — чернофигурный (чёрный лак по глине). Меандр — структурный элемент: прогресс и разделители. */
:root {
  --glaze: #ecd3b0;        /* фон: обожжённая глина */
  --glaze-2: #f4e0c2;      /* приподнятые поверхности */
  --glaze-3: #e0c29b;      /* углубления, поля ввода */
  --clay: #22170f;         /* «фигуры»: акцент и линии */
  --clay-2: #4a3424;
  --on-clay: #f4e0c2;
  --bone: #1d140e;         /* основной текст */
  --muted: #6e5643;
  --ochre: #94620c;        /* опыт и драхмы */
  --olive: #4f6a14;        /* верно */
  --wine: #a42a1d;         /* ошибка, урон */
  --sea: #1e5e86;          /* голос и разговор */
  --line: rgba(29, 20, 14, .16);
  --shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 18px -10px rgba(40, 20, 5, .45);

  --f-display: 'Alegreya SC', 'Alegreya', Georgia, 'Times New Roman', serif;
  --f-greek: 'Alegreya', Georgia, 'Times New Roman', serif;
  --f-body: 'Commissioner', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r: 10px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glaze: #15100c; --glaze-2: #211913; --glaze-3: #2d231b;
    --clay: #d47e48; --clay-2: #eda06a; --on-clay: #1a110b;
    --bone: #f1e5d1; --muted: #b6a189; --ochre: #e6b04f; --olive: #9fb556; --wine: #e0634f; --sea: #6aaed6;
    --line: rgba(241, 229, 209, .12);
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 24px -14px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --glaze: #15100c; --glaze-2: #211913; --glaze-3: #2d231b;
  --clay: #d47e48; --clay-2: #eda06a; --on-clay: #1a110b;
  --bone: #f1e5d1; --muted: #b6a189; --ochre: #e6b04f; --olive: #9fb556; --wine: #e0634f; --sea: #6aaed6;
  --line: rgba(241, 229, 209, .12);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 24px -14px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--glaze); color: var(--bone);
  font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--glaze); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--clay-2); }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
[hidden] { display: none !important; }
.el { font-family: var(--f-greek); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.boot { display: grid; place-items: center; height: 100vh; font: 700 42px var(--f-display); color: var(--clay); letter-spacing: .06em; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100%; }
.side {
  display: none; width: 232px; flex: none; padding: 22px 14px; border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font: 800 26px/1 var(--f-display); color: var(--clay); letter-spacing: .04em; padding: 4px 10px 18px; }
.brand small { display: block; font: 500 12px var(--f-body); color: var(--muted); letter-spacing: .02em; margin-top: 6px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.navlink {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border: 0;
  background: none; text-align: left; cursor: pointer; color: var(--muted); font-weight: 500;
}
.navlink svg { width: 20px; height: 20px; flex: none; }
.navlink:hover { color: var(--bone); background: var(--glaze-2); }
.navlink.on { color: var(--clay); background: var(--glaze-2); }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px)); }
.page { max-width: 880px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 18px 32px; }
.page.wide { max-width: 1080px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: color-mix(in srgb, var(--glaze) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottomnav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none;
  color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; cursor: pointer;
}
.bottomnav button svg { width: 22px; height: 22px; }
.bottomnav button.on { color: var(--clay); }
.bottomnav .speak-tab span.orb {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--clay); color: var(--on-clay); box-shadow: 0 0 0 5px var(--glaze), var(--shadow);
}
.bottomnav .speak-tab span.orb svg { width: 26px; height: 26px; }

@media (min-width: 900px) {
  .side { display: block; }
  .bottomnav { display: none; }
  .main { padding-bottom: 32px; }
  .page { padding-block: 32px 48px; }
}

/* ---------- типографика ---------- */
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 6vw, 40px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
.eyebrow { font: 600 11px/1.2 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lead { color: var(--muted); max-width: 62ch; margin: 6px 0 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 12px; }

/* Меандр: маска SVG, окрашивается токеном */
.meander, .meter::after {
  --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 11H22V1H6V7H16V4H10' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
}
.meander { height: 12px; background: var(--clay); -webkit-mask: var(--m) repeat-x left center / 24px 12px; mask: var(--m) repeat-x left center / 24px 12px; opacity: .55; }
.meter { position: relative; height: 14px; border-radius: 3px; background: var(--glaze-3); overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; display: block; background: var(--c, var(--clay)); transition: width .5s ease; }
/* Меандр «прорезан» поверх заливки цветом фона — как роспись по лаку */
.meter::after {
  content: ""; position: absolute; inset: 1px 0; background: var(--glaze-2); opacity: .55;
  -webkit-mask: var(--m) repeat-x left center / 24px 12px; mask: var(--m) repeat-x left center / 24px 12px;
}
.meter.plain::after { display: none; }

/* ---------- элементы управления ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glaze-2); color: var(--bone); font-weight: 600;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--glaze-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--clay); border-color: var(--clay); color: var(--on-clay); }
.btn.primary:hover { background: var(--clay-2); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--bone); background: var(--glaze-2); }
.btn.sea { background: var(--sea); border-color: var(--sea); color: var(--glaze); }
.btn.big { min-height: 54px; font-size: 16px; padding: 0 22px; }
.btn.block { width: 100%; }
.iconbtn { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--glaze-3); color: var(--bone); outline: none;
}
.input:focus { border-color: var(--clay); }
textarea.input { min-height: 220px; line-height: 1.6; resize: vertical; font-family: var(--f-greek); font-size: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); background: var(--glaze-2);
}
.chip.good { color: var(--olive); border-color: color-mix(in srgb, var(--olive) 40%, transparent); }
.chip.bad { color: var(--wine); border-color: color-mix(in srgb, var(--wine) 40%, transparent); }
.chip.gold { color: var(--ochre); border-color: color-mix(in srgb, var(--ochre) 40%, transparent); }
.chip.sea { color: var(--sea); border-color: color-mix(in srgb, var(--sea) 40%, transparent); }

.panel { background: var(--glaze-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.panel.flat { box-shadow: none; }
.panel.inset { background: var(--glaze-3); box-shadow: none; }
.list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.list > * { border-bottom: 1px solid var(--line); }
.tile {
  display: flex; gap: 14px; align-items: center; padding: 14px 4px; background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; cursor: pointer; width: 100%;
}
.tile:hover { background: color-mix(in srgb, var(--glaze-2) 60%, transparent); }
.tile .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--glaze-3); color: var(--clay); }
.tile .ic svg { width: 22px; height: 22px; }
.tile .tx { flex: 1; min-width: 0; }
.tile .tx b { display: block; font-weight: 600; }
.tile .tx span { color: var(--muted); font-size: 13px; }
.tile.done .ic { background: color-mix(in srgb, var(--olive) 18%, var(--glaze-3)); color: var(--olive); }
.tile.done .tx b { text-decoration: line-through; text-decoration-color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 60; background: var(--bone); color: var(--glaze); padding: 10px 16px; border-radius: 8px; font-weight: 600;
  max-width: min(92vw, 520px); box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: rise .25s ease;
}
@media (min-width: 900px) { .toast { bottom: 28px; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 3, .62); display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: 88vh; overflow: auto; background: var(--glaze-2); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }

/* ---------- лагерь ---------- */
.herohead { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.herohead .portrait { width: 84px; height: 84px; }
.heroname { font: 700 26px/1.1 var(--f-display); }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.stat { display: flex; flex-direction: column; }
.stat b { font: 700 20px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.countdown { display: flex; align-items: baseline; gap: 10px; }
.countdown b { font: 800 56px/0.9 var(--f-display); color: var(--clay); font-variant-numeric: tabular-nums; }
.heat { display: grid; grid-template-columns: repeat(35, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 2px; background: var(--glaze-3); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--clay) 35%, var(--glaze-3)); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--clay) 65%, var(--glaze-3)); }
.heat i[data-l="3"] { background: var(--clay); }
.heat i.today { outline: 1px solid var(--bone); }

.cta-speak {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; width: 100%;
  padding: 18px; border-radius: 14px; border: 0; cursor: pointer; text-align: left;
  background: var(--sea); color: var(--glaze);
}
.cta-speak .orb { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--glaze) 18%, transparent); }
.cta-speak .orb svg { width: 28px; height: 28px; }
.cta-speak b { font: 700 20px var(--f-display); display: block; }

/* ---------- карта ---------- */
.mapwrap { overflow-x: auto; }
.map { position: relative; }
.map svg.route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.isles { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px 14px; }
@media (max-width: 560px) { .isles { grid-template-columns: repeat(2, 1fr); } }
.isle {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 12px 6px; border: 0; background: none; cursor: pointer; border-radius: 12px; color: var(--bone);
}
.isle:hover { background: var(--glaze-2); }
.isle .medal { position: relative; width: 82px; height: 82px; }
.isle .medal svg.ring { position: absolute; inset: 0; }
.isle .medal .mon { position: absolute; inset: 12px; }
.isle .no { font: 700 12px var(--f-body); color: var(--muted); letter-spacing: .1em; }
.isle .pl { font: 700 15px/1.15 var(--f-display); }
.isle.current .medal::after { content: ""; position: absolute; inset: -6px; border: 2px dashed var(--clay); border-radius: 50%; animation: spin 18s linear infinite; }
.isle.review .pl { color: var(--ochre); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- бой ---------- */
.arena { display: grid; gap: 14px; }
.foe { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; }
.foe .mon { width: 112px; height: 112px; }
.foe.hit .mon { animation: shake .35s; }
.foe.dead .mon { animation: fall .7s forwards; }
@keyframes shake { 20% { transform: translateX(-6px) rotate(-3deg); } 40% { transform: translateX(6px) rotate(3deg); } 60% { transform: translateX(-4px); } }
@keyframes fall { to { transform: translateY(20px) scale(.8); opacity: .15; filter: grayscale(1); } }
.hearts { display: flex; gap: 4px; }
.hearts svg { width: 20px; height: 20px; color: var(--wine); }
.hearts span { display: inline-flex; }
.hearts span.lost svg { color: var(--glaze-3); }
.qcard { padding: 20px; border-radius: 14px; background: var(--glaze-2); border: 1px solid var(--line); }
.qprompt { font: 500 30px/1.25 var(--f-greek); margin: 6px 0 4px; overflow-wrap: anywhere; }
.qprompt.ru { font: 600 22px/1.3 var(--f-body); }
.qhint { color: var(--muted); font-size: 14px; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); margin-top: 16px; }
.choice {
  min-height: 52px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--glaze-3);
  cursor: pointer; text-align: left; font-size: 17px;
}
.choice.el { font-family: var(--f-greek); font-size: 20px; }
.choice:hover:not(:disabled) { border-color: var(--clay); }
.choice.right { border-color: var(--olive); background: color-mix(in srgb, var(--olive) 18%, var(--glaze-3)); }
.choice.wrong { border-color: var(--wine); background: color-mix(in srgb, var(--wine) 16%, var(--glaze-3)); }
.feedback { margin-top: 14px; padding: 14px; border-radius: 10px; border-left: 4px solid var(--olive); background: var(--glaze-3); }
.feedback.bad { border-left-color: var(--wine); }
.feedback .answer { font: 600 20px var(--f-greek); }
.combo { font: 800 15px var(--f-display); color: var(--ochre); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 10px; border-radius: 10px; background: var(--glaze-3); }
.wordtile { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--glaze-2); font: 500 18px var(--f-greek); cursor: pointer; }
.dmg { position: absolute; font: 800 26px var(--f-display); color: var(--wine); animation: float 0.9s forwards; pointer-events: none; }
@keyframes float { to { transform: translateY(-40px); opacity: 0; } }

/* ---------- разговор ---------- */
.convo { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 86%; padding: 12px 14px; border-radius: 14px; position: relative; }
.bubble.npc { align-self: flex-start; background: var(--glaze-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: color-mix(in srgb, var(--sea) 22%, var(--glaze-2)); border-bottom-right-radius: 4px; }
.bubble .who { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.bubble .gr { font: 400 19px/1.45 var(--f-greek); }
.bubble .tr { font-size: 14px; color: var(--muted); margin-top: 6px; }
.bubble .tools { display: flex; gap: 4px; margin-top: 6px; }
.fix { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--wine) 12%, var(--glaze-2)); border: 1px solid color-mix(in srgb, var(--wine) 30%, transparent); font-size: 14px; }
.fix s { color: var(--wine); }
.fix .ok { font: 600 17px var(--f-greek); color: var(--olive); }
.goals { display: flex; flex-wrap: wrap; gap: 6px; }
.goal { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--line); color: var(--muted); }
.goal.done { border-style: solid; border-color: var(--olive); color: var(--olive); }
.dock {
  position: sticky; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 10px; border-radius: 16px; background: color-mix(in srgb, var(--glaze-2) 94%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(8px); margin-top: 16px;
}
@media (min-width: 900px) { .dock { bottom: 12px; } }
.shell.immersive .dock { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.shell.immersive .main { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.tonos { font: 500 24px/1 var(--f-greek); }
.mic {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--sea); color: var(--glaze); touch-action: none; user-select: none; -webkit-user-select: none;
}
.mic svg { width: 28px; height: 28px; }
.mic.rec { background: var(--wine); animation: pulse 1.2s infinite; }
.mic:disabled { opacity: .5; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--wine) 60%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.live-orb {
  width: 180px; height: 180px; margin: 10px auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--clay-2), var(--clay) 55%, color-mix(in srgb, var(--clay) 50%, var(--glaze)) 100%);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--clay) 40%, transparent);
  transition: transform .12s ease;
}
.live-orb.npc { animation: breathe 1.6s ease-in-out infinite; }
.live-orb.idle { filter: saturate(.4); opacity: .7; }
@keyframes breathe { 50% { box-shadow: 0 0 0 22px transparent; transform: scale(1.03); } }

.score-ring { width: 120px; height: 120px; }
.crit { display: grid; grid-template-columns: 120px 1fr 30px; gap: 10px; align-items: center; }
.diff ins { text-decoration: none; background: color-mix(in srgb, var(--olive) 25%, transparent); border-radius: 3px; padding: 0 2px; }
.diff del { color: var(--wine); }

/* ---------- прочее ---------- */
.flash { perspective: 900px; }
.flash .card3d { min-height: 220px; display: grid; place-items: center; text-align: center; padding: 26px; border-radius: 16px; background: var(--glaze-2); border: 1px solid var(--line); cursor: pointer; }
.flash .front { font: 500 34px/1.25 var(--f-greek); }
.flash .back { font-size: 22px; }
.gradebar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 15px; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; }
table.tbl th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
table.tbl td.el { font-size: 17px; }
.tablewrap { overflow-x: auto; }
.vocab-row { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.vocab-row .el { font-size: 18px; }
.split { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .split { grid-template-columns: 1fr 1fr; } }
.timer { font: 700 18px var(--f-display); font-variant-numeric: tabular-nums; }
.readtext { font: 400 19px/1.7 var(--f-greek); white-space: pre-wrap; }
.kbd { display: flex; gap: 6px; flex-wrap: wrap; }
.kbd button { min-width: 38px; height: 36px; border-radius: 6px; border: 1px solid var(--line); background: var(--glaze-2); font: 500 18px var(--f-greek); cursor: pointer; }
.portrait-svg { color: var(--clay); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(148, 98, 12, .18), transparent 55%),
    linear-gradient(180deg, var(--glaze-3), var(--glaze));
}
.login .panel { width: min(400px, 100%); }
.login.gate .panel { width: min(440px, 100%); }
.prologue p { margin: 0; font-size: 16px; line-height: 1.55; }
.prologue .meander { margin: 4px 0 8px; }
.briefing .brief-list { margin: 8px 0 0; padding-left: 18px; line-height: 1.45; }
.briefing .brief-list li + li { margin-top: 6px; }
.briefing .brief-body { margin-top: 8px; line-height: 1.55; font-size: 15px; }
.briefing .brief-examples { margin-top: 10px; }
.briefing .brief-examples .vocab-row { grid-template-columns: 1fr 1fr; }
.vocab-row .chip.tiny { font-size: 10px; padding: 1px 6px; vertical-align: middle; margin-left: 4px; }

/* ---------- урок слов: прогрессивное знакомство ---------- */
.words-learn { animation: brief-in .4s ease both; }
.words-card {
  position: relative; text-align: center; padding: 28px 20px 24px;
  margin-top: 12px; min-height: 200px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
}
.words-card.flash-tap { cursor: pointer; width: 100%; border: 1px solid var(--line); background: var(--glaze-2); color: inherit; font: inherit; }
.words-card.flash-tap:hover { border-color: var(--clay); }
.words-speak { position: absolute; top: 10px; right: 10px; }
.words-el { font: 500 36px/1.25 var(--f-greek); }
.words-el.reveal { animation: brief-in .35s ease both; margin-top: 12px; }
.words-ru { font-size: 20px; color: var(--muted); line-height: 1.35; }
.words-card.open .words-ru { color: var(--bone); }

/* ---------- сопоставление в бою ---------- */
.match-board {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px;
}
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-chip {
  text-align: left; padding: 12px 14px; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--line); background: var(--glaze-3); color: var(--bone);
  font: 600 15px/1.3 var(--f-body); transition: border-color .15s, background .15s, transform .1s;
}
.match-chip.el { font-family: var(--f-greek); font-size: 18px; font-weight: 500; }
.match-chip:hover:not(:disabled) { border-color: var(--clay); transform: translateY(-1px); }
.match-chip.sel { border-color: var(--sea); background: color-mix(in srgb, var(--clay) 16%, var(--glaze-3)); }
.match-chip.paired {
  border-color: var(--olive); background: color-mix(in srgb, var(--olive) 18%, var(--glaze-3));
  opacity: .85; cursor: default;
}
.match-chip.miss {
  border-color: var(--wine); background: color-mix(in srgb, var(--wine) 16%, var(--glaze-3));
  animation: match-shake .35s ease;
}
@keyframes match-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

.briefing .brief-cta { flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.briefing .brief-tip { animation: brief-in .45s ease both; }
@keyframes brief-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.island-path { display: flex; flex-direction: column; gap: 0; max-width: 560px; }
.stage-wrap { display: flex; flex-direction: column; align-items: stretch; }
.stage-rail { width: 3px; height: 18px; margin: 0 0 0 27px; background: var(--line); border-radius: 2px; }
.stage-rail.lit { background: color-mix(in srgb, var(--ochre) 70%, var(--line)); }
.stage-node {
  display: grid; grid-template-columns: 40px 28px 1fr auto; gap: 10px; align-items: center;
  text-align: left; width: 100%; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--glaze-2); color: inherit; cursor: pointer;
  font: inherit; box-shadow: var(--shadow); transition: border-color .2s, transform .2s;
}
.stage-node:hover:not(.locked) { border-color: color-mix(in srgb, var(--ochre) 50%, var(--line)); transform: translateY(-1px); }
.stage-node.current { border-color: color-mix(in srgb, var(--sea) 55%, var(--line)); outline: 2px solid color-mix(in srgb, var(--sea) 25%, transparent); }
.stage-node.done { border-color: color-mix(in srgb, var(--olive) 45%, var(--line)); }
.stage-node.locked { opacity: .55; cursor: not-allowed; box-shadow: none; }
.stage-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--glaze-3); border: 1px solid var(--line); font: 700 15px var(--f-display);
}
.stage-node.current .stage-num { background: color-mix(in srgb, var(--sea) 18%, var(--glaze-3)); border-color: var(--sea); color: var(--sea); }
.stage-node.done .stage-num { background: color-mix(in srgb, var(--olive) 18%, var(--glaze-3)); border-color: var(--olive); color: var(--olive); }
.stage-ic { width: 24px; height: 24px; color: var(--clay); display: grid; place-items: center; }
.stage-ic svg { width: 22px; height: 22px; }
.stage-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage-tx b { font-size: 15px; }
.stage-tx span { font-size: 13px; color: var(--muted); }
.tile.locked { opacity: .55; cursor: not-allowed; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }

/* ---------- тренажёр грамматики ---------- */
.g-trainer { margin-top: 8px; }
.g-progress { display: flex; gap: 6px; margin-bottom: 12px; }
.g-progress i {
  flex: 1; height: 4px; border-radius: 2px; background: var(--glaze-3);
  transition: background .25s ease, transform .25s ease;
}
.g-progress i.on { background: var(--clay); transform: scaleY(1.4); }
.g-progress i.done { background: color-mix(in srgb, var(--olive) 70%, var(--glaze-3)); }
.g-step-title {
  margin: 4px 0 0; font: 700 22px/1.25 var(--f-display); color: var(--clay);
}
.g-step-body { animation: brief-in .4s ease both; }
.g-lead { margin: 0 0 16px; font-size: 16px; line-height: 1.55; }
.g-trio {
  display: grid; gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 520px) { .g-trio { grid-template-columns: 1fr; } }
.g-pill {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 14px 12px; border-radius: 10px; border: 1px solid var(--line);
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--g, var(--clay)) 14%, var(--glaze-2)), var(--glaze-2));
  box-shadow: var(--shadow);
}
.g-pill .g-art { font: 700 28px/1 var(--f-greek); color: var(--g, var(--clay)); }
.g-pill .g-lab { font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.g-pill .g-tip { font-size: 12px; color: var(--muted); }
.g-masc { --g: var(--sea); }
.g-fem { --g: var(--wine); }
.g-neut { --g: var(--olive); }
.g-examples { display: flex; flex-direction: column; gap: 10px; }
.g-ex {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--glaze-2);
  animation: brief-in .45s ease both; animation-delay: var(--d, 0ms);
}
.g-art-badge {
  min-width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  font: 700 22px/1 var(--f-greek); color: var(--on-clay);
  background: var(--g, var(--clay));
}
.g-word { font-size: 22px; line-height: 1.2; }
.g-stem { font-family: var(--f-greek); }
.g-practice .g-prompt { font: 500 28px/1.3 var(--f-greek); margin-bottom: 14px; }
.g-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.g-choices.gender { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .g-choices.gender { grid-template-columns: 1fr; } }
.g-choice, .g-chip-btn {
  min-height: 52px; min-width: 72px; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--g, var(--line)) 55%, var(--line));
  background: color-mix(in srgb, var(--g, var(--clay)) 10%, var(--glaze-2));
  color: var(--bone); font: 700 22px/1 var(--f-greek);
  transition: transform .1s ease, border-color .15s, background .15s;
}
.g-choice:hover:not(:disabled), .g-chip-btn:hover:not(:disabled) { transform: translateY(-1px); }
.g-choice:disabled, .g-chip-btn:disabled { cursor: default; opacity: .85; }
.g-choice.right, .g-chip-btn.right {
  border-color: var(--olive); background: color-mix(in srgb, var(--olive) 22%, var(--glaze-2));
}
.g-choice.wrong, .g-chip-btn.wrong {
  border-color: var(--wine); background: color-mix(in srgb, var(--wine) 18%, var(--glaze-2));
}
.g-chip-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  font-family: var(--f-body); font-size: 13px; font-weight: 600;
}
.g-chip-btn .el { font: 700 24px/1 var(--f-greek); color: var(--g, var(--clay)); }
.g-fb { margin-top: 12px; font-weight: 600; font-size: 14px; }
.g-fb.ok { color: var(--olive); }
.g-fb.bad { color: var(--wine); }
.g-pattern-map { display: flex; flex-direction: column; gap: 8px; }
.g-pair {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  border-left: 4px solid var(--g, var(--clay)); background: var(--glaze-2); font-size: 16px;
}
.g-inline {
  display: inline-block; padding: 1px 8px; border-radius: 6px; font-weight: 700;
  background: color-mix(in srgb, var(--g, var(--clay)) 18%, transparent); color: var(--g, var(--clay));
}
.g-scroll {
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 120% 80% at 10% 0%, color-mix(in srgb, var(--ochre) 12%, transparent), transparent 50%),
    var(--glaze-2);
}
.g-bullets { margin: 14px 0 0; padding-left: 18px; line-height: 1.5; }
.g-bullets li + li { margin-top: 6px; }
.g-rule-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.g-rule {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start;
  padding: 10px 12px; border-radius: 8px; background: var(--glaze-2); border: 1px solid var(--line);
  animation: brief-in .4s ease both; animation-delay: var(--d, 0ms);
}
.g-rule-n {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 700 13px var(--f-display); background: var(--glaze-3); color: var(--clay); border: 1px solid var(--line);
}
.g-card-block + .g-card-block { margin-top: 14px; }
.g-cta { margin-top: 20px; }
.g-tbl td .g-inline { font-size: 15px; }

/* ---------- лавка ---------- */
.shop-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.shop-card {
  padding: 18px 16px; border-radius: var(--r); border: 1px solid var(--line);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--ochre) 10%, var(--glaze-2)), var(--glaze-2));
  box-shadow: var(--shadow);
  animation: brief-in .45s ease both;
}
.shop-ic { width: 36px; height: 36px; color: var(--ochre); margin-bottom: 6px; }
.shop-ic svg { width: 32px; height: 32px; }
.price-tag { display: flex; align-items: baseline; gap: 6px; font-size: 18px; }
.price-tag s { font-size: 14px; }

/* ---------- роли / очки навыков ---------- */
.skills-strip-wrap { animation: brief-in .45s ease both; }
.skills-strip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.skill-chip {
  flex: 0 0 auto; scroll-snap-align: start;
  display: grid; grid-template-columns: 32px 1fr; gap: 8px 10px; align-items: center;
  min-width: 132px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--glaze-2); color: inherit;
  font: inherit; text-align: left; cursor: pointer;
  animation: brief-in .4s ease both; animation-delay: calc(var(--i, 0) * 50ms);
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}
.skill-chip.lit { border-color: color-mix(in srgb, var(--ochre) 40%, var(--line)); }
.skill-chip.on {
  border-color: var(--ochre);
  background: linear-gradient(165deg, color-mix(in srgb, var(--ochre) 14%, var(--glaze-2)), var(--glaze-2));
  transform: translateY(-1px);
}
.skill-chip-ic {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--glaze-3); color: var(--clay); border: 1px solid var(--line);
}
.skill-chip-ic svg { width: 18px; height: 18px; }
.skill-chip.lit .skill-chip-ic, .skill-chip.on .skill-chip-ic { border-color: var(--olive); color: var(--olive); }
.skill-chip-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.skill-chip-tx b { font-size: 13px; line-height: 1.2; }
.skill-chip-tx .num { font-size: 12px; color: var(--muted); }
.skill-chip-bonus {
  grid-column: 1 / -1; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.skill-spend {
  margin-top: 12px; padding: 14px 16px; border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--ochre) 40%, var(--line));
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--ochre) 12%, var(--glaze-2)), var(--glaze-2));
  box-shadow: var(--shadow);
  animation: brief-in .35s ease both;
}
.skill-spend-points {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0;
}
.skill-spend-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .skill-spend-grid { grid-template-columns: 1fr; } }
.skill-spend-btn {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--glaze-3); color: inherit; font: inherit; cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.skill-spend-btn:hover:not(:disabled) { border-color: var(--ochre); }
.skill-spend-btn:disabled { opacity: .55; cursor: not-allowed; }
.skill-spend-btn b { font-size: 15px; }

.skill-points-banner {
  display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--r); border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 90% 80% at 0% 0%, color-mix(in srgb, var(--ochre) 16%, transparent), transparent 55%),
    var(--glaze-2);
}
.skill-points-num {
  display: block; font: 700 36px/1 var(--f-display); color: var(--ochre); margin: 4px 0;
}

.skill-tree { display: flex; flex-direction: column; gap: 22px; }
.skill-branch {
  display: grid; gap: 10px;
  padding: 14px; border-radius: var(--r); border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--glaze-3) 55%, transparent);
  animation: brief-in .5s ease both; animation-delay: calc(var(--i, 0) * 60ms);
}
.skill-branch.lit { border-style: solid; border-color: color-mix(in srgb, var(--ochre) 45%, var(--line)); }
.skill-branch.selected { border-color: var(--ochre); border-style: solid; }
.skill-perks { display: grid; gap: 8px; margin-left: 18px; padding-left: 14px; border-left: 2px solid var(--line); }
.skill-node {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start;
  padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--glaze-2);
}
.skill-node.role { box-shadow: var(--shadow); }
.skill-node.role.clickable {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.skill-node.unlocked { border-color: color-mix(in srgb, var(--olive) 45%, var(--line)); }
.skill-node.locked { opacity: .72; }
.skill-node.perk.unlocked { background: color-mix(in srgb, var(--olive) 8%, var(--glaze-2)); }
.skill-ic {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--glaze-3); color: var(--clay); border: 1px solid var(--line); flex: 0 0 auto;
}
.skill-ic.lit { border-color: var(--olive); color: var(--olive); }
.skill-ic svg { width: 22px; height: 22px; }
.skill-node.unlocked .skill-ic { border-color: var(--olive); color: var(--olive); }
.skill-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.skill-tx b { font-size: 15px; }

/* ---------- награды боя ---------- */
.reward-stake {
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--ochre) 12%, var(--glaze-2)), var(--glaze-2));
  animation: brief-in .4s ease both;
}
.reward-stake.result { text-align: left; }
.reward-big {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px;
}
.reward-big > div {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px; border-radius: 10px; background: var(--glaze-3); border: 1px solid var(--line);
}
.reward-big b.num { font: 700 28px/1 var(--f-display); }
.reward-big span { font-size: 13px; color: var(--muted); }
.reward-breakdown {
  margin: 12px 0 0; padding-left: 18px; color: var(--ink); font-size: 14px; line-height: 1.45;
}
.reward-breakdown li + li { margin-top: 4px; }
.reward-strip {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ochre) 8%, var(--glaze-3));
}
.battle-brief .foe { margin-bottom: 4px; }

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