/* Битва за остров. Две темы: тёмная неоновая и светлая; «авто» берёт настройку устройства (атрибут data-theme
   ставит index.html до отрисовки). Задачи и теория в обеих темах — на светлых «листах», чтобы иллюстрации читались. */
:root, :root[data-theme="dark"] {
  --well: rgba(0, 0, 0, .28); --well2: rgba(0, 0, 0, .38); --blob1: rgba(168, 85, 247, .35); --blob2: rgba(34, 211, 238, .18);
  --cyan-ink: #22d3ee; --gold-ink: #facc15; --fire-ink: #fb923c; --ice-ink: #7dd3fc; --soft-ink: #e0e7ff;
  --storm-ink: #e9d5ff; --storm-warn: #f0abfc; --place-ink: #fff; --nav-bg: rgba(11, 16, 38, .92); --nav-on: #fff;
  --top-bg: linear-gradient(rgba(11, 16, 38, .95), rgba(11, 16, 38, .75)); --paper-well: #f8fafc;
  --lobby-bg: linear-gradient(135deg, rgba(168, 85, 247, .45), rgba(34, 211, 238, .25)); --lobby-line: rgba(255, 255, 255, .2);
  color-scheme: dark;
}
:root {
  --bg1: #0b1026; --bg2: #1a1050; --panel: rgba(255, 255, 255, .07); --panel2: rgba(255, 255, 255, .12); --line: rgba(255, 255, 255, .14);
  --ink: #f1f5f9; --muted: #a5b4fc; --cyan: #22d3ee; --pink: #f472b6; --yellow: #facc15; --violet: #a855f7; --green: #22c55e;
  --paper: #ffffff; --pink2: #db2777; --paper-ink: #1f2937; --paper-muted: #64748b; --paper-line: #e2e8f0;
  --ok: #16a34a; --ok-bg: #dcfce7; --warn-bg: #ffedd5; --bad: #dc2626; --bad-bg: #fee2e2;
  --common: #94a3b8; --rare: #3b82f6; --epic: #a855f7; --legendary: #f59e0b;
  --r: 20px; --glow: 0 0 0 1px rgba(255, 255, 255, .08), 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { background: var(--bg2); }
body {
  font-family: "Nunito", "Segoe UI Rounded", "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink); min-height: 100vh; font-size: 18px; line-height: 1.45;
  background: radial-gradient(1200px 600px at 80% -10%, var(--blob1), transparent 60%),
              radial-gradient(900px 500px at -10% 30%, var(--blob2), transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2)) fixed;
}
#app { max-width: 860px; margin: 0 auto; padding: 14px 14px 110px; }
.loading { text-align: center; padding-top: 32vh; font-weight: 900; font-style: italic; font-size: 28px; letter-spacing: .06em; color: var(--yellow); animation: pulse 1.2s infinite; }
h1, h2, h3 { margin: .2em 0 .4em; line-height: 1.15; }
h1 { font-size: 30px; } h2 { font-size: 24px; } h3 { font-size: 20px; }
.sec { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .03em; margin-top: 22px; }
button { font: inherit; cursor: pointer; border: 0; color: inherit; }
input { font: inherit; }
label { display: block; font-weight: 700; color: var(--paper-muted); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
a { color: var(--cyan-ink); }
.link { background: none; color: var(--cyan-ink); font-weight: 800; padding: 6px; text-decoration: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 14px 0; box-shadow: var(--glow); backdrop-filter: blur(6px); }
.card.paper { background: var(--paper); color: var(--paper-ink); border: 0; }
.card.paper .muted { color: var(--paper-muted); }

.btn { background: var(--cyan); color: #0b1026; border-radius: 14px; padding: 14px 22px; font-weight: 900; font-size: 19px; letter-spacing: .02em;
  box-shadow: 0 5px 0 #0e7490; transition: transform .08s, filter .15s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #0e7490; }
.btn:hover { filter: brightness(1.08); }
.btn.big { width: 100%; padding: 18px; font-size: 22px; }
.btn.sm { padding: 8px 14px; font-size: 16px; margin-top: 6px; }
.btn.yellow { background: var(--yellow); color: #1a1050; box-shadow: 0 5px 0 #a16207; font-style: italic; text-transform: uppercase; }
.btn.green { background: var(--green); color: #fff; box-shadow: 0 5px 0 #15803d; }
.btn.violet { background: var(--violet); color: #fff; box-shadow: 0 5px 0 #6b21a8; font-style: italic; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; border: 2px solid var(--line); }
.btn:disabled { opacity: .45; }

/* ---------- логотип и вход ---------- */
.logo { padding: 20px 0 6px; }
.logo-t { font-size: 46px; line-height: .95; font-weight: 900; font-style: italic; letter-spacing: .02em;
  background: linear-gradient(180deg, #fde047, #f97316); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #7c2d12) drop-shadow(0 0 18px rgba(250, 204, 21, .35)); transform: skew(-6deg); }
.logo-s { margin-top: 8px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; font-size: 13px; color: var(--cyan-ink); }
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.prof { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 14px; text-align: center; font-weight: 900; font-size: 20px; }
.pin-hero { display: flex; justify-content: center; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0; }
.dots i { width: 20px; height: 20px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); }
.dots i.on { background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.field { width: 100%; padding: 14px; border: 3px solid var(--paper-line); border-radius: 14px; font-size: 20px; margin: 6px 0 12px; color: var(--paper-ink); }
.field:focus { outline: none; border-color: var(--cyan); }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: 4px 2px 8px; }
.who b { font-size: 20px; }
.lvl { font-size: 13px; color: var(--cyan-ink); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 900; white-space: nowrap; }
.pill.sm { font-size: 14px; padding: 3px 10px; }
.pill.fire { color: var(--fire-ink); } .pill.cr { color: var(--cyan-ink); } .pill.ice { color: var(--ice-ink); }
.card.paper .pill.fire { background: #fff7ed; color: #ea580c; border-color: #fed7aa; }
.banner { display: inline-grid; place-items: center; width: 46px; height: 54px; font-size: 24px; font-weight: 900; color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .2); }
.banner.big { width: 64px; height: 76px; font-size: 34px; }

/* ---------- лобби ---------- */
.lobby { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: center; border-radius: 26px; padding: 18px;
  background: var(--lobby-bg); border: 1px solid var(--lobby-line); box-shadow: var(--glow); overflow: hidden; position: relative; }
.lobby::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 320px; height: 320px; background: radial-gradient(circle, rgba(250, 204, 21, .25), transparent 60%); }
.lobby h2 { font-weight: 900; font-style: italic; font-size: 28px; margin: 4px 0 6px; }
.lobby p { margin: 0 0 14px; color: var(--soft-ink); }
.lobby-hero { position: relative; display: flex; flex-direction: column; align-items: center; }
.lobby-hero .hero-svg { position: relative; z-index: 1; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .4)); }
.lobby-hero.sm .hero-svg { width: 90px; height: 126px; }
.platform { width: 150px; height: 26px; margin-top: -18px; border-radius: 50%; background: radial-gradient(ellipse, rgba(34, 211, 238, .9), rgba(34, 211, 238, .1) 70%); box-shadow: 0 0 30px rgba(34, 211, 238, .6); }
.tag { display: inline-block; font-size: 12px; font-weight: 900; letter-spacing: .12em; color: #1a1050; background: var(--yellow); padding: 3px 10px; border-radius: 6px; transform: skew(-8deg); }

.season { cursor: pointer; }
.xpbar { height: 14px; background: var(--well2); border-radius: 8px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink)); border-radius: 8px; transition: width .5s; }
.xpbar.sm { height: 9px; margin: 0; flex: 1; }
.next-rw { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 700; color: var(--soft-ink); }
.next-rw .hero-svg, .next-rw .glider-svg { max-height: 46px; width: auto; }
.next-rw .banner { width: 34px; height: 40px; font-size: 18px; }
.rw-ico { font-size: 30px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.rw-ico b { font-size: 14px; margin-top: 2px; }
.ch { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ch:last-child { border-bottom: 0; }
.ch-t { font-weight: 800; }
.ch-b { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 14px; font-weight: 800; }
.ch-b b { color: var(--gold-ink); min-width: 50px; text-align: right; }
.ch.done { opacity: .6; }

/* ---------- локации ---------- */
.zone { border-radius: 22px; padding: 14px; margin: 14px 0; background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--zc); }
.zone.locked { filter: grayscale(.8); opacity: .55; }
.zone .zh { display: flex; align-items: center; gap: 12px; }
.zone .ze { font-size: 38px; }
.zone .zp { font-weight: 900; color: var(--zc); }
.zone .bar { height: 9px; border-radius: 6px; background: var(--well2); overflow: hidden; margin-top: 6px; }
.zone .bar i { display: block; height: 100%; border-radius: 6px; background: var(--zc); box-shadow: 0 0 10px var(--zc); }
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 12px; }
.node { overflow-wrap: anywhere; hyphens: auto; background: var(--well); border-radius: 16px; padding: 10px 6px; text-align: center; font-size: 13px; font-weight: 800; line-height: 1.2; border: 2px solid transparent; }
.node .nm { display: grid; place-items: center; margin: 0 auto 6px; position: relative; width: 58px; height: 58px; }
.node .nm span { position: absolute; font-size: 24px; }
.node.mastered { border-color: rgba(34, 197, 94, .6); background: rgba(34, 197, 94, .12); }
.node.learning, .node.new { border-color: rgba(34, 211, 238, .45); }
.node.locked { opacity: .45; }
.node.due::after { content: "🔁"; }
.badge-new { display: inline-block; background: var(--pink2); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 7px; margin-top: 4px; }
.boss-btn { margin-top: 12px; }

/* ---------- пропуск ---------- */
.pass { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.ptier { position: relative; border-radius: 16px; padding: 10px 6px 8px; text-align: center; background: var(--well); border: 2px solid var(--line); min-height: 140px; display: flex; flex-direction: column; align-items: center; }
.ptier .tn { position: absolute; top: 6px; left: 8px; font-weight: 900; font-style: italic; color: var(--muted); }
.ptier .ta { height: 78px; display: grid; place-items: center; }
.ptier .ta .hero-svg { width: 50px; height: 70px; }
.ptier .ta .glider-svg { width: 70px; height: 47px; }
.ptier .banner { width: 44px; height: 52px; font-size: 24px; }
.ptier .tt { font-size: 12px; font-weight: 800; line-height: 1.15; }
.ptier.got { background: rgba(34, 197, 94, .12); }
.ptier .tick { position: absolute; top: 4px; right: 8px; color: var(--green); font-weight: 900; font-size: 20px; }
.ptier:not(.got) .ta { filter: grayscale(.6) brightness(.8); }

/* ---------- редкость ---------- */
.r-common { border-color: var(--common) !important; }
.r-rare { border-color: var(--rare) !important; background-image: linear-gradient(180deg, rgba(59, 130, 246, .25), transparent 70%); }
.r-epic { border-color: var(--epic) !important; background-image: linear-gradient(180deg, rgba(168, 85, 247, .3), transparent 70%); }
.r-legendary { border-color: var(--legendary) !important; background-image: linear-gradient(180deg, rgba(245, 158, 11, .35), transparent 70%); box-shadow: 0 0 18px rgba(245, 158, 11, .25); }

/* ---------- шкафчик и магазин ---------- */
.locker-top { display: flex; gap: 14px; align-items: center; }
.seg { display: flex; gap: 6px; background: var(--well); border-radius: 14px; padding: 4px; margin: 12px 0; overflow-x: auto; }
.seg button { flex: 1; padding: 9px 10px; border-radius: 10px; font-weight: 800; font-size: 15px; color: var(--muted); white-space: nowrap; background: none; }
.seg button.on { background: var(--violet); color: #fff; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.item { border-radius: 16px; padding: 10px 8px; text-align: center; background: var(--well); border: 2px solid var(--line); display: flex; flex-direction: column; align-items: center; }
.item .ia { height: 96px; display: grid; place-items: center; }
.item .it { font-weight: 900; font-size: 15px; line-height: 1.15; }
.item .ir { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item.no .ia { filter: grayscale(1) brightness(.5); }
.item.eq { outline: 3px solid var(--yellow); outline-offset: 2px; }
.item .own { color: var(--green); font-weight: 900; margin-top: 8px; }
.shop .item .ia { height: 120px; }
.emote-art { display: grid; place-items: center; }

/* ---------- база ---------- */
.mats { display: flex; gap: 14px; font-weight: 900; font-size: 18px; margin: 6px 0 10px; }
.base { display: grid; gap: 4px; padding: 10px; border-radius: 20px; background: radial-gradient(circle at 50% 40%, #4ade80, #16a34a 70%, #0e7490 100%); box-shadow: inset 0 0 0 4px rgba(254, 240, 138, .6), var(--glow); }
.cell { aspect-ratio: 1; border-radius: 8px; background: rgba(255, 255, 255, .14); border: 1px dashed rgba(255, 255, 255, .35); font-size: clamp(20px, 6vw, 38px); display: grid; place-items: center; padding: 0; }
.cell.full { border-style: solid; }
.cell.deco { background: rgba(255, 255, 255, .22); }
.wood { background: repeating-linear-gradient(0deg, #a16207 0 9px, #854d0e 9px 11px) !important; border-color: #713f12 !important; }
.stone { background: repeating-linear-gradient(90deg, #9ca3af 0 14px, #6b7280 14px 16px), #9ca3af !important; border-color: #4b5563 !important; }
.metal { background: linear-gradient(135deg, #cbd5e1, #64748b 60%, #cbd5e1) !important; border-color: #334155 !important; }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.piece { background: var(--well); border: 2px solid var(--line); border-radius: 14px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.piece.on { border-color: var(--yellow); background: rgba(250, 204, 21, .15); }
.piece .pv { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 30px; }
.piece b { font-size: 13px; line-height: 1.1; }
.piece small { font-size: 12px; color: var(--muted); font-weight: 800; }

/* ---------- высадка ---------- */
.drop { position: fixed; inset: 0; z-index: 30; overflow: hidden; background: linear-gradient(180deg, #312e81 0%, #7c3aed 45%, #f472b6 75%, #fb923c 100%); cursor: pointer; }
.sky { position: absolute; inset: 0; }
.ship { position: absolute; top: 28%; left: -20%; font-size: 64px; animation: fly 3.2s linear forwards; }
.cloud { position: absolute; background: rgba(255, 255, 255, .5); border-radius: 50px; height: 34px; filter: blur(2px); animation: drift 6s linear infinite; }
.c1 { width: 160px; top: 30%; left: 70%; } .c2 { width: 110px; top: 52%; left: 10%; animation-duration: 8s; } .c3 { width: 200px; top: 70%; left: 50%; animation-duration: 7s; }
.diver { position: absolute; left: 50%; top: -30%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; animation: dive 3s ease-out forwards; }
.diver > div { margin-top: -18px; }
.island { position: absolute; left: 50%; bottom: -60px; transform: translateX(-50%); width: 420px; height: 200px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, var(--zc), #065f46 70%); box-shadow: 0 0 0 14px rgba(254, 240, 138, .7), 0 0 60px rgba(0, 0, 0, .4); display: grid; place-items: start center; }
.island span { font-size: 60px; margin-top: 20px; }
.drop-t { position: absolute; top: 9%; left: 0; right: 0; text-align: center; animation: pop .6s .3s both; }
.drop-t h1 { font-size: 40px; font-weight: 900; font-style: italic; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0, 0, 0, .3); margin: 8px 0 4px; }
.drop-t .muted { color: #fde68a; font-weight: 800; }
.tap { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: #fff; opacity: .8; }

/* ---------- урок / HUD ---------- */
.lesson-top { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; padding: 8px 0; z-index: 5;
  background: var(--top-bg); backdrop-filter: blur(6px); }
.x { background: var(--panel2); border: 1px solid var(--line); width: 44px; height: 44px; border-radius: 50%; font-size: 20px; flex: none; }
.hud { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; justify-content: flex-end; }
.hp { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 5px 9px; font-weight: 900; font-size: 15px; white-space: nowrap; transition: transform .2s; }
.hp.rank { color: var(--gold-ink); } .hp.score { color: var(--cyan-ink); }
.hp.bump { transform: scale(1.18); }
.storm { display: flex; align-items: center; gap: 4px; font-weight: 900; color: var(--storm-ink); margin-right: auto; }
.storm.warn { color: var(--storm-warn); animation: pulse 1s infinite; }
.bosshp { flex: 1; height: 16px; background: var(--well2); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.bosshp i { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f97316); transition: width .4s; }
.prog { flex: 1; height: 16px; background: var(--well2); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #84cc16); border-radius: 10px; transition: width .4s; }
.feed { min-height: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; margin: 4px 0; }
.kf { font-size: 13px; font-weight: 800; background: var(--well2); padding: 3px 10px; border-radius: 8px; animation: slide .4s; }
.kf.me { color: var(--gold-ink); } .kf.storm { color: var(--storm-ink); }
.chip { display: inline-block; font-size: 14px; font-weight: 900; padding: 4px 12px; border-radius: 999px; background: #e0e7ff; color: #3730a3; }
.chip.boss, .chip.zone_boss { background: #fee2e2; color: #b91c1c; } .chip.remed { background: #ffedd5; color: #c2410c; } .chip.warmup { background: #dcfce7; color: #166534; }
.lvl-stars { color: #f59e0b; font-size: 15px; letter-spacing: 1px; }
.task { font-size: 22px; font-weight: 700; margin: 10px 0 6px; }
.task b { color: #1d4ed8; white-space: nowrap; }
.ill { max-width: 100%; height: auto; display: block; margin: 10px auto; max-height: 340px; }
.ans { margin-top: 12px; }
.display { min-height: 64px; border: 3px solid var(--paper-line); border-radius: 16px; font-size: 32px; font-weight: 800; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--paper-ink); letter-spacing: 1px; }
.display.focus { border-color: #7c3aed; }
.display .ph { color: #cbd5e1; }
.frac { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.frac .display { min-width: 120px; min-height: 56px; }
.frac hr { width: 140px; border: 0; border-top: 4px solid var(--paper-ink); margin: 0; }
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 12px; }
.pad button { background: #fff; color: var(--paper-ink); border-radius: 14px; font-size: 26px; font-weight: 800; padding: 14px 0; box-shadow: 0 4px 0 #cbd5e1; border: 2px solid var(--paper-line); }
.pad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #cbd5e1; }
.pad .ok { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 4px 0 #15803d; grid-row: span 2; }
.pad .del { background: #fef2f2; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { background: #fff; color: var(--paper-ink); border: 3px solid var(--paper-line); border-radius: 16px; padding: 16px 10px; font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 #cbd5e1; }
.choice.sel { border-color: #7c3aed; background: #f3e8ff; }
.choice.good { border-color: var(--ok); background: var(--ok-bg); }
.choice.badc { border-color: var(--bad); background: var(--bad-bg); }

.fb { border-radius: 18px; padding: 14px 16px; margin-top: 14px; font-size: 18px; animation: pop .25s; }
.fb.ok { background: var(--ok-bg); color: #14532d; }
.fb.retry { background: var(--warn-bg); color: #7c2d12; }
.fb.bad { background: var(--bad-bg); color: #7f1d1d; }
.fb h3 { margin: 0 0 6px; }
.sol { background: #fff; border-radius: 14px; padding: 10px 12px; margin-top: 10px; color: var(--paper-ink); }
.chest { display: flex; gap: 12px; align-items: center; border-radius: 14px; padding: 10px 12px; margin: 8px 0; color: #fff; border: 2px solid; animation: chest .6s; }
.chest .ch-ico { font-size: 40px; animation: wobble .8s; }
.chest.r-common { background: #475569; } .chest.r-rare { background: #1d4ed8; } .chest.r-epic { background: #7e22ce; } .chest.r-legendary { background: linear-gradient(135deg, #b45309, #f59e0b); }

.note { display: flex; gap: 10px; align-items: flex-start; background: rgba(250, 204, 21, .12); border: 1px solid rgba(250, 204, 21, .4); border-radius: 16px; padding: 10px 14px; margin: 8px 0; font-weight: 700; animation: pop .3s; }
.note.new { background: rgba(34, 211, 238, .12); border-color: rgba(34, 211, 238, .45); }
.note.boss { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .5); }
.note.remed { background: rgba(249, 115, 22, .15); border-color: rgba(249, 115, 22, .5); }
.note.tier { background: rgba(168, 85, 247, .2); border-color: rgba(168, 85, 247, .6); }
.fb .note, .card.paper .note { color: var(--paper-ink); background: #fffbeb; border-color: #fde68a; }
.fb .note.new, .card.paper .note.new { background: #ecfeff; border-color: #a5f3fc; }
.fb .note.tier { background: #f3e8ff; border-color: #d8b4fe; }
.whoi { font-size: 30px; line-height: 1; }

/* ---------- теория ---------- */
.theory .lbl { font-size: 13px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--paper-muted); margin-top: 14px; }
.theory .ex { background: #eff6ff; border-radius: 14px; padding: 12px; }
.theory .rem { background: #fef9c3; border-radius: 14px; padding: 12px; border-left: 6px solid #facc15; }

/* ---------- итоги ---------- */
.done { text-align: center; padding-top: 10px; display: flex; flex-direction: column; align-items: center; }
.place { font-size: 84px; font-weight: 900; font-style: italic; line-height: 1; color: var(--place-ink); text-shadow: 0 6px 0 rgba(0, 0, 0, .35); animation: pop .5s; }
.place small { display: block; margin-top: 6px; font-size: 16px; font-style: normal; color: var(--muted); }
.done-t { margin-top: 14px; font-size: 42px; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; animation: pop .6s .1s both; }
.done.win .place, .done.win .done-t { background: linear-gradient(180deg, #fde047, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #7c2d12) drop-shadow(0 0 24px rgba(250, 204, 21, .5)); }
.done.top .done-t { color: var(--cyan-ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; text-align: center; }
.stats div { background: var(--well); border-radius: 14px; padding: 10px 6px; font-size: 14px; color: var(--muted); }
.stats b { display: block; font-size: 24px; color: var(--ink); }
.card.paper .stats div { background: var(--paper-well); color: var(--paper-muted); } .card.paper .stats b { color: var(--paper-ink); }
.final { margin-top: 12px; background: var(--well); border-radius: 14px; padding: 10px 14px; }
.frow { padding: 4px 0; font-weight: 800; border-bottom: 1px solid var(--line); }
.frow.me { color: var(--gold-ink); }
.big-emoji { font-size: 80px; text-align: center; animation: pop .5s; }

/* ---------- нижнее меню ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: var(--nav-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 10; }
.nav button { background: none; flex: 1; max-width: 130px; border-radius: 12px; padding: 5px 2px; font-size: 12px; font-weight: 900; color: var(--muted); }
.nav button span { display: block; font-size: 24px; }
.nav button.on { background: rgba(168, 85, 247, .3); color: var(--nav-on); }

/* ---------- герой: танцы ---------- */
.hero-svg { overflow: visible; }
.hero-svg .arm-r { transform-origin: 74px 66px; } .hero-svg .arm-l { transform-origin: 26px 66px; }
.emote-idle { animation: bob 2.4s infinite ease-in-out; }
.emote-wave .arm-r { animation: wave 1s infinite ease-in-out; }
.emote-jump { animation: jump .8s infinite cubic-bezier(.3, 0, .5, 1); }
.emote-spin { animation: spin 1.4s infinite linear; }
.emote-robot { animation: robot 1.2s infinite steps(2); } .emote-robot .arm-r, .emote-robot .arm-l { animation: robotarm 1.2s infinite steps(2); }
.emote-disco { animation: disco 1.6s infinite ease-in-out; } .emote-disco .arm-r { animation: wave .8s infinite; }
.emote-flip { animation: flip 1.6s infinite ease-in-out; transform-origin: 50% 60%; }
.emote-rocket { animation: rocket 2s infinite ease-in-out; }

/* ---------- родитель (светлая тема) ---------- */
:root[data-theme="light"] body.parent { background: #f1f5f9; color: var(--paper-ink); }
:root[data-theme="light"] body.parent .muted { color: var(--paper-muted); }
:root[data-theme="light"] body.parent .dots i { background: #e2e8f0; }
body.parent .pad button { box-shadow: 0 4px 0 #cbd5e1; }
.ptable { width: 100%; border-collapse: collapse; font-size: 16px; }
.ptable td, .ptable th { padding: 6px 4px; border-bottom: 1px solid var(--paper-line); text-align: left; }
.mbar { height: 10px; background: var(--paper-well); border-radius: 6px; overflow: hidden; min-width: 80px; }
.mbar i { display: block; height: 100%; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 800; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 50; border: 1px solid var(--line); }
#toast.on { opacity: 1; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
#fx span { position: absolute; font-size: 30px; animation: fall 1.6s ease-in forwards; }
.plus { position: fixed; width: 100px; text-align: center; font-size: 30px; font-weight: 900; color: #7c3aed; text-shadow: 0 2px 0 #fff; animation: rise 1.1s ease-out forwards; pointer-events: none; z-index: 45; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pop { 0% { transform: scale(.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes fall { 0% { transform: translateY(-40px) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(540deg); opacity: .9; } }
@keyframes rise { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-80px); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes slide { 0% { transform: translateX(30px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes chest { 0% { transform: scale(.6) rotate(-4deg); opacity: 0; } 60% { transform: scale(1.06) rotate(2deg); } 100% { transform: none; opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-150deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }
@keyframes spin { 0% { transform: scaleX(1); } 25% { transform: scaleX(.1); } 50% { transform: scaleX(-1); } 75% { transform: scaleX(.1); } 100% { transform: scaleX(1); } }
@keyframes robot { 0% { transform: rotate(-6deg); } 100% { transform: rotate(6deg); } }
@keyframes robotarm { 0% { transform: rotate(-60deg); } 100% { transform: rotate(0); } }
@keyframes disco { 0%, 100% { transform: translateX(-6px) rotate(-5deg); filter: hue-rotate(0); } 50% { transform: translateX(6px) rotate(5deg); filter: hue-rotate(120deg); } }
@keyframes flip { 0%, 30% { transform: rotate(0) translateY(0); } 50% { transform: rotate(180deg) translateY(30px); } 70%, 100% { transform: rotate(360deg) translateY(0); } }
@keyframes rocket { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-40px) rotate(-6deg); } 60% { transform: translateY(-40px) rotate(6deg); } }
@keyframes fly { 0% { left: -20%; } 100% { left: 110%; } }
@keyframes drift { 0% { transform: translateX(0); } 100% { transform: translateX(-60px); } }
@keyframes dive { 0% { top: -30%; } 100% { top: 42%; } }
.shake { animation: shake .3s; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .task { font-size: 20px; }
  .pad button { padding: 11px 0; font-size: 24px; }
  .lobby { grid-template-columns: 1fr; text-align: center; }
  .lobby .lobby-hero .hero-svg { width: 100px; height: 140px; }
  .hp { padding: 4px 6px; font-size: 13px; }
  .storm svg { width: 32px; height: 32px; }
  .logo-t { font-size: 40px; }
  .island { width: 320px; }
}
/* ---------- дроби в условии (в столбик), ввод смешанного числа ---------- */
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.05; margin: 0 .1em; font-size: .9em; }
.fr > span { padding: 0 .18em; }
.fr > span:first-child { border-bottom: 2px solid currentColor; padding-bottom: 1px; }
.fr > span:last-child { padding-top: 1px; }
.mx { margin-right: .06em; }
.task .fr { font-size: .85em; }
.mixed-in { display: inline-flex; align-items: center; gap: 12px; }
.mixed-in .whole { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mixed-in .whole .display { min-width: 84px; min-height: 76px; font-size: 38px; }
.mixed-in small { font-size: 12px; color: var(--paper-muted); font-weight: 700; }
.mixed-in .frac .display { min-width: 96px; }
.mixed-in .frac hr { width: 110px; }

/* ---------- четверти ---------- */
.quarter { border-left: 6px solid var(--green); }
.zone.closed { opacity: .75; border-left-style: dashed; background: repeating-linear-gradient(135deg, var(--panel), var(--panel) 12px, transparent 12px, transparent 24px); }
.zone.closed .ze { font-size: 30px; }
.celebrate { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 50% 30%, rgba(250, 204, 21, .35), transparent 55%), rgba(11, 16, 38, .82); backdrop-filter: blur(4px); animation: pop .35s; }
.cel-card { max-width: 520px; width: 100%; text-align: center; background: var(--paper); color: var(--paper-ink); border-radius: 28px; padding: 22px 20px;
  box-shadow: 0 0 0 4px #facc15, 0 20px 60px rgba(0, 0, 0, .5); }
.cel-card h1 { font-size: 34px; font-weight: 900; font-style: italic; margin: 8px 0; }
.cel-card .tag { margin-top: 4px; }
.cel-gift { display: flex; gap: 14px; align-items: center; justify-content: center; text-align: left; background: #fffbeb; border-radius: 16px; padding: 10px 14px; margin: 10px 0; }
.cel-next { background: #ecfeff; border-radius: 16px; padding: 12px 14px; margin: 10px 0 16px; }
.cel-zones { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.cel-zones span { background: #fff; border: 2px solid #a5f3fc; border-radius: 999px; padding: 3px 10px; font-size: 14px; font-weight: 800; }
.qrow { background: var(--paper-well); border-radius: 14px; padding: 10px 12px; margin: 12px 0; }
.qrow p { margin: 6px 0 0; }

/* ---------- переключатель оформления ---------- */
.theme-sw { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-sw .seg { flex: 1; margin: 0; min-width: 260px; }
.card.paper .seg { background: var(--paper-well); }
.card.paper .seg button { color: var(--paper-muted); }
.card.paper .seg button.on { color: #fff; }

/* ---------- новые танцы (сезон 2) ---------- */
.emote-shiver { animation: shiver .18s infinite linear; }
.emote-skate { animation: skate 1.8s infinite ease-in-out; }
.emote-float { animation: floaty 2.4s infinite ease-in-out; filter: drop-shadow(0 0 12px rgba(52, 211, 153, .7)); }
@keyframes shiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px) rotate(-1deg); } 75% { transform: translateX(2px) rotate(1deg); } }
@keyframes skate { 0%, 100% { transform: translateX(-14px) rotate(-6deg); } 50% { transform: translateX(14px) rotate(6deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-26px); } }

/* ---------- светлая тема ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg1: #f5f3ff; --bg2: #e0f2fe; --blob1: rgba(168, 85, 247, .16); --blob2: rgba(34, 211, 238, .14);
  --panel: rgba(255, 255, 255, .82); --panel2: #ffffff; --line: rgba(30, 27, 75, .12);
  --ink: #1e1b4b; --muted: #5b5f97; --cyan-ink: #0e7490; --gold-ink: #b45309; --fire-ink: #ea580c; --ice-ink: #0369a1;
  --soft-ink: #312e81; --storm-ink: #7c3aed; --storm-warn: #c026d3; --place-ink: #1e1b4b;
  --well: rgba(30, 27, 75, .06); --well2: rgba(30, 27, 75, .1);
  --nav-bg: rgba(255, 255, 255, .94); --nav-on: #6b21a8; --top-bg: linear-gradient(rgba(245, 243, 255, .97), rgba(245, 243, 255, .85));
  --lobby-bg: linear-gradient(135deg, #e9d5ff, #cffafe); --lobby-line: rgba(124, 58, 237, .25);
  --glow: 0 1px 2px rgba(30, 27, 75, .06), 0 8px 24px rgba(30, 27, 75, .08);
}
:root[data-theme="light"] .card { backdrop-filter: none; }
:root[data-theme="light"] .lobby::before { background: radial-gradient(circle, rgba(250, 204, 21, .35), transparent 60%); }
:root[data-theme="light"] .platform { background: radial-gradient(ellipse, rgba(8, 145, 178, .55), rgba(8, 145, 178, .05) 70%); box-shadow: 0 0 24px rgba(8, 145, 178, .35); }
:root[data-theme="light"] .lobby-hero .hero-svg { filter: drop-shadow(0 6px 10px rgba(30, 27, 75, .25)); }
:root[data-theme="light"] .node.mastered { background: rgba(34, 197, 94, .14); }
:root[data-theme="light"] .zone .bar i { box-shadow: none; }
:root[data-theme="light"] .ptier .tn { color: var(--muted); }
:root[data-theme="light"] .ptier.got, :root[data-theme="light"] .item, :root[data-theme="light"] .piece { background-color: #fff; }
:root[data-theme="light"] .ptier { background-color: rgba(255, 255, 255, .7); }
:root[data-theme="light"] .r-legendary { box-shadow: 0 0 14px rgba(245, 158, 11, .3); }
:root[data-theme="light"] .item.no .ia { filter: grayscale(1) opacity(.45); }
:root[data-theme="light"] .ptier:not(.got) .ta { filter: grayscale(.6) opacity(.7); }
:root[data-theme="light"] .seg button.on { color: #fff; }
:root[data-theme="light"] .btn.ghost { color: var(--muted); }
:root[data-theme="light"] .x { box-shadow: var(--glow); }
:root[data-theme="light"] .kf { box-shadow: var(--glow); background: #fff; }
:root[data-theme="light"] .note { background: #fffbeb; border-color: #fde68a; }
:root[data-theme="light"] .note.new { background: #ecfeff; border-color: #a5f3fc; }
:root[data-theme="light"] .note.boss { background: #fef2f2; border-color: #fecaca; }
:root[data-theme="light"] .note.remed { background: #fff7ed; border-color: #fed7aa; }
:root[data-theme="light"] .note.tier { background: #f3e8ff; border-color: #d8b4fe; }
:root[data-theme="light"] .done.win .place, :root[data-theme="light"] .done.win .done-t { filter: drop-shadow(0 3px 0 #92400e); }
:root[data-theme="light"] .place { text-shadow: 0 4px 0 rgba(124, 58, 237, .25); }
:root[data-theme="light"] .place small { color: var(--muted); }
:root[data-theme="light"] .tap { color: #fff; }
:root[data-theme="light"] .logo-t { filter: drop-shadow(0 4px 0 #9a3412); }
:root[data-theme="light"] .prof { background: #fff; }
:root[data-theme="light"] .dots i { background: #e2e8f0; }
:root[data-theme="light"] .base { box-shadow: inset 0 0 0 4px rgba(254, 240, 138, .8), var(--glow); }
:root[data-theme="light"] #toast { border-color: transparent; }

/* страница родителя в тёмной теме: тёмные карточки */
:root[data-theme="dark"] body.parent { --paper: #161b3d; --paper-ink: #e2e8f0; --paper-muted: #a5b4fc; --paper-line: rgba(255, 255, 255, .12); --paper-well: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] body.parent .card.paper { border: 1px solid var(--line); }
:root[data-theme="dark"] body.parent .chart text { fill: #cbd5e1; }
:root[data-theme="dark"] body.parent .field { background: #0b1026; }

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