/* Chess Daily on the web: the app's controls on the warm cream of chessdaily.app.
   White cards on cream (warm charcoal in dark mode). */
:root {
  --bg: #F7F1E8;
  --card: #FFFFFF;
  --card-2: #EDE4D8;
  --ink: #1F1D1A;
  --muted: #6F6A62;
  --faint: #D3C8BA;
  --brand: #2A93BF;
  --brand-soft: rgba(42, 147, 191, 0.14);
  --logo: #17789E;
  --green: #34C759;
  --green-soft: rgba(52, 199, 89, 0.16);
  --orange: #FF9500;
  --orange-soft: rgba(255, 149, 0, 0.16);
  --red: #FF3B30;
  --red-soft: rgba(255, 59, 48, 0.14);
  --teal: #20A4B5;
  --teal-soft: rgba(32, 164, 181, 0.13);
  --sq-light: #F3E7D9;
  --sq-dark: #C98463;
  --sq-last: rgba(237, 194, 102, 0.55);
  --sq-selected: rgba(61, 128, 143, 0.45);
  --sq-hint: #2B6B85;
  --dot: rgba(0, 0, 0, 0.16);
  --shadow: 0 10px 30px rgba(120, 60, 30, 0.14);
  --lift: 0 1px 2px rgba(120, 60, 30, 0.06), 0 4px 14px rgba(120, 60, 30, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --logo-font: "Hoefler Text", "Libre Baskerville", Baskerville, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171615; --card: #22201E; --card-2: #302C29; --ink: #F3EEE6; --muted: #A39D94; --faint: #4A4642; --lift: none;
    --brand: #4FB0D6; --brand-soft: rgba(79, 176, 214, 0.18); --logo: #4FB0D6;
    --green: #30D158; --green-soft: rgba(48, 209, 88, 0.18); --orange: #FF9F0A; --orange-soft: rgba(255, 159, 10, 0.18);
    --red: #FF453A; --red-soft: rgba(255, 69, 58, 0.18); --teal: #4CC4D3; --teal-soft: rgba(76, 196, 211, 0.16);
    --dot: rgba(0, 0, 0, 0.22); --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171615; --card: #22201E; --card-2: #302C29; --ink: #F3EEE6; --muted: #A39D94; --faint: #4A4642; --lift: none;
  --brand: #4FB0D6; --brand-soft: rgba(79, 176, 214, 0.18); --logo: #4FB0D6;
  --green: #30D158; --green-soft: rgba(48, 209, 88, 0.18); --orange: #FF9F0A; --orange-soft: rgba(255, 159, 10, 0.18);
  --red: #FF453A; --red-soft: rgba(255, 69, 58, 0.18); --teal: #4CC4D3; --teal-soft: rgba(76, 196, 211, 0.16);
  --dot: rgba(0, 0, 0, 0.22); --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--font);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ----------
   Phone: one column sized so the board and its buttons fit in the browser window without scrolling.
   Wide screens: the board on the left at full height, everything else in a panel beside it. */
.app {
  --board: min(100%, max(260px, calc(100svh - 318px)));
  max-width: 480px; margin: 0 auto; padding-block: max(10px, env(safe-area-inset-top, 0px)) 28px;
  display: flex; flex-direction: column; gap: 10px;
}
.app > .board-wrap { width: var(--board); margin-inline: auto; }
.app.results { max-width: 560px; gap: 16px; }
@media (min-width: 600px) and (max-aspect-ratio: 1/1) { .app { max-width: 600px; } }

/* Side-by-side layouts: short landscape screens (a phone on its side), and anything wide enough
   for the board to sit in the middle. Medium screens with room above and below keep the single column. */
@media (min-width: 760px) and (min-aspect-ratio: 1/1) and (max-height: 699px), (min-width: 1150px) and (min-aspect-ratio: 1/1) {
  .app {
    --panel: clamp(330px, 28vw, 380px);
    --board: min(calc(100svh - 132px), calc(100vw - var(--panel) - 104px), 800px);
  }
  .app.play {
    max-width: none; min-height: calc(100svh - 1px); padding-block: 18px 28px;
    display: grid; justify-content: center; align-content: start; column-gap: 40px; row-gap: 12px;
    grid-template-columns: var(--panel) var(--board);
    grid-template-rows: auto auto auto auto auto auto 1fr auto;
    grid-template-areas: "top top" "strip board" "status board" "steps board" "hints board" "promo board" ". board" "foot board";
  }
  .app.play > .top { grid-area: top; margin-bottom: 10px; }
  .app.play > .strip { grid-area: strip; }
  .app.play > .status { grid-area: status; }
  .app.play > .board-wrap { grid-area: board; align-self: start; position: sticky; top: 18px; width: var(--board); margin: 0; }
  .app.play > .step-row { grid-area: steps; margin-top: 0; height: 44px; }
  .app.play > .bottom-row { grid-area: hints; justify-content: flex-start; }
  .app.play > .promo-small { grid-area: promo; margin-top: 6px; }
  .app.play > footer { grid-area: foot; text-align: left; }
  .app.play > .notice { grid-column: 1 / -1; }
  .app.play .status { height: auto; min-height: 92px; padding: 14px 16px; background: var(--card); border-radius: 18px; box-shadow: var(--lift); }
  .app.play .strip { grid-template-columns: 1fr auto; grid-template-areas: "rating spark" "progress progress"; row-gap: 14px; padding: 16px; }
  .app.play .strip .spark { display: block; }
  .app.play .strip .rating .value { font-size: 34px; }
  .app.play .strip .rating .value-row { flex-direction: column; gap: 0; }
  .app.play .strip .today-word { display: inline; }
  .app.play .strip .progress { align-items: center; flex-direction: row; justify-content: space-between; border-top: 1px solid var(--card-2); padding-top: 12px; }
  .app.play .strip .tile.sm { width: 30px; height: 30px; }
  .app.play .strip .tiles { gap: 5px; }
}
/* Wide screens: the board in the middle of the screen, your rating and tiles on the left,
   what to do and the controls on the right. */
@media (min-width: 1150px) and (min-aspect-ratio: 1/1) {
  .app {
    --panel: clamp(270px, 21vw, 330px);
    --board: min(calc(100svh - 132px), calc(100vw - 2 * var(--panel) - 2 * 36px - 48px), 820px);
  }
  .app.play {
    column-gap: 36px;
    grid-template-columns: var(--panel) var(--board) var(--panel);
    grid-template-rows: auto auto auto auto 1fr auto;
    align-items: start;
    grid-template-areas: "top top top" "strip board status" "strip board steps" "promo board hints" ". board ." "foot board .";
  }
  .app.play > .promo-small { margin-top: 0; }
  .app.play .strip { grid-template-columns: 1fr auto; }
  .app.play .strip .progress { flex-direction: column; align-items: flex-start; gap: 10px; }
  .app.play .strip .set-btn { margin-left: -8px; }
  .app.play .strip .tile.sm { width: 34px; height: 34px; }
  .app.play .strip .tiles { gap: 6px; }
  .app.play .step-row { background: var(--card); border-radius: 14px; box-shadow: var(--lift); padding: 0 4px; height: 52px; }
  .app.play .bottom-row { flex-wrap: wrap; justify-content: stretch; gap: 8px; }
  .app.play .bottom-row .btn:not(.big) { flex: 1 1 auto; }
  .app.play .bottom-row .btn.big { width: 100%; }
  .app.play .step-row .btn { font-size: 15px; padding: 8px 14px; }
}
@media (min-width: 960px) {
  .app.results { max-width: max(900px, calc(var(--panel, 380px) + 40px + var(--board, 600px))); display: grid; grid-template-columns: 1.15fr 1fr; grid-template-areas: "top top" "res side" "foot foot" "test test"; column-gap: 28px; align-items: start; padding-top: 28px; }
  .app.results > .top { grid-area: top; }
  .app.results > .results { display: contents; }
  .app.results .res-card { grid-area: res; }
  .app.results .res-side { grid-area: side; }
  .app.results > footer { grid-area: foot; }
  .app.results > .testbar { grid-area: test; }
}

/* ---------- Header bar: the app icon and name (a link back to today's page), then Days, Stats, Settings ---------- */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); border-radius: 12px; padding: 2px 6px 2px 0; }
.brand-icon { width: 36px; height: 36px; border-radius: 9px; display: block; box-shadow: 0 2px 6px rgba(120, 60, 30, 0.18); }
.brand-name { font-family: var(--logo-font); font-weight: 900; font-size: 23px; letter-spacing: -0.01em; line-height: 1; white-space: nowrap; }
.nav-btn { height: 42px; min-width: 42px; border: 0; background: none; color: var(--brand); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 9px; cursor: pointer; font-weight: 600; font-size: 15px; }
.nav-btn svg { width: 23px; height: 23px; flex: none; }
.nav-btn span { display: none; }
@media (hover: hover) { .nav-btn:hover, .brand:hover { background: var(--brand-soft); } .brand:hover { background: none; opacity: 0.8; } }
@media (min-width: 760px) { .nav-btn span { display: inline; } .nav-btn { padding: 0 12px; } .brand-icon { width: 40px; height: 40px; border-radius: 10px; } .brand-name { font-size: 26px; } }

.logo-bishop { display: inline-block; width: 0.458em; height: 0.631em; margin: 0 0.0086em; vertical-align: baseline; overflow: visible; }
.logo-bishop .body { fill: var(--logo); stroke: var(--logo); stroke-width: 1.5; stroke-linejoin: round; }
.logo-bishop .detail { fill: none; stroke: var(--bg); stroke-width: 1.5; stroke-linecap: round; }
.logo-bishop .slit { stroke-width: 1.9; }
.icons { display: flex; gap: 2px; margin-right: -8px; }
.icon-btn { width: 42px; height: 42px; border: 0; background: none; color: var(--brand); border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 24px; height: 24px; }
@media (hover: hover) { .icon-btn:hover { background: var(--brand-soft); } }

/* ---------- Strip: rating, today's set and tiles ---------- */
.strip { box-shadow: var(--lift); background: var(--card); border-radius: 18px; padding: 8px 12px 8px 16px; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "rating progress"; align-items: center; column-gap: 12px; }
.strip .rating { grid-area: rating; display: flex; flex-direction: column; min-width: 0; }
.strip .label, .res-rating .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.strip .today-word { display: none; }
.strip .value-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.strip .value, .res-rating .value { font-size: 28px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.change { font-size: 14px; font-weight: 600; white-space: nowrap; letter-spacing: 0; }
.change.up { color: var(--green); } .change.down { color: var(--red); } .change.flat { color: var(--muted); font-weight: 500; }
.strip .spark { grid-area: spark; display: none; }
.strip .progress { grid-area: progress; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.set-btn { border: 0; background: none; padding: 2px 4px 2px 8px; margin-right: -4px; border-radius: 99px; color: var(--brand); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; white-space: nowrap; }
.set-btn .chev svg { width: 14px; height: 14px; display: block; }
.set-btn.static { color: var(--muted); cursor: default; }
@media (hover: hover) { button.set-btn:hover { background: var(--brand-soft); } }

.spark { position: relative; width: 150px; height: 52px; }
.spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.spark i { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--brand); }

/* Hard Challenge banner (same slot as the strip) */
.strip.challenge { grid-template-columns: auto 1fr auto; grid-template-areas: none; color: #fff; background: linear-gradient(100deg, #FF9F0A, #F0533A); box-shadow: 0 8px 24px rgba(240, 83, 58, 0.22); padding: 14px 16px; }
.strip.challenge .star svg { width: 28px; height: 28px; display: block; }
.ch-text .t { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ch-text .s { font-size: 14px; opacity: 0.95; }
.ch-rating { text-align: right; }
.ch-rating b { display: block; font-size: 28px; line-height: 1; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.ch-rating span { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }

/* Tiles */
.tiles { display: flex; gap: 6px; }
.tile { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 16px;
  background: var(--card-2); color: var(--muted); border: 0; padding: 0; font-variant-numeric: tabular-nums; }
.tile.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
.strip .tile:not(.green):not(.orange):not(.red):not(.current) { background: var(--bg); }
.tile.current { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.tile.green { background: var(--green); color: #fff; } .tile.orange { background: var(--orange); color: #fff; } .tile.red { background: var(--red); color: #fff; }
.tile svg { width: 56%; height: 56%; }
button.tile { cursor: pointer; }
.tile.star { background: linear-gradient(135deg, #FF9F0A, #F0533A); color: #fff; border-radius: 50%; }
.tile.star.missed { background: var(--card-2); color: var(--muted); }

/* ---------- Status ---------- */
.status { height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3px; }
.status .title { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; line-height: 1.2; }
.status .title img { width: 26px; height: 26px; }
.status .detail { font-size: 14px; color: var(--muted); }
.status.explaining { gap: 1px; }
.status.explaining .move { font-size: 15px; }
.status.explaining .why { font-size: 13px; line-height: 1.25; }
.status .move { font-size: 16px; font-weight: 600; }
.status .why { font-size: 14px; color: var(--muted); max-width: 44ch; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.title.green { color: var(--green); } .title.red { color: var(--red); } .title.muted { color: var(--muted); }
.title .tries { color: var(--red); } .title .sep { color: var(--ink); }
.out-of-tries { transform: scale(1.15); }
.bigpop { animation: bigpop 0.45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bigpop { from { transform: scale(0.8); } to { transform: scale(1.15); } }
:root[data-theme="dark"] .status .title img { filter: drop-shadow(0 0 1.5px rgba(255,255,255,.7)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status .title img { filter: drop-shadow(0 0 1.5px rgba(255,255,255,.7)); } }
.pill { display: inline-block; border-radius: 99px; padding: 2px 14px; font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.pill.up { background: var(--green-soft); color: var(--green); } .pill.down { background: var(--red-soft); color: var(--red); } .pill.flat { background: var(--card-2); color: var(--muted); }
.theme-tag { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--teal-soft); color: var(--teal);
  border-radius: 99px; padding: 4px 12px; font-size: 14px; font-weight: 600; cursor: pointer; max-width: 100%; }
.theme-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-tag svg { width: 15px; height: 15px; flex: none; }
.pop-in { animation: pop 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.pop-late { animation: pop 0.35s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Board ---------- */
.board-wrap { position: relative; border-radius: 10px; aspect-ratio: 1; box-shadow: 0 10px 30px rgba(120, 60, 30, 0.16); }
.board-wrap.glow-gold { box-shadow: 0 0 30px 6px rgba(240, 196, 80, 0.7); }
.board-wrap.glow-anim { animation: glow 1.6s ease-in-out 2; }
.board-wrap.glow-orange { box-shadow: 0 0 26px 3px rgba(255, 140, 40, 0.42); }
.board-wrap.loading .board { opacity: 0.6; }
@keyframes glow { 50% { box-shadow: 0 0 46px 12px rgba(240, 196, 80, 0.95); } }
.board { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); container-type: inline-size; }
.board:focus-visible { outline-offset: 3px; }
.sq { position: relative; }
.sq.l { background: var(--sq-light); } .sq.d { background: var(--sq-dark); }
.sq.last::after, .sq.sel::after { content: ""; position: absolute; inset: 0; }
.sq.last::after { background: var(--sq-last); } .sq.sel::after { background: var(--sq-selected); }
.sq.cursor { box-shadow: inset 0 0 0 3px var(--brand); z-index: 4; }
.sq .coord { position: absolute; font-size: max(9px, 2.6cqi); font-weight: 700; z-index: 1; pointer-events: none; line-height: 1; }
.sq .rank { top: 4%; left: 5%; } .sq .file { bottom: 4%; right: 6%; }
.sq.l .coord { color: var(--sq-dark); } .sq.d .coord { color: var(--sq-light); }
.sq .target { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; pointer-events: none; }
.sq .target::before { content: ""; width: 30%; height: 30%; border-radius: 50%; background: var(--dot); }
.sq .target.cap::before { width: 90%; height: 90%; background: none; border: max(4px, 0.9cqi) solid var(--dot); box-sizing: border-box; }
.sq .hint { position: absolute; inset: 6%; border-radius: 50%; border: max(3px, 0.6cqi) solid var(--sq-hint); z-index: 3; pointer-events: none; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.9); opacity: 0.7; } }
.pieces { position: absolute; inset: 0; pointer-events: none; }
.piece { position: absolute; width: 12.5%; height: 12.5%; z-index: 2; will-change: transform; }
.piece img { width: 100%; height: 100%; display: block; pointer-events: none; }
.piece.dragging { z-index: 10; transition: none !important; }
.piece.dragging img { transform: scale(1.18); filter: drop-shadow(0 6px 8px rgba(0,0,0,0.3)); }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (hover: hover) { .board { cursor: pointer; } }

/* ---------- Buttons ---------- */
.step-row { display: flex; align-items: center; justify-content: space-between; height: 40px; margin-top: -6px; }
.step { width: 48px; height: 44px; border: 0; background: none; display: grid; place-items: center; color: var(--ink); opacity: 0.7; cursor: pointer; border-radius: 12px; }
.step:disabled { opacity: 0.2; cursor: default; }
.step svg { width: 22px; height: 22px; }
@media (hover: hover) { .step:not(:disabled):hover { background: var(--card); opacity: 1; } }
.btn { white-space: nowrap; border: 0; border-radius: 99px; padding: 9px 18px; font-weight: 600; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: filter 0.15s, transform 0.1s; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(0.95); } }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.soft-red { background: var(--red-soft); color: var(--red); }
.btn.soft-teal { background: var(--teal-soft); color: var(--teal); }
.btn.big { background: var(--brand); color: #fff; padding: 13px 32px; font-size: 18px; font-weight: 600; }
.btn.white { background: #fff; color: #E8641E; }
.btn.wide { width: 100%; max-width: 320px; padding-block: 13px; font-size: 17px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.bottom-row { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; }
.help { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 50%; }
.help svg { width: 24px; height: 24px; }
@media (max-width: 400px) { .bottom-row { gap: 6px; } .bottom-row .btn { padding: 9px 12px; font-size: 15px; } }

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: 16px; }
.res-card { box-shadow: var(--lift); background: var(--card); border-radius: 22px; padding: 22px 18px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.res-card h2 { font-size: 28px; margin: -4px 0 0; text-wrap: balance; }
.res-card .streak { color: var(--orange); font-weight: 600; margin-top: -6px; }
.result-tiles { display: flex; gap: 10px; margin-top: 4px; }
.result-row { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.result-row .tile { width: 44px; height: 44px; border-radius: 12px; }
.result-row .chg { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chg.up { color: var(--green); } .chg.down { color: var(--red); } .chg.flat { color: var(--muted); }
.tap-note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.res-rating { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border-radius: 16px; padding: 12px 16px; text-align: left; }
.res-rating .value { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.res-rating .spark { width: 40%; max-width: 160px; }
.actions { justify-content: center; flex-wrap: wrap; }
.res-side { display: flex; flex-direction: column; gap: 16px; }
.cta-challenge { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 22px; color: #fff; background: linear-gradient(100deg, #FF9F0A, #F0533A); box-shadow: 0 10px 28px rgba(240, 83, 58, 0.25); }
.cta-challenge .star svg { width: 30px; height: 30px; display: block; }
.cta-challenge div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cta-challenge b { font-size: 18px; } .cta-challenge span { font-size: 14px; opacity: 0.95; }
.tomorrow { display: flex; flex-direction: column; align-items: center; padding: 16px; border-radius: 22px; border: 1.5px dashed var(--card-2); }
.tomorrow b { font-size: 26px; font-variant-numeric: tabular-nums; }
.tomorrow span { font-size: 14px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.notice { background: var(--card); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 4px; text-align: center; color: var(--muted); }
.notice b { color: var(--ink); }

/* App promo */
.promo { box-shadow: var(--lift); background: var(--card); border-radius: 22px; padding: 16px; display: flex; align-items: center; gap: 14px; text-align: left; flex-wrap: wrap; }
.promo img.icon { width: 52px; height: 52px; border-radius: 12px; flex: none; }
.promo .txt { min-width: 0; flex: 1 1 150px; }
.promo b { display: block; font-size: 16px; }
.promo span { font-size: 14px; color: var(--muted); }
.promo .store { flex: none; line-height: 0; }
.promo .store img { height: 40px; width: auto; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding-top: 6px; line-height: 1.6; }
footer a { color: var(--muted); }
footer .credit { font-size: 12px; opacity: 0.85; }

/* ---------- Sheets (review, stats, calendar, settings, welcome) ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.38); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--bg); width: 100%; max-width: 540px; max-height: 94svh; overflow-y: auto; overscroll-behavior: contain; border-radius: 22px 22px 0 0;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: up 0.28s cubic-bezier(.2, .9, .3, 1); }
@media (min-width: 640px) { .sheet-back { align-items: center; } .sheet { border-radius: 22px; max-height: 92svh; padding-inline: 24px; box-shadow: var(--shadow); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet:focus { outline: none; }
.sheet-head { position: sticky; top: 0; background: var(--bg); z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 0 10px; }
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-head .done { justify-self: end; border: 1px solid var(--card-2); background: var(--bg); color: var(--brand); font-weight: 600; border-radius: 99px; padding: 6px 16px; cursor: pointer; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet .board-wrap { width: min(100%, max(240px, calc(92svh - 400px))); margin: 0 auto; }

.picker { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: var(--muted); font-size: 12px; padding: 0; }
.chip .c { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--card); }
.chip.on .c { background: var(--brand-soft); box-shadow: inset 0 0 0 2.5px var(--brand); }
.chip.on { color: var(--brand); font-weight: 700; }
.chip .tile { width: 26px; height: 26px; border-radius: 7px; }
.review-meta { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; }
.explain { min-height: 70px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.explain .m { font-weight: 600; font-size: 17px; }
.explain .m.opp { color: var(--muted); }
.explain .w { color: var(--muted); font-size: 15px; }
.step-label { font-size: 15px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.center { display: flex; justify-content: center; }

.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-top: 26px; }
.welcome .wicon { width: 76px; height: 76px; border-radius: 18px; box-shadow: 0 8px 20px rgba(120, 60, 30, 0.18); }
.welcome h2 { margin: 4px 0 0; font-size: 26px; text-wrap: balance; }
.welcome .lead { margin: 0; color: var(--muted); max-width: 36ch; }
.points { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 12px; text-align: left; width: 100%; max-width: 380px; }
.points li { display: flex; gap: 12px; align-items: flex-start; }
.points .wi { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.points .wi svg { width: 20px; height: 20px; }
.points b { display: block; } .points span { font-size: 14px; color: var(--muted); }
.welcome .ask { margin: 8px 0 2px; font-weight: 600; }
.welcome .btn.big { width: 100%; max-width: 320px; }

.popover { position: fixed; z-index: 60; background: var(--bg); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; max-width: 320px; font-size: 15px; animation: fade 0.15s; border: 1px solid var(--card-2); }
.popover h4 { margin: 0 0 4px; font-size: 16px; color: var(--teal); }
.popover p { margin: 0 0 8px; } .popover p:last-child { margin: 0; }
.popover table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.popover td { padding: 3px 0; } .popover td:last-child { text-align: right; font-weight: 600; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 6px; font-size: 16px; font-weight: 500; cursor: pointer; color: var(--ink); text-align: left; border-radius: 10px; }
.menu-item + .menu-item { border-top: 1px solid var(--card-2); border-radius: 0; }
.menu-item svg { width: 20px; height: 20px; color: var(--brand); flex: none; }
@media (hover: hover) { .menu-item:hover { background: var(--card); } }
.menu-item.rich { align-items: flex-start; }
.menu-item.rich b { display: block; } .menu-item.rich small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.menu-item .tick { width: 20px; height: 20px; flex: none; color: var(--brand); }

/* Stats */
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile { background: var(--card); border-radius: 14px; padding: 12px 6px; text-align: center; }
.stat-tile .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 6px; }
.stat-tile .ic svg { width: 19px; height: 19px; }
.ic.green { background: var(--green-soft); color: var(--green); } .ic.brand { background: var(--brand-soft); color: var(--brand); }
.ic.orange { background: var(--orange-soft); color: var(--orange); } .ic.gold { background: rgba(240, 190, 60, 0.22); color: #D4A017; }
.res-side .stat-tiles .stat-tile, .res-side .stat-tile { background: var(--card); }
.stat-tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 13px; color: var(--muted); }
.rating-card { background: var(--card); border-radius: 18px; padding: 14px 18px; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rating-card > div:first-child { min-width: 0; flex: 1 1 auto; }
.rating-card .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.rating-card .value { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.card { background: var(--card); border-radius: 18px; padding: 16px; }
.card h4 { margin: 0 0 12px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--card); border-radius: 99px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg.wide { display: flex; width: 100%; background: var(--card-2); }
.seg.wide button { flex: 1; }
.seg.wide button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.chart { width: 100%; height: 190px; display: block; margin-top: 10px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.skill { display: flex; justify-content: space-between; padding: 6px 0; font-size: 16px; }
.skill b { font-variant-numeric: tabular-nums; }
.skill span { color: var(--muted); font-size: 13px; margin-left: 6px; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 17px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px 0; text-align: center; }
.cal .dow { font-size: 13px; color: var(--muted); font-weight: 600; }
.cal .d { width: 38px; height: 38px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 15px; border: 0; background: none; color: var(--faint); font-variant-numeric: tabular-nums; padding: 0; }
.cal .d.played { border: 3px solid var(--green); background: var(--green-soft); color: var(--ink); font-weight: 700; cursor: pointer; }
.cal .d.started { border: 2px dashed var(--orange); color: var(--ink); cursor: pointer; }
.cal .d.missed { border: 2px dotted var(--faint); color: var(--muted); }
.cal .d.on { box-shadow: 0 0 0 3px var(--brand); }
.legend { display: flex; gap: 16px; justify-content: center; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.lg.played { border: 2.5px solid var(--green); background: var(--green-soft); } .lg.started { border: 2px dashed var(--orange); } .lg.missed { border: 2px dotted var(--faint); }
.day-card { background: var(--card); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.day-card .top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-height: 0; }
.day-card .tiles { justify-content: flex-start; }
.day-card .tile { width: 32px; height: 32px; border-radius: 8px; }

/* Settings */
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-opt { border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0; }
.theme-opt .sw { width: 100%; max-width: 52px; aspect-ratio: 1; border-radius: 10px; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; }
.theme-opt.on .sw { box-shadow: 0 0 0 3px var(--brand); }
.theme-opt.on { color: var(--brand); font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { width: 51px; height: 31px; border-radius: 99px; border: 0; background: var(--card-2); position: relative; cursor: pointer; transition: background 0.2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: transform 0.2s; }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.share-img { width: 100%; max-width: 360px; margin: 0 auto; display: block; border-radius: 16px; box-shadow: var(--shadow); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 80; animation: fade 0.2s; max-width: calc(100vw - 32px); text-align: center; }
.testbar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 12px; align-items: center; }
.testbar button { border: 1px solid var(--card-2); background: var(--card); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

@media (max-width: 370px) {
  .brand-name { font-size: 21px; } .brand-icon { width: 32px; height: 32px; }
  .tile.sm { width: 27px; height: 27px; }
  .strip .value { font-size: 25px; }
  .result-row .tile { width: 40px; height: 40px; }
  .result-tiles { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* The app, offered quietly during the puzzles */
.promo-small { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--card); box-shadow: var(--lift); text-decoration: none; color: var(--ink); margin-top: 8px; }
.promo-small .icon { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.promo-small .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.promo-small b { font-size: 15px; } .promo-small .txt span { font-size: 13px; color: var(--muted); }
.promo-small .get { flex: none; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; padding: 6px 16px; border-radius: 99px; }
@media (hover: hover) { .promo-small:hover .get { background: var(--brand); color: #fff; } }
.stat-tile { box-shadow: var(--lift); }
.card { box-shadow: var(--lift); }
.day-card { box-shadow: var(--lift); }
