/* Tangent. The map is the picture; the words sit straight on it, with no boxes around them.
   Type: Instrument Serif for the title and headings (the game's own lettering), IBM Plex Sans for reading,
   IBM Plex Mono for scores, counts and the clock. One button shape (8px corners, 44px tall):
   gold for the one thing to do on each screen, an outline for the rest. One accent colour (gold), nothing else lit. */
:root {
  --bg: #04050c; --ink: #f1efe9; --soft: rgba(241, 239, 233, .64); --faint: rgba(241, 239, 233, .4); --line: rgba(241, 239, 233, .14);
  --mine: #f2c46d; --mine-ink: #17110a; --low: #ff7a66;
  --title: "Instrument Serif", Georgia, serif;     /* only the word "Tangent" on the menu, as it always was */
  --serif: "Instrument Serif", Georgia, serif;     /* the headings: the title, today's row, panels, the question */
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --lift: 0 1px 3px rgba(0, 0, 0, .9);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); font-variant-numeric: tabular-nums; overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; font-weight: 500; border: 0; border-radius: 8px; min-height: 44px; padding: 0 20px; background: var(--mine); color: var(--mine-ink); cursor: pointer; transition: background .15s, color .15s, opacity .15s; }
button:hover:not(:disabled) { background: #f7d48d; }
button.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
button.quiet:hover:not(:disabled) { background: rgba(241, 239, 233, .06); }
button.link { background: none; color: var(--faint); font-size: 12px; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover:not(:disabled) { background: none; color: var(--soft); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--mine); outline-offset: 3px; }

#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.tip { position: fixed; z-index: 5; pointer-events: none; background: #0b0c16; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: 13px;
  transform: translate(-50%, -130%); white-space: nowrap; max-width: calc(100vw - 20px); overflow: hidden; text-overflow: ellipsis; }

/* ----- top: where you are, and how your answer did ----- */
.hud { position: fixed; top: 16px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; z-index: 2; text-shadow: var(--lift); }
body[data-screen="home"] .hud { display: none; }
.where { display: flex; flex-direction: column; gap: 6px; }
#where { display: flex; flex-direction: column; }
#where .t { font-size: 13px; color: var(--soft); }
#where .q { font: 400 24px/1.1 var(--serif); }
#where b { font-weight: 400; }
.pips { display: flex; gap: 3px; margin-top: 2px; }
.pips:empty { display: none; }
.pips i { width: 14px; height: 2px; background: rgba(241, 239, 233, .2); }
.pips i.done { background: var(--mine); }
.pips i.now { background: rgba(242, 196, 109, .7); }
.pips i.lost { background: var(--low); }
#stat { text-align: right; font-size: 14px; color: var(--soft); max-width: 50%; }
#stat b { color: var(--ink); font: 500 18px/1 var(--mono); }
#stat.alone, #stat.alone b { color: var(--mine); }
#stat.pop { animation: pop .5s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ----- a big moment, said once over the map ----- */
.moment { position: fixed; left: 16px; right: 16px; bottom: 200px; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; pointer-events: none; text-shadow: var(--lift); }
.moment b { font: italic 400 clamp(32px, 7vw, 48px)/1.05 var(--serif); color: var(--mine); }
.moment span { font-size: 15px; color: var(--ink); }
.moment.on { animation: moment 3.2s ease-out forwards; }
@keyframes moment { 0% { opacity: 0; transform: translateY(8px); } 12% { opacity: 1; transform: none; } 78% { opacity: 1; } 100% { opacity: 0; } }

/* ----- the menu: over its own background (stars, and the big Earth low on the right) ----- */
.home { position: fixed; inset: 0; z-index: 3; overflow-y: auto; text-shadow: var(--lift); animation: arrive .4s ease-out .1s both; }
.home.leaving { animation: leave .35s ease-in forwards; pointer-events: none; }
@keyframes arrive { from { opacity: 0; } }
@keyframes leave { to { opacity: 0; } }

/* Top bar: the Smile More house on the left (as the other Smile More games have it), your account on the right. */
.topbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; height: 60px; padding: 8px max(8px, calc(7vw - 12px)) 0; }
.home-link { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); }
.home-link:hover { background: rgba(241, 239, 233, .1); }
.home-link:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 16px; border-radius: 8px; background: rgba(4, 5, 12, .5); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); text-shadow: none; }
.home .acct-btn:hover:not(:disabled) { background: rgba(241, 239, 233, .08); }
.acct-name { font-size: 14px; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; display: flex; flex-direction: column; padding: 6px; border-radius: 10px; background: #0b0d1c; box-shadow: 0 0 0 1px var(--line), 0 16px 40px rgba(0, 0, 0, .55); text-shadow: none; }
.acct-menu button { justify-content: flex-start; text-align: left; background: none; color: var(--ink); min-height: 40px; padding: 0 12px; font-size: 14px; }
.home .acct-menu button:hover:not(:disabled) { background: rgba(241, 239, 233, .08); }

/* The column: on wider screens it stops short of the Earth (82% across, its radius 42% of the shorter side). */
.menu { max-width: 520px; margin: 0 0 0 max(20px, 7vw); padding: clamp(8px, 5vh, 64px) 20px 40px 0; }
@media (min-width: 701px) { .menu { max-width: max(330px, min(520px, calc(75vw - min(42vw, 42vh) - 28px))); } }
.title { margin: 0; font: 400 clamp(44px, 10vw, 64px)/1 var(--title); letter-spacing: -.01em; }     /* the game's name, in its own lettering */
.lede { margin: 14px 0 32px; color: var(--soft); max-width: 32ch; font-size: 16px; }

/* Today's Tangent: one line, the one loud thing on the menu. */
.today { display: flex; align-items: center; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.today-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.today-name { font: 400 40px/1 var(--serif); }
.today-meta { font-size: 14px; color: var(--soft); }
.today .no { margin-left: 10px; color: var(--faint); }
.today-act { flex: none; display: flex; align-items: center; gap: 14px; }
.today .score { font: 500 30px/1 var(--mono); }
.today.beta .today-name { font-style: italic; color: var(--mine); }
@media (max-width: 420px) {
  .today:has(.score) { flex-wrap: wrap; }
  .today:has(.score) .today-act { width: 100%; justify-content: space-between; }
}

/* The quiet ways into everything else. */
.links { display: flex; flex-direction: column; }
.links button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--ink); font-size: 16px; }
.links button span { flex: 1; }
.links button::after { content: '›'; color: var(--faint); font-size: 18px; }
.links button small { color: var(--soft); font-size: 13px; }
.links button:hover:not(:disabled) span:not(.ride) { color: var(--mine); }
.links .ride i { font-style: normal; }
.links button:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
.links button:disabled { opacity: .35; cursor: default; }
/* Your rocket's row: a small picture of the one you fly, and its name, at the right end. */
.links .ride { flex: none; display: flex; align-items: center; gap: 8px; color: var(--soft); font-size: 14px; }
.links .ride canvas { width: 46px; height: 26px; }

/* A short notice at the top (a new rocket). */
.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 8; min-height: 40px; padding: 0 18px; border-radius: 8px; background: #0b0d1c; color: var(--ink); font-size: 14px;
  box-shadow: 0 0 0 1px rgba(242, 196, 109, .6), 0 12px 30px rgba(0, 0, 0, .5); white-space: nowrap; }
.toast:hover:not(:disabled) { background: #12162e; }
.toast.can-open::after { content: '  ›'; color: var(--mine); white-space: pre; }
.toast.on { animation: toast 6s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 6% { opacity: 1; transform: translate(-50%, 0); } 88% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* Practice, past days, your stats, your rocket: in place of the menu. */
.menu.in { animation: arrive .2s ease-out; }
.back { all: unset; cursor: pointer; color: var(--soft); font-size: 14px; min-height: 36px; display: inline-flex; align-items: center; }
.back:hover { color: var(--ink); }
.back:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
.panel-title { margin: 4px 0 6px; font: 400 40px/1 var(--serif); }
.panel-note { margin: 0 0 20px; color: var(--soft); font-size: 14px; }
.panel-body .panel-note { margin-top: 12px; }
.item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:first-child { border-top: 1px solid var(--line); }
.item canvas { flex: none; width: 28px; height: 28px; }
.item-words { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.item b { font-weight: 500; font-size: 16px; color: var(--ink); }
.item small { color: var(--faint); font-size: 14px; }
.item .go { flex: none; font-size: 14px; color: var(--mine); }
.item .go.done { color: var(--ink); }
.item:hover:not(:disabled) b { color: var(--mine); }
.item:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
.home .item:disabled { cursor: default; opacity: 1; }
.item:disabled b { color: var(--soft); }
.item:disabled .go { color: var(--faint); }
.item:disabled canvas { opacity: .45; }
/* (These are buttons, but not gold ones.) */
.home .item:hover:not(:disabled), .home .links button:hover:not(:disabled), .home .back:hover:not(:disabled) { background: none; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.tile { padding: 14px 0 12px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); }
.tile b { font: 500 28px/1 var(--mono); }
.tile span { font-size: 13px; color: var(--soft); }
.panel .section { margin: 26px 0 10px; font-size: 14px; color: var(--soft); }
.spread { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; height: 96px; align-items: end; }
.bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--mine); border-radius: 2px 2px 0 0; }
.bar.none i { background: var(--line); }
.bar span { font-size: 12px; color: var(--faint); }

/* Your rocket: every rocket as its real art, the one you fly ringed in gold; locked ones in silhouette. */
.rockets { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 4px; }
.rocket-tile { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 10px 12px; border-radius: 12px; background: rgba(5, 6, 16, .55); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; text-align: center; }
.rocket-tile canvas { width: 108px; height: 58px; }
.rocket-tile b { font-weight: 500; font-size: 14px; }
.rocket-tile small { font-size: 12px; line-height: 1.35; color: var(--soft); }
.rocket-tile small:empty { display: none; }
.home .rocket-tile:hover:not(:disabled) { background: rgba(241, 239, 233, .07); }
.rocket-tile:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
.rocket-tile.chosen { box-shadow: inset 0 0 0 1.5px var(--mine); background: rgba(242, 196, 109, .07); cursor: default; }
.home .rocket-tile:disabled { opacity: 1; cursor: default; }
.rocket-tile.locked b { color: var(--soft); }

/* How to play: a short sheet. */
.how { max-width: min(420px, calc(100vw - 32px)); padding: 26px 26px 22px; border: 0; border-radius: 12px; background: #0b0d1c; color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, .6); }
.how::backdrop { background: rgba(2, 3, 10, .6); }
.how h2 { margin: 0 0 12px; font: 400 32px/1 var(--serif); }
.how ul { margin: 0 0 20px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--soft); }
.how li::marker { color: var(--mine); }
.how form { display: flex; justify-content: flex-end; }

#map.blink { animation: arrive .35s ease-out; }
/* Leaving the menu: the question comes in once the menu's words have gone. */
body.from-home .hud, body.from-home .dock { animation: arrive .5s ease-out .3s both; }
@media (prefers-reduced-motion: reduce) { .home, .menu.in { animation: none; } .home.leaving { animation-duration: .15s; } }
.hint { color: var(--soft); font-size: 14px; margin: 14px 0 0; }
.error { color: var(--low); margin-top: 16px; }

/* ----- play: the question, set over the map, fading into the dark at the bottom ----- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; padding: 56px 18px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; align-items: center;
  background: linear-gradient(to top, rgba(4, 5, 12, .95) 50%, rgba(4, 5, 12, 0)); }
.dock > * { width: 100%; max-width: 620px; }
.said { margin: 0; font-size: 14px; color: var(--soft); text-align: center; text-wrap: balance; }
.said:empty { display: none; }
.ask { margin: 0; font: 400 clamp(28px, 6.5vw, 40px)/1.08 var(--serif); text-align: center; text-wrap: balance; }
.ask.fresh, .said.fresh { animation: arrive .25s ease-out; }
/* Word play: the word to find, picked out of the question. */
.word { font-style: italic; color: var(--mine); white-space: nowrap; }
.said .word { font-style: normal; color: var(--ink); }
/* A free pick: the route ran out of road and the question opened up. A marker, not a warning. */
.free { display: inline-block; vertical-align: 1px; margin-right: 6px; padding: 1px 7px; border-radius: 99px; box-shadow: inset 0 0 0 1px rgba(242, 196, 109, .6);
  font: 500 12px/1.5 var(--sans); color: var(--mine); text-shadow: none; }
.said.is-free { color: var(--ink); }
.detail .num .free { margin: 0 0 0 6px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
form { display: flex; gap: 14px; align-items: center; }
input { flex: 1; min-width: 0; font: 400 20px var(--sans); color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid rgba(241, 239, 233, .3); border-radius: 0; padding: 10px 2px; transition: border-color .15s; }
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-bottom-color: var(--mine); }
input:focus-visible { outline: none; }
input:disabled { opacity: .6; }
input.shake { animation: shake .35s; border-bottom-color: var(--low); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* The countdown: a thin ring with the seconds inside. */
.clock { position: relative; flex: none; width: 42px; height: 42px; display: grid; place-items: center; }
.clock svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.clock circle { fill: none; stroke-width: 2; }
.clock .track { stroke: rgba(241, 239, 233, .14); }
.clock .ring { stroke: var(--mine); stroke-dasharray: 131.95; transition: stroke .3s; }
.clock span { font: 500 14px var(--mono); font-variant-numeric: tabular-nums; }
.clock.low .ring { stroke: var(--low); }
.clock.low span { color: var(--low); }
.clock.last span { animation: beat 1s ease-out infinite; }
@keyframes beat { 0% { transform: scale(1.25); } 40% { transform: none; } }
.clock.stopped { opacity: .5; }
/* Paused while the server checks: the ring breathes slowly instead of counting down. */
.clock.waiting { opacity: 1; }
.clock.waiting .ring { animation: breathe 1.8s ease-in-out infinite; }
.clock.waiting span { color: var(--soft); animation: none; }
@keyframes breathe { 50% { opacity: .35; } }

.feedback { margin: 0; min-height: 1.4em; font-size: 13px; color: var(--soft); text-align: center; }
.feedback.wrong { color: var(--low); }
.feedback.calm { color: var(--ink); }
.suggest { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; font-size: 16px; animation: rise .25s ease-out; }
.suggest b { color: var(--mine); font-weight: 500; }
.suggest button { min-height: 36px; padding: 0 14px; font-size: 14px; }
.suggest small { color: var(--faint); font-size: 12px; }

/* ----- the end: everyone's map full-bleed, and one results panel over it ----- */
/* A sheet along the bottom on a phone; a panel down the left on a wide screen (body.end-side). The map has the rest. */
body[data-screen="end"] .hud { display: none; }
.end { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  padding: 20px 20px max(16px, env(safe-area-inset-bottom)); background: rgba(5, 6, 15, .94); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  animation: rise .5s ease-out; text-shadow: none; }
body.end-side .end { top: 0; right: auto; width: 380px; max-height: none; border-top: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 28px 28px 24px; }
.end p { margin: 0; }
.end-title { display: flex; align-items: baseline; gap: 10px; font-size: 14px; color: var(--soft); }
.end-title b { font-weight: 500; color: var(--ink); }
.headline { display: flex; align-items: baseline; gap: 14px; }
.score { margin: 0; font: 500 52px/.95 var(--mono); letter-spacing: -.02em; }
.kicker { color: var(--mine); font-size: 15px; }
.kicker:empty { display: none; }
.actions { display: flex; gap: 10px; margin-top: 4px; }
.actions button { flex: 1; }
.end .hint { font-size: 13px; color: var(--soft); }
.end-note { font-size: 14px; color: var(--soft); }
.end-note:empty { display: none; }

/* A rocket you have just earned. */
.unlock { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(242, 196, 109, .55); background: rgba(242, 196, 109, .06); }
.unlock canvas { flex: none; width: 72px; height: 40px; }
.unlock div { flex: 1; display: flex; flex-direction: column; }
.unlock small { font-size: 12px; color: var(--mine); }
.unlock b { font-weight: 500; }
.unlock button { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* How you did against everyone: where everyone finished (yours in gold), and how rare your answers were. */
.standing { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.standing > div { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.standing p, .standing span { font-size: 14px; color: var(--soft); line-height: 1.4; }
.standing p b { color: var(--ink); font-weight: 500; }
.standing p span { display: block; font-size: 12px; color: var(--faint); }
.standing .rare b { flex: none; width: 88px; font: 500 28px/1 var(--mono); color: var(--ink); }
.standing .alone-note { padding: 12px 0; border-bottom: 1px solid var(--line); }
.standing .alone-note:empty { display: none; }
.mini { flex: none; display: flex; align-items: flex-end; gap: 2px; width: 88px; height: 34px; }
.mini i { flex: 1; background: rgba(241, 239, 233, .22); border-radius: 1px; }
.mini i.you { background: var(--mine); }

/* Your answers: tap one to see that question on the map, and the question itself. */
.answers { list-style: none; margin: 0; padding: 0; }
.answers-head { display: flex; justify-content: space-between; padding: 0 0 6px; font-size: 12px; color: var(--faint); }
.answer { all: unset; box-sizing: border-box; display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; }
.answer .n { flex: none; width: 18px; color: var(--faint); font-size: 13px; padding-top: 2px; }
.answer .a { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.answer b { font-weight: 500; font-size: 15px; color: var(--mine); }
.answer small { display: none; font: 400 15px/1.35 var(--sans); color: var(--ink); }
.answer.open small { display: block; }
.answer .s { flex: none; font-size: 13px; color: var(--soft); padding-top: 2px; }
.answer.only .s { color: var(--mine); }
.answer.lost b { color: var(--low); font-weight: 400; }
.answer:hover b { text-decoration: underline; text-underline-offset: 3px; }
.answer:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
.answer.open, .end .answer.open:hover:not(:disabled) { background: linear-gradient(to right, rgba(242, 196, 109, .08), transparent); }
.end .answer:hover:not(:disabled) { background: none; }
.end { scrollbar-width: thin; scrollbar-color: rgba(241, 239, 233, .2) transparent; }

/* Back to your own path, on the map. */
.my-path { position: fixed; top: 16px; right: 16px; z-index: 3; min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 8px; background: rgba(5, 6, 15, .8); }

