:root {
  --bg: #0f1720;
  --bg-soft: #172637;
  --panel: rgba(19, 29, 40, 0.92);
  --panel-strong: rgba(25, 40, 54, 0.96);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #f8f1df;
  --muted: #b8c4cf;
  --gold: #f5b83b;
  --gold-deep: #d7811f;
  --cyan: #5fd2d6;
  --green: #72d17c;
  --red: #ec5b5b;
  --shadow: 0 24px 70px rgba(3, 8, 13, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  color: var(--text);
  font-family:
    Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(95, 210, 214, 0.24), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(245, 184, 59, 0.18), transparent 28%),
    linear-gradient(180deg, #152231 0%, #0f1720 52%, #0b1119 100%);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 8px),
    linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  opacity: 0.45;
}

button {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(0px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom))
    max(0px, env(safe-area-inset-left));
}

.hud,
.stage-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(13, 21, 30, 0.94));
  box-shadow: var(--shadow);
}

.hud {
  position: relative;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1.9fr);
  gap: 16px;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(245, 184, 59, 0.13), transparent 35%),
    linear-gradient(180deg, rgba(28, 43, 56, 0.98), rgba(10, 17, 25, 0.96));
}

.hud::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 226, 140, 0.18), transparent 16%),
    repeating-linear-gradient(90deg, transparent 0 35px, rgba(255, 255, 255, 0.035) 36px 37px);
  opacity: 0.68;
}

.hud > * {
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 58% 65%, #f9d56b 0 19%, transparent 20%),
    linear-gradient(135deg, #5fd2d6 0 35%, #23394d 36% 100%);
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.22);
}

.eyebrow {
  margin: 0;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.credit {
  margin: 5px 0 0;
  color: #ffe28c;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 3px;
  font-size: clamp(2rem, 5vw, 3.45rem);
  line-height: 0.95;
}

.hud-stack {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.hud-board {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(170px, 1.45fr) minmax(135px, 0.9fr) minmax(92px, 0.58fr);
  gap: 10px;
  align-items: stretch;
}

.primary-readout,
.timer-readout,
.hud-badge {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  overflow: hidden;
}

.primary-readout {
  padding: 11px 14px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  box-shadow: inset 0 -12px 24px rgba(0, 0, 0, 0.22);
}

.primary-readout::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: currentColor;
  opacity: 0.9;
}

.primary-readout span,
.timer-readout span {
  color: rgba(248, 241, 223, 0.74);
  font-size: 0.74rem;
  font-weight: 850;
}

.primary-readout strong,
.timer-readout strong {
  display: block;
  color: #fff9e7;
  line-height: 1;
  overflow-wrap: anywhere;
}

.money-readout {
  color: var(--gold);
  border-color: rgba(255, 224, 134, 0.48);
  background:
    radial-gradient(circle at 87% 24%, rgba(255, 226, 140, 0.34), transparent 24%),
    linear-gradient(135deg, rgba(141, 82, 19, 0.78), rgba(39, 26, 14, 0.9));
}

.money-readout strong {
  margin-top: 5px;
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  text-shadow: 0 2px 0 rgba(83, 45, 8, 0.6);
}

.target-readout {
  color: var(--green);
  border-color: rgba(114, 209, 124, 0.34);
  background:
    linear-gradient(90deg, rgba(114, 209, 124, 0.18), transparent 70%),
    rgba(255, 255, 255, 0.055);
}

.target-readout strong {
  margin-top: 7px;
  color: #dfffe5;
  font-size: clamp(1.25rem, 2.7vw, 1.8rem);
}

.timer-readout {
  width: 100%;
  min-height: 72px;
  aspect-ratio: 1.18;
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  padding: 8px;
  border-radius: 50%;
  border-color: rgba(255, 145, 113, 0.42);
  background:
    radial-gradient(circle at 50% 50%, rgba(236, 91, 91, 0.15), transparent 62%),
    conic-gradient(from 210deg, rgba(236, 91, 91, 0.42), rgba(245, 184, 59, 0.25), rgba(236, 91, 91, 0.42));
  box-shadow:
    inset 0 0 0 6px rgba(7, 14, 22, 0.72),
    inset 0 -12px 20px rgba(0, 0, 0, 0.22);
}

.timer-readout strong {
  margin-top: 3px;
  color: #ffe2d7;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.mini-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.hud-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
  color: #dde9f0;
  background: rgba(255, 255, 255, 0.075);
  font-size: 0.78rem;
  font-weight: 850;
}

.hud-badge strong {
  color: #ffffff;
  font-size: 1rem;
}

.level-badge {
  border-color: rgba(95, 210, 214, 0.34);
}

.bomb-badge {
  border-color: rgba(236, 91, 91, 0.36);
  color: #ffd2d2;
}

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

.scoreboard.hidden {
  display: none;
}

.score-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(5, 12, 18, 0.36);
}

.score-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--score-color, var(--cyan));
  opacity: 0.95;
}

.score-card.is-local {
  border-color: rgba(158, 247, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(158, 247, 255, 0.14);
}

.score-card.is-leading {
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 226, 140, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(245, 184, 59, 0.18), rgba(255, 255, 255, 0.05)),
    rgba(5, 12, 18, 0.4);
}

.score-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(248, 241, 223, 0.74);
  font-size: 0.7rem;
  font-weight: 900;
}

.score-card strong {
  display: block;
  margin-top: 5px;
  color: #fff9e7;
  font-size: clamp(1.35rem, 3.2vw, 2.2rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.score-card small {
  color: #ffe28c;
  font-size: 0.64rem;
  font-weight: 900;
}

.score-track {
  height: 7px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.score-track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--score-color, var(--cyan)), #ffe28c);
}

.score-gap {
  grid-column: 1 / -1;
  min-height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 226, 140, 0.22);
  border-radius: 999px;
  color: #ffe28c;
  background: rgba(255, 226, 140, 0.08);
  font-size: 0.74rem;
  font-weight: 950;
}

.stage-panel {
  position: relative;
  margin-top: 14px;
  border-radius: 18px;
  overflow: hidden;
}

.stage-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.meter {
  min-width: 0;
}

#statusText {
  display: block;
  min-height: 1.45em;
  color: #fff8e5;
  font-weight: 800;
}

.target-track {
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.target-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 160ms ease;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.multiplayer-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(86px, 120px) repeat(3, auto) minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
}

.multiplayer-panel input {
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-weight: 850;
  text-transform: uppercase;
  user-select: text;
  -webkit-user-select: text;
}

.multiplayer-panel span {
  min-width: 0;
  color: rgba(184, 196, 207, 0.9);
  font-size: 0.78rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.13);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #281600;
  border-color: rgba(255, 223, 141, 0.65);
  background: linear-gradient(180deg, #ffe28c, var(--gold));
}

.button-danger {
  border-color: rgba(255, 165, 165, 0.54);
  background: rgba(236, 91, 91, 0.24);
}

.button-skill {
  color: #071a1d;
  border-color: rgba(151, 245, 255, 0.58);
  background: linear-gradient(180deg, #9ef7ff, #5fd2d6);
}

.button-ghost {
  background: transparent;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(95, 210, 214, 0.12) 0 24%, transparent 25%),
    #101721;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

@media (orientation: landscape) {
  html,
  body {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    touch-action: none;
  }

  body {
    position: fixed;
    inset: 0;
  }

  .shell {
    height: 100dvh;
    overflow: hidden;
  }

  .dialog,
  .overlay {
    touch-action: pan-y;
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(8, 13, 19, 0.68);
  backdrop-filter: blur(5px);
}

.overlay.hidden {
  display: none;
}

.dialog {
  width: min(640px, 100%);
  max-height: calc(100% - 36px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(31, 45, 59, 0.98), rgba(13, 22, 31, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.4);
  scrollbar-color: rgba(158, 247, 255, 0.55) rgba(255, 255, 255, 0.08);
}

.dialog h2 {
  margin-top: 5px;
  font-size: clamp(1.8rem, 5vw, 2.65rem);
}

.dialog p {
  color: var(--muted);
  line-height: 1.65;
}

.reward-grid,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.reward-grid {
  margin: 17px 0 12px;
}

.shop-grid {
  margin: 17px 0;
}

#continueButton {
  position: static;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 10px 24px rgba(13, 22, 31, 0.32);
}

.reward-card,
.shop-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
  cursor: pointer;
}

.reward-card {
  min-height: 142px;
  border-color: rgba(255, 226, 140, 0.4);
  background:
    linear-gradient(135deg, rgba(245, 184, 59, 0.18), rgba(95, 210, 214, 0.08)),
    rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 226, 140, 0.08);
}

.shop-card {
  min-height: 132px;
}

.reward-card:hover:not(:disabled),
.shop-card:hover:not(:disabled) {
  border-color: rgba(255, 226, 140, 0.66);
  background:
    linear-gradient(135deg, rgba(245, 184, 59, 0.22), rgba(95, 210, 214, 0.1)),
    rgba(255, 255, 255, 0.075);
}

.reward-card.is-picked {
  border-color: rgba(114, 209, 124, 0.72);
  background:
    linear-gradient(135deg, rgba(114, 209, 124, 0.22), rgba(95, 210, 214, 0.12)),
    rgba(255, 255, 255, 0.07);
}

.reward-card.is-locked {
  opacity: 0.48;
}

.reward-card strong,
.shop-card strong {
  font-size: 1rem;
}

.reward-card span,
.shop-card span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.reward-card b,
.shop-card b {
  color: #fff4cf;
}

.reward-card em,
.shop-card em {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  color: #08161c;
  background: #9ef7ff;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.reward-card em {
  color: #241400;
  background: #ffe28c;
}

.reward-card:disabled:not(.is-picked),
.shop-card:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-strip {
  min-height: 38px;
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 4px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  color: rgba(184, 196, 207, 0.86);
  font-weight: 760;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.status-strip span {
  min-width: 0;
}

@media (max-width: 900px) {
  .shell {
    width: min(100vw - 18px, 760px);
    padding-top: 9px;
  }

  .hud,
  .stage-toolbar {
    grid-template-columns: 1fr;
  }

  .multiplayer-panel {
    grid-template-columns: minmax(78px, 1fr) repeat(3, minmax(66px, auto));
  }

  .multiplayer-panel span {
    grid-column: 1 / -1;
  }

  .hud-board {
    grid-template-columns: minmax(170px, 1.4fr) minmax(130px, 0.9fr) minmax(88px, 0.56fr);
  }

  .mini-hud {
    justify-content: flex-start;
  }

  .actions {
    justify-content: stretch;
  }

  .button {
    flex: 1 1 92px;
  }

  .reward-grid,
  .shop-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .hud {
    padding: 12px;
  }

  .brand-mark {
    width: 45px;
    border-radius: 13px;
  }

  .hud-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .money-readout {
    grid-column: 1 / -1;
  }

  .timer-readout {
    aspect-ratio: auto;
    border-radius: 8px;
  }

  .stage-toolbar {
    padding: 10px;
  }

  .button {
    min-height: 40px;
    padding-inline: 10px;
  }

  .dialog {
    padding: 16px;
  }
}

@media (orientation: landscape) {
  body {
    min-height: 100dvh;
  }

  .shell {
    width: 100vw;
    min-height: 100dvh;
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: clamp(156px, 18vw, 260px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .hud,
  .stage-panel,
  .status-strip {
    box-shadow: 0 14px 36px rgba(3, 8, 13, 0.26);
  }

  .hud {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: stretch;
    border-radius: 14px;
    padding: 9px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    border-radius: 10px;
  }

  .eyebrow {
    font-size: 0.56rem;
    letter-spacing: 0.08em;
  }

  h1 {
    font-size: clamp(1.18rem, 3.8vw, 1.7rem);
    line-height: 1;
  }

  .credit {
    margin-top: 2px;
    font-size: 0.64rem;
    letter-spacing: 0.04em;
  }

  .hud-stack {
    width: 100%;
    gap: 6px;
  }

  .hud-board {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .primary-readout {
    min-height: 52px;
    border-radius: 8px;
    padding: 6px 8px;
  }

  .primary-readout::before {
    width: 4px;
  }

  .primary-readout span,
  .timer-readout span {
    font-size: 0.62rem;
  }

  .primary-readout strong,
  .timer-readout strong {
    margin-top: 2px;
    font-size: clamp(0.95rem, 3vw, 1.18rem);
  }

  .money-readout {
    grid-column: auto;
  }

  .timer-readout {
    min-height: 46px;
    aspect-ratio: auto;
    border-radius: 8px;
    box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.22);
  }

  .mini-hud {
    justify-content: stretch;
    gap: 5px;
  }

  .hud-badge {
    flex: 1 1 auto;
    min-height: 25px;
    justify-content: center;
    padding: 3px 8px;
    font-size: 0.62rem;
  }

  .hud-badge strong {
    font-size: 0.78rem;
  }

  .scoreboard {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .score-card {
    border-radius: 8px;
    padding: 7px 8px;
  }

  .score-card header {
    font-size: 0.6rem;
  }

  .score-card strong {
    margin-top: 3px;
    font-size: clamp(1rem, 3vw, 1.28rem);
  }

  .score-card small {
    font-size: 0.56rem;
  }

  .score-track {
    height: 5px;
    margin-top: 6px;
  }

  .score-gap {
    min-height: 22px;
    font-size: 0.62rem;
  }

  .stage-panel {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    height: 100%;
    margin-top: 0;
    border-radius: 14px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .stage-toolbar {
    grid-template-columns: minmax(120px, 1fr) auto;
    gap: 8px;
    padding: 7px;
  }

  .multiplayer-panel {
    grid-column: 1 / -1;
    grid-template-columns: minmax(62px, 0.8fr) repeat(3, minmax(48px, 0.7fr)) minmax(96px, 1.1fr);
    gap: 5px;
  }

  .multiplayer-panel input {
    min-height: 30px;
    border-radius: 8px;
    padding: 0 7px;
    font-size: 0.72rem;
  }

  .multiplayer-panel .button {
    min-height: 30px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .multiplayer-panel span {
    font-size: 0.68rem;
  }

  #statusText {
    min-height: 1.2em;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .target-track {
    height: 7px;
    margin-top: 5px;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(54px, 1fr));
    gap: 5px;
    width: min(52vw, 340px);
  }

  .button {
    min-height: 32px;
    min-width: 0;
    border-radius: 8px;
    padding: 0 7px;
    font-size: 0.76rem;
    line-height: 1;
  }

  .canvas-wrap {
    min-height: 0;
    height: 100%;
    display: grid;
    place-items: center;
  }

  canvas {
    width: min(100%, calc((100dvh - 74px) * 1.6));
    height: auto;
    max-height: calc(100dvh - 74px);
    background: #101721;
  }

  .status-strip {
    grid-column: 2;
    grid-row: 2;
    min-height: 32px;
    margin-top: 0;
    padding: 5px 2px 0;
    gap: 8px;
    font-size: 0.72rem;
  }

  .overlay {
    padding: 8px;
  }

  .dialog {
    width: min(92vw, 760px);
    max-height: calc(100% - 16px);
    padding: 12px;
    border-radius: 12px;
  }

  .dialog h2 {
    font-size: 1.35rem;
  }

  .dialog p {
    margin: 6px 0;
    font-size: 0.78rem;
    line-height: 1.42;
  }

  .reward-grid,
  .shop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 8px 0;
  }

  .reward-card,
  .shop-card {
    min-height: 96px;
    border-radius: 9px;
    padding: 8px;
    gap: 5px;
  }

  .reward-card strong,
  .shop-card strong {
    font-size: 0.82rem;
  }

  .reward-card span,
  .shop-card span {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .reward-card em,
  .shop-card em {
    padding: 3px 6px;
    font-size: 0.58rem;
  }
}

@media (orientation: landscape) and (max-height: 390px) {
  .shell {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 6px;
  }

  .hud {
    padding: 7px;
  }

  .brand-mark {
    display: none;
  }

  h1 {
    font-size: 1.32rem;
    white-space: nowrap;
  }

  .credit {
    font-size: 0.58rem;
  }

  .hud-board {
    gap: 4px;
  }

  .primary-readout,
  .timer-readout {
    min-height: 38px;
    padding: 4px 6px;
  }

  .mini-hud {
    gap: 4px;
  }

  .hud-badge {
    min-height: 22px;
    padding: 2px 6px;
  }

  .stage-toolbar {
    grid-template-columns: minmax(96px, 1fr) auto;
    padding: 5px;
  }

  .multiplayer-panel {
    grid-template-columns: minmax(50px, 0.7fr) repeat(3, minmax(42px, 0.6fr)) minmax(72px, 1fr);
  }

  .multiplayer-panel input,
  .multiplayer-panel .button {
    min-height: 26px;
    font-size: 0.62rem;
  }

  .actions {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
    width: min(64vw, 440px);
  }

  .button {
    min-height: 28px;
    padding-inline: 5px;
    font-size: 0.68rem;
  }

  canvas {
    width: min(100%, calc((100dvh - 52px) * 1.6));
    max-height: calc(100dvh - 52px);
  }

  .status-strip {
    display: none;
  }

  .stage-panel {
    grid-row: 1 / span 2;
  }
}
