/* Stellarchy: neon glass on deep space. One dark theme on purpose (it is a starfield). */
@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url(fonts/chakra-petch-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url(fonts/chakra-petch-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-mono-latin-700-normal.woff2) format("woff2"); }

:root {
  --void: #04060b; --deep: #070b16; --ink: #e8eef8; --muted: #8b97ad; --faint: #56627a; --line: rgba(120, 150, 210, .18); --line2: rgba(120, 150, 210, .32);
  --glass: rgba(10, 15, 28, .72); --glass2: rgba(14, 20, 36, .86);
  --gold: #f4e3b5; --sol: #ffe7a3; --cyan: #22d3c5; --mag: #ff3df2; --red: #ff4d5a; --ok: #3fcf6a;
  --me: var(--cyan);
  --display: "Chakra Petch", "Arial Narrow", sans-serif; --body: "IBM Plex Sans", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
  --r: 14px; --gut: max(12px, env(safe-area-inset-left, 0px)); --gutr: max(12px, env(safe-area-inset-right, 0px));
  --top: calc(10px + env(safe-area-inset-top, 0px)); --bot: calc(12px + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(ellipse 80% 60% at 70% 30%, #12183a 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 20% 80%, #1a0e2e 0%, transparent 60%), var(--void);
  color: var(--ink); font: 400 15px/1.45 var(--body); overflow: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
#stage { position: fixed; inset: 0; touch-action: none; }
#stage canvas { display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; contain: strict; }
body:has(#title:not([hidden])) #labels { opacity: 0; }
.lbl, .cnt { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; pointer-events: none; }
.lbl { font: 500 10.5px var(--mono); color: var(--muted); text-shadow: 0 0 4px #000, 0 0 2px #000; }
.lbl.sol { color: var(--sol); font-weight: 700; }
.cnt { font: 700 12px/1 var(--mono); font-variant-numeric: tabular-nums; text-shadow: 0 0 3px rgba(0, 0, 0, .55); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- glass and controls ---------- */
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset, 0 18px 50px rgba(0, 0, 0, .45); }
.eyebrow { font: 500 .7rem var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0; }
.btn { font: 700 .86rem var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line2); border-radius: 10px; padding: 10px 16px; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; }
.btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(160, 190, 255, .5); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.go { background: var(--me); color: #041014; border-color: transparent; box-shadow: 0 0 22px color-mix(in srgb, var(--me) 55%, transparent); }
.btn.go:hover { box-shadow: 0 0 32px color-mix(in srgb, var(--me) 75%, transparent); background: color-mix(in srgb, var(--me) 88%, #fff); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.btn.big { min-height: 54px; font-size: 1rem; padding: 12px 22px; }
.btn.small { min-height: 34px; padding: 6px 11px; font-size: .74rem; border-radius: 8px; }
.btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
.btn .ico { font-size: .9em; opacity: .85; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input, select { font: 500 .95rem var(--mono); color: var(--ink); background: rgba(0, 0, 0, .35); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
input[type=color] { padding: 3px; width: 48px; cursor: pointer; }
input[type=range] { accent-color: var(--me); padding: 0; min-height: 32px; border: 0; background: none; width: 100%; }
a { color: var(--gold); }

/* waiting bar: Skip and the pace share a row; planned ships are chips you tap to cancel (round 37) */
.waitrow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.waitrow:empty { display: none; }
.waitrow .seg { justify-content: center; }
.planrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.planchip { display: inline-flex; align-items: center; gap: 6px; font: 600 .78rem var(--body); color: var(--ink, #e8eefc); background: color-mix(in srgb, var(--me) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--me) 55%, transparent); border-radius: 999px; padding: 4px 6px 4px 11px; min-height: 32px; cursor: pointer;
  box-shadow: 0 0 10px color-mix(in srgb, var(--me) 22%, transparent); transition: background .15s, border-color .15s; }
.planchip b { font-weight: 700; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planchip i { font-style: normal; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--muted); font-size: .7rem; }
.planchip:hover, .planchip:focus-visible { border-color: #ff6b7a; background: rgba(255, 77, 90, .14); }
.planchip:hover i, .planchip:focus-visible i { background: #ff4d5a; color: #fff; }

/* "While you waited" recap (round 38) */
.recapbtn { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; width: 100%; font: 600 .82rem var(--body); color: #cfe3ff; cursor: pointer;
  background: rgba(62, 155, 255, .08); border: 1px dashed rgba(111, 179, 255, .45); border-radius: 12px; padding: 7px 12px; min-height: 38px; }
.recapbtn i { font-style: normal; color: var(--gold); letter-spacing: .06em; text-transform: uppercase; font-size: .7rem; }
.recapbtn.bad { color: #ffd0d4; background: rgba(255, 77, 90, .08); border-color: rgba(255, 107, 122, .5); box-shadow: 0 0 14px rgba(255, 77, 90, .15); }
.recapbtn:hover, .recapbtn:focus-visible { border-style: solid; }
.recaplist { display: grid; gap: 6px; }
.recaprow { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; text-align: left; cursor: pointer; font: .86rem var(--body); color: var(--ink, #e8eefc);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-left: 3px solid #4fd18b; border-radius: 10px; padding: 8px 12px; min-height: 44px; }
.recaprow.bad { border-left-color: #ff4d5a; }
.recaprow span { color: var(--muted); font-size: .8rem; }
.recaprow em { font-style: normal; font-weight: 700; }
.recaprow i { font-style: normal; color: var(--muted); }
.recaprow:hover, .recaprow:focus-visible { border-color: var(--line2); background: rgba(255, 255, 255, .06); }
@media (max-width: 520px) { .recaprow { grid-template-columns: 1fr auto; } .recaprow span { grid-column: 1; } .recaprow i { grid-row: 1 / 3; grid-column: 2; } }

/* note to the developer (round 42) */
textarea { font: .95rem/1.45 var(--body); color: inherit; width: 100%; resize: vertical; min-height: 120px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(0, 0, 0, .35); }
textarea:focus { outline: none; border-color: var(--me); box-shadow: 0 0 0 3px color-mix(in srgb, var(--me) 25%, transparent); }
.dlg.note .count { text-align: right; margin: 4px 0 0; }

/* end-the-game vote banner (round 42) */
.votebanner { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 12px; font-size: .84rem;
  background: rgba(255, 196, 77, .09); border: 1px solid rgba(255, 196, 77, .45); box-shadow: 0 0 16px rgba(255, 196, 77, .14); color: #ffe7b0; }
.votebanner .row { gap: 6px; }

/* ---------- title ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--top) var(--gutr) var(--bot) var(--gut); overflow: auto; z-index: 3;
  background: radial-gradient(ellipse at center, rgba(4, 6, 11, .1) 0%, rgba(4, 6, 11, .65) 75%); }
.title-inner { width: min(520px, 100%); display: grid; gap: 18px; justify-items: center; text-align: center; padding: 24px 0; }
.wordmark { margin: 0; font: 700 clamp(2.7rem, 11vw, 5.4rem)/.95 var(--display); letter-spacing: .12em; text-transform: uppercase; padding-left: .12em;
  background: linear-gradient(180deg, #fff 0%, #ffe7a3 45%, #ff9a3c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 170, 70, .45)) drop-shadow(0 0 2px rgba(255, 230, 170, .8)); }
.tagline { margin: 0; color: #c3cde0; max-width: 40ch; font-size: 1.02rem; }
.menu { display: grid; gap: 10px; width: min(360px, 100%); margin-top: 4px; }
.joinrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.joinrow input { text-transform: uppercase; letter-spacing: .4em; text-align: center; font-weight: 700; }
.fine { margin: 0; font-size: .8rem; color: var(--muted); }
.you { width: min(360px, 100%); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 15, 28, .55); cursor: pointer; text-align: left; }
.you:hover { border-color: var(--line2); }
.you .who { flex: 1; min-width: 0; }
.you .who b { font: 700 1rem var(--display); letter-spacing: .04em; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you .who span { font-size: .8rem; color: var(--muted); }
.swatch { width: 30px; height: 30px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px var(--sw-sub, #fff), 0 0 16px var(--sw-main, #fff); background: var(--sw-main, #fff); }
.swatch.s { width: 14px; height: 14px; box-shadow: 0 0 0 2px var(--sw-sub, #fff), 0 0 8px var(--sw-main, #fff); }
.edit { font: 500 .72rem var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }

/* ---------- dialog ---------- */
dialog { color: var(--ink); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line2); }
dialog::backdrop { background: rgba(2, 4, 8, .6); backdrop-filter: blur(3px); }
.dlg { display: grid; gap: 16px; padding: 20px; }
.dlg h2 { margin: 0; font: 700 1.35rem var(--display); letter-spacing: .06em; text-transform: uppercase; }
.dlg .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dlg .row.end { justify-content: flex-end; }
.field { display: grid; gap: 6px; }
.field > span { font: 500 .72rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font: 600 .82rem var(--body); color: var(--muted); background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; min-height: 40px; cursor: pointer; }
.seg button[aria-pressed=true] { color: #041014; background: var(--me); border-color: transparent; box-shadow: 0 0 14px color-mix(in srgb, var(--me) 50%, transparent); }
.seg.hulls button { font-size: 1.05rem; min-width: 52px; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.palette button { aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); min-height: 30px; }
.palette button[aria-pressed=true] { outline: 3px solid #fff; outline-offset: 2px; }
.preview { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.preview .swatch { width: 44px; height: 44px; }
.rooms { display: grid; gap: 8px; max-height: 50dvh; overflow: auto; }
.roomrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.roomrow .grow { flex: 1; min-width: 0; }
.roomrow b { font: 700 1rem var(--mono); letter-spacing: .2em; }
.roomrow .mini { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- HUD ---------- */
.topbar { position: fixed; top: var(--top); left: var(--gut); right: var(--gutr); display: flex; gap: 8px; align-items: center; z-index: 5;   /* above the sun card (round 39) */ pointer-events: none; }
.topbar > * { pointer-events: auto; }
.spacer { flex: 1; }
.chip { font: 700 .8rem var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; backdrop-filter: blur(10px); }
.chip.code { font-family: var(--mono); letter-spacing: .3em; color: var(--gold); }
.dotlogo { width: 10px; height: 10px; border-radius: 50%; background: var(--sol); box-shadow: 0 0 10px var(--sol); }
.iconbtn { position: relative; font: 700 1.05rem var(--mono); color: var(--ink); background: var(--glass); border: 1px solid var(--line); border-radius: 12px; min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(10px); }
.iconbtn .lab { font: 700 .72rem var(--display); letter-spacing: .12em; text-transform: uppercase; }
.iconbtn[aria-expanded=true] { border-color: var(--me); box-shadow: 0 0 12px color-mix(in srgb, var(--me) 40%, transparent); }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: #11161c; font: 700 .72rem/20px var(--mono); }
.badge.hot { background: var(--red); color: #fff; box-shadow: 0 0 12px var(--red); }

.panel { position: fixed; z-index: 4; overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.side { top: calc(var(--top) + 54px); left: var(--gut); width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - var(--top) - 200px); }
.side.right { left: auto; right: var(--gutr); }
.prow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 10px; border: 1px solid transparent; }
.prow.turn { border-color: color-mix(in srgb, var(--pc) 70%, transparent); background: color-mix(in srgb, var(--pc) 10%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--pc) 25%, transparent); }
.prow.out { opacity: .38; }
.prow .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .nm small { color: var(--muted); font-size: .74rem; margin-left: 4px; }
.prow .st { font: 500 .78rem var(--mono); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .06); overflow: hidden; grid-column: 1 / -1; }
.bar-track i { display: block; height: 100%; background: var(--pc); box-shadow: 0 0 8px var(--pc); }
.logline { font: 500 .78rem/1.4 var(--mono); color: var(--muted); }

.suncard { position: fixed; z-index: 4; right: var(--gutr); bottom: calc(var(--bot) + var(--barh, 150px) + 10px); width: min(300px, calc(100vw - 24px)); padding: 14px; display: grid; gap: 8px;
  /* round 39: a tall card (photo, facts) over a tall bar reached the top bar and swallowed taps on Cards; it now stops below the top bar and scrolls */
  max-height: calc(100dvh - var(--top) - 64px - var(--bot) - var(--barh, 150px) - 10px); overflow-y: auto; overscroll-behavior: contain; }
.suncard h3 { margin: 0; font: 700 1.15rem var(--display); letter-spacing: .03em; display: flex; gap: 8px; align-items: center; }
.suncard dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: .85rem; }
.suncard dt { color: var(--muted); }
.suncard dd { margin: 0; font-family: var(--mono); font-size: .8rem; }
.suncard .fact { margin: 0; font-size: .8rem; color: var(--gold); }
.sundot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; box-shadow: 0 0 8px currentColor; vertical-align: 0; }

.actionbar { position: fixed; z-index: 5; left: 50%; bottom: var(--bot); transform: translateX(-50%); width: min(620px, calc(100vw - 24px)); padding: 14px 18px 16px; display: grid; gap: 10px; justify-items: center; text-align: center;
  transition: border-color .25s, box-shadow .25s; }
.actionbar.mine { border-color: color-mix(in srgb, var(--me) 75%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--me) 40%, transparent), 0 0 40px color-mix(in srgb, var(--me) 30%, transparent), 0 18px 50px rgba(0, 0, 0, .5); }
.actionbar .big { font: 700 clamp(1.2rem, 4.6vw, 1.7rem)/1 var(--display); letter-spacing: .1em; text-transform: uppercase; }
.actionbar.mine .big { color: var(--me); text-shadow: 0 0 18px color-mix(in srgb, var(--me) 60%, transparent); }
.actionbar .what { font-size: .95rem; color: #c9d3e6; max-width: 52ch; }
.actionbar .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; width: 100%; }
.actionbar .row .btn { flex: 1 1 auto; max-width: 240px; }
.phases { display: flex; gap: 4px; justify-content: center; }
.phases i { font: 500 .62rem var(--mono); letter-spacing: .14em; text-transform: uppercase; font-style: normal; color: var(--faint); padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; }
.phases i.on { color: var(--me); border-color: color-mix(in srgb, var(--me) 50%, transparent); }
.stepper { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; }
.stepper output { font: 700 1.6rem var(--mono); min-width: 3ch; }
.dice { display: flex; gap: 6px; justify-content: center; font: 700 1.1rem var(--mono); }
.die { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); border: 1px solid var(--line2); }
.die.a { border-color: var(--me); color: var(--me); }
.die.d { border-color: var(--red); color: var(--red); }
.timer { font: 500 .78rem var(--mono); color: var(--gold); }
.timer.warn { color: var(--red); animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }

#toasts { position: fixed; z-index: 6; top: calc(var(--top) + 60px); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(460px, calc(100vw - 24px)); }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line2); font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: tin .25s ease-out; }
.toast.out { animation: tout .4s ease-in forwards; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
@keyframes tout { to { opacity: 0; transform: translateY(-8px); } }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cardface { position: relative; border: 1px solid var(--line); border-top: 3px solid var(--cc); border-radius: 10px; padding: 9px 10px; background: rgba(255, 255, 255, .035); display: grid; gap: 4px; font-size: .78rem; cursor: pointer; text-align: left; color: var(--ink); font-family: var(--body); }
.cardface[aria-pressed=true] { outline: 2px solid var(--cc); box-shadow: 0 0 18px color-mix(in srgb, var(--cc) 45%, transparent); background: color-mix(in srgb, var(--cc) 10%, transparent); }
.cardface .top { display: flex; gap: 6px; align-items: center; font: 700 .86rem var(--display); }
.cardface .ty { color: var(--muted); font-size: .74rem; }
.cardface .fact { color: var(--gold); font-size: .72rem; }
.cardface.k0 { --cc: #ff5a3c; } .cardface.k1 { --cc: #ffa340; } .cardface.k2 { --cc: #fff1b8; } .cardface.k3 { --cc: #f4e3b5; }

.win { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 28px 22px; }
.win .crown { font-size: 2.6rem; filter: drop-shadow(0 0 16px var(--wc)); }
.win h2 { color: var(--wc); text-shadow: 0 0 22px var(--wc); }

/* ---------- small screens: bottom sheets, a compact bar ---------- */
@media (max-width: 700px) {
  .iconbtn .lab { display: none; }
  .iconbtn { padding: 0; width: 44px; }
  .chip.brand { font-size: 0; gap: 0; padding: 0 14px; }
  .chip.brand .dotlogo { margin: 0; }
  .side, .side.right { top: auto; left: var(--gut); right: var(--gutr); width: auto; bottom: calc(var(--bot) + var(--barh, 132px) + 10px); max-height: 46dvh; }
  .suncard { left: var(--gut); right: var(--gutr); width: auto; bottom: calc(var(--bot) + var(--barh, 132px) + 10px); padding: 10px 12px; }
  .suncard dl { grid-template-columns: auto 1fr auto 1fr; }
  .actionbar { width: calc(100vw - var(--gut) - var(--gutr)); padding: 10px 12px 12px; gap: 8px; }
  .actionbar .what { font-size: .86rem; }
  .actionbar .row .btn { min-height: 46px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .actionbar { left: auto; right: var(--gutr); transform: none; width: min(360px, 46vw); }
  .suncard { left: var(--gut); right: auto; width: min(280px, 40vw); bottom: var(--bot); max-height: calc(100dvh - var(--top) - 60px - var(--bot)); }
  .side, .side.right { bottom: var(--bot); top: calc(var(--top) + 52px); left: var(--gut); right: auto; width: min(280px, 40vw); max-height: none; }
  .title-inner { gap: 10px; }
  /* round 36: landscape phones were tested for the first time. The bar took 84% of the height and the title hid the menu */
  .actionbar { padding: 8px 12px 10px; gap: 6px; max-height: calc(100dvh - var(--top) - var(--bot) - 64px); overflow-y: auto; bottom: var(--bot); }
  .actionbar .big { font-size: 1.05rem; }
  .actionbar .what { font-size: .8rem; line-height: 1.35; }
  .actionbar .row .btn { min-height: 40px; padding: 6px 12px; font-size: .82rem; }
  .actionbar .seg button { min-height: 34px; padding: 4px 10px; font-size: .8rem; }
  .actionbar .phases { font-size: .66rem; }
  .iconbtn .lab { display: none; }
  .iconbtn { padding: 0; width: 44px; }
  #toasts { left: var(--gut); transform: none; width: min(340px, calc(100vw - min(360px, 46vw) - var(--gut) - var(--gutr) - 16px)); top: calc(var(--top) + 56px); }
  .screen { place-items: start center; }
  .title-inner { width: min(680px, 100%); padding: 6px 0; }
  .wordmark { font-size: min(9vw, 17vh); }
  .tagline { font-size: .86rem; max-width: 60ch; }
  .menu { grid-template-columns: 1fr 1fr; width: min(620px, 100%); gap: 8px; }
  .menu .btn.big { min-height: 44px; padding: 8px 14px; }
  .menu .btn:not(.big), .joinrow input { min-height: 40px; }
  .title-inner { gap: 8px; }
  .menu > :first-child, .menu > :last-child { grid-column: 1 / -1; }
  /* round 37: the waiting bar in one short block: Skip and the pace on one row, short labels, smaller chips */
  .actionbar .long { display: none; }
  .waitrow { flex-wrap: nowrap; gap: 6px; }
  .waitrow .btn { min-height: 34px; padding: 4px 12px; font-size: .78rem; flex: none; }
  .waitrow .seg { flex-wrap: nowrap; gap: 4px; }
  .waitrow .seg button { padding: 4px 8px; font-size: .74rem; }
  .planchip { min-height: 28px; font-size: .72rem; padding: 2px 4px 2px 9px; }
  .planchip i { width: 18px; height: 18px; }
  .planrow .btn.small { min-height: 28px; padding: 2px 10px; font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- quick chat ---------- */
.emotepop { position: fixed; z-index: 7; top: calc(var(--top) + 54px); right: var(--gutr); padding: 10px; display: grid; grid-template-columns: repeat(4, auto); gap: 6px; }
.emotepop button { font: 600 .9rem var(--body); color: var(--ink); background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 10px; min-width: 52px; min-height: 42px; padding: 6px 10px; cursor: pointer; }
.emotepop button:hover { border-color: var(--me); box-shadow: 0 0 12px color-mix(in srgb, var(--me) 40%, transparent); }
#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.bubble { position: absolute; left: 0; top: 0; padding: 7px 12px; border-radius: 14px 14px 14px 4px; background: var(--glass2); border: 1.5px solid var(--bc); color: var(--ink); font: 600 .95rem var(--body); white-space: nowrap;
  box-shadow: 0 0 18px color-mix(in srgb, var(--bc) 45%, transparent); animation: bub 2.8s ease-out forwards; }
.bubble small { display: block; font: 500 .66rem var(--mono); color: var(--bc); letter-spacing: .08em; text-transform: uppercase; }
@keyframes bub { 0% { opacity: 0; transform: var(--at) translateY(6px) scale(.9); } 10% { opacity: 1; transform: var(--at) scale(1); } 80% { opacity: 1; transform: var(--at); } 100% { opacity: 0; transform: var(--at) translateY(-10px); } }
@media (max-width: 700px) { .emotepop { left: var(--gut); right: var(--gutr); grid-template-columns: repeat(5, 1fr); } }
dialog.tip::backdrop { background: rgba(2, 4, 8, .12); backdrop-filter: none; }
dialog.tip { top: auto; bottom: calc(var(--bot) + var(--barh, 150px) + 16px); margin-bottom: 0; }

/* ---------- dice and battle losses ---------- */
.dice { align-items: center; flex-wrap: wrap; }
.dice .vs { opacity: .5; font-size: .8rem; margin: 0 4px; }
.dice .tally { flex-basis: 100%; font: 500 .78rem var(--mono); color: var(--muted); margin-top: 2px; }
.die { transition: opacity .2s, box-shadow .2s; }
.die.won { box-shadow: 0 0 12px currentColor; background: color-mix(in srgb, currentColor 16%, transparent); }
.die.lost { opacity: .45; }
.dice.fresh .die { animation: tumble .55s cubic-bezier(.2, .8, .3, 1.2) backwards; animation-delay: calc(var(--j) * 45ms); }
@keyframes tumble { 0% { transform: translateY(-14px) rotate(-200deg) scale(.6); opacity: 0; } 70% { transform: translateY(2px) rotate(12deg) scale(1.08); opacity: 1; } 100% { transform: none; } }
.dmg { position: absolute; left: 0; top: 0; font: 700 1.05rem var(--mono); color: var(--c); text-shadow: 0 0 10px var(--c), 0 0 2px #000; animation: dmg 1.4s ease-out forwards; pointer-events: none; }
@keyframes dmg { 0% { opacity: 0; transform: var(--at) translate(-50%, 6px) scale(.8); } 15% { opacity: 1; transform: var(--at) translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: var(--at) translate(-50%, -34px) scale(1); } }
@media (max-width: 700px) {
  .suncard:not(.open) dl dt:nth-of-type(n+3), .suncard:not(.open) dl dd:nth-of-type(n+3), .suncard:not(.open) .fact, .suncard:not(.open) .eyebrow, .suncard:not(.open) .sky { display: none; }
  .suncard { cursor: pointer; }
  .suncard:not(.open)::after { content: "Tap for the science"; font: 500 .66rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
}

/* ---------- results ---------- */
.chart { margin: 0; width: 100%; display: grid; gap: 4px; }
.chart svg { width: 100%; height: auto; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 10px; }
.chart polyline { fill: none; stroke: var(--lc); stroke-width: 2; stroke-linejoin: round; opacity: .75; filter: drop-shadow(0 0 3px var(--lc)); }
.chart polyline.lead { stroke-width: 3.2; opacity: 1; }
.chart .grid { stroke: rgba(255, 255, 255, .1); stroke-dasharray: 4 6; }
.chart figcaption { display: flex; justify-content: space-between; font: 500 .68rem var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.standings { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .85rem; }
.standings > span { display: inline-flex; align-items: center; gap: 6px; }
.standings b { font: 700 .8rem var(--mono); color: var(--muted); }
.standings .me { color: var(--pc); font-weight: 600; }
.win { width: 100%; }
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }

/* ---------- drag to attack ---------- */
.dragline { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; opacity: 0; transition: opacity .12s; }
.dragline.on { opacity: 1; }
.dragline line { stroke: var(--dc); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 9; filter: drop-shadow(0 0 6px var(--dc)); animation: march .5s linear infinite; }
.dragline.locked line { stroke-dasharray: none; stroke-width: 4; }
@keyframes march { to { stroke-dashoffset: -11; } }

/* ---------- truces ---------- */
.truce { font-size: .95rem; filter: drop-shadow(0 0 6px rgba(244, 227, 181, .7)); }
.truce.pending { opacity: .6; font-size: .8rem; }
.truce-btn { min-height: 28px; padding: 2px 6px; font-size: .9rem; opacity: .55; }
.truce-btn:hover { opacity: 1; }
.toast.ask { pointer-events: auto; display: flex; gap: 12px; align-items: center; border-color: var(--gold); box-shadow: 0 0 22px rgba(244, 227, 181, .25), 0 10px 30px rgba(0, 0, 0, .5); }
.moments { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; width: 100%; font-size: .88rem; }
.moments li { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); }
.moments li > span:first-child { flex: none; }
.dlg.how h3 { margin: 4px 0 0; font: 700 .95rem var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.dlg.how ol, .dlg.how ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .9rem; color: #c9d3e6; }
.rlbl { position: absolute; left: 0; top: 0; font: 700 13px var(--display); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; pointer-events: none; text-shadow: 0 0 10px currentColor, 0 0 3px #000; will-change: transform, opacity; }
.regionrow { width: 100%; text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.regionrow:hover { border-color: var(--line2); background: rgba(255, 255, 255, .06); }
.cardface .sci { font-size: .72rem; color: #c9d3e6; line-height: 1.35; border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
.sky { margin: 2px 0 0; display: grid; gap: 2px; }
.sky svg { width: 100%; height: auto; border-radius: 6px; background: radial-gradient(ellipse at 50% 40%, #0d1630, #04060b 75%); border: 1px solid var(--line); }
.sky figcaption { font: 500 .62rem var(--mono); color: var(--muted); letter-spacing: .04em; }
.sky img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #04060b; display: block; }
.sky.photo svg, .sky.photo.noimg img { display: none; }
.sky.photo.noimg svg { display: block; }
.sky .cr { display: block; opacity: .7; font-size: .56rem; margin-top: 1px; }
.shippreview { display: block; width: 100%; height: 170px; border-radius: 12px; border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 55%, #10183a, #04060b 75%); }
