:root {
  color-scheme: dark;
  --ink: #f4f8ff;
  --muted: #91a4c2;
  --muted-strong: #b7c5db;
  --surface: rgba(8, 19, 42, .86);
  --surface-strong: rgba(10, 25, 52, .96);
  --surface-soft: rgba(16, 34, 66, .66);
  --line: rgba(127, 183, 235, .18);
  --line-strong: rgba(127, 210, 255, .34);
  --cyan: #43d6ff;
  --cyan-soft: #a3efff;
  --green: #68f0a6;
  --gold: #ffd768;
  --violet: #a77cff;
  --danger: #ff657a;
  --orange: #ff9f62;
  --shadow: 0 24px 80px rgba(0, 0, 0, .36);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: #050817;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 55% -5%, rgba(49, 141, 201, .19), transparent 36rem),
    linear-gradient(180deg, #060b1b 0%, #050817 52%, #071023 100%);
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:not(:disabled), label, [role="button"] { cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(67, 214, 255, .8);
  outline-offset: 3px;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.nebula, .starfield { position: absolute; inset: -20%; }
.nebula { filter: blur(44px); opacity: .62; }
.nebula-a {
  background: radial-gradient(ellipse at 24% 30%, rgba(47, 125, 196, .23), transparent 27%), radial-gradient(ellipse at 76% 60%, rgba(110, 61, 186, .17), transparent 31%);
  animation: drift-a 24s ease-in-out infinite alternate;
}
.nebula-b {
  background: radial-gradient(ellipse at 62% 10%, rgba(52, 218, 229, .1), transparent 23%), radial-gradient(ellipse at 18% 86%, rgba(80, 160, 221, .12), transparent 22%);
  animation: drift-b 30s ease-in-out infinite alternate;
}
.starfield {
  opacity: .45;
  background-image:
    radial-gradient(circle at 15% 28%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 62% 18%, #86ddff 0 1px, transparent 1.7px),
    radial-gradient(circle at 84% 69%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 33% 79%, #a8bfff 0 1px, transparent 1.6px);
  background-size: 162px 138px, 247px 197px, 314px 263px, 381px 329px;
}
.starfield-b { transform: scale(.72) rotate(18deg); opacity: .26; }

@keyframes drift-a { to { transform: translate3d(3%, -2%, 0) scale(1.06); } }
@keyframes drift-b { to { transform: translate3d(-2%, 3%, 0) scale(.96); } }

.app-shell { width: min(1600px, 100%); min-height: 100vh; min-height: 100dvh; margin: 0 auto; }
.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(76px + var(--safe-top));
  padding: calc(12px + var(--safe-top)) max(24px, var(--safe-right)) 12px max(24px, var(--safe-left));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px;
  border: 0;
  background: transparent;
  text-align: left;
}
.brand strong { display: block; font-size: 17px; letter-spacing: .13em; }
.brand small { display: block; margin-top: 2px; color: #6f86a8; font-size: 8px; font-weight: 800; letter-spacing: .32em; }
.brand-mark { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(91, 211, 255, .38); border-radius: 50%; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border: 1px solid rgba(91, 211, 255, .26); border-radius: 50%; transform: rotate(-20deg); }
.brand-mark::before { width: 50px; height: 18px; }
.brand-mark::after { width: 20px; height: 50px; }
.brand-mark i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 11px var(--cyan); }
.brand-mark i:nth-child(1) { transform: translate(-18px, -7px); }
.brand-mark i:nth-child(2) { width: 10px; height: 10px; background: var(--gold); }
.brand-mark i:nth-child(3) { transform: translate(14px, 11px); background: var(--green); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.save-state { display: inline-flex; align-items: center; gap: 8px; margin-right: 7px; color: #7f93b0; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.save-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px rgba(104, 240, 166, .8); }
.save-state.is-saving i { background: var(--gold); }
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(12, 27, 54, .62);
  color: var(--muted-strong);
  transition: border-color .2s, background .2s, transform .2s;
}
.icon-button:hover { border-color: var(--line-strong); background: rgba(20, 44, 80, .84); transform: translateY(-1px); }

.screen { display: none; animation: screen-in .45s ease both; }
.screen.is-active { display: block; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

.home-screen { padding: clamp(28px, 5vw, 76px) clamp(24px, 6vw, 90px) 70px; }
.home-screen.is-active { display: grid; grid-template-columns: minmax(390px, .85fr) minmax(520px, 1.15fr); align-items: center; gap: clamp(35px, 6vw, 110px); }
.hero-copy { position: relative; z-index: 2; max-width: 660px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 22px; color: var(--cyan-soft); font-size: 11px; font-weight: 900; letter-spacing: .25em; text-transform: uppercase; }
.eyebrow > span { display: inline-block; width: 28px; height: 1px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.hero-copy h1, .setup-heading h1 { margin: 0; font-family: "STKaiti", "KaiTi", "Songti SC", serif; font-weight: 600; line-height: 1.12; letter-spacing: .02em; }
.hero-copy h1 { font-size: clamp(54px, 6.6vw, 100px); }
.hero-copy h1 em { color: transparent; background: linear-gradient(100deg, #fff2b0, var(--gold) 33%, #84ebd2 72%, var(--cyan)); background-clip: text; -webkit-background-clip: text; font-style: normal; text-shadow: 0 9px 40px rgba(95, 217, 224, .12); }
.hero-lead { max-width: 560px; margin: 28px 0 34px; color: var(--muted-strong); font-size: clamp(15px, 1.4vw, 18px); line-height: 1.9; }
.hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.primary-button, .secondary-button, .compact-button {
  border: 0;
  border-radius: 15px;
  font-weight: 800;
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-width: 216px;
  min-height: 57px;
  padding: 0 12px 0 24px;
  color: #04101c;
  background: linear-gradient(105deg, #d4fff7, #62e4dd 40%, #43d6ff);
  box-shadow: 0 14px 40px rgba(67, 214, 255, .2), inset 0 1px rgba(255,255,255,.7);
}
.primary-button b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: rgba(1, 18, 30, .12); font-size: 19px; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 18px 52px rgba(67, 214, 255, .28); filter: brightness(1.05); }
.secondary-button { min-height: 57px; padding: 0 24px; border: 1px solid var(--line-strong); color: #dce9f8; background: rgba(11, 27, 54, .68); }
.secondary-button:hover { transform: translateY(-2px); background: rgba(18, 42, 78, .86); }
.hero-facts { display: flex; gap: 0; margin: 46px 0 0; padding: 0; list-style: none; }
.hero-facts li { display: grid; gap: 3px; min-width: 108px; padding: 0 24px; border-left: 1px solid var(--line); }
.hero-facts li:first-child { padding-left: 0; border-left: 0; }
.hero-facts strong { font-size: 19px; font-weight: 900; }
.hero-facts span { color: #7589a8; font-size: 11px; }

.hero-visual { position: relative; width: min(100%, 720px); aspect-ratio: 1.05; margin: 0 auto; isolation: isolate; }
.hero-visual::before { content: ""; position: absolute; inset: 10% 5%; border-radius: 50%; background: radial-gradient(circle, rgba(35, 134, 196, .21), transparent 58%); filter: blur(26px); }
.hero-halo { position: absolute; left: 50%; top: 48%; border: 1px solid rgba(101, 185, 237, .13); border-radius: 50%; transform: translate(-50%, -50%) rotate(-17deg); }
.hero-halo-one { width: 78%; height: 38%; }
.hero-halo-two { width: 44%; height: 87%; transform: translate(-50%, -50%) rotate(39deg); }
.hero-orbit { position: absolute; left: 50%; top: 48%; width: 67%; aspect-ratio: 1; border: 1px solid rgba(112, 208, 255, .25); border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 44px rgba(56, 175, 235, .09), inset 0 0 46px rgba(56, 175, 235, .05); }
.hero-orbit::before { content: ""; position: absolute; inset: -5px; border: 7px solid transparent; border-top-color: rgba(255, 213, 104, .62); border-right-color: rgba(112, 243, 135, .48); border-bottom-color: rgba(67, 214, 255, .45); border-radius: 50%; filter: blur(7px); opacity: .55; }
.orbit-dot { --angle: 0deg; --dot: #43d6ff; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; border-radius: 50%; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-238%) rotate(calc(-1 * var(--angle))); background: radial-gradient(circle at 34% 28%, #fff, var(--dot) 28%, color-mix(in srgb, var(--dot), #071127 55%) 73%); box-shadow: 0 0 15px color-mix(in srgb, var(--dot), transparent 25%); }
.orbit-dot:nth-child(2n) { width: 18px; height: 18px; background: #09172f; border: 2px solid var(--dot); }
.hero-wormhole { position: absolute; left: 50%; top: 48%; display: grid; place-items: center; width: 21%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle, #010209 0 23%, #5934a8 29%, #2fb9d6 48%, transparent 70%); }
.hero-wormhole span { position: absolute; inset: 7%; border: 1px dashed rgba(157, 231, 255, .72); border-radius: 50%; animation: spin 18s linear infinite; }
.hero-wormhole span:nth-child(2) { inset: 16%; border-color: rgba(185, 116, 255, .68); animation-direction: reverse; animation-duration: 11s; }
.hero-wormhole span:nth-child(3) { inset: 25%; border-style: solid; border-color: rgba(255,255,255,.22); }
.hero-wormhole strong { position: relative; z-index: 2; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(15px, 2vw, 24px); letter-spacing: .18em; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-ship { position: absolute; display: flex; align-items: center; gap: 7px; filter: drop-shadow(0 0 11px var(--ship)); }
.hero-ship i { display: block; width: 34px; height: 24px; background: var(--ship); clip-path: polygon(100% 50%, 21% 0, 35% 38%, 0 50%, 35% 62%, 21% 100%); }
.hero-ship span { padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--ship), transparent 40%); border-radius: 7px; color: #eafcff; background: rgba(3, 9, 23, .75); font: 800 9px/1 system-ui; }
.ship-cyan { --ship: var(--cyan); top: 15%; left: 51%; transform: rotate(17deg); }
.ship-gold { --ship: var(--gold); top: 67%; left: 19%; transform: rotate(-44deg); }
.ship-violet { --ship: var(--violet); top: 55%; right: 11%; transform: rotate(112deg); }
.black-hole-preview { position: absolute; display: grid; place-items: center; width: 15%; aspect-ratio: 1.45; border: 1px solid rgba(150, 116, 255, .3); border-radius: 50%; background: radial-gradient(ellipse, #000 0 44%, #1c0f36 54%, rgba(66, 203, 255, .15) 66%, transparent 72%); transform: rotate(-9deg); }
.black-hole-preview i { position: absolute; inset: 7%; border-top: 2px solid rgba(130, 216, 255, .55); border-radius: 50%; animation: spin 8s linear infinite; }
.black-hole-preview span { position: relative; font-size: 10px; font-weight: 800; }
.black-hole-left { left: 1%; top: 41%; }
.black-hole-right { right: 0; top: 30%; transform: rotate(12deg); }
.visual-caption { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); white-space: nowrap; color: #7690b2; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.visual-caption span { display: inline-block; width: 34px; height: 1px; margin: 0 8px 3px 0; background: var(--cyan); }

.home-panels { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-top: 16px; }
.info-card { display: flex; gap: 17px; min-height: 132px; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius-md); background: linear-gradient(135deg, rgba(11, 26, 53, .7), rgba(8, 17, 37, .48)); }
.card-number { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(80, 208, 255, .32); border-radius: 10px; color: var(--cyan); font-size: 10px; font-weight: 900; }
.info-card h2 { margin: 0 0 7px; font-size: 16px; }
.info-card p { margin: 0; color: #8599b7; font-size: 12px; line-height: 1.75; }

.setup-screen { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 90px; }
.setup-heading { max-width: 690px; margin: 0 auto 34px; text-align: center; }
.setup-heading .eyebrow { justify-content: center; margin-top: 20px; }
.setup-heading h1 { font-size: clamp(38px, 5vw, 64px); }
.setup-heading > p:last-child { color: var(--muted); line-height: 1.8; }
.text-button { border: 0; color: var(--muted); background: transparent; }
.text-button:hover { color: var(--ink); }
.setup-card { padding: clamp(20px, 4vw, 42px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: linear-gradient(140deg, rgba(10, 25, 51, .94), rgba(6, 15, 34, .93)); box-shadow: var(--shadow); }
.setup-section + .setup-section { margin-top: 35px; padding-top: 34px; border-top: 1px solid var(--line); }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.section-heading-row > div:first-child { display: flex; align-items: center; gap: 12px; }
.section-heading-row h2 { margin: 0; font-size: 18px; }
.step-chip, .turn-chip { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 9px; border: 1px solid rgba(67, 214, 255, .28); border-radius: 8px; color: var(--cyan); background: rgba(67, 214, 255, .07); font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.count-stepper { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 13, 30, .72); }
.count-stepper button { display: grid; place-items: center; width: 34px; height: 30px; border: 0; border-radius: 8px; color: var(--muted-strong); background: transparent; font-size: 20px; }
.count-stepper button:hover { background: rgba(67, 214, 255, .1); }
.count-stepper output { min-width: 34px; color: var(--ink); text-align: center; font-weight: 900; }
.player-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.player-field { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 14, 33, .6); }
.player-color { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid color-mix(in srgb, var(--player-color), transparent 40%); border-radius: 11px; color: #06111c; background: var(--player-color); font-size: 11px; font-weight: 1000; box-shadow: 0 0 16px color-mix(in srgb, var(--player-color), transparent 72%); }
.player-field input { width: 100%; min-width: 0; padding: 10px 2px; border: 0; outline: 0; color: var(--ink); background: transparent; font-weight: 750; }
.player-field input::placeholder { color: #637797; }
.skill-set-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.choice-card { position: relative; display: flex; flex-direction: column; min-height: 146px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(7, 16, 36, .64); transition: border-color .2s, transform .2s, background .2s; }
.choice-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.choice-card.selected { border-color: rgba(67, 214, 255, .58); background: linear-gradient(150deg, rgba(29, 77, 106, .48), rgba(9, 25, 50, .76)); box-shadow: inset 0 0 30px rgba(67, 214, 255, .05); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card::after { content: ""; position: absolute; right: 13px; top: 13px; width: 15px; height: 15px; border: 1px solid #536a8b; border-radius: 50%; }
.choice-card.selected::after { border: 4px solid #b7f5ff; background: var(--cyan); box-shadow: 0 0 9px var(--cyan); }
.choice-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 16px; border-radius: 10px; color: var(--cyan-soft); background: rgba(67, 214, 255, .09); }
.choice-card strong { margin-bottom: 7px; font-size: 14px; }
.choice-card small { color: #7187a8; font-size: 10px; line-height: 1.6; }
.setup-note { display: flex; gap: 13px; margin-top: 28px; padding: 15px; border: 1px solid rgba(255, 215, 104, .2); border-radius: 13px; background: rgba(255, 215, 104, .05); }
.setup-note > span { flex: 0 0 auto; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid rgba(255, 215, 104, .38); border-radius: 50%; color: var(--gold); font-family: serif; }
.setup-note p { margin: 0; color: #8091ad; font-size: 11px; line-height: 1.7; }
.setup-note strong { display: block; margin-bottom: 2px; color: #dbe6f4; }
.launch-button { width: min(100%, 320px); margin: 28px auto 0; display: flex; }

.game-screen { padding: 10px max(18px, var(--safe-right)) max(32px, var(--safe-bottom)) max(18px, var(--safe-left)); }
.game-statusbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; min-height: 70px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7, 18, 40, .7); backdrop-filter: blur(16px); }
.phase-identity { display: flex; align-items: center; gap: 13px; }
.round-pill { display: grid; place-items: center; min-width: 72px; height: 42px; border: 1px solid rgba(67, 214, 255, .36); border-radius: 12px; color: var(--cyan-soft); background: rgba(67, 214, 255, .08); font-size: 11px; font-weight: 900; }
.phase-identity small { display: block; color: #5e7699; font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.phase-identity strong { display: block; margin-top: 3px; font-size: 16px; }
.phase-timer { text-align: center; }
.phase-timer span { display: block; color: #617a9d; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.phase-timer strong { display: block; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: .11em; }
.compact-button { justify-self: end; min-height: 42px; padding: 0 18px; color: #06101b; background: linear-gradient(100deg, #b8fff1, var(--cyan)); }
.compact-button:hover { transform: translateY(-1px); box-shadow: 0 8px 25px rgba(67, 214, 255, .19); }
.compact-button.danger { color: #fff; background: linear-gradient(100deg, #b53c61, var(--danger)); }

.player-strip { display: flex; gap: 8px; padding: 10px 2px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.player-strip::-webkit-scrollbar { display: none; }
.player-pill { --player: var(--cyan); position: relative; flex: 1 0 146px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; min-width: 146px; max-width: 230px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 13px; background: rgba(8, 18, 39, .7); scroll-snap-align: start; transition: border-color .2s, background .2s; }
.player-pill::before { content: ""; position: absolute; inset: -1px auto -1px -1px; width: 3px; border-radius: 13px 0 0 13px; background: var(--player); box-shadow: 0 0 10px var(--player); }
.player-pill.active { border-color: color-mix(in srgb, var(--player), transparent 35%); background: color-mix(in srgb, var(--player) 11%, rgba(8, 18, 39, .87)); }
.player-pill.eliminated { opacity: .45; filter: grayscale(.8); }
.pill-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #07121e; background: var(--player); font-size: 9px; font-weight: 1000; }
.pill-name { min-width: 0; }
.pill-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.pill-name small { display: block; margin-top: 3px; color: #6f84a3; font-size: 8px; }
.pill-engine { text-align: right; }
.pill-engine strong { display: block; color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; }
.pill-engine small { color: #677d9d; font-size: 7px; }

.game-layout { display: grid; grid-template-columns: minmax(560px, 1.45fr) minmax(320px, .55fr); gap: 12px; min-height: calc(100dvh - 184px - var(--safe-top)); }
.board-card, .control-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(8, 20, 43, .88), rgba(5, 13, 30, .84)); box-shadow: 0 18px 52px rgba(0,0,0,.18); }
.board-card { position: relative; display: flex; flex-direction: column; min-height: 620px; border-radius: var(--radius-lg); overflow: hidden; }
.board-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 46%, rgba(44, 138, 197, .12), transparent 46%), linear-gradient(115deg, transparent 30%, rgba(101, 220, 255, .025) 50%, transparent 70%); }
.board-toolbar { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; min-height: 50px; padding: 8px 13px; border-bottom: 1px solid rgba(126, 181, 231, .1); }
.legend { display: flex; gap: 15px; color: #6c83a4; font-size: 8px; font-weight: 700; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { display: block; width: 8px; height: 8px; border-radius: 50%; }
.legend-planet { background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
.legend-home { border: 2px solid var(--green); }
.legend-danger { background: var(--danger); }
.zoom-controls { display: flex; padding: 3px; border: 1px solid rgba(126, 181, 231, .13); border-radius: 9px; }
.zoom-controls button { display: grid; place-items: center; width: 28px; height: 26px; border: 0; color: #748aa9; background: transparent; }
.zoom-controls button:hover { color: #e7f5ff; background: rgba(67, 214, 255, .08); }
.board-viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: pan-x pan-y; }
.game-board { display: block; width: 100%; height: 100%; min-height: 540px; transform: scale(var(--board-scale, 1)); transform-origin: center; transition: transform .2s ease; }
.orbit-track { fill: none; }
.orbit-track-wide { stroke: url(#orbitGradient); stroke-width: 24; stroke-opacity: .11; filter: url(#softGlow); }
.orbit-track-core { stroke: url(#orbitGradient); stroke-width: 2.5; stroke-opacity: .7; stroke-dasharray: 4 8; }
.board-node { --node-color: var(--cyan); transition: opacity .2s, transform .2s; transform-box: fill-box; transform-origin: center; }
.board-node:hover, .board-node.is-selectable { transform: scale(1.08); }
.board-node.is-destroyed { opacity: .16; filter: grayscale(1); pointer-events: none; }
.node-hit { fill: transparent; stroke: transparent; stroke-width: 12; }
.node-aura { fill: var(--node-color); opacity: .12; filter: url(#softGlow); }
.node-orb { fill: #07152d; stroke: var(--node-color); stroke-width: 2.5; filter: url(#nodeGlow); }
.board-node.home .node-orb { fill: color-mix(in srgb, var(--node-color) 14%, #07152d); stroke-dasharray: 5 3; }
.board-node.is-selectable .node-orb { stroke: #fff2a9; stroke-width: 5; animation: node-pulse 1.1s ease-in-out infinite alternate; }
@keyframes node-pulse { to { filter: drop-shadow(0 0 12px #fff2a9); } }
.node-title { fill: #eaf7ff; font: 800 13px/1 system-ui; letter-spacing: .06em; pointer-events: none; }
.node-subtitle { fill: #7089aa; font: 800 9px/1 system-ui; letter-spacing: .13em; pointer-events: none; }
.node-number { fill: var(--node-color); font: 1000 19px/1 system-ui; pointer-events: none; }
.danger-marker path { fill: rgba(255, 101, 122, .15); stroke: var(--danger); stroke-width: 2; }
.danger-marker text { fill: #ffc2cc; font: 800 10px/1 system-ui; }
.player-piece { --player: var(--cyan); filter: drop-shadow(0 0 9px color-mix(in srgb, var(--player), transparent 35%)); transition: transform .45s cubic-bezier(.2,.75,.2,1); }
.player-piece .piece-disc { fill: #050a16; stroke: var(--player); stroke-width: 4; }
.player-piece .piece-ship { fill: var(--player); }
.player-piece .piece-label { fill: #07111d; font: 1000 10px/1 system-ui; }
.player-piece.is-active .piece-disc { stroke-width: 7; animation: active-piece 1s ease-in-out infinite alternate; }
@keyframes active-piece { to { stroke-opacity: .55; transform: scale(1.08); transform-origin: center; } }
.black-hole-svg .hole-disc { fill: url(#blackHoleGradient); stroke: rgba(139, 110, 255, .54); stroke-width: 2; }
.black-hole-svg .hole-ring { fill: none; stroke: rgba(72, 215, 255, .62); stroke-width: 2; stroke-dasharray: 7 11; transform-box: fill-box; transform-origin: center; animation: spin 11s linear infinite; }
.black-hole-svg text { fill: #d4dded; font: 800 11px/1 system-ui; letter-spacing: .08em; }
.black-hole-svg .hole-cost { fill: #7489a7; font-size: 8px; }
.wormhole-ring { transform-box: fill-box; transform-origin: center; }
.ring-outer { animation: spin 16s linear infinite; filter: url(#softGlow); }
.ring-inner { animation: wormhole-breathe 2.8s ease-in-out infinite alternate; }
@keyframes wormhole-breathe { to { transform: scale(1.08); opacity: .76; } }
.wormhole-title, .eye-label { fill: #eef9ff; font: 700 20px/1 "STKaiti", "KaiTi", serif; letter-spacing: .2em; }
.wormhole-caption { fill: #6c81a2; font: 900 7px/1 system-ui; letter-spacing: .22em; }
.eye-label { fill: #aec8df; font-size: 13px; }
.move-route { fill: none; stroke: #fff1a8; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 12 13; marker-end: url(#routeArrow); filter: drop-shadow(0 0 7px rgba(255, 215, 104, .7)); animation: route-flow 1s linear infinite; }
@keyframes route-flow { to { stroke-dashoffset: -25; } }
.board-prompt { position: absolute; z-index: 3; left: 50%; bottom: 13px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 30px); min-height: 34px; padding: 8px 13px; border: 1px solid rgba(74, 211, 255, .21); border-radius: 10px; color: #a7bad1; background: rgba(4, 11, 26, .82); transform: translateX(-50%); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(10px); }
.board-prompt i { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

.control-column { display: grid; grid-template-rows: auto minmax(300px, 1fr) minmax(170px, .54fr); gap: 10px; min-height: 0; }
.control-card { min-width: 0; border-radius: 18px; padding: 15px; overflow: hidden; }
.control-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-label { display: block; color: #61799b; font-size: 7px; font-weight: 1000; letter-spacing: .22em; }
.control-card h2 { margin: 4px 0 0; font-size: 15px; }
.ghost-button { padding: 5px 7px; border: 0; color: #7890b0; background: transparent; font-size: 9px; font-weight: 800; }
.ghost-button:hover { color: var(--cyan-soft); }
.active-player-main { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.player-avatar { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(67, 214, 255, .48); border-radius: 14px; color: #04101b; background: var(--active-player, var(--cyan)); box-shadow: 0 0 22px color-mix(in srgb, var(--active-player, var(--cyan)), transparent 70%); font-size: 11px; font-weight: 1000; }
.active-player-main small { color: #738aa9; font-size: 8px; }
.active-player-main h2 { margin: 2px 0; font-size: 17px; }
.active-player-main p { margin: 0; color: #8195b2; font-size: 9px; }
.resource-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 13px; }
.resource-grid > div { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 8px; border: 1px solid rgba(126, 181, 231, .11); border-radius: 10px; background: rgba(4, 13, 29, .44); }
.resource-icon { flex: 0 0 auto; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; font-size: 9px; font-weight: 1000; }
.engine-icon { color: var(--gold); background: rgba(255, 215, 104, .1); }
.crystal-icon { color: var(--violet); background: rgba(167, 124, 255, .11); }
.move-icon { color: var(--green); background: rgba(104, 240, 166, .1); }
.resource-grid p { min-width: 0; margin: 0; }
.resource-grid small { display: block; overflow: hidden; color: #607696; font-size: 7px; white-space: nowrap; text-overflow: ellipsis; }
.resource-grid strong { display: block; margin-top: 1px; font-size: 14px; font-variant-numeric: tabular-nums; }
.action-card { display: flex; flex-direction: column; }
.turn-chip { color: var(--green); border-color: rgba(104, 240, 166, .22); background: rgba(104, 240, 166, .06); white-space: nowrap; }
.action-helper { margin: 12px 0; color: #778da9; font-size: 10px; line-height: 1.65; }
.context-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.action-button { position: relative; display: flex; align-items: center; gap: 9px; min-height: 47px; padding: 8px 10px; border: 1px solid rgba(103, 178, 227, .16); border-radius: 11px; color: #dbe8f4; background: rgba(11, 27, 54, .62); text-align: left; transition: transform .18s, border-color .18s, background .18s; }
.action-button:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(67, 214, 255, .4); background: rgba(18, 47, 82, .72); }
.action-button:disabled { opacity: .4; cursor: not-allowed; }
.action-button .action-icon { flex: 0 0 auto; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--action-color, var(--cyan-soft)); background: color-mix(in srgb, var(--action-color, var(--cyan)) 12%, transparent); font-size: 14px; }
.action-button strong { display: block; font-size: 10px; }
.action-button small { display: block; margin-top: 2px; color: #6e84a3; font-size: 7px; }
.action-button.primary-action { color: #06111e; border-color: transparent; background: linear-gradient(100deg, #c0fff4, var(--cyan)); }
.action-button.primary-action small { color: rgba(2, 19, 32, .62); }
.action-button.danger-action { --action-color: var(--danger); }
.hand-section { min-height: 0; margin-top: 15px; padding-top: 12px; border-top: 1px solid rgba(126, 181, 231, .1); }
.subheading-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.subheading-row h3 { margin: 0; font-size: 10px; }
.subheading-row span { color: #647b9b; font-size: 8px; }
.hand-list { display: flex; gap: 7px; min-height: 76px; padding: 2px 1px 6px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(80, 143, 193, .3) transparent; }
.skill-card { --card-color: var(--cyan); position: relative; flex: 0 0 102px; min-height: 72px; padding: 10px; border: 1px solid color-mix(in srgb, var(--card-color), transparent 62%); border-radius: 11px; background: linear-gradient(145deg, color-mix(in srgb, var(--card-color) 12%, #07142b), #071127); text-align: left; overflow: hidden; }
.skill-card::after { content: ""; position: absolute; right: -18px; bottom: -22px; width: 52px; height: 52px; border: 1px solid color-mix(in srgb, var(--card-color), transparent 60%); border-radius: 50%; }
.skill-card:hover { border-color: color-mix(in srgb, var(--card-color), transparent 25%); }
.skill-card strong { position: relative; z-index: 1; display: block; margin-top: 9px; font-size: 9px; }
.skill-card small { color: color-mix(in srgb, var(--card-color), #c5d3e5 40%); font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.skill-card .card-count { position: absolute; z-index: 1; right: 8px; top: 8px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; color: #06111f; background: var(--card-color); font-size: 8px; font-weight: 1000; }
.empty-state { display: flex; flex: 1; align-items: center; justify-content: center; gap: 8px; min-width: 170px; border: 1px dashed rgba(126, 181, 231, .15); border-radius: 10px; color: #586f90; font-size: 8px; }
.empty-state span { color: var(--cyan); }
.log-card { min-height: 0; }
.event-log { max-height: 145px; margin: 11px 0 0; padding: 0; overflow-y: auto; list-style: none; scrollbar-width: thin; scrollbar-color: rgba(80, 143, 193, .3) transparent; }
.event-log li { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 8px; padding: 7px 0 7px 9px; border-left: 1px solid rgba(82, 157, 211, .17); color: #91a4be; font-size: 8px; line-height: 1.45; }
.event-log li::before { content: ""; position: absolute; left: -3px; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: #45688e; }
.event-log li:first-child::before { background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
.event-log time { color: #526989; font-variant-numeric: tabular-nums; }
.event-log b { color: #d8e5f2; font-weight: 800; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(1, 4, 12, .78); backdrop-filter: blur(10px); }
.sheet-dialog { width: min(820px, calc(100% - 28px)); max-height: min(880px, calc(100dvh - 28px)); padding: 0; border: 1px solid rgba(111, 196, 244, .24); border-radius: 24px; background: linear-gradient(145deg, #0a1b39, #060f23 70%); box-shadow: 0 34px 100px rgba(0,0,0,.56); overflow: hidden; }
.sheet-dialog[open] { animation: dialog-in .3s ease both; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dialog-header { position: sticky; z-index: 3; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); background: rgba(8, 21, 45, .94); }
.dialog-header h2 { margin: 5px 0 0; font-size: 20px; }
.dialog-close { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(4, 12, 28, .5); font-size: 24px; line-height: 1; }
.dialog-close:hover { color: white; border-color: var(--line-strong); }
.rule-tabs { display: flex; gap: 4px; padding: 10px 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.rule-tabs button { flex: 1 0 auto; min-width: 92px; padding: 9px 14px; border: 0; border-radius: 10px; color: #7186a6; background: transparent; font-size: 11px; font-weight: 800; }
.rule-tabs button.active { color: #06111e; background: linear-gradient(100deg, #bafff2, var(--cyan)); }
.rules-body { max-height: calc(100dvh - 180px); padding: 24px; overflow-y: auto; }
.rule-panel { display: none; }
.rule-panel.active { display: block; animation: screen-in .25s ease; }
.rule-panel > h3 { margin: 27px 0 9px; font-size: 15px; }
.rule-panel > p { color: #9aadc6; font-size: 12px; line-height: 1.9; }
.rule-hero { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 18px; border: 1px solid rgba(67, 214, 255, .2); border-radius: 15px; background: rgba(67, 214, 255, .06); }
.rule-hero span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: #06111e; background: var(--cyan); font-weight: 1000; }
.rule-hero p { margin: 0; color: #c1d3e7; font-size: 13px; line-height: 1.75; }
.rule-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 13px; }
.rule-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(5, 13, 30, .42); }
.rule-grid strong { display: block; color: var(--gold); font-size: 25px; }
.rule-grid span { display: block; margin-top: 3px; font-size: 10px; font-weight: 800; }
.rule-grid p { margin: 7px 0 0; color: #687e9e; font-size: 8px; }
.timeline-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.timeline-list li { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 18, 38, .56); }
.timeline-list > li > span { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(67, 214, 255, .26); border-radius: 12px; color: var(--cyan); font-size: 10px; font-weight: 1000; }
.timeline-list strong { font-size: 13px; }
.timeline-list p { margin: 6px 0 0; color: #8498b5; font-size: 11px; line-height: 1.75; }
.rule-callout { margin-bottom: 11px; padding: 19px; border: 1px solid color-mix(in srgb, var(--callout), transparent 70%); border-left: 3px solid var(--callout); border-radius: 14px; background: color-mix(in srgb, var(--callout) 7%, transparent); }
.rule-callout.cyan { --callout: var(--cyan); }
.rule-callout.violet { --callout: var(--violet); }
.rule-callout.gold { --callout: var(--gold); }
.rule-callout strong { color: var(--callout); font-size: 13px; }
.rule-callout p { margin: 7px 0 0; color: #91a4bf; font-size: 11px; line-height: 1.8; }
.skill-rule-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.skill-rule { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 13, 30, .4); }
.skill-rule strong { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.skill-rule strong i { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: var(--skill-color, var(--cyan)); background: color-mix(in srgb, var(--skill-color, var(--cyan)) 10%, transparent); font-style: normal; }
.skill-rule p { margin: 7px 0 0; color: #7e92b0; font-size: 9px; line-height: 1.7; }
.recipe-list { display: grid; gap: 7px; }
.recipe { display: grid; grid-template-columns: minmax(130px, .7fr) 28px minmax(140px, .8fr); align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5, 13, 30, .4); font-size: 9px; }
.recipe .ingredients { color: #8aa0bd; }
.recipe .recipe-arrow { color: var(--cyan); text-align: center; }
.recipe .result { color: #e2edf8; font-weight: 800; }

.action-dialog { width: min(600px, calc(100% - 24px)); }
.action-dialog-body { max-height: min(64dvh, 620px); padding: 22px; overflow-y: auto; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 22px max(15px, var(--safe-bottom)); border-top: 1px solid var(--line); background: rgba(5, 14, 31, .72); }
.dialog-footer:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field > span { color: #8297b5; font-size: 9px; font-weight: 800; }
.form-field select, .form-field input[type="number"], .form-field input[type="text"] { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: #07142d; }
.form-field select:focus, .form-field input:focus { border-color: var(--cyan); }
.dialog-button { min-height: 41px; padding: 0 17px; border: 1px solid var(--line); border-radius: 11px; color: #c3d2e4; background: rgba(14, 31, 59, .72); font-size: 10px; font-weight: 900; }
.dialog-button.primary { color: #06101c; border-color: transparent; background: linear-gradient(100deg, #c2fff4, var(--cyan)); }
.dialog-button.danger { color: #fff; border-color: rgba(255, 101, 122, .4); background: rgba(255, 101, 122, .13); }
.option-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.option-button { min-height: 64px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; color: #c8d7e7; background: rgba(7, 18, 39, .76); text-align: left; }
.option-button:hover, .option-button.selected { border-color: var(--cyan); background: rgba(67, 214, 255, .09); }
.option-button strong { display: block; font-size: 10px; }
.option-button small { display: block; margin-top: 4px; color: #6f85a5; font-size: 8px; }
.cost-summary { display: flex; gap: 8px; margin-top: 14px; padding: 11px; border: 1px solid rgba(255, 215, 104, .18); border-radius: 10px; color: #879bb7; background: rgba(255, 215, 104, .05); font-size: 9px; line-height: 1.6; }
.cost-summary strong { color: var(--gold); }
.ranking-list { display: grid; gap: 8px; }
.ranking-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.ranking-row.winner { border-color: rgba(255, 215, 104, .46); background: rgba(255, 215, 104, .06); }
.ranking-row > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #06101d; background: var(--rank-color, var(--cyan)); font-size: 10px; font-weight: 1000; }
.ranking-row small { display: block; color: #6f84a2; font-size: 8px; }
.ranking-row strong { font-size: 12px; }
.ranking-engine { color: var(--gold); font-size: 16px; font-weight: 1000; }

.pass-dialog { width: min(430px, calc(100% - 28px)); padding: 38px 28px; border: 1px solid rgba(119, 218, 255, .28); border-radius: 28px; color: var(--ink); background: linear-gradient(145deg, #0a1d3d, #050d20); box-shadow: var(--shadow); text-align: center; }
.pass-dialog[open] { animation: dialog-in .3s ease both; }
.pass-dialog .eyebrow { justify-content: center; }
.pass-dialog h2 { margin: 8px 0 12px; font-family: "STKaiti", "KaiTi", serif; font-size: 29px; }
.pass-dialog > p:not(.eyebrow) { color: #8297b4; font-size: 12px; line-height: 1.8; }
.pass-dialog .primary-button { width: 100%; margin-top: 18px; }
.pass-sigil { position: relative; display: grid; place-items: center; width: 100px; height: 100px; margin: 0 auto 27px; border: 1px solid rgba(67, 214, 255, .3); border-radius: 50%; }
.pass-sigil::before, .pass-sigil::after { content: ""; position: absolute; border: 1px dashed rgba(167, 124, 255, .55); border-radius: 50%; animation: spin 13s linear infinite; }
.pass-sigil::before { inset: 10px; }
.pass-sigil::after { inset: 21px; animation-direction: reverse; animation-duration: 8s; }
.pass-sigil span { width: 28px; height: 38px; border: 2px solid var(--cyan); border-radius: 8px; }
.pass-sigil i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.settings-list { padding: 8px 22px; }
.settings-list label { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 70px; border-bottom: 1px solid var(--line); }
.settings-list label:last-child { border-bottom: 0; }
.settings-list strong { display: block; font-size: 12px; }
.settings-list small { display: block; margin-top: 4px; color: #758baa; font-size: 9px; }
.settings-list input[type="checkbox"] { appearance: none; position: relative; flex: 0 0 auto; width: 43px; height: 24px; border: 1px solid #3b5273; border-radius: 999px; background: #0a1933; transition: .2s; }
.settings-list input[type="checkbox"]::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #7e91aa; transition: .2s; }
.settings-list input[type="checkbox"]:checked { border-color: var(--cyan); background: rgba(67, 214, 255, .2); }
.settings-list input[type="checkbox"]:checked::after { left: 21px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 10px 22px 22px; padding: 15px; border: 1px solid rgba(255, 101, 122, .2); border-radius: 13px; background: rgba(255, 101, 122, .04); }
.danger-zone strong { font-size: 11px; }
.danger-zone p { margin: 4px 0 0; color: #7589a8; font-size: 8px; }
.danger-button { min-height: 36px; padding: 0 12px; border: 1px solid rgba(255, 101, 122, .4); border-radius: 10px; color: #ffb6c1; background: rgba(255, 101, 122, .1); font-size: 9px; font-weight: 900; }

.toast-region { position: fixed; z-index: 100; left: 50%; bottom: max(22px, calc(var(--safe-bottom) + 12px)); display: grid; gap: 8px; width: min(420px, calc(100% - 30px)); transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 13px; color: #dce9f6; background: rgba(7, 20, 42, .94); box-shadow: 0 16px 44px rgba(0,0,0,.45); font-size: 10px; line-height: 1.5; animation: toast-in .25s ease both; }
.toast::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--toast-color, var(--cyan)); box-shadow: 0 0 8px var(--toast-color, var(--cyan)); }
.toast.error { --toast-color: var(--danger); }
.toast.success { --toast-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.motion-reduced *, .motion-reduced *::before, .motion-reduced *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }

@media (max-width: 1120px) {
  .home-screen.is-active { grid-template-columns: minmax(340px, .8fr) minmax(430px, 1.2fr); gap: 30px; }
  .hero-copy h1 { font-size: clamp(50px, 6.4vw, 72px); }
  .game-layout { grid-template-columns: minmax(510px, 1.3fr) minmax(290px, .7fr); }
  .resource-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resource-grid > div { padding: 7px 5px; }
}

@media (max-width: 880px) {
  .home-screen.is-active { display: flex; flex-direction: column; padding-top: 32px; }
  .hero-copy { max-width: 700px; text-align: center; }
  .hero-copy .eyebrow, .hero-actions { justify-content: center; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-facts { justify-content: center; }
  .hero-visual { max-width: 650px; }
  .home-panels { width: 100%; }
  .skill-set-options { grid-template-columns: repeat(2, 1fr); }
  .game-statusbar { grid-template-columns: 1fr auto; }
  .phase-timer { display: none; }
  .game-layout { display: flex; flex-direction: column; }
  .board-card { min-height: min(760px, 84dvh); }
  .game-board { min-height: 600px; }
  .control-column { grid-template-columns: repeat(2, 1fr); grid-template-rows: auto auto; }
  .active-player-card { grid-column: 1; }
  .action-card { grid-row: 1 / span 2; grid-column: 2; }
  .log-card { grid-column: 1; }
}

@media (max-width: 620px) {
  .topbar { min-height: calc(64px + var(--safe-top)); padding-left: max(14px, var(--safe-left)); padding-right: max(14px, var(--safe-right)); }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 6px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark::before { width: 41px; height: 15px; }
  .brand-mark::after { width: 17px; height: 41px; }
  .save-state { display: none; }
  .icon-button { width: 36px; height: 36px; }
  .home-screen { padding: 28px 18px 50px; }
  .hero-copy h1 { font-size: clamp(44px, 14.5vw, 64px); }
  .hero-lead { margin-top: 20px; font-size: 14px; }
  .hero-actions { flex-direction: column; }
  .primary-button, .secondary-button { width: 100%; }
  .hero-facts { margin-top: 32px; }
  .hero-facts li { min-width: 92px; padding: 0 13px; }
  .hero-visual { width: min(112%, 520px); margin-top: 15px; }
  .orbit-dot { transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-216%) rotate(calc(-1 * var(--angle))); }
  .home-panels { grid-template-columns: 1fr; margin-top: 0; }
  .info-card { min-height: 110px; padding: 18px; }
  .setup-screen { width: calc(100% - 24px); padding: 30px 0 60px; }
  .setup-heading h1 { font-size: 40px; }
  .setup-card { padding: 18px; border-radius: 22px; }
  .player-fields { grid-template-columns: 1fr; }
  .skill-set-options { grid-template-columns: 1fr 1fr; }
  .choice-card { min-height: 130px; padding: 14px; }
  .game-screen { padding-left: max(8px, var(--safe-left)); padding-right: max(8px, var(--safe-right)); }
  .game-statusbar { padding: 9px 10px; border-radius: 14px; }
  .phase-identity { gap: 8px; }
  .round-pill { min-width: 58px; height: 36px; }
  .phase-identity strong { font-size: 13px; }
  .compact-button { min-height: 36px; padding: 0 11px; font-size: 10px; }
  .player-strip { padding-top: 8px; }
  .player-pill { flex-basis: 138px; }
  .game-layout { min-height: auto; }
  .board-card { min-height: auto; height: auto; border-radius: 16px; }
  .board-toolbar { min-height: 42px; }
  .legend { gap: 8px; font-size: 7px; }
  .game-board { min-height: 0; aspect-ratio: .96; }
  .board-prompt { bottom: 8px; font-size: 8px; }
  .control-column { display: flex; flex-direction: column; }
  .action-card { order: -1; }
  .control-card { border-radius: 15px; }
  .event-log { max-height: 190px; }
  .rules-body { padding: 17px; }
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-rule-grid { grid-template-columns: 1fr; }
  .recipe { grid-template-columns: 1fr 22px 1fr; }
  .dialog-header { padding: 16px 17px; }
  .dialog-header h2 { font-size: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .option-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .hero-copy h1 { font-size: 43px; }
  .hero-facts strong { font-size: 16px; }
  .hero-facts li { min-width: 82px; padding: 0 9px; }
  .skill-set-options { grid-template-columns: 1fr; }
  .choice-card { min-height: 115px; }
  .context-actions { grid-template-columns: 1fr; }
  .game-board { aspect-ratio: .9; }
  .legend span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(173, 222, 255, .45); --muted: #b7c8de; }
  .board-node .node-orb { stroke-width: 4; }
}
