/* Kaonty — mobile-first game styles.
   World: "cahier de maths" by day (squared notebook, fountain-pen blue,
   highlighter yellow, Seyès pages) and "ardoise" when the phone is in dark
   mode (chalk on a school slate). Layout first, then the world layer at the end. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url("../fonts/nunito-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url("../fonts/nunito-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/caveat-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/caveat-700-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --navy-900: #0b1726;
  --navy-800: #0f1f33;
  --navy-700: #16293f;
  --navy-600: #1e3a5f;
  --navy-500: #2d5a8f;
  --gold: #ffe45c;
  --gold-hi: #1e3d73;
  --gold-lo: #c9a800;
  --cream: #faf3e6;
  --cream-2: #efe3cc;
  --ink: #1b2a3d;
  --muted: #8ea3bd;
  --good: #23803a;
  --bad: #ff7a7a;
  --r1: #9fb6cf;
  --r2: #c9f0c1;
  --r3: #d6e6ff;
  --tile: clamp(52px, 19vw, 76px);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: #fbfcfd;
  color: #1f2a44;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.modal-card:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
a { color: var(--gold); }

#app { height: 100dvh; max-width: 520px; margin: 0 auto; position: relative; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; padding: calc(8px + var(--safe-t)) 12px calc(10px + var(--safe-b)); }
.screen.active { display: flex; animation: screenIn .28s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  border-radius: 999px; padding: 12px 18px; font-weight: 700; letter-spacing: .01em;
  transition: transform .08s ease, filter .15s, opacity .15s; min-height: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: var(--navy-900); box-shadow: 0 4px 0 #7d5a33; }
.btn-gold:active { box-shadow: 0 1px 0 #7d5a33; transform: translateY(3px); }
.btn-ghost { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); }
.btn.armed { border-color: var(--bad); color: var(--bad); }
.btn-big { font-size: 1.15rem; padding: 16px 22px; }
.btn-small { min-width: 46px; padding: 10px 12px; }
#btn-hint .coin { width: 15px; height: 15px; font-size: .56rem; margin: 0 2px 0 4px; }
#hint-cost { display: inline-flex; align-items: center; font-size: .8rem; }
.btn-daily { background: linear-gradient(135deg, #24507f, #183354); border: 1px solid rgba(212,165,116,.5); flex-direction: column; gap: 2px; padding: 12px 18px; border-radius: 18px; }
.btn-daily small { font-weight: 500; color: var(--muted); font-size: .8rem; }
.daily-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.btn-archives { flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 18px; font-size: 1.2rem; min-width: 74px; }
.btn-archives small { font-size: .7rem; font-weight: 600; color: var(--cream-2); }
.arch-list { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto; margin: 10px 0; text-align: left; }
.arch-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: var(--cream); font: inherit; }
.arch-row small { color: var(--muted); margin-left: 4px; }
.arch-row .go { color: var(--gold-hi); font-weight: 700; }
.arch-row .ok { color: var(--good); }
.arch-row .ko { color: var(--bad); }
.arch-row .lock { opacity: .7; }
.arch-row:active { transform: scale(.98); }
.btn-unlock { background: transparent; border: 1px dashed rgba(212,165,116,.6); color: var(--gold-hi); font-size: .92rem; }
.btn-unlock.owned { border-style: solid; border-color: rgba(111,211,155,.5); color: var(--good); pointer-events: none; }
.link { text-decoration: underline; color: var(--gold); font-size: inherit; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.07); font-size: 1.1rem; }

/* ------------------------------------------------------------------ menu */
#screen-menu { justify-content: center; overflow-y: auto; }
.menu-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.menu-bg span {
  position: absolute; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: var(--cream); color: var(--ink); font-weight: 800; font-size: 1.3rem; opacity: .07;
  animation: float 14s linear infinite;
}
@keyframes float { from { transform: translateY(110vh) rotate(0deg); } to { transform: translateY(-20vh) rotate(200deg); } }
.menu-inner { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: center; padding: 10px 6px; }
.logo { font-weight: 700; line-height: 1; }
.tagline { color: var(--muted); margin-top: -6px; font-size: 1rem; letter-spacing: .04em; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-stats { color: var(--muted); font-size: .82rem; min-height: 1.2em; }
.menu-footer { display: flex; flex-wrap: wrap; gap: 0 14px; justify-content: center; font-size: .78rem; margin-top: 10px; opacity: .8; }
.menu-footer a, .menu-footer .link { color: var(--muted); padding: 10px 2px; }

/* ------------------------------------------------------------------ game top */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.where { flex: 1; min-width: 0; }
.where-main { font-weight: 800; font-size: 1.02rem; }
.where-sub { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; background: rgba(0,0,0,.25); padding: 7px 12px; border-radius: 999px; font-size: 1.02rem; }
.coin { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .66rem; font-weight: 800; color: #6b4a22; background: radial-gradient(circle at 35% 30%, #ffe2b0, var(--gold) 60%, var(--gold-lo)); box-shadow: inset 0 -1px 0 rgba(0,0,0,.25); }
.coins.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

.boss-banner { margin-top: 6px; background: linear-gradient(90deg, rgba(255,90,90,.18), rgba(255,90,90,.05)); border: 1px solid rgba(255,122,122,.45); border-radius: 12px; padding: 7px 12px; font-size: .86rem; display: flex; gap: 8px; align-items: center; }
.boss-banner b { color: var(--bad); }

.scoreboard { margin-top: 8px; background: rgba(0,0,0,.22); border-radius: var(--radius); padding: 10px 12px 8px; border: 1px solid rgba(255,255,255,.06); }
.score-line { display: flex; justify-content: space-between; align-items: flex-end; }
.score-block { display: flex; flex-direction: column; }
.score-block.right { align-items: flex-end; }
.label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.score { font-size: 1.9rem; font-weight: 800; line-height: 1.05; color: var(--cream); }
.score.pulse { animation: pulse .4s ease; }
@keyframes pulse { 40% { transform: scale(1.12); color: var(--gold-hi); } }
.target { font-size: 1.25rem; font-weight: 800; color: var(--gold); }
.progress { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); margin: 8px 0 7px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transition: width .5s cubic-bezier(.16,1,.3,1); }
.progress-fill.done { background: linear-gradient(90deg, #3fae74, var(--good)); }
.counters { display: flex; gap: 8px; font-size: .8rem; color: var(--muted); }
.counter b { color: var(--cream); font-size: .95rem; }
.counter.low b { color: var(--bad); }
.bag-btn { padding: 10px 4px; margin: -10px 0 -10px auto; color: var(--muted); text-decoration: underline dotted; font-size: .8rem; }

/* ------------------------------------------------------------------ theorems */
.theorems { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.th {
  position: relative; aspect-ratio: 1 / 1.05; border-radius: 12px; background: linear-gradient(180deg, #213c5e, #172c46);
  border: 1.5px solid var(--r1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px;
  overflow: hidden;
}
.th.r2 { border-color: var(--r2); }
.th.r3 { border-color: var(--r3); }
.th.empty { border: 1.5px dashed rgba(255,255,255,.14); background: transparent; }
.th.empty.first { border-color: rgba(255,255,255,.3); }
.th.empty.first .glyph { color: var(--muted); }
.th.empty.first .nm { color: var(--muted); }
.th .glyph { font-weight: 800; font-size: 1.15rem; color: var(--gold-hi); line-height: 1; }
.th .nm { font-size: .62rem; color: var(--cream-2); text-align: center; line-height: 1.05; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.th .val { position: absolute; top: 2px; right: 3px; font-size: .55rem; font-weight: 800; color: var(--good); }
.th.fire { animation: fire .45s ease; }
@keyframes fire { 0% { transform: scale(1); } 35% { transform: scale(1.18) rotate(-4deg); } 100% { transform: scale(1); } }

/* ------------------------------------------------------------------ slate */
.slate {
  margin-top: 8px; flex: 1; min-height: 92px; border-radius: var(--radius); padding: 10px;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 22px), #12243a;
  border: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  position: relative; overflow: hidden;
}
.slate-tiles { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; min-height: 44px; }
.slate-tiles .tile { --tile: 44px; font-size: 1.25rem; }
.slate-tiles .tile.op { --tile: 34px; }
.slate-preview { font-size: 1rem; color: var(--muted); text-align: center; min-height: 1.5em; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; justify-content: center; }
.slate-preview .eq { color: var(--cream); font-weight: 800; font-size: 1.35rem; }
.slate-preview .chip { font-size: .8rem; padding: 2px 7px; border-radius: 99px; background: rgba(212,165,116,.15); color: var(--gold-hi); font-weight: 700; }
.slate-preview .chip.flat { background: rgba(111,211,155,.14); color: var(--good); }
.slate-preview .chip.cost { background: rgba(255,122,122,.14); color: var(--bad); }
.slate-preview .final { color: var(--gold-hi); font-weight: 800; font-size: 1.6rem; }
.slate-preview .warn { color: var(--bad); font-size: .85rem; }
.slate-preview .hintline { font-size: .9rem; }
.slate.flash { animation: flash .5s ease; }
@keyframes flash { 30% { background-color: #2a4566; } }
.running { font-weight: 800; color: var(--cream); font-size: 1.5rem; }
.slate-preview .expr { color: var(--cream-2); font-weight: 700; font-size: 1rem; white-space: nowrap; }
.slate-preview .expr .bv, .slate-preview .expr b { color: var(--good); font-weight: 900; }
.tile.boosted { box-shadow: 0 4px 0 #c9b48f, 0 0 0 2px var(--good); }
.tile .boost {
  position: absolute; top: -9px; right: -9px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; background: var(--good); color: #0b1a2b; font-size: .72rem; font-weight: 900;
  box-shadow: 0 2px 6px rgba(0,0,0,.45); z-index: 2;
}
.tile .boost.pop { animation: tpop .3s ease; }
.th.armed { box-shadow: 0 0 0 2px var(--gold-hi); }
.th.armed.fire { animation: fire .45s ease; }
.floater.boost-float { color: var(--good); font-size: 1.15rem; }

/* first-run coach, on the real board */
.coach { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; padding: 8px 10px 8px 12px; border-radius: 12px; background: rgba(240,201,149,.1); border: 1px solid rgba(240,201,149,.45); text-align: left; }
.coach p { flex: 1; font-size: .86rem; line-height: 1.35; color: var(--cream); }
.coach .link { font-size: .8rem; color: var(--muted); padding: 8px 4px; flex: none; }
.coach .btn-coach { min-height: 40px; padding: 8px 14px; font-size: .9rem; flex: none; }
.btn-calc.coach-target { animation: coachPulse 1.4s ease-in-out infinite; }
@keyframes coachPulse { 50% { box-shadow: 0 4px 0 #7d5a33, 0 0 0 5px rgba(240,201,149,.35); } }
.ended .hand .tile { opacity: .4; }

/* ------------------------------------------------------------------ tiles */
.hand { display: grid; grid-template-columns: repeat(4, var(--tile)); gap: 9px; justify-content: center; margin: 10px 0 8px; min-height: calc(var(--tile) * 2 + 9px); align-content: start; }
.hand.five { grid-template-columns: repeat(5, calc(var(--tile) * .86)); }
.hand.five .tile { --tile: calc(clamp(52px, 19vw, 76px) * .86); }
.tile {
  width: var(--tile); height: var(--tile); border-radius: 14px; position: relative;
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--tile) * .46); line-height: 1;
  background: linear-gradient(180deg, #fffaf0, var(--cream) 50%, var(--cream-2)); color: var(--ink);
  box-shadow: 0 4px 0 #c9b48f, 0 6px 14px rgba(0,0,0,.35);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
}
.tile.op { background: linear-gradient(180deg, #2c4f7a, var(--navy-600)); color: var(--gold-hi); box-shadow: 0 4px 0 #0e1d30, 0 6px 14px rgba(0,0,0,.35); font-size: calc(var(--tile) * .5); }
.tile.op.concat { color: #9fe0ff; }
.tile.fx-gold { background: linear-gradient(160deg, #fff1c9, #f2c46e 45%, #c9913d); box-shadow: 0 4px 0 #8a6224; }
.tile.fx-prism { background: linear-gradient(135deg, #ffe0f0, #e0f0ff 35%, #e8ffe0 65%, #fff4d6); box-shadow: 0 4px 0 #9a8bb8; }
.tile.fx-glass { background: linear-gradient(160deg, rgba(220,245,255,.95), rgba(160,215,240,.75)); box-shadow: 0 4px 0 #6d9fb8; }
.tile .fxmark { position: absolute; top: 4px; right: 5px; font-size: calc(var(--tile) * .18); opacity: .8; }
.tile .big { font-size: calc(var(--tile) * .36); }
.tile.hidden { background: repeating-linear-gradient(45deg, #2a4a72 0 6px, #24426a 6px 12px); color: var(--gold); box-shadow: 0 4px 0 #0e1d30; }
.tile.sel { transform: translateY(-6px) scale(.94); opacity: .35; }
.tile.dim { opacity: .45; }
.tile.swap-mark { transform: translateY(-6px) rotate(-4deg); box-shadow: 0 0 0 3px var(--bad), 0 8px 16px rgba(0,0,0,.4); }
.slate-tiles .tile.swap-mark { transform: none; }
#btn-swap.active { border-color: var(--bad); color: var(--bad); }
.tile:not(.sel):not(.dim):active { transform: translateY(2px); box-shadow: 0 2px 0 #c9b48f; }
.tile.deal { animation: deal .3s cubic-bezier(.16,1,.3,1) both; }
@keyframes deal { from { transform: translateY(40px) scale(.6); opacity: 0; } }
.tile.pop { animation: tpop .25s ease; }
@keyframes tpop { 50% { transform: scale(1.25); } }
.tile.lit { box-shadow: 0 0 0 3px var(--gold-hi); }
.tile.mini { --tile: 34px; border-radius: 8px; box-shadow: 0 2px 0 #c9b48f; }
.tile.mini.op { box-shadow: 0 2px 0 #0e1d30; }

/* ------------------------------------------------------------------ actions */
.actions { display: grid; grid-template-columns: 1fr auto 1.4fr; gap: 8px; align-items: center; }
.btn-calc { font-size: 1.08rem; }
.actions .btn { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
#btn-swap { font-size: .92rem; }
#screen-shop .actions { grid-template-columns: 1fr 1.4fr; }
.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.bigshake { animation: bigshake .5s ease; }
@keyframes bigshake { 15% { transform: translate(-6px, 3px) rotate(-.6deg); } 30% { transform: translate(6px, -3px) rotate(.6deg); } 45% { transform: translate(-4px, 2px); } 60% { transform: translate(4px, -2px); } 80% { transform: translate(-2px, 1px); } }

/* ------------------------------------------------------------------ shop */
.shop-scroll { flex: 1; overflow-y: auto; padding: 4px 2px 12px; -webkit-overflow-scrolling: touch; }
.shop-h { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 14px 2px 8px; }
.owned { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.offers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tiles-offers { grid-template-columns: repeat(3, 1fr); }
.offer {
  background: linear-gradient(180deg, #1d3756, #152a43); border-radius: var(--radius); padding: 12px 10px; border: 1.5px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; position: relative; min-height: 120px;
}
.offer.r1 { border-color: rgba(159,182,207,.6); }
.offer.r2 { border-color: rgba(111,211,155,.7); }
.offer.r3 { border-color: rgba(232,163,255,.8); }
.offer .glyph { font-size: 1.6rem; font-weight: 800; color: var(--gold-hi); }
.offer .nm { font-weight: 800; font-size: .95rem; }
.offer .ds { font-size: .78rem; color: var(--cream-2); line-height: 1.25; flex: 1; }
.offer .rar { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.offer .price { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; background: rgba(0,0,0,.3); padding: 5px 11px; border-radius: 99px; }
.offer.cant .price { color: var(--bad); }
.offer.sold { opacity: .35; pointer-events: none; }
.offer.sold::after { content: attr(data-sold); position: absolute; top: 40%; transform: rotate(-12deg); font-weight: 800; color: var(--good); font-size: 1.1rem; border: 2px solid var(--good); padding: 2px 8px; border-radius: 8px; }
.offer:active { transform: scale(.97); }
.services { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.service { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.service .nm { font-weight: 800; font-size: .9rem; }
.service .ds { font-size: .76rem; color: var(--muted); }
.service .price { display: inline-flex; gap: 5px; align-items: center; font-weight: 800; font-size: .9rem; }
.next-preview { margin: 2px 0 6px; padding: 10px 12px; border-radius: var(--radius); background: rgba(0,0,0,.2); font-size: .88rem; color: var(--cream-2); line-height: 1.4; }
.next-preview b { color: var(--gold-hi); }
.next-preview .bossname { color: var(--bad); }
.shop-tip { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,.12); color: var(--cream); }
.offer .full-tag { color: var(--gold-hi); }

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; background: rgba(5,12,22,.72); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fadeIn .2s ease; }
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: min(460px, 100%); max-height: 88dvh; overflow-y: auto; background: linear-gradient(180deg, #1f3b5e, #142840);
  border: 1px solid rgba(212,165,116,.35); border-radius: 22px; padding: 22px 18px 18px; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: cardIn .3s cubic-bezier(.16,1,.3,1);
}
@keyframes cardIn { from { transform: translateY(24px) scale(.94); opacity: 0; } }
.modal-card h2 { line-height: 1.1; margin-bottom: 8px; }
.modal-card h3 { font-size: 1rem; margin: 10px 0 6px; }
.modal-card .small { font-size: .85rem; }

.build { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.build .th { aspect-ratio: auto; min-height: 60px; }
.pay-safe { font-size: .8rem; color: var(--cream-2); margin-top: 2px; }
.field-label { display: block; text-align: left; font-size: .85rem; color: var(--cream-2); margin: 10px 0 6px; }
.field-err { color: #ffb3b3; font-size: .85rem; text-align: left; margin-top: 8px; }
.consent.need { color: var(--cream); }
.consent.need input { outline: 2px solid var(--bad); outline-offset: 2px; }
.reward-opt .full-note { color: var(--gold-hi); }
.howto-demo { display: flex; gap: 4px; align-items: center; margin: 4px 0 6px; flex-wrap: wrap; }
.howto-demo .eqn { font-weight: 800; color: var(--cream); margin-left: 4px; }
.modal-card p { color: var(--cream-2); line-height: 1.45; margin: 6px 0; }
.modal-card .btns { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.modal-card .btns.row { flex-direction: row; }
.modal-card .btns.row .btn { flex: 1; }
.big-number { font-size: 2.6rem; font-weight: 800; color: var(--gold-hi); line-height: 1.1; }
.rows { margin: 12px 0; text-align: left; }
.rows div { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px dashed rgba(255,255,255,.1); color: var(--cream-2); }
.rows div b { color: var(--cream); display: inline-flex; gap: 5px; align-items: center; }
.rows div.tot { border: 0; font-size: 1.1rem; }
.rows div.tot b { color: var(--gold-hi); }
.checklist { list-style: none; text-align: left; margin: 12px auto; max-width: 340px; }
.checklist li { padding: 5px 0 5px 28px; position: relative; color: var(--cream-2); }
.checklist li::before { content: '✓'; position: absolute; left: 4px; color: var(--good); font-weight: 800; }
.consent { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: .82rem; color: var(--cream-2); margin-top: 12px; cursor: pointer; }
.consent input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.price-tag { display: inline-block; font-size: 2rem; font-weight: 800; color: var(--cream); margin: 4px 0; }
.price-tag small { font-size: .9rem; color: var(--muted); font-weight: 500; display: block; }
.grid-emoji { font-size: 1.4rem; letter-spacing: 2px; margin: 8px 0; }
.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25); color: var(--cream); font: inherit; text-align: center; letter-spacing: .05em; }
.reward-opts { display: grid; gap: 10px; margin-top: 12px; }
.reward-opt { display: flex; gap: 12px; align-items: center; text-align: left; background: rgba(255,255,255,.06); border: 1.5px solid rgba(212,165,116,.35); border-radius: 16px; padding: 12px; }
.reward-opt .glyph { font-size: 1.6rem; font-weight: 800; color: var(--gold-hi); width: 44px; text-align: center; flex: none; }
.reward-opt .nm { font-weight: 800; }
.reward-opt .ds { font-size: .8rem; color: var(--cream-2); }
.reward-opt:disabled { opacity: .4; }
.bag-grid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.bag-grid .tile { cursor: pointer; }
.bag-grid .tile.used { opacity: .3; }
.coll-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; text-align: left; }
.coll-item { background: rgba(255,255,255,.05); border-radius: 12px; padding: 8px 10px; }
.coll-item.locked { opacity: .5; }
.coll-item .nm { font-weight: 800; font-size: .86rem; }
.coll-item .ds { font-size: .74rem; color: var(--muted); }
.howto { text-align: left; }
.howto h3 { color: var(--gold-hi); }
.howto p { font-size: .92rem; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.seg { display: inline-flex; background: rgba(0,0,0,.3); border-radius: 99px; padding: 3px; }
.seg button { padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: .85rem; color: var(--muted); }
.seg button.on { background: var(--gold); color: var(--navy-900); }

/* ------------------------------------------------------------------ popover / toasts / fx */
.popover { position: fixed; z-index: 60; max-width: 260px; background: #0d1b2c; border: 1px solid rgba(212,165,116,.5); border-radius: 12px; padding: 10px 12px; font-size: .85rem; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.popover .nm { font-weight: 800; color: var(--gold-hi); margin-bottom: 3px; }
.popover .rar { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.toasts { position: fixed; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; width: min(420px, 92vw); pointer-events: none; }
.toast { background: #0d1b2c; border: 1px solid var(--gold); color: var(--cream); padding: 10px 14px; border-radius: 12px; font-size: .9rem; font-weight: 700; box-shadow: 0 10px 24px rgba(0,0,0,.4); animation: toastIn .3s ease, toastOut .3s ease 2.6s forwards; text-align: center; }
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-12px); opacity: 0; } }
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.floater { position: absolute; font-weight: 800; color: var(--gold-hi); font-size: 1.6rem; text-shadow: 0 2px 10px rgba(0,0,0,.6); animation: floatUp 1s ease-out forwards; white-space: nowrap; }
@keyframes floatUp { from { transform: translate(-50%, 0) scale(.8); opacity: 0; } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.15); } to { transform: translate(-50%, -80px) scale(1); opacity: 0; } }
.spark { position: absolute; width: 8px; height: 8px; border-radius: 2px; background: var(--gold); animation: spark .9s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(360deg); opacity: 0; } }

@media (min-height: 760px) {
  :root { --tile: clamp(56px, 19vw, 80px); }
  .slate { min-height: 120px; }
}
@media (max-height: 640px) {
  :root { --tile: clamp(46px, 16vw, 64px); }
  .score { font-size: 1.5rem; }
  .theorems { gap: 4px; }
  .th .nm { display: none; }
  .th { aspect-ratio: 1.3 / 1; }
  .slate { min-height: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==================================================================== world
   Cahier de maths (light, default) / Ardoise (dark, follows the phone).
   Everything below is driven by these tokens. */
:root {
  color-scheme: light dark;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --page: repeating-linear-gradient(0deg, rgba(98,140,214,.17) 0 1px, transparent 1px 18px), repeating-linear-gradient(90deg, rgba(98,140,214,.17) 0 1px, transparent 1px 18px), #fbfcfd;
  --pen: #1e3d73;            /* headings, numbers, strong ink */
  --text: #1f2a44;
  --text-2: #3b4866;
  --muted: #56627f;
  --red: #c43a46;            /* the margin red: section titles, boss, loss */
  --swap: #c25e00;           /* orange highlighter: tiles picked for a swap */
  --hl-c: rgba(255,228,92,.85);
  --hl: linear-gradient(transparent 55%, var(--hl-c) 55% 92%, transparent 92%);
  --line: #1e3d73;           /* drawn outlines (operators, ghost buttons) */
  --line-soft: rgba(30,61,115,.28);
  --surface: rgba(255,255,255,.88);
  --card: #fff;              /* number tiles, offers */
  --card-ink: #1f2a44;
  --card-edge: rgba(30,61,115,.26);
  --primary: #1e3d73;
  --primary-ink: #fff;
  --primary-edge: #10244a;
  --good: #23803a;
  --good-ink: #fff;
  --sticky-1: #fff2a8;
  --sticky-2: #c9f0c1;
  --sticky-3: #d6e6ff;
  --paper: #fff;             /* Seyès pages (windows) */
  --paper-ink: #1e3d73;
  --paper-text: #2c3e66;
  --paper-muted: #46557a;
  --backdrop: rgba(31,42,68,.42);
  --rough: 255px 14px 225px 14px / 14px 225px 14px 255px;
  /* legacy names used by the layout layer */
  --cream: var(--text);
  --cream-2: var(--text-2);
  --ink: #1f2a44;
  --gold: #ffe45c;
  --gold-hi: var(--pen);
  --gold-lo: #c9a800;
  --bad: var(--red);
  --r1: var(--sticky-1);
  --r2: var(--sticky-2);
  --r3: var(--sticky-3);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: radial-gradient(60% 40% at 30% 18%, rgba(255,255,255,.05), transparent 70%), radial-gradient(50% 35% at 75% 72%, rgba(255,255,255,.035), transparent 70%), #26322d;
    --pen: #f3f0e6;
    --text: #ebe8de;
    --text-2: #d2d4ca;
    --muted: #aeb8ad;
    --red: #f5a3b4;
    --swap: #ffb565;
    --hl-c: rgba(242,216,107,.34);
    --line: rgba(243,240,230,.82);
    --line-soft: rgba(243,240,230,.24);
    --surface: rgba(255,255,255,.04);
    --card: #fbf7ec;
    --card-edge: #c9c3b0;
    --primary: #f2d86b;
    --primary-ink: #1f2a44;
    --primary-edge: #b99d2c;
    --good: #b5e39f;
    --good-ink: #1f2a44;
    --paper: #efebe0;
    --backdrop: rgba(10,14,12,.72);
    --gold: #f2d86b;
  }
}

body { background: var(--page); color: var(--text); font-variant-numeric: lining-nums tabular-nums; }
::selection { background: var(--hl-c); color: inherit; }
:focus-visible { outline-color: var(--red); }
a, .link { color: var(--pen); }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* buttons */
.btn { border-radius: var(--rough); font-weight: 800; }
.btn-gold { background: var(--primary); color: var(--primary-ink); box-shadow: 0 3px 0 var(--primary-edge), 0 5px 10px rgba(0,0,0,.18); }
.btn-gold:active { box-shadow: 0 1px 0 var(--primary-edge); }
.btn-ghost { background: var(--surface); border: 2px solid var(--line); color: var(--pen); }
.btn.armed { border-color: var(--red); color: var(--red); }
.btn-daily { background: var(--surface); border: 2px solid var(--line); border-radius: var(--rough); color: var(--pen); box-shadow: 4px 5px 0 var(--hl-c); }
.btn-daily span { font-family: var(--hand); font-size: 1.55rem; font-weight: 700; line-height: 1.05; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.btn-daily span .ic { width: .8em; height: .8em; }
.btn-daily small { color: var(--muted); display: inline-flex; gap: 3px; align-items: center; justify-content: center; flex-wrap: wrap; }
.btn-archives { border-radius: var(--rough); }
.btn-archives .ic { width: 1.3em; height: 1.3em; }
.btn-archives small { color: var(--pen); }
.btn-unlock { border: 2px dashed var(--line); color: var(--pen); border-radius: var(--rough); background: var(--surface); }
.icon-btn { background: var(--surface); border: 2px solid var(--line); color: var(--pen); border-radius: var(--rough); width: 44px; height: 44px; }

/* menu */
.menu-bg span { background: transparent; color: var(--pen); border: 2px solid currentColor; border-radius: var(--rough); opacity: .07; font-family: var(--hand); }
.logo { font-family: var(--hand); font-size: clamp(4.6rem, 23vw, 6.2rem); line-height: .9; color: var(--pen); background: var(--hl); align-self: center; padding: 0 14px; transform: rotate(-2deg); }
.tagline { font-family: var(--hand); font-weight: 700; font-size: 1.45rem; color: var(--red); letter-spacing: 0; margin-top: 2px; }
.menu-stats { color: var(--muted); }
.menu-footer { opacity: 1; }
.menu-footer a, .menu-footer .link { color: var(--muted); }

/* game top */
.where-main { font-family: var(--hand); font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--pen); }
.where-sub { color: var(--muted); }
.coins { background: var(--surface); border: 2px solid var(--line); color: var(--pen); border-radius: var(--rough); }
.coin { background: #ffe45c; color: #1f2a44; box-shadow: inset 0 0 0 1.5px #1e3d73; }
.boss-banner { background: var(--surface); border: 2px solid var(--red); color: var(--text); }
.boss-banner b { color: var(--red); }
.boss-banner .ic { color: var(--red); width: 1.3em; height: 1.3em; }

.scoreboard { background: transparent; border: 0; border-bottom: 2px solid rgba(220,60,70,.55); border-radius: 0; padding: 4px 4px 8px; }
.label { color: var(--muted); }
.score { font-family: var(--hand); font-weight: 700; font-size: 2.8rem; line-height: .9; color: var(--pen); }
.target { font-family: var(--hand); font-weight: 700; font-size: 1.9rem; color: var(--pen); background: var(--hl); padding: 0 4px; }
.score.pulse { animation: none; }
.progress { background: var(--line-soft); height: 6px; border-radius: 99px; }
.progress-fill { background: var(--pen); }
.progress-fill.done { background: var(--good); }
.counters, .bag-btn { color: var(--muted); }
.counter b { color: var(--pen); }
.counter.low b { color: var(--red); }

/* theorems: sticky notes */
.th { background: var(--sticky-1); color: var(--card-ink); border: 0; border-radius: 2px; box-shadow: 0 4px 8px rgba(0,0,0,.2); }
.th.r2 { background: var(--sticky-2); }
.th.r3 { background: var(--sticky-3); box-shadow: 0 4px 8px rgba(0,0,0,.2); }
.theorems .th:nth-child(odd), .owned .th:nth-child(odd), .build .th:nth-child(odd) { transform: rotate(-2deg); }
.theorems .th:nth-child(even), .owned .th:nth-child(even), .build .th:nth-child(even) { transform: rotate(1.5deg); }
.th.empty { background: transparent; border: 2px dashed var(--line-soft); box-shadow: none; transform: none !important; }
.th.empty.first .glyph, .th.empty.first .nm { color: var(--muted); }
.th .glyph { color: #1e3d73; font-family: var(--hand); font-weight: 700; font-size: 1.5rem; }
.th .nm { color: #2c3858; font-weight: 700; font-size: .7rem; }
.th .val { color: #1d6b30; font-size: .7rem; font-weight: 900; }
.th.armed { box-shadow: 0 0 0 3px var(--pen), 0 4px 8px rgba(0,0,0,.2); animation: none; }

/* slate */
.slate { background: var(--surface); border: 2px solid var(--line-soft); border-radius: var(--rough); }
.slate-preview { color: var(--muted); }
.slate-preview .eq, .running { font-family: var(--hand); font-weight: 700; font-size: 2rem; color: var(--pen); }
.slate-preview .final { font-family: var(--hand); font-weight: 700; font-size: 2.2rem; color: var(--pen); background: var(--hl); padding: 0 6px; }
.slate-preview .expr { font-family: var(--hand); font-weight: 700; font-size: 1.45rem; color: var(--text-2); }
.slate-preview .expr .bv, .slate-preview .expr b { color: var(--good); }
.slate-preview .chip { background: var(--surface); border: 1.5px solid var(--line); color: var(--pen); }
.slate-preview .chip.flat { border-color: var(--good); color: var(--good); }
.slate-preview .chip.cost { border-color: var(--red); color: var(--red); background: var(--surface); }
.slate-preview .warn { color: var(--red); }
.coach { background: var(--surface); border: 2px dashed var(--line); border-radius: var(--rough); }
.coach p { color: var(--text); }
.coach .link { color: var(--muted); }
.btn-calc.coach-target { animation: coachPulse 1.4s ease-in-out infinite; }
@keyframes coachPulse { 50% { box-shadow: 0 3px 0 var(--primary-edge), 0 0 0 5px var(--hl-c); } }

/* tiles: white cards, pen- or chalk-drawn operators */
.tile { background: var(--card); color: var(--card-ink); border-radius: 6px; box-shadow: 0 0 0 1.5px var(--card-edge), 0 3px 0 var(--card-edge), 0 5px 10px rgba(0,0,0,.14); font-weight: 900; }
.tile.op { background: var(--surface); color: var(--pen); border: 2.5px solid var(--line); border-radius: var(--rough); box-shadow: none; font-family: var(--hand); font-weight: 700; font-size: calc(var(--tile) * .64); }
.tile.op.concat { color: var(--red); border-color: var(--red); }
.tile.fx-gold { background: #ffe45c; }
.tile.fx-prism { background: linear-gradient(135deg, #fde2ee, #e1effd 50%, #e7f9dd); }
.tile.fx-glass { background: #dff1fb; }
.tile .fxmark { color: #1e3d73; }
.tile.sel { background: transparent; color: transparent; box-shadow: none; border: 2px dashed var(--muted); opacity: .55; transform: none; }
.tile.sel > * { visibility: hidden; }
.tile.op.sel { color: transparent; border-color: var(--muted); }
.tile.dim { opacity: .38; }
.tile:not(.sel):not(.dim):active { transform: translateY(2px); box-shadow: 0 0 0 1.5px var(--card-edge), 0 1px 0 var(--card-edge); }
.tile.op:not(.sel):not(.dim):active { box-shadow: none; }
.tile.lit { box-shadow: 0 0 0 3px var(--hl-c), 0 0 0 4.5px var(--pen); }
.tile.boosted { box-shadow: 0 0 0 2.5px var(--good), 0 3px 0 var(--card-edge); }
.tile .boost { background: var(--good); color: var(--good-ink); }
.tile.swap-mark { box-shadow: 0 0 0 3px var(--swap), 0 8px 16px rgba(0,0,0,.25); }
#btn-swap.active { border-color: var(--swap); color: var(--swap); }
.tile.mini { box-shadow: 0 0 0 1px var(--card-edge), 0 2px 0 var(--card-edge); }
.tile.mini.op { box-shadow: none; border-width: 2px; }
.tile.hidden { background: repeating-linear-gradient(45deg, var(--line-soft) 0 3px, transparent 3px 9px); border: 2px solid var(--line); color: var(--pen); box-shadow: none; }
#hint-cost { gap: 2px; }
#hint-cost .ic { width: 1.25rem; height: 1.25rem; }

/* windows: a Seyès page (the paper stays light in dark mode, slightly dimmed) */
.modal { background: var(--backdrop); }
.modal-card {
  background: linear-gradient(90deg, transparent 38px, rgba(220,60,70,.6) 38px 40px, transparent 40px), repeating-linear-gradient(0deg, rgba(98,140,214,.3) 0 1px, transparent 1px 32px), repeating-linear-gradient(0deg, rgba(98,140,214,.15) 0 1px, transparent 1px 8px), var(--paper);
  color: var(--paper-ink); border: 0; border-radius: 4px; padding: 20px 16px 18px 52px; text-align: left; box-shadow: 0 20px 50px rgba(0,0,0,.35);
  --pen: var(--paper-ink); --text: var(--paper-text); --text-2: var(--paper-text); --muted: var(--paper-muted); --red: #c43a46; --line: #1e3d73; --line-soft: rgba(30,61,115,.28);
  --surface: #fff; --primary: #1e3d73; --primary-ink: #fff; --primary-edge: #10244a; --good: #23803a; --good-ink: #fff; --hl-c: rgba(255,228,92,.85); --card: #fff; --card-edge: rgba(30,61,115,.26);
}
.modal-card h2 { font-family: var(--hand); font-weight: 700; font-size: 2.2rem; color: var(--pen); background: var(--hl); display: inline; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.modal-card h2 + * { margin-top: 12px; }
.modal-card h3 { color: var(--red); }
.modal-card p, .checklist li, .rows div, .consent { color: var(--text); }
.modal-card .small, .pay-safe { color: var(--muted); }
.modal-icon { color: var(--pen); }
.modal-icon .ic { width: 2.6rem; height: 2.6rem; stroke-width: 1.6; }
.kicker-boss { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; color: var(--red) !important; }
.big-number, .price-tag { font-family: var(--hand); font-weight: 700; color: var(--pen); font-size: 3.1rem; }
.rows div { border-bottom: 1px solid rgba(98,140,214,.3); }
.rows div b, .rows div.tot b { color: var(--pen); }
.checklist { margin-left: 0; }
.checklist li::before { content: '✓'; color: var(--red); font-family: var(--hand); font-weight: 700; font-size: 1.3rem; top: 0; }
.consent input { accent-color: var(--pen); }
.consent.need input { outline-color: var(--red); }
.field-label { color: var(--text); }
.field-err { color: #b3261e; }
.modal-card.tone-boss { box-shadow: 0 0 0 4px var(--red), 0 20px 50px rgba(0,0,0,.35); }
.modal-card.tone-boss h2 { color: var(--red); }
.modal-card.tone-win h2 { color: var(--pen); }
.modal-card.tone-lost h2 { background: none; }
.modal-card.tone-pay { box-shadow: 0 0 0 4px var(--hl-c), 0 20px 50px rgba(0,0,0,.35); }
.modal-card .btns { align-items: stretch; }
.reward-opt { background: #fff; border: 1.5px solid rgba(30,61,115,.3); color: var(--text); }
.reward-opt .glyph { color: var(--pen); font-family: var(--hand); }
.reward-opt .ds { color: var(--muted); }
.reward-opt .full-note { color: var(--red); }
.coll-item { background: var(--sticky-1); color: var(--pen); border-radius: 2px; box-shadow: 0 2px 5px rgba(0,0,0,.14); }
.coll-item.r2 { background: var(--sticky-2); }
.coll-item.r3 { background: var(--sticky-3); }
.coll-item.locked { opacity: 1; background: transparent; border: 1.5px dashed rgba(30,61,115,.3); box-shadow: none; }
.coll-item.locked .nm, .coll-item.locked .ds { color: var(--muted); }
.coll-item .ds { color: var(--muted); }
.coll-item.unseen { background: #fff; box-shadow: 0 0 0 1.5px rgba(30,61,115,.2); }
.coll-item .ic { width: 1em; height: 1em; }
.howto h3 { color: var(--red); }
.howto-demo .eqn { color: var(--pen); }
.input { background: #fff; color: var(--pen); border-color: rgba(30,61,115,.35); font-size: 1rem; }
.seg { background: rgba(30,61,115,.1); }
.seg button { color: var(--muted); min-height: 44px; padding: 6px 16px; }
.seg button.on { background: var(--primary); color: var(--primary-ink); }
.settings-row { border-bottom-color: rgba(98,140,214,.3); color: var(--pen); }
.arch-row { background: #fff; color: var(--pen); border-color: rgba(30,61,115,.2); }
.arch-row small { color: var(--muted); }
.arch-row .go { color: var(--pen); }
.arch-row .ok { color: var(--good); }
.arch-row .ko, .arch-row .lock { color: var(--red); opacity: 1; }
.grid-emoji { text-align: left; }

/* shop, popover, toasts, fx */
.offer { background: var(--card); color: var(--card-ink); border: 0; border-radius: 4px; box-shadow: 0 0 0 1.5px var(--card-edge), 0 4px 10px rgba(0,0,0,.12); }
/* theorem offers are sticky notes, like the theorems you own */
.offer.r1, .offer.r2, .offer.r3 { border-radius: 2px; box-shadow: 0 4px 10px rgba(0,0,0,.18); }
.offer.r1 { background: var(--sticky-1); }
.offer.r2 { background: var(--sticky-2); }
.offer.r3 { background: var(--sticky-3); }
.offer .glyph { color: #1e3d73; font-family: var(--hand); font-weight: 700; }
.offer .nm { color: var(--card-ink); }
.offer .ds { color: #3b4866; }
.offer .rar { color: #56627f; }
.offer .full-tag { color: #c43a46; }
.offer .price { background: rgba(255,228,92,.7); color: #1f2a44; }
.offer.cant .price { color: #b3261e; }
.offer.sold::after { color: #23803a; border-color: #23803a; background: #fff; }
.service { border: 2px solid var(--line-soft); border-radius: var(--rough); background: var(--surface); color: var(--pen); }
.service .ds { color: var(--muted); }
.next-preview { background: var(--surface); border: 2px dashed var(--line-soft); border-radius: var(--rough); color: var(--text); }
.next-preview b { color: var(--pen); }
.next-preview .bossname { color: var(--red); }
.next-preview .ic { color: var(--red); }
.shop-tip { border-top-color: var(--line-soft); color: var(--text); }
.shop-h { font-family: var(--hand); font-size: 1.4rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--red); }
.popover { background: var(--sticky-1); color: #1f2a44; border: 0; border-radius: 2px; box-shadow: 0 8px 18px rgba(0,0,0,.28); }
.popover .nm { color: #1e3d73; }
.popover .rar { color: #56627f; }
.popover .btn-ghost { background: #fff; color: #1e3d73; border-color: #1e3d73; }
.popover .btn.armed { color: #c43a46; border-color: #c43a46; }
.toasts { top: auto; bottom: calc(92px + var(--safe-b)); }
.toasts.on-slate { bottom: auto; transform: translate(-50%, -100%); width: min(360px, 84vw); }
.toast { background: #fff; color: #1e3d73; border: 2px solid #1e3d73; border-radius: 4px; display: flex; gap: 8px; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(0,0,0,.18); animation: toastIn .25s cubic-bezier(.16,1,.3,1); }
.toast .ic { width: 1.3em; height: 1.3em; color: #c43a46; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.floater { font-family: var(--hand); font-weight: 700; color: var(--pen); font-size: 2.2rem; text-shadow: none; }
.floater.boost-float { color: var(--good); }
.spark { background: var(--gold) !important; border-radius: 50%; width: 6px; height: 6px; }
.offer.r1 .price, .offer.r2 .price, .offer.r3 .price { background: rgba(255,255,255,.75); }

/* polish pass */
.slate-preview .expr .face { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; margin-right: 1px; }
.slate-preview .ghost { display: block; width: 100%; color: var(--muted); font-size: .82rem; margin-bottom: 4px; }
.slate-preview .ghost b { color: var(--pen); }
.up-next { display: block; font-family: var(--hand); font-weight: 700; font-size: 1.25rem; color: var(--red); line-height: 1.1; }
.service:disabled { opacity: .5; }
.modal-card .btns.sticky { position: sticky; bottom: -18px; margin: 16px -16px -18px -52px; padding: 12px 16px calc(14px + var(--safe-b)) 52px; background: var(--paper); box-shadow: 0 -6px 12px -8px rgba(0,0,0,.25); }
.offer .full-tag { color: #9a4a00; }
.offer.cant .price { color: #46557a; background: rgba(255,255,255,.6); text-decoration: line-through; text-decoration-thickness: 1.5px; }
