/* Grimlings web — the app's dungeon look, translated. Palette from
 * Theme.swift; glass chrome approximated with backdrop-filter. */

:root {
  --dungeon-top: #29263d;
  --dungeon-bottom: #0f0f1c;
  --tile-hidden: #474563;
  --tile-hidden-lip: #5c5980;
  --tile-revealed: #212130;
  --ink: #f5f5f5;
  --ink-2: rgba(245, 245, 245, 0.62);
  --ink-3: rgba(245, 245, 245, 0.38);
  --heart: #fa5c73;
  --heart-empty: rgba(255, 255, 255, 0.16);
  --lantern: #ffd15c;
  --proof: #66ccff;
  --sprout: #6bd999;
  --m1: #70b8ff; --m2: #6bd999; --m3: #ffc75c; --m4: #ff995c; --m5: #ff7070; --m6: #f573d9;
  --rar-common: #b3b3b3; --rar-uncommon: #6bd999; --rar-rare: #70b8ff;
  --rar-epic: #b885fa; --rar-legendary: #ffd15c;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-line: rgba(255, 255, 255, 0.14);
  --game-font: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, system-ui, sans-serif;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/play/assets/nunito.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1E00-1EFF, U+2000-206F, U+20AC, U+2113, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------- shell */

#game-shell {
  background: linear-gradient(var(--dungeon-top), var(--dungeon-bottom));
  color: var(--ink);
  font-family: var(--game-font);
  border-radius: 24px;
  margin: 18px auto 40px;
  max-width: 720px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line, #2e2640);
}

#game-app { display: flex; flex-direction: column; min-height: min(88svh, 900px); }
#game-main { display: flex; flex-direction: column; flex: 1; padding: 6px 0 18px; }

@media (max-width: 760px) {
  #game-shell { margin: 0 0 32px; border-radius: 0; border-left: 0; border-right: 0; }
  #game-app { min-height: calc(100svh - 58px); }
}

.icn { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }

button { font-family: inherit; color: inherit; }
#game-shell button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#game-shell button:disabled { opacity: 0.35; cursor: default; }

/* -------------------------------------------------------------- header */

.game-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px 4px;
  position: relative;
}
.game-header .title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.hbtn {
  background: none;
  border: 0;
  color: var(--ink-2);
  font-size: 19px;
  padding: 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}
.hbtn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.hbtn b { font-size: 15px; }
.hbtn.lit { color: var(--lantern); }
.spacer { flex: 1; }

.menu-panel {
  position: absolute;
  top: 46px;
  z-index: 40;
  min-width: 240px;
  background: rgba(24, 22, 40, 0.92);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
#mode-menu { left: 10px; }
#more-menu { right: 10px; }
.menu-panel hr { border: 0; border-top: 1px solid var(--glass-line); margin: 6px 4px; }
.menu-label { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-3); padding: 8px 12px 4px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.menu-item:hover { background: rgba(255, 255, 255, 0.08); }
.menu-item .icn { color: var(--ink-2); }
.menu-item.locked { color: var(--ink-3); font-size: 13px; cursor: default; }
.icn-gap { width: 1em; display: inline-block; }

/* --------------------------------------------------------------- timer */

.timer-chip {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  color: var(--ink-2);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
}
.timer-chip.paused { color: var(--lantern); }

/* ----------------------------------------------------------------- HUD */

.hud {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 34px 10px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.hud .stat { flex: 1; }
.hud .stat.right { text-align: right; }
.hud .stat .v {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 900;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.hud .stat.right .v { justify-content: flex-end; }
.hud .stat .v .icn { font-size: 12px; color: var(--ink-2); }
.hud .stat .l {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--ink-3);
  white-space: nowrap;
}
.hud .stat.right .l { text-align: right; }

.hearts { display: flex; gap: 2.5px; }
.hearts .pip { font-size: 15px; line-height: 1; }
.hearts .pip.full { color: var(--heart); }
.hearts .pip.empty { color: var(--heart-empty); }
.hearts .pip.throb { animation: throb 1s ease-in-out infinite; }
@keyframes throb { 50% { transform: scale(1.26); } }

/* --------------------------------------------------------------- board */

.board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-height: 0;
}
.board {
  position: relative;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 26px;
  padding: 12px;
  width: min(100%, 74svh, 560px);
}
.board .grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 3px;
}
.board.shaking { animation: shake 0.42s linear; }
@keyframes shake {
  10% { transform: translateX(6.5px); }
  25% { transform: translateX(-5.5px); }
  40% { transform: translateX(4.5px); }
  55% { transform: translateX(-3.5px); }
  70% { transform: translateX(2.5px); }
  85% { transform: translateX(-1.5px); }
  100% { transform: translateX(0); }
}

.cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 18%;
  position: relative;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  container-type: size;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.cell.void { visibility: hidden; pointer-events: none; }
.cell.hidden-tile {
  background: linear-gradient(var(--tile-hidden-lip), var(--tile-hidden));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 1.5px 1.5px rgba(0, 0, 0, 0.35);
}
.cell.hidden-tile:active { filter: brightness(1.12); }
.cell.revealed {
  background: var(--tile-revealed);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: pop-in 0.18s ease-out;
}
@keyframes pop-in { from { transform: scale(0.72); opacity: 0.4; } }

.cell .num {
  font-size: 52cqw;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.num.m1 { color: var(--m1); } .num.m2 { color: var(--m2); } .num.m3 { color: var(--m3); }
.num.m4 { color: var(--m4); } .num.m5 { color: var(--m5); } .num.m6 { color: var(--m6); }

.cell .glyph { width: 84%; height: 84%; animation: pop-in 0.22s ease-out; }

.flags { display: flex; flex-direction: column; align-items: center; gap: 4cqw; animation: pop-in 0.18s ease-out; }
.flags .row { display: flex; gap: 10cqw; }
.flags.f1 .pennant, .flags.f2 .pennant { font-size: 24cqw; }
.flags.f2 { flex-direction: row; gap: 14cqw; }
.flags.f3 .pennant, .flags.f4 .pennant { font-size: 21cqw; }
.pennant { color: var(--lantern); line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4)); }

.cell.hl-clue, .cell.hl-proof, .cell.hl-support { z-index: 2; }
.cell.hl-clue { box-shadow: 0 0 0 2.5px var(--lantern), 0 0 12px rgba(255, 209, 92, 0.8); }
.cell.hl-proof { box-shadow: 0 0 0 2.5px var(--proof), 0 0 12px rgba(102, 204, 255, 0.8); }
.cell.hl-support { box-shadow: 0 0 0 1.5px rgba(102, 204, 255, 0.45), 0 0 8px rgba(102, 204, 255, 0.35); }

.danger-vignette {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  pointer-events: none;
  opacity: 0;
  border: 6px solid rgba(255, 40, 40, 0.65);
  filter: blur(3px);
}
.danger-vignette.on { animation: danger 1.57s ease-in-out infinite; }
@keyframes danger { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }

/* --------------------------------------------------------- bottom slot */

.bottom-slot {
  max-width: 560px;
  width: 100%;
  margin: 12px auto 0;
  padding: 0 16px;
  min-height: 74px;
}
.control-bar { display: flex; justify-content: center; gap: 12px; position: relative; }
.tool {
  min-width: 64px;
  min-height: 56px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 17px;
  border-radius: 18px;
}
.tool span { font-size: 11.5px; font-weight: 600; }
.tool.active { color: var(--lantern); box-shadow: inset 0 0 0 1.5px rgba(255, 209, 92, 0.6); }
.flag-dot {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lantern);
  right: calc(50% - 130px);
  top: 2px;
  opacity: 0;
}
.flag-dot.on { opacity: 1; }

.glass, .glass-panel {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
}
.glass { border-radius: 18px; color: var(--ink); }
.glass:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }

/* ---------------------------------------------------------- hint panel */

.hint-banner { border-radius: 22px; padding: 12px 16px; }
.hint-top { display: flex; align-items: flex-start; gap: 10px; }
.hint-message {
  flex: 1;
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.45;
  max-height: 130px;
  overflow-y: auto;
}
.close-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--ink-2);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hint-actions { display: flex; gap: 8px; }
.hint-action {
  flex: 1;
  border-radius: 16px;
  border: 1px solid var(--glass-line);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
}
.hint-action.plain { background: var(--glass); color: var(--ink); }
.hint-action.prominent { background: var(--heart); border-color: transparent; color: #fff; }
.hint-action.prominent:hover { filter: brightness(1.06); }
.hint-action .title { display: flex; align-items: center; gap: 5px; font-size: 14.5px; font-weight: 700; }
.hint-action .count { opacity: 0.65; font-variant-numeric: tabular-nums; }
.hint-action .note { font-size: 11px; font-weight: 500; opacity: 0.7; }

/* ------------------------------------------------------- covers, big cta */

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: var(--heart);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(250, 92, 115, 0.35);
}
.cta:hover { filter: brightness(1.06); }
.cta.secondary { background: var(--glass); border: 1px solid var(--glass-line); color: var(--ink); box-shadow: none; }
.cta.danger { background: var(--heart); }
.next-btn { display: flex; }
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  width: 100%;
}
.text-btn:hover { color: var(--ink); }

#pause-cover, #gen-cover {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background: var(--dungeon-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.pause-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pause-inner b { font-size: 19px; font-weight: 800; }
.pause-inner .cta { width: auto; padding: 0 22px; }
.gen-spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--heart);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- overlays */

#overlay-host { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px; }
#overlay-host .scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.32); }
#overlay-host .scrim.light { background: rgba(0, 0, 0, 0.28); }
#overlay-host .scrim.dark { background: rgba(0, 0, 0, 0.45); }
.glass-card {
  position: relative;
  background: rgba(30, 28, 48, 0.88);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--glass-line);
  border-radius: 32px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  padding: 54px 28px 28px;
  width: min(330px, 92%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  text-align: center;
  animation: card-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes card-in { from { transform: scale(0.92); opacity: 0; } }
.glass-card h2 { margin: 0; font-size: 25px; font-weight: 800; }
.glass-card h2.big { font-size: 32px; }
.card-close { position: absolute; top: 10px; right: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pill.lantern { color: var(--lantern); background: rgba(255, 209, 92, 0.16); }
.pill.heart { color: var(--heart); background: rgba(250, 92, 115, 0.14); }
.card-hearts { justify-content: center; padding: 2px 0; }
.keep-going { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.killer .glyph, .killer { width: 60px; height: 60px; }
.depth-line { font-size: 22px; font-weight: 900; }
.best-line { color: var(--lantern); font-weight: 700; font-size: 13px; display: flex; gap: 5px; align-items: center; }
.score-line { font-weight: 800; font-size: 17px; display: flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.flame-big { position: relative; font-size: 92px; color: var(--lantern); line-height: 1; filter: drop-shadow(0 0 14px rgba(255, 209, 92, 0.6)); }
.flame-big .icn { color: var(--lantern); }
.flame-big b {
  position: absolute;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  font-size: 30px;
  color: #fff;
}
.streak-line { color: var(--lantern); font-weight: 700; }
.unlock-banner {
  width: 100%;
  background: rgba(255, 209, 92, 0.16);
  border-radius: 18px;
  padding: 10px 14px;
}
.unlock-banner .head { color: var(--lantern); font-weight: 700; display: flex; justify-content: center; gap: 6px; align-items: center; }
.unlock-banner .sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.save-btn { width: auto; }

/* Explicit size: a canvas is a replaced element, so `inset: 0` alone leaves
 * width/height at the *intrinsic* size — its own width/height attributes — and
 * the confetti tick would then grow the canvas by dpr every frame, forever. */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 29; pointer-events: none; }
#fx-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.flying-heart { position: fixed; color: var(--heart); font-size: 24px; transform: translate(-50%, -50%); filter: drop-shadow(0 0 5px rgba(250, 92, 115, 0.7)); z-index: 61; }
.score-pop {
  position: fixed;
  color: var(--lantern);
  font-family: var(--game-font);
  font-weight: 900;
  font-size: 17px;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  transition: top 0.7s ease-out, opacity 0.7s ease-out;
  z-index: 61;
}
.score-pop.rise { top: calc(var(--y, 0px)); margin-top: -46px; opacity: 0; }

/* ---------------------------------------------------------------- toasts */

#toasts {
  position: absolute;
  top: 8px; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 45;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 16px;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.3s, transform 0.3s;
}
.toast.in { opacity: 1; transform: none; }
.toast .glyph-slot { width: 34px; height: 34px; }
.toast .txt { display: flex; flex-direction: column; text-align: left; }
.toast .over { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.toast .name { font-weight: 800; font-size: 15px; }
.toast .rar { font-size: 10px; font-weight: 900; letter-spacing: 0.4px; }
.streak-toast .flame-ic { font-size: 26px; color: var(--lantern); }
.streak-toast b { font-size: 15.5px; font-weight: 800; }
.rar-common { color: var(--rar-common); } .rar-uncommon { color: var(--rar-uncommon); }
.rar-rare { color: var(--rar-rare); } .rar-epic { color: var(--rar-epic); } .rar-legendary { color: var(--rar-legendary); }

/* ---------------------------------------------------------------- sheets */

#sheet-host, #modal-host { position: absolute; inset: 0; z-index: 50; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.sheet {
  position: absolute;
  inset: 4svh 0 0;
  background: linear-gradient(var(--dungeon-top), var(--dungeon-bottom));
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  border-top: 1px solid var(--glass-line);
}
@keyframes sheet-up { from { transform: translateY(6%); opacity: 0.6; } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.done-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: 0;
  color: var(--proof);
  font-weight: 700;
  font-size: 15px;
}
.sheet-body { overflow-y: auto; padding: 4px 20px 34px; display: flex; flex-direction: column; gap: 12px; }

.glass-panel { border-radius: 20px; padding: 14px 16px; }
.tier-label { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: var(--ink-3); margin-top: 8px; }

.besti-head b { font-weight: 800; }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--heart); border-radius: 3px; }
.besti-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 12px 14px;
}
.besti-row .slot { width: 52px; height: 52px; flex-shrink: 0; }
.besti-row .mystery {
  width: 52px; height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 19px;
  font-weight: 800;
}
.besti-row .txt { flex: 1; min-width: 0; }
.besti-row .nm { display: flex; align-items: baseline; gap: 8px; }
.besti-row .nm b { font-size: 15.5px; font-weight: 800; }
.besti-row .rar { font-size: 10px; font-weight: 900; letter-spacing: 0.5px; font-style: normal; }
.besti-row .blurb { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.besti-row .met { color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.besti-foot { text-align: center; font-size: 12px; color: var(--ink-3); padding-top: 4px; }

.seg { display: flex; background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1;
  border: 0;
  background: none;
  border-radius: 9px;
  padding: 7px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.seg button.on { background: rgba(255, 255, 255, 0.14); color: var(--ink); }

.stat-tiles { display: flex; }
.stat-tiles .tile { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-tiles .tile b { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-tiles .tile span { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.alltime { text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-2); }

.stats-table h3, .recent-runs h3 { margin: 0 0 10px; font-size: 15.5px; font-weight: 800; }
.stats-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats-table th { font-size: 11px; font-weight: 800; color: var(--ink-3); text-align: right; padding: 3px 0; }
.stats-table th.l, .stats-table td.l { text-align: left; }
.stats-table td { text-align: right; padding: 4px 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.stats-table td.l { font-weight: 800; color: var(--ink); }
.stats-table td.hl { color: var(--lantern); font-weight: 700; }
.run-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.run-row .ic.ok { color: var(--sprout); }
.run-row .ic.died { color: var(--heart); }
.run-row .txt { flex: 1; display: flex; flex-direction: column; }
.run-row .txt b { font-size: 14px; font-weight: 700; }
.run-row .txt i { font-size: 11px; color: var(--ink-3); font-style: normal; }
.run-row .sc { color: var(--lantern); font-weight: 700; font-size: 13.5px; }
.run-row .tm { color: var(--ink-2); font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-2); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty-state .icn { font-size: 34px; color: var(--lantern); }
.empty-state b { color: var(--ink); font-size: 16px; }
.empty-state p { margin: 0; font-size: 14px; }

.flame-hero { position: relative; text-align: center; font-size: 62px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.flame-hero .icn { color: var(--lantern); filter: drop-shadow(0 0 12px rgba(255, 209, 92, 0.5)); }
.flame-hero b { font-size: 58px; font-weight: 900; }
.flame-sub { text-align: center; color: var(--ink-2); font-weight: 600; margin-top: -6px; }
.stat-tiles.two .tile { padding: 8px 0; }
.hint-note { text-align: center; font-size: 11.5px; color: var(--ink-3); }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { font-weight: 800; }
.cal-head button { background: none; border: 0; color: var(--ink-2); font-size: 15px; padding: 6px; }
.cal-head button:disabled { opacity: 0.3; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-grid .dow { text-align: center; font-size: 10px; font-weight: 800; color: var(--ink-3); }
.cal-grid .day, .cal-grid .blank { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.cal-grid .day i { font-style: normal; font-size: 14px; font-weight: 600; z-index: 1; }
.cal-grid .day.future i { opacity: 0.35; }
.cal-grid .day.done { background: linear-gradient(var(--lantern), var(--heart)); border-radius: 50%; }
.cal-grid .day.done i { color: #fff; font-weight: 900; }
.cal-grid .day.froze { background: rgba(102, 178, 255, 0.28); border-radius: 50%; color: #2673d9; }
.cal-grid .day.today::after { content: ""; position: absolute; inset: 0; border: 2px solid rgba(245, 245, 245, 0.8); border-radius: 50%; }
.cal-grid .ring { position: absolute; inset: 6%; transform: rotate(-90deg); }
.cal-grid .ring .track { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 3; }
.cal-grid .ring .fill { fill: none; stroke: var(--heart); stroke-width: 3; stroke-linecap: round; }
.cal-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink-2); align-items: center; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .sw.done { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(var(--lantern), var(--heart)); display: inline-block; }
.cal-legend .icn { color: #4a90e2; }

.mile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; }
.mile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2);
}
.mile.on { background: rgba(255, 209, 92, 0.14); color: var(--lantern); }
.mile b { font-size: 14.5px; font-weight: 900; color: var(--ink); }
.mile:not(.on) b { color: var(--ink-2); }

.set-group { display: flex; flex-direction: column; padding: 4px 0; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  background: none;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}
.set-row + .set-row { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.set-row:hover { background: rgba(255, 255, 255, 0.05); }
.set-foot { font-size: 11.5px; color: var(--ink-3); padding: 0 16px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.switch {
  width: 46px; height: 28px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch.on { background: var(--sprout); }
.switch i { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left 0.2s; }
.switch.on i { left: 20px; }
.set-version { text-align: center; color: var(--ink-3); font-size: 12px; }

/* --------------------------------------------------------------- how-to */

.ht-row { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0 14px; }
.ht-row p { margin: 0; text-align: center; font-size: 13px; color: var(--ink-2); line-height: 1.5; max-width: 340px; }
.ht-diagram { display: flex; align-items: center; gap: 12px; }
.ht-diagram.col { flex-direction: column; align-items: flex-start; gap: 8px; }
.ht-line { display: flex; align-items: center; gap: 10px; }
.ht-tile {
  width: 44px; height: 44px;
  border-radius: 9px;
  background: var(--tile-revealed);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
.ht-tile.hidden { background: linear-gradient(var(--tile-hidden-lip), var(--tile-hidden)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.ht-tile .glyph { width: 84%; height: 84%; }
.ht-tile .num { font-size: 23px; font-weight: 900; }
.ht-arrow, .ht-eq { color: var(--ink-3); font-size: 15px; font-weight: 800; }
.ht-mini { display: grid; grid-template-columns: repeat(3, 30px); gap: 3px; }
.ht-tile.sm { width: 30px; height: 30px; border-radius: 7px; }
.ht-tile.sm .num { font-size: 16px; }
.ht-descend { color: var(--sprout); font-size: 21px; }
.ht-hearts { display: flex; gap: 4px; font-size: 19px; }
.ht-hearts .pip.full { color: var(--heart); }
.ht-hearts .pip.empty { color: var(--heart-empty); }
.text-btn.center { width: auto; margin: 0 auto; }

/* -------------------------------------------------------------- tutorial */

#tutorial { display: flex; flex-direction: column; flex: 1; padding: 18px 24px 30px; }
.tut-top { display: flex; align-items: center; justify-content: space-between; min-height: 34px; }
.tut-top .text-btn { width: auto; }
.dots { display: flex; gap: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(245, 245, 245, 0.22); transition: width 0.25s; }
.dots i.on { width: 20px; background: var(--heart); }
.tut-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 430px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}
.tut-content h1 { margin: 0; font-size: 34px; font-weight: 900; }
.tut-content h2 { margin: 0; font-size: 21px; font-weight: 800; }
.tut-tag { color: var(--lantern); font-weight: 700; font-size: 14px; margin-top: -12px; }
.tut-coach { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.4; }
.tut-coach.good { color: var(--sprout); }
.tut-cast { display: flex; gap: 14px; align-items: flex-end; }
.tut-glyph { display: inline-block; animation: breathe 1.8s ease-in-out infinite alternate; }
@keyframes breathe { from { transform: scale(0.97); } to { transform: scale(1.06); } }
.fang-creature {
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  color: var(--ink);
}
.fang-creature b { font-size: 14.5px; font-weight: 700; }
.fangs-row { display: flex; gap: 5px; min-height: 16px; }
.fang-tri {
  width: 12px; height: 14px;
  background: var(--heart);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  animation: pop-in 0.35s ease-out;
}
.tap-hint { position: absolute; bottom: 42px; color: var(--lantern); font-size: 16px; animation: throb 1.2s ease-in-out infinite; }
.tut-sum { display: flex; align-items: center; gap: 8px; }
.tut-sum .op { font-size: 21px; font-weight: 900; color: var(--ink-2); }
.tut-tile {
  width: 62px; height: 62px;
  border-radius: 13px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tile-revealed);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 0;
}
.tut-tile.hidden { background: linear-gradient(var(--tile-hidden-lip), var(--tile-hidden)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 1.5px 1.5px rgba(0, 0, 0, 0.35); }
.tut-tile .num { font-size: 30px; font-weight: 900; }
.tut-tile.good { box-shadow: inset 0 0 0 3px var(--sprout); transform: scale(1.06); }
.tut-tile.hl-proof { box-shadow: 0 0 0 2.5px var(--proof), 0 0 12px rgba(102, 204, 255, 0.8); }
.tut-tile.pulse { animation: pulse-t 0.75s ease-in-out infinite alternate; }
@keyframes pulse-t { to { transform: scale(1.08); } }
.tut-caption { font-size: 15px; font-weight: 600; color: var(--ink-2); min-height: 22px; }
.tut-caption.good { color: var(--sprout); }
.tut-board { display: grid; grid-template-columns: repeat(3, 62px); gap: 4px; padding: 12px; background: rgba(0, 0, 0, 0.25); border-radius: 22px; }
.tut-board .tut-tile .glyph { width: 44px; height: 44px; }
.shake-once { animation: shake 0.4s linear; }
.bite-demo { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--ink); }
.demo-hearts { display: flex; gap: 8px; font-size: 26px; }
.demo-hearts .pip.full { color: var(--heart); }
.demo-hearts .pip.empty { color: var(--heart-empty); }
.bite-demo i { font-style: normal; font-size: 15px; font-weight: 600; color: var(--ink-2); }
#tutorial .cta { max-width: 340px; min-height: 50px; }
#tutorial .text-btn { width: auto; }

/* ------------------------------------------------------------ mini cards */

.mini-card {
  position: fixed; /* centre on the viewport — the shell can be taller */
  left: 50vw; top: 50vh;
  transform: translate(-50%, -50%);
  width: min(340px, 92vw);
  padding: 26px 24px 18px;
  z-index: 55;
}
.mini-card .bulb { font-size: 38px; color: var(--lantern); }
.mini-card h3 { margin: 0; font-size: 19px; font-weight: 800; }
.mini-card p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.mini-card .app-plug { font-weight: 600; color: var(--ink); }
.mini-card .store-badge img { height: 46px; }

/* --------------------------------------------------------------- iOS gate */

#ios-gate { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 28px 70px; text-align: center; }
#ios-gate img.app-icon { width: 108px; height: 108px; border-radius: 24px; box-shadow: 0 0 48px rgba(69, 224, 176, 0.35); }
#ios-gate h1 { margin: 0; font-family: var(--game-font); font-size: 26px; font-weight: 900; color: var(--ink); }
#ios-gate p { margin: 0; max-width: 400px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
#ios-gate .store-badge img { height: 54px; }

/* --------------------------------------------------------------- helpers */

[hidden] { display: none !important; }
