/* vegas.aspected.com family: ink and violet in light, night navy and violet in dark, Plus Jakarta Sans, mono labels,
   22px blocks, one accent. Green and amber are kept for the tiles: same and close. */
:root {
  --bg: #F3F3F7; --surface: #FFFFFF; --surface-2: #F0F0F6; --line: #DEDEE3; --fg: #161D26; --muted: #5F626B;
  --accent: #5724FF; --accent-ink: #FFFFFF; --hot: #B2008F;
  --good: #026B43; --good-bg: #DDF3E8; --warn: #8F4A00; --warn-bg: #FCEFC9; --bad: #D91515;
  --chip-on: #161D26; --chip-on-ink: #FFFFFF;
  --display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 22px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F141A; --surface: #161D26; --surface-2: #1D2631; --line: #2A3441; --fg: #F3F3F7; --muted: #A4A4AD;
  --accent: #9B7BFF; --accent-ink: #0F141A; --hot: #FF3DB4;
  --good: #3ECF8E; --good-bg: #12362A; --warn: #FFB547; --warn-bg: #3A2C10; --bad: #FF5D5D;
  --chip-on: #F3F3F7; --chip-on-ink: #0F141A;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0F141A; --surface: #161D26; --surface-2: #1D2631; --line: #2A3441; --fg: #F3F3F7; --muted: #A4A4AD;
    --accent: #9B7BFF; --accent-ink: #0F141A; --hot: #FF3DB4;
    --good: #3ECF8E; --good-bg: #12362A; --warn: #FFB547; --warn-bg: #3A2C10; --bad: #FF5D5D;
    --chip-on: #F3F3F7; --chip-on-ink: #0F141A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--display);
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 120px max(16px, env(safe-area-inset-left, 0px));
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 980px; margin: 0 auto; }
.narrow { max-width: 720px; margin: 0 auto; }
.mono { font-family: var(--mono); }
.label { font: 600 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.stack { display: grid; gap: 14px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px; }
.brand { display: flex; align-items: center; gap: 6px; font: 800 20px/1 var(--display); letter-spacing: -.02em; text-decoration: none; }
.brand .pill { background: var(--accent); color: var(--accent-ink); padding: 3px 9px 4px; border-radius: 8px; transform: rotate(-2deg); display: inline-block; }
.top-right { display: flex; gap: 8px; align-items: center; }
.ghost { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); padding: 0; }
.ghost svg { width: 18px; height: 18px; }
.datamark { font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
@media (max-width: 420px) { .datamark .dt { display: none; } }

/* blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.home { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 28px 30px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.hero > div:first-child { container-type: inline-size; min-width: 0; }
.hero h1 { font: 800 clamp(26px, 12.5cqi, 46px)/1.04 var(--display); letter-spacing: -.03em; margin: 0 0 12px; }
.hero h1 .ln { display: block; white-space: nowrap; }
.hero h1 .rot { color: var(--accent); }
.hero p { margin: 0; color: var(--muted); max-width: 46ch; }
.hero-art { width: 112px; height: 112px; }
.tile { text-align: left; border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); background: var(--surface); }
.tile.beam { background: var(--accent); color: var(--accent-ink); border-color: transparent; min-height: 104px; }
.ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); flex: none; }
.tile.beam .ic { background: rgba(255,255,255,.18); color: var(--accent-ink); }
.ic svg { width: 20px; height: 20px; }
.tile b { display: block; font: 700 17px/1.2 var(--display); margin-top: 14px; }
.tile b + span { display: block; font-size: 13px; margin-top: 2px; }
.brow { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 14px 16px; width: 100%; }
.brow b { display: block; font: 700 16px/1.2 var(--display); }
.brow small { color: var(--muted); font-size: 13px; }
.brow .status { font: 600 13px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.brow .status.ok { color: var(--good); }
.brow .status.no { color: var(--bad); }
.dash { border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: var(--r); padding: 20px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.dash h2 { font: 700 14px/1 var(--display); color: var(--accent); margin: 0 0 10px; }
.kpis { display: flex; gap: 22px; flex-wrap: wrap; }
.kpi b { display: block; font: 800 28px/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font: 600 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* play */
.playhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
/* the question is the page's headline: the size and weight of "Guess it. Aspect by aspect." */
.q { font: 800 clamp(28px, 7.4vw, 46px)/1.04 var(--display); letter-spacing: -.03em; margin: 6px 0 0; text-wrap: balance; }
.q em { font-style: normal; color: var(--accent); }
.seg { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: none; border-radius: 999px; padding: 7px 14px; font: 600 13px/1 var(--display); color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font: 600 11px/1.4 var(--mono); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; }
.legend i { font-style: normal; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; margin-right: 5px; font-size: 11px; flex: none; }
.legend .h { background: var(--good-bg); color: var(--good); }
.legend .n { background: var(--warn-bg); color: var(--warn); }
.legend .m { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.picker { position: sticky; top: 8px; z-index: 4; }
.pin { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--fg); border-radius: 18px; padding: 4px 14px 4px 16px; box-shadow: 0 6px 20px rgba(15, 20, 26, .08); }
.pin:focus-within { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.pin svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pin input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; padding: 12px 0; font-size: 16px; font-weight: 600; }
.pin .left { font: 600 12px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; max-height: min(46vh, 320px); overflow: auto; box-shadow: 0 12px 30px rgba(15, 20, 26, .14); }
.sugg button { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 12px; padding: 11px 12px; font-weight: 600; }
.sugg button:hover, .sugg li:first-child button.first { background: var(--surface-2); }
.sugg .none { padding: 11px 12px; color: var(--muted); }

.rows { display: grid; gap: 10px; }
.g { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: grid; gap: 10px; }
.g.found { border-color: var(--good); }
.g-h { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; }
.g-h .n { font: 600 12px/1 var(--mono); color: var(--muted); }
.g-h b { font: 700 16px/1.2 var(--display); overflow-wrap: anywhere; }
.rank { font: 600 12px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.g.found .rank { color: var(--good); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tiles.n4 { grid-template-columns: repeat(2, 1fr); }   /* four aspects: two by two on a phone, not three and a stray */
@media (min-width: 640px) { .tiles, .tiles.n4 { grid-template-columns: repeat(var(--n, 6), 1fr); } }
.t { border-radius: 12px; padding: 8px 9px; min-height: 56px; display: grid; align-content: space-between; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.t .tl { display: flex; justify-content: space-between; gap: 4px; font: 600 9.5px/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.t .tv { font: 700 13px/1.2 var(--display); overflow-wrap: anywhere; }
.t .ar { font-style: normal; font-weight: 800; margin-left: 5px; }
.t.hit { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.t.hit .tl { color: var(--good); }
.t.near { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.t.near .tl { color: var(--warn); }
.t.miss .tv { color: var(--muted); }
.g.fresh .t { animation: flip .42s both; animation-delay: calc(var(--i) * 80ms); }
@keyframes flip { from { transform: rotateX(88deg); opacity: 0; } to { transform: none; opacity: 1; } }
.one { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.heat { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.heat i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.one .mono { font-size: 12px; font-weight: 600; color: var(--muted); }
.empty { border: 1.5px dashed var(--line); border-radius: 18px; padding: 18px; color: var(--muted); display: grid; gap: 10px; }
.empty b { color: var(--fg); }

.fact { border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: var(--r); padding: 16px 18px; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.fact .label { color: var(--accent); }
.fact p { margin: 6px 0 0; font-size: 16px; }
.verdict { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.verdict h2 { font: 800 28px/1.1 var(--display); margin: 4px 0 0; letter-spacing: -.02em; }
.verdict h2 span { font: 600 15px/1 var(--mono); color: var(--muted); margin-left: 6px; }
.verdict .pts { font: 800 30px/1 var(--display); color: var(--accent); white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; background: var(--surface); }
.chip .label { font-size: 10px; }
.how p { margin: 0; }
.how ol { margin: 0; padding-left: 20px; }
.linkbtn { border: 0; background: none; padding: 0; font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 2px; }
details summary { cursor: pointer; font-weight: 700; }
details textarea { width: 100%; min-height: 72px; margin: 10px 0; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; }

/* actions */
.bar-actions { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 5; }
.bar-actions .wrap { display: flex; gap: 10px; justify-content: flex-end; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 12px 20px; font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.wide { flex: 1; max-width: 360px; }

/* result */
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 12px 14px; width: 100%; }
.line b { font-weight: 700; }
.line .sq { grid-column: 1; font-size: 15px; letter-spacing: 2px; }
.line .r { grid-row: 1 / span 2; grid-column: 2; font: 700 15px/1 var(--mono); }
.board .row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.board .row.me { color: var(--accent); font-weight: 700; }
.field { display: flex; gap: 8px; flex-wrap: wrap; }
.field input { flex: 1; min-width: 160px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 11px 16px; }
dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--fg); max-width: 620px; width: calc(100% - 32px); padding: 24px; }
dialog::backdrop { background: rgba(15, 20, 26, .55); }
dialog h2 { font: 800 22px/1.15 var(--display); margin: 0 0 8px; }
dialog h3 { font: 700 15px/1.2 var(--display); margin: 16px 0 4px; }
dialog p, dialog li { color: var(--muted); }
dialog ul { padding-left: 20px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--chip-on); color: var(--chip-on-ink); padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 9; }

/* The first screen's mysteries, and how its two columns line up.
   The left column (hero, play, challenge) always keeps its own height. The right column ends on the same line:
   its mysteries keep their height and the streak box takes what is left. One to three mysteries are rows; four
   stand two by two and five or six three across, as small tiles, so the right column does not outgrow the left. */
.rowsgrid { display: grid; gap: 14px; }
.dash .note { margin-top: 12px; }
@media (min-width: 761px) {
  /* minmax(0, ...): the columns keep their 1.1 to 1 split whatever the right one holds, so the left never moves */
  .home { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .home > .stack:first-child { align-self: start; }
  .home > .stack:last-child { display: flex; flex-direction: column; }
  .home > .stack:last-child > .dash { flex: 1 0 auto; display: flex; flex-direction: column; }
  .home > .stack:last-child > .dash > .note:last-child { margin-top: auto; padding-top: 12px; }
  .rowsgrid.many { grid-template-columns: 1fr 1fr; }
  .rowsgrid.lots { grid-template-columns: 1fr 1fr 1fr; }
  .rowsgrid.many .brow, .rowsgrid.lots .brow { min-width: 0; padding: 14px; }
  .rowsgrid.many .brow > :nth-child(2), .rowsgrid.lots .brow > :nth-child(2) { min-width: 0; }
  /* two across: icon left, name and status under each other on the right, as low as a row */
  .rowsgrid.many .brow { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic tx" "ic st"; row-gap: 4px; }
  .rowsgrid.many .brow > :nth-child(1) { grid-area: ic; }
  .rowsgrid.many .brow > :nth-child(2) { grid-area: tx; }
  .rowsgrid.many .brow > :nth-child(3) { grid-area: st; justify-self: start; font-size: 12px; }
  .rowsgrid.many .brow b, .rowsgrid.many .brow small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* three across: icon and status on top, a short name and count under them */
  .rowsgrid.lots .brow { grid-template-columns: auto 1fr; grid-template-areas: "ic st" "tx tx"; row-gap: 8px; padding: 12px 14px; }
  .rowsgrid.lots .brow > :nth-child(1) { grid-area: ic; }
  .rowsgrid.lots .brow > :nth-child(2) { grid-area: tx; }
  .rowsgrid.lots .brow > :nth-child(3) { grid-area: st; justify-self: end; }
  /* three across there is room for one short line each: "Language", "56 to choose from" */
  .rowsgrid.lots .brow .pre, .rowsgrid.lots .brow .rest { display: none; }
  .rowsgrid.lots .brow .noun { display: inline-block; }
  .rowsgrid.lots .brow .noun::first-letter { text-transform: uppercase; }
  .rowsgrid.lots .brow small.count::after { content: " to choose from"; }
  .rowsgrid.lots .brow b, .rowsgrid.lots .brow small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rowsgrid.lots ~ .dash .note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 760px) {
  .home { grid-template-columns: 1fr; }
  .hero { padding: 22px; }
  .hero-art { width: 76px; height: 76px; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .g.fresh .t { animation: none; } }

/* packs, challenge and crowd round */
.packs { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.playhead .who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.sugg button small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.g-h small { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.tile.plain { flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; width: 100%; }
.tile.plain b { margin-top: 0; }
.tile.plain b + span { color: var(--muted); }
.pickset { display: flex; gap: 8px; flex-wrap: wrap; }
.pickset button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; }
.pickset button[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); border-color: transparent; }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 16px; padding: 12px 14px; }
.linkbox code { font: 600 13px/1.4 var(--mono); overflow-wrap: anywhere; flex: 1; min-width: 180px; }
#crowdBar { margin-bottom: 14px; }
.crowd { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--accent); color: var(--accent-ink); border-radius: 18px; padding: 12px 16px; }
.crowd b { font: 700 15px/1.3 var(--display); }
.crowd .btn { border-color: transparent; background: var(--accent-ink); color: var(--accent); padding: 9px 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.facts .t { min-height: 52px; }
.src { font-size: 12px; color: var(--muted); }
