:root {
  color-scheme: dark;
  --bg: #0b111d;
  --bg-soft: #101827;
  --panel: rgba(23, 35, 57, 0.9);
  --panel-solid: #172339;
  --panel-lift: #1e2d48;
  --paper: #f7e8c9;
  --paper-muted: #c9b995;
  --ink: #142033;
  --text: #f7f1e4;
  --muted: #aab5c6;
  --line: rgba(219, 229, 242, 0.14);
  --cat: #ff7357;
  --cat-soft: rgba(255, 115, 87, 0.15);
  --mouse: #5ad7c8;
  --mouse-soft: rgba(90, 215, 200, 0.14);
  --gold: #f4bf5d;
  --danger: #ff7d86;
  --success: #71ddb0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 115, 87, 0.1), transparent 28rem),
    radial-gradient(circle at 90% 28%, rgba(90, 215, 200, 0.08), transparent 30rem),
    linear-gradient(155deg, #0e1727 0%, var(--bg) 52%, #080d16 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(90, 215, 200, 0.45);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 10px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0.22;
  filter: blur(80px);
  border-radius: 50%;
}

.ambient-one {
  top: -12rem;
  left: -8rem;
  background: var(--cat);
}

.ambient-two {
  right: -10rem;
  bottom: 4rem;
  background: var(--mouse);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: max(12px, env(safe-area-inset-top)) clamp(16px, 4vw, 48px) 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 25, 0.78);
  backdrop-filter: blur(20px) saturate(140%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 6px 1fr;
  align-items: center;
  min-width: 74px;
  height: 40px;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border-radius: 13px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.brand-mark b {
  display: grid;
  height: 100%;
  place-items: center;
  font-size: 16px;
}

.brand-mark b:first-child {
  color: #7e2f26;
  background: linear-gradient(145deg, #ff927c, var(--cat));
}

.brand-mark b:last-child {
  color: #0f514d;
  background: linear-gradient(145deg, #8ce9de, var(--mouse));
}

.brand-mark i {
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform: skewX(-10deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.06em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-status {
  color: var(--danger);
  font-size: 12px;
}

.app-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 73px);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 0 calc(56px + var(--safe-bottom));
}

.loading-panel {
  display: grid;
  min-height: 52vh;
  place-items: center;
  align-content: center;
  color: var(--muted);
}

.loader {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--mouse);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.72fr);
  gap: clamp(30px, 7vw, 88px);
  align-items: center;
  min-height: 70vh;
}

.hero-copy {
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 9em;
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(52px, 9vw, 100px);
  font-weight: 800;
  line-height: 0.97;
  letter-spacing: -0.07em;
}

.hero-copy h1 span:first-child { color: var(--cat); }
.hero-copy h1 span:last-child { color: var(--mouse); }

.hero-lead {
  max-width: 36rem;
  margin: 26px 0 0;
  color: #d3dbe7;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.85;
}

.hero-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.signal-chip {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(155deg, rgba(30, 45, 72, 0.94), rgba(17, 26, 43, 0.94));
  box-shadow: var(--shadow);
}

.entry-panel {
  padding: clamp(22px, 4vw, 34px);
}

.entry-panel h2,
.section-heading h2,
.dialog-head h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.025em;
}

.muted {
  color: var(--muted);
}

.entry-panel > .muted {
  margin: 8px 0 24px;
  line-height: 1.7;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.field-label {
  color: #dce4ee;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.number-input,
.code-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid rgba(225, 235, 246, 0.18);
  border-radius: 12px;
  outline: 0;
  background: rgba(5, 10, 18, 0.38);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input:hover,
.field input:focus,
.number-input:hover,
.number-input:focus,
.code-input:hover,
.code-input:focus {
  border-color: rgba(90, 215, 200, 0.62);
  background: rgba(5, 10, 18, 0.54);
  box-shadow: 0 0 0 4px rgba(90, 215, 200, 0.08);
}

.code-input {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease, opacity 150ms ease;
}

.button:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: 0.46; }
.button-primary { color: #102420; background: var(--mouse); }
.button-cat { color: #34140e; background: var(--cat); }
.button-paper { color: var(--ink); background: var(--paper); }
.button-ghost { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.045); }
.button-danger { color: #ffdfe1; border: 1px solid rgba(255, 125, 134, 0.38); background: rgba(255, 125, 134, 0.11); }
.button-small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.button-wide { width: 100%; }

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 22px 0;
  color: #77859a;
  font-size: 11px;
}

.divider::before,
.divider::after {
  height: 1px;
  content: "";
  background: var(--line);
}

.home-layout,
.lobby-layout,
.game-layout {
  display: grid;
  gap: 20px;
}

.page-heading,
.game-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-heading h1,
.game-heading h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 58px);
  letter-spacing: -0.05em;
}

.page-heading p,
.game-heading p { margin: 8px 0 0; }

.room-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.choice-card {
  position: relative;
  min-height: 300px;
  padding: clamp(24px, 5vw, 40px);
  overflow: hidden;
}

.choice-card::after {
  position: absolute;
  right: -20px;
  bottom: -52px;
  color: rgba(255, 255, 255, 0.055);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 164px;
  font-weight: 900;
}

.choice-card:first-child::after { content: "猫"; }
.choice-card:last-child::after { content: "鼠"; }

.choice-card h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 28px;
}

.choice-card p {
  position: relative;
  z-index: 1;
  max-width: 32rem;
  color: var(--muted);
  line-height: 1.8;
}

.choice-card form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  max-width: 440px;
  margin-top: 28px;
}

.room-banner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: clamp(24px, 5vw, 46px);
  overflow: hidden;
}

.room-banner::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(110deg, rgba(90, 215, 200, 0.08), transparent 40%, rgba(255, 115, 87, 0.07));
}

.room-banner > * { position: relative; }

.room-code-block {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.room-code-block small { color: var(--muted); }

.room-code {
  color: var(--paper);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: clamp(30px, 6vw, 54px);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.lobby-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.48fr);
  gap: 18px;
}

.content-panel { padding: clamp(20px, 4vw, 32px); }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading h2 { font-size: clamp(21px, 3vw, 28px); }

.count-badge,
.status-badge,
.room-type,
.id-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.count-badge,
.status-badge { color: var(--mouse); background: var(--mouse-soft); }
.status-badge.finished { color: var(--gold); background: rgba(244, 191, 93, 0.12); }
.status-badge.danger { color: var(--danger); background: rgba(255, 125, 134, 0.12); }

.player-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.player-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  color: #dde5ef;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.028);
}

.player-avatar {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 50%;
  font-weight: 900;
}

.host-tag {
  margin-left: auto;
  color: var(--gold);
  font-size: 11px;
}

.steps-list {
  display: grid;
  gap: 18px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: steps;
}

.steps-list li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  color: var(--muted);
  line-height: 1.65;
  counter-increment: steps;
}

.steps-list li::before {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ink);
  content: counter(steps);
  background: var(--mouse);
  border-radius: 10px;
  font-weight: 900;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.game-heading {
  align-items: center;
}

.game-heading-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.secret-card {
  min-width: 154px;
  padding: 12px 16px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  background: linear-gradient(145deg, #fff3d7, var(--paper));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  transform: rotate(1deg);
}

.secret-card small,
.secret-card strong { display: block; }
.secret-card small { color: #796c52; font-size: 11px; }
.secret-card strong { margin-top: 2px; font-family: ui-monospace, monospace; font-size: 26px; letter-spacing: 0.12em; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  position: relative;
  min-height: 118px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(23, 35, 57, 0.72);
}

.metric-card::after {
  position: absolute;
  right: 12px;
  bottom: -18px;
  color: rgba(255, 255, 255, 0.055);
  font-size: 68px;
  font-weight: 900;
}

.metric-card.points::after { content: "分"; }
.metric-card.mice::after { content: "鼠"; }
.metric-card.cap::after { content: "限"; }
.metric-card.progress::after { content: "轮"; }

.metric-card small,
.metric-card strong { position: relative; z-index: 1; display: block; }
.metric-card small { color: var(--muted); font-size: 12px; }
.metric-card strong { margin-top: 10px; font-size: 28px; }
.metric-card.points strong { color: var(--gold); }
.metric-card.mice strong { color: var(--mouse); }

.game-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, 0.62fr);
  align-items: start;
  margin-top: 18px;
}

.action-composer {
  padding: clamp(20px, 4vw, 32px);
}

.composer-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.composer-section:first-of-type { padding-top: 0; border-top: 0; }

.composer-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 18px;
}

.step-number {
  display: inline-grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 9px;
  font-size: 12px;
}

.section-help {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.purchase-grid,
.conversion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.purchase-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
}

.purchase-card.cat { border-color: rgba(255, 115, 87, 0.2); background: var(--cat-soft); }
.purchase-card.mouse { border-color: rgba(90, 215, 200, 0.2); background: var(--mouse-soft); }

.purchase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.purchase-head b { font-size: 16px; }
.purchase-head span { color: var(--muted); font-size: 12px; }

.number-input {
  min-height: 44px;
  font-size: 18px;
  font-weight: 800;
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.room-tile {
  position: relative;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(5, 10, 18, 0.25);
}

.room-tile.public {
  border-color: rgba(244, 191, 93, 0.27);
  background: linear-gradient(145deg, rgba(244, 191, 93, 0.09), rgba(5, 10, 18, 0.25));
}

.room-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.room-tile-head h4 { margin: 0; font-size: 16px; }
.room-type.public { color: var(--gold); background: rgba(244, 191, 93, 0.13); }
.room-type.private { color: var(--muted); background: rgba(255, 255, 255, 0.06); }

.room-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.mini-field {
  display: grid;
  gap: 6px;
}

.mini-field span { color: var(--muted); font-size: 11px; }
.mini-field.cat span { color: #ffad9c; }
.mini-field.mouse span { color: #9debe2; }

.budget-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 10, 18, 0.25);
}

.budget-strip div { min-width: 0; }
.budget-strip small,
.budget-strip strong { display: block; }
.budget-strip small { color: var(--muted); font-size: 10px; }
.budget-strip strong { margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.budget-strip .warning strong { color: var(--gold); }

.validation-list {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.validation-list li {
  color: var(--danger);
  font-size: 12px;
}

.validation-list li::before { margin-right: 6px; content: "!"; font-weight: 900; }

.submission-note {
  padding: 18px;
  color: #b9f1df;
  border: 1px solid rgba(113, 221, 176, 0.24);
  border-radius: 15px;
  background: rgba(113, 221, 176, 0.08);
  line-height: 1.65;
}

.side-stack {
  display: grid;
  gap: 16px;
}

.side-panel { padding: 20px; }

.id-chip {
  color: var(--paper);
  background: rgba(247, 232, 201, 0.11);
  font-family: ui-monospace, monospace;
}

.bulletin-round {
  display: grid;
  gap: 11px;
}

.bulletin-round + .bulletin-round {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.bulletin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bulletin-title h3 { margin: 0; font-size: 16px; }

.result-room {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.024);
}

.result-room-head,
.result-numbers {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-room-head b { font-size: 13px; }
.result-numbers { margin-top: 9px; color: var(--muted); font-size: 12px; }
.cat-text { color: #ff9c89; }
.mouse-text { color: #8ce7dc; }

.public-detail {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}

.public-detail p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.standings {
  display: grid;
  gap: 8px;
}

.standing-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.026);
}

.standing-row.own { box-shadow: inset 0 0 0 1px rgba(90, 215, 200, 0.32); background: rgba(90, 215, 200, 0.07); }
.standing-row .place { color: var(--gold); font-weight: 900; }
.standing-row .score { color: var(--paper); font-weight: 800; }
.standing-row .mice-count { color: var(--mouse); font-size: 12px; }

.empty-state {
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  line-height: 1.7;
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.027);
}

.rank-card.top-three { border-color: rgba(244, 191, 93, 0.26); background: rgba(244, 191, 93, 0.07); }
.rank-number { color: var(--gold); font-family: ui-monospace, monospace; font-size: 24px; font-weight: 900; }
.rank-card h4,
.rank-card p { margin: 0; }
.rank-card p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.rank-score { text-align: right; }
.rank-score strong,
.rank-score small { display: block; }
.rank-score small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.rules-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: min(860px, calc(100vh - 24px));
  padding: 0;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: #121d30;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.55);
}

.rules-dialog::backdrop { background: rgba(2, 6, 12, 0.74); backdrop-filter: blur(7px); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(20px, 5vw, 38px) 18px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  font-size: 24px;
}

.rules-scroll {
  max-height: calc(100vh - 140px);
  padding: 8px clamp(20px, 5vw, 38px) 38px;
  overflow: auto;
}

.rules-scroll section { padding-top: 26px; }
.rules-scroll h3 { margin: 0 0 12px; font-size: 20px; }
.rules-scroll p,
.plain-list { color: #c6d0de; line-height: 1.8; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rule-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.rule-grid article > span { color: var(--gold); font-size: 25px; font-weight: 900; }
.rule-grid h4 { margin: 8px 0 0; }
.rule-grid p { margin: 6px 0 0; font-size: 12px; }

.round-track,
.plain-list { padding-left: 20px; }
.round-track { display: grid; gap: 9px; }
.round-track li { padding-left: 4px; color: var(--muted); }
.round-track b { display: inline-block; min-width: 78px; color: var(--text); }
.fine-print { color: #8794a8 !important; font-size: 12px; }

.schedule-list {
  display: grid;
  gap: 7px;
}

.schedule-list p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
}

.schedule-list span { color: var(--muted); text-align: right; }

.toast-region {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: grid;
  width: min(380px, calc(100% - 40px));
  gap: 9px;
}

.toast {
  padding: 13px 15px;
  color: var(--ink);
  border-radius: 13px;
  background: var(--paper);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
  font-size: 13px;
  font-weight: 750;
  animation: toast-in 180ms ease-out;
}

.toast.error { color: #fff0f1; background: #9b3a46; }
.toast.success { color: #0c3024; background: var(--success); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@media (max-width: 900px) {
  .hero-layout,
  .game-layout { grid-template-columns: 1fr; }
  .hero-copy { padding-top: 20px; }
  .hero-layout { min-height: auto; }
  .lobby-columns { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .topbar { min-height: 64px; }
  .brand-mark { min-width: 62px; height: 36px; }
  .brand > span:last-child small { display: none; }
  .connection-status { position: fixed; top: 68px; left: 50%; padding: 5px 9px; background: #35171d; border-radius: 8px; transform: translateX(-50%); }
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 26px; }
  .hero-layout { gap: 30px; }
  .hero-copy h1 { font-size: clamp(54px, 20vw, 78px); }
  .hero-lead { font-size: 15px; }
  .room-choice-grid,
  .side-stack,
  .rule-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: 260px; }
  .room-banner { grid-template-columns: 1fr; }
  .room-code-block { justify-items: start; }
  .room-code { font-size: 38px; }
  .page-heading,
  .game-heading { align-items: flex-start; flex-direction: column; }
  .game-heading-main { width: 100%; justify-content: space-between; }
  .secret-card { min-width: 132px; }
  .rooms-grid { grid-template-columns: 1fr; }
  .budget-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .standing-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .standing-row .mice-count { grid-column: 2 / 4; }
}

@media (max-width: 420px) {
  .brand > span:last-child { display: none; }
  .topbar { padding-inline: 12px; }
  .app-shell { width: min(100% - 20px, 1180px); }
  .panel { border-radius: 20px; }
  .entry-panel,
  .content-panel,
  .action-composer { padding: 18px; }
  .purchase-grid,
  .conversion-grid { grid-template-columns: 1fr; }
  .player-list { grid-template-columns: 1fr; }
  .metrics-grid { gap: 8px; }
  .metric-card { min-height: 104px; padding: 14px; }
  .metric-card strong { font-size: 24px; }
  .game-heading-main { align-items: flex-start; flex-direction: column; }
  .secret-card { width: 100%; transform: none; }
  .action-row .button { flex: 1 1 100%; }
  .schedule-list p { align-items: flex-start; flex-direction: column; gap: 3px; }
  .schedule-list span { text-align: left; }
}

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