/* Star Crossed. A night sky (dark) and a pale dawn sky (light). */
:root {
  color-scheme: light;
  --sky: linear-gradient(180deg, #d9def7 0%, #ece6f6 45%, #fbe7dc 100%);
  --bg: #ece6f6;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #fbf9ff;
  --panel-2: rgba(42, 36, 90, 0.07);
  --ink: #241f4f;
  --text: #241f4f;
  --muted: #615b8c;
  --faint: #8a85ad;
  --line: rgba(36, 31, 79, 0.14);
  --gold: #f2b631;
  --gold-deep: #d99a12;
  --gold-ink: #3a2700;
  --accent: #6a5acd;
  --danger: #d6384f;
  --star: #f2b631;
  --star-stroke: #241f4f;
  --star-glow: rgba(242, 182, 49, 0.45);
  --star-hint: #8a85ad;
  --cross: rgba(36, 31, 79, 0.45);
  --grid-line: rgba(36, 31, 79, 0.14);
  --edge: #241f4f;
  --board-bg: rgba(255, 255, 255, 0.5);
  --region-s: 70%;
  --region-l: 84%;
  --region-a: 0.92;
  --link: rgba(36, 31, 79, 0.75);
  --focus: rgba(106, 90, 205, 0.9);
  --scrim: rgba(30, 26, 60, 0.4);
  --shadow: 0 10px 30px rgba(36, 31, 79, 0.16);
  --twinkle: rgba(98, 88, 170, 0.35);
  --twinkle-n: 0.35;
  --won-dim: rgba(255, 255, 255, 0.35);
  --display: "Outfit", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.25, 1.15, 0.45, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sky: radial-gradient(120% 70% at 50% 0%, #252a63 0%, #12143a 45%, #080918 100%);
    --bg: #0b0d22;
    --panel: rgba(30, 34, 80, 0.62);
    --panel-solid: #1a1d48;
    --panel-2: rgba(255, 255, 255, 0.07);
    --ink: #eceaff;
    --text: #eceaff;
    --muted: #aaa8d8;
    --faint: #7a79a6;
    --line: rgba(200, 200, 255, 0.14);
    --star: #ffe08a;
    --star-stroke: rgba(0, 0, 0, 0);
    --star-glow: rgba(255, 214, 110, 0.85);
    --star-hint: #c9c6ec;
    --cross: rgba(220, 220, 255, 0.42);
    --grid-line: rgba(0, 0, 0, 0.3);
    --edge: #04050f;
    --board-bg: rgba(4, 5, 16, 0.55);
    --region-s: 52%;
    --region-l: 30%;
    --region-a: 0.72;
    --link: rgba(255, 236, 170, 0.9);
    --focus: rgba(255, 214, 110, 0.95);
    --danger: #ff6b81;
    --scrim: rgba(2, 3, 12, 0.6);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --twinkle: #ffffff;
    --twinkle-n: 1;
    --won-dim: rgba(2, 3, 12, 0.45);
  --won-dim: rgba(2, 3, 12, 0.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sky: radial-gradient(120% 70% at 50% 0%, #252a63 0%, #12143a 45%, #080918 100%);
  --bg: #0b0d22;
  --panel: rgba(30, 34, 80, 0.62);
  --panel-solid: #1a1d48;
  --panel-2: rgba(255, 255, 255, 0.07);
  --ink: #eceaff;
  --text: #eceaff;
  --muted: #aaa8d8;
  --faint: #7a79a6;
  --line: rgba(200, 200, 255, 0.14);
  --star: #ffe08a;
  --star-stroke: rgba(0, 0, 0, 0);
  --star-glow: rgba(255, 214, 110, 0.85);
  --star-hint: #c9c6ec;
  --cross: rgba(220, 220, 255, 0.42);
  --grid-line: rgba(0, 0, 0, 0.3);
  --edge: #04050f;
  --board-bg: rgba(4, 5, 16, 0.55);
  --region-s: 52%;
  --region-l: 30%;
  --region-a: 0.72;
  --link: rgba(255, 236, 170, 0.9);
  --focus: rgba(255, 214, 110, 0.95);
  --danger: #ff6b81;
  --scrim: rgba(2, 3, 12, 0.6);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --twinkle: #ffffff;
  --twinkle-n: 1;
  --won-dim: rgba(2, 3, 12, 0.45);
}

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg) var(--sky) fixed;
  color: var(--text);
  font: 500 15px/1.45 var(--body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; flex: none; }

#app { position: relative; height: 100%; max-width: 640px; margin: 0 auto; overflow: hidden; }
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden;
  transition: opacity 180ms ease, visibility 0s 180ms;
}
.screen.active { opacity: 1; visibility: visible; transition: opacity 180ms ease; }

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding-inline: 20px; border-radius: 16px;
  font: 700 16px/1 var(--display);
  transition: transform 90ms ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--gold); color: var(--gold-ink); box-shadow: 0 1px 2px rgba(120, 80, 0, 0.3), 0 8px 22px rgba(242, 182, 49, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn.ghost { background: var(--panel); border: 1px solid var(--line); }
.link-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; color: var(--muted); font-weight: 600; }
.link-btn svg { width: 18px; height: 18px; }
.eyebrow { margin: 0; font: 700 12px/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- home -- */
#home { align-items: center; gap: 14px; overflow-y: auto; }
.home-top { align-self: stretch; display: flex; justify-content: flex-end; }
:root { --pr-bg: var(--panel-solid); --pr-fg: var(--text); --pr-shadow: var(--shadow); }
peanut-menu {
  --pm-bg: var(--panel-solid); --pm-fg: var(--text); --pm-muted: var(--muted); --pm-line: var(--line);
  --pm-hover: var(--panel-2); --pm-accent: var(--gold); --pm-accent-fg: var(--gold-ink); --pm-danger: var(--danger);
  --pm-trigger-bg: var(--panel-solid); --pm-font: var(--body);
}
.brand { text-align: center; margin-top: 2vh; }
.brand-star { width: 46px; height: 46px; color: var(--gold); }
.wordmark { margin: 4px 0 0; font: 700 clamp(40px, 12vw, 56px)/1 var(--display); letter-spacing: -0.035em; }
.tagline { margin: 8px auto 0; max-width: 280px; color: var(--muted); font-size: 14px; }
.daily {
  width: 100%; max-width: 420px; margin-top: 2vh;
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 16px 16px 16px 20px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.daily-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.daily-text b { font: 700 22px/1.1 var(--display); }
.daily-text small { color: var(--muted); font-size: 13px; }
.daily-go { flex: none; min-height: 44px; padding: 0 20px; display: grid; place-items: center; border-radius: 14px; background: var(--gold); color: var(--gold-ink); font: 700 16px/1 var(--display); box-shadow: 0 1px 2px rgba(120, 80, 0, 0.3), 0 8px 22px rgba(242, 182, 49, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.daily.done .daily-go { background: var(--panel-2); color: var(--text); box-shadow: none; }
.section-label { align-self: stretch; max-width: 420px; width: 100%; margin: 10px auto 0; font: 700 12px/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tiers { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.tier {
  display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 60px; padding: 10px 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
}
.tier:active { transform: scale(0.99); }
.tier-size { flex: none; width: 46px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--panel-2); font: 700 14px/1 var(--display); color: var(--muted); }
.tier-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tier-text b { font: 700 17px/1.1 var(--display); }
.tier-text small { color: var(--muted); font-size: 13px; }
.build { margin: auto 0 0; padding-top: 12px; color: var(--faint); font-size: 12px; }

/* ---------------------------------------------------------------- game -- */
.hud { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.hud-mid { flex: 1; text-align: center; min-width: 0; }
.hud-mid h2 { margin: 0; font: 700 20px/1.1 var(--display); }
.hud-mid p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.hud-time { width: 44px; text-align: right; font: 700 15px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--muted); }
.board-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-block: 8px; }
.board {
  display: grid; touch-action: none;
  border: 3px solid var(--edge); border-radius: 10px; overflow: hidden;
  background: var(--board-bg);
  box-shadow: var(--shadow);
}
.cell {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: 0;
  background: hsl(var(--h) var(--region-s) var(--region-l) / var(--region-a));
  border: 0 solid var(--grid-line); border-width: 0 1px 1px 0;
  transition: filter 120ms;
}
/* Region edges: a thick line where the neighbor is in another region. */
.cell.er { border-right: 3px solid var(--edge); }
.cell.eb { border-bottom: 3px solid var(--edge); }
.cell.lc { border-right-width: 0; }
.cell.lr { border-bottom-width: 0; }
.cell svg { width: 58%; height: 58%; pointer-events: none; }
.cell .x { color: var(--cross); width: 42%; height: 42%; }
.cell .s { color: var(--star); stroke: var(--star-stroke); stroke-width: 1.2px; stroke-linejoin: round; filter: drop-shadow(0 0 5px var(--star-glow)); animation: pop 220ms var(--spring); }
.cell.bad .s { color: var(--danger); }
.cell.bad::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--danger) 18%, transparent) 5px 8px); }
.cell.focus { filter: brightness(1.08) saturate(1.2); box-shadow: inset 0 0 0 3px var(--focus); z-index: 1; }
.cell.flash { box-shadow: inset 0 0 0 3px var(--focus); z-index: 1; }
.cell.flash::before { content: ""; position: absolute; inset: 0; background: var(--focus); opacity: 0.28; animation: flash 900ms ease 3; }
.board.won .cell .s { animation: twinkle 700ms var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes flash { 50% { opacity: 0.05; } }
@keyframes twinkle { 0% { transform: scale(1) rotate(0); } 45% { transform: scale(1.35) rotate(18deg); } 100% { transform: scale(1) rotate(0); } }

/* Fixed height so hints and notes never push the board around. */
.message {
  height: 66px; margin: 6px 0 0; padding: 0 8px; align-self: stretch;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.35;
}
.message.hint { color: var(--text); }
.tools { display: flex; justify-content: center; gap: 10px; padding-top: 6px; }
.tool {
  flex: 1; max-width: 120px; min-height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.tool svg { color: var(--text); }
.tool:disabled { opacity: 0.45; }
.tool:active:not(:disabled) { transform: scale(0.97); }

/* -------------------------------------------------------------- sheets -- */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--scrim); animation: fade 180ms ease;
}
.sheet {
  position: relative; width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto;
  padding: 24px 22px 20px; border-radius: 26px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
  animation: rise 300ms var(--spring);
  -webkit-user-select: text; user-select: text;
}
.sheet h3 { margin: -6px 0 0; font: 700 28px/1.1 var(--display); }
.sheet .close { position: absolute; top: 14px; right: 14px; }
.sheet-copy { margin: 0; color: var(--muted); }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.win { text-align: center; align-items: stretch; }
.win h3 { font-size: 34px; }
.stars { display: flex; justify-content: center; gap: 8px; }
.stars svg { width: 40px; height: 40px; color: var(--line); }
.stars svg.on { color: var(--gold); animation: pop 360ms var(--spring) both; }
.stars svg.on.help { color: var(--star-hint); }
.stats { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { padding: 10px 6px; border-radius: 14px; background: var(--panel-2); }
.stats dt { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 700 20px/1 var(--display); font-variant-numeric: tabular-nums; }
.toggles { display: flex; flex-direction: column; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 56px; padding-block: 6px; border-top: 1px solid var(--line); cursor: pointer; }
.toggle:first-child { border-top: 0; }
.toggle span { flex: 1; display: flex; flex-direction: column; }
.toggle small { color: var(--muted); font-size: 13px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); position: relative; transition: background 150ms; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel-solid); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 180ms var(--ease); }
.toggle input:checked + i { background: var(--gold); }
.toggle input:checked + i::after { transform: translateX(18px); }
.toggle input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }

.toast {
  position: absolute; z-index: 20; left: 50%; bottom: 110px; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: rise 240ms var(--spring);
}
.loading { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; }
.loading svg { width: 40px; height: 40px; color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

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

/* ---------------------------------------------------------- the index -- */
.past { align-self: center; margin-top: -6px; font-size: 14px; }
.past span { font-size: 18px; line-height: 1; }
#list { gap: 10px; }
.list-next { align-self: center; min-width: 220px; }
.list-scroll { flex: 1; min-height: 0; overflow-y: auto; margin-inline: -16px; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; gap: 8px; }
.grid.nums { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }
.grid.days { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.tile {
  position: relative; min-height: 58px; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.tile b { font: 700 17px/1 var(--display); font-variant-numeric: tabular-nums; }
.tile small { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.grid.days .tile { min-height: 84px; }
.tile.solved { background: color-mix(in srgb, var(--gold) 16%, var(--panel)); border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.tile.solved.helped { background: var(--panel-2); border-color: var(--line); }
.tile.next, .tile.today:not(.solved) { box-shadow: inset 0 0 0 2px var(--accent); }
.tile.live { box-shadow: inset 0 0 0 2px var(--gold); }
.tile .tag { color: var(--muted); font-weight: 700; line-height: 1; }
.mini { display: flex; gap: 1px; }
.mini svg { width: 11px; height: 11px; color: var(--line); }
.mini svg.on { color: var(--gold-deep); }
.mini svg.on.help { color: var(--star-hint); }
.list-more { align-self: center; }

/* ------------------------------------------------------------ account -- */
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.btn.wide { width: 100%; }
.account { display: flex; flex-direction: column; gap: 10px; }
.account > div { display: flex; flex-direction: column; gap: 10px; }
.acct-row { display: flex; gap: 8px; }
.acct-row input {
  flex: 1; min-width: 0; min-height: 50px; padding-inline: 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 600 16px/1 var(--body); /* 16px keeps iOS from zooming in */
  -webkit-user-select: text; user-select: text;
}
.acct-row input::placeholder { color: var(--faint); }
.acct-row input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
#acctCodeInput { letter-spacing: 0.35em; font-variant-numeric: tabular-nums; text-align: center; }
#acctCodeInput::placeholder { letter-spacing: 0.35em; }
.acct-row .btn { flex: none; padding-inline: 18px; }
.acct-links { display: flex; justify-content: space-between; gap: 8px; margin: -4px -10px 0; }
.acct-links .link-btn { font-size: 14px; padding-inline: 10px; }
.acct-wait { margin: 0; min-height: 50px; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.acct-in p { margin: 0 0 4px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-in b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-in small { color: var(--muted); font-size: 13px; }
.acct-captcha:empty { display: none; }
.acct-captcha { display: flex; justify-content: center; }
.spin { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.btn .spin { margin-right: 2px; }
.account .btn:disabled { box-shadow: none; transform: none; }
.account .btn.primary:disabled { background: var(--panel-2); color: var(--muted); }
.account .btn.primary[aria-busy="true"]:disabled { background: var(--gold); color: var(--gold-ink); }
.acct-error { margin: 0; color: var(--danger); font-size: 14px; }
.account button:disabled, .account input:disabled { opacity: 0.55; cursor: default; }
.account .btn.primary:disabled, .account .btn[aria-busy="true"] { opacity: 1; }

/* ------------------------------------------------- the daily calendar -- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head .icon-btn:disabled { opacity: 0.35; }
.flip { transform: scaleX(-1); }
.cal-title { flex: 1; min-height: 44px; border-radius: 12px; font: 700 19px/1 var(--display); }
.cal-title::after { content: " ▾"; font-size: 12px; color: var(--muted); }
.cal-title[aria-expanded="true"]::after { content: " ▴"; }
.cal-pick { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.pick-year { display: flex; align-items: center; justify-content: space-between; }
.pick-year b { font: 700 18px/1 var(--display); }
.pick-year .icon-btn:disabled { opacity: 0.35; }
.pick-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pick-months button { min-height: 40px; border-radius: 10px; background: var(--panel-2); font-weight: 700; }
.pick-months button.on { background: var(--gold); color: var(--gold-ink); }
.pick-months button:disabled { opacity: 0.35; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; margin-bottom: -6px; }
.cal-week span { display: flex; flex-direction: column; gap: 1px; }
.cal-week b { font-size: 13px; color: var(--text); }
.cal-week small { font-size: 8.5px; font-weight: 700; letter-spacing: 0; color: var(--muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.grid.cal { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.tile.day { min-height: 0; aspect-ratio: 1; padding: 2px; border-radius: 12px; gap: 2px; }
.tile.day b { font-size: 16px; }
.tile.day .mini svg { width: 9px; height: 9px; }
.tile.day:disabled { opacity: 0.35; }
.cal-note { margin: 0; text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------------------------------------------------------------- sky -- */
.twinkles { position: fixed; inset: 0; pointer-events: none; opacity: var(--twinkle-n); }
.twinkles i { position: absolute; border-radius: 50%; background: var(--twinkle); opacity: 0.2; animation: twinkle-dot ease-in-out infinite; }
.twinkles i.gold { background: #ffd36e; box-shadow: 0 0 4px rgba(255, 211, 110, 0.6); }
@keyframes twinkle-dot { 0%, 55%, 100% { opacity: 0.2; transform: scale(1); } 78% { opacity: 1; transform: scale(1.35); } }
/* Panels float over the sky. */
.daily, .tier, .tool, .icon-btn, .tile, .cal-pick, .sheet { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sheet { background: var(--panel-solid); }
.brand-star { filter: drop-shadow(0 0 10px var(--star-glow)); }
.wordmark { text-shadow: 0 0 24px color-mix(in srgb, var(--star-glow) 35%, transparent); }

/* ------------------------------------------------------ constellations -- */
.board-frame { position: relative; }
.constellation { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.constellation line { stroke: var(--link); stroke-width: 0.07; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 520ms var(--ease) forwards; animation-delay: var(--d, 0ms); filter: drop-shadow(0 0 0.08px var(--star-glow)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* After a solve the sky dims behind the stars, so the constellation stands out. */
.cell svg { position: relative; z-index: 1; }
.board.won .cell::before { content: ""; position: absolute; inset: 0; background: var(--won-dim); animation: fade 700ms ease both; }
.board.won .cell .x { opacity: 0; transition: opacity 400ms; }
.win-art { display: block; width: 140px; height: 140px; margin: -4px auto -6px; overflow: visible; }
.win-art line { stroke: var(--link); stroke-width: 0.09; stroke-linecap: round; }
.win-art circle { fill: var(--star); filter: drop-shadow(0 0 0.25px var(--star-glow)); }
.win-sub { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
@media (prefers-reduced-motion: reduce) {
  .twinkles i { animation: none; opacity: 0.5; }
  .constellation line { stroke-dashoffset: 0; }
}

/* Stars placed so far, one slot per star. */
.star-count { display: flex; justify-content: center; gap: 6px; min-height: 22px; margin: 6px 0 -2px; }
.star-count svg { width: 18px; height: 18px; color: var(--line); transition: color 200ms, transform 200ms var(--spring); }
.star-count svg.on { color: var(--star); filter: drop-shadow(0 0 4px var(--star-glow)); transform: scale(1.08); }
.star-count.over svg.on { color: var(--danger); filter: none; }
#hudTime { width: auto; min-width: 52px; padding: 6px 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); text-align: center; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#hudTime[hidden] { display: block !important; visibility: hidden; }

/* ------------------------------------------------------------ home polish -- */
/* Faint nebulae drifting behind the stars. */
body::before {
  content: ""; position: fixed; inset: -10%; pointer-events: none; z-index: -1;
  background:
    radial-gradient(40% 30% at 18% 22%, color-mix(in srgb, #7a5cff 26%, transparent), transparent 70%),
    radial-gradient(35% 28% at 85% 55%, color-mix(in srgb, #ff6fb1 14%, transparent), transparent 70%),
    radial-gradient(45% 30% at 40% 95%, color-mix(in srgb, #3fb6ff 14%, transparent), transparent 70%);
  animation: drift 40s ease-in-out infinite alternate;
  opacity: var(--twinkle-n);
}
@keyframes drift { to { transform: translate(3%, -2%) scale(1.05); } }
.twinkles { z-index: -1; }
#app { z-index: 0; }

.tier-stars { display: flex; gap: 2px; }
.tier-stars svg { width: 13px; height: 13px; color: var(--line); }
.tier-stars svg.on { color: var(--gold); filter: drop-shadow(0 0 3px var(--star-glow)); }
.tier-size { font-variant-numeric: tabular-nums; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--panel-2)), var(--panel-2)); color: var(--text); }
.tier { transition: transform 160ms var(--ease), border-color 160ms, box-shadow 200ms; }
.tier:hover { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: 0 8px 24px color-mix(in srgb, var(--star-glow) 18%, transparent); }

/* The daily card glows like a lit window in the sky. */
.daily { position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.daily::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(70% 120% at 100% 0%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 60%);
}
.daily::after { /* a slow sheen */
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.daily.done::after { display: none; }
.daily-text, .daily-go { position: relative; z-index: 1; }
.brand-star { animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { body::before, .daily::after, .brand-star { animation: none; } }
