:root {
  color-scheme: light;
  --sky-top: #70d8ff;
  --sky: #8fe7ff;
  --sky-low: #c6f5ff;
  --cloud: #fff8dc;
  --cloud-shadow: #cfeaf0;
  --ink: #15214f;
  --muted: #42628d;
  --line: #15214f;
  --panel: rgba(255, 248, 212, 0.94);
  --panel-blue: #dff9ff;
  --cyan: #18a8d8;
  --gold: #ffd447;
  --rose: #e7434f;
  --green: #49b84a;
  --button: #fff2a8;
  --button-secondary: #bdf1ff;
  --shadow: #15214f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--sky);
  font-family:
    "Trebuchet MS", "Yu Gothic", "Hiragino Kaku Gothic ProN", ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
}

button {
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--button);
  box-shadow: 4px 4px 0 var(--shadow);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 14px 18px;
  text-transform: uppercase;
  transition:
    transform 100ms steps(2, end),
    box-shadow 100ms steps(2, end),
    background 100ms steps(2, end);
}

button:hover {
  transform: translate(-2px, -2px);
  background: #ffffff;
  box-shadow: 6px 6px 0 var(--shadow);
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.shell {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 0;
}

.game-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-height: none;
  overflow: hidden;
  border: 5px solid var(--line);
  border-radius: 0;
  background: var(--sky);
  box-shadow: none;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 26px 28px;
}

.game-frame:has(.menu:not(.is-hidden)) .hud {
  visibility: hidden;
}

.hud-panel {
  position: absolute;
  top: 24px;
  width: 184px;
  display: grid;
  gap: 6px;
}

.hud-panel.left {
  left: 26px;
  top: 56px;
}

.game-frame.mode-survival #p1-label,
.game-frame.mode-boss #p1-label {
  display: none;
}

.boss-hp-panel {
  pointer-events: none;
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 2;
  display: grid;
  gap: 5px;
  justify-items: center;
  width: min(400px, 54vw);
  transform: translateX(-50%);
}

.boss-hp-panel.is-hidden {
  display: none;
}

.boss-hp-label {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fffef8;
  text-align: center;
  -webkit-text-stroke: 1.5px #15214f;
  paint-order: stroke fill;
  text-shadow:
    0 0 6px rgba(21, 33, 79, 0.85),
    0 2px 4px rgba(21, 33, 79, 0.55),
    2px 0 0 #15214f,
    -2px 0 0 #15214f,
    0 2px 0 #15214f,
    0 -2px 0 #15214f,
    3px 3px 0 rgba(21, 33, 79, 0.65);
}

.boss-hp-bar {
  position: relative;
  width: 100%;
  height: 11px;
  border: 2px solid #15214f;
  background: rgba(21, 33, 79, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 rgba(21, 33, 79, 0.35);
  overflow: hidden;
}

.boss-hp-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(100% / var(--boss-hp-segments, 10) - 1px),
    rgba(21, 33, 79, 0.72) calc(100% / var(--boss-hp-segments, 10) - 1px),
    rgba(21, 33, 79, 0.72) calc(100% / var(--boss-hp-segments, 10))
  );
}

.boss-hp-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #ffb347 0%, #ff5f7e 52%, #e7434f 100%);
  transition: width 0.15s ease-out;
}

.boss-hp-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.player-status-panel {
  pointer-events: none;
  position: absolute;
  top: 20px;
  right: 26px;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 33, 79, 0.45);
}

.player-status-panel:has(.cluster-buff-panel:not(.is-hidden)) {
  min-width: 220px;
}

.center-hud:not(:has(.round-state:not([hidden]))) {
  display: none;
}

.game-frame.mode-boss .climb-gas-fill,
.game-frame.mode-boss .climb-line--gas,
.game-frame.mode-boss .climb-stat:has(#climb-stat-gas) {
  display: none;
}

.center-hp-row {
  justify-content: center;
}

.survival-climb-panel {
  pointer-events: none;
  position: absolute;
  top: 108px;
  right: 26px;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: 184px;
  padding: 10px 12px 12px;
  border: 3px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent),
    var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 33, 79, 0.55);
}

.survival-climb-panel.is-hidden {
  display: none;
}

.game-frame:has(.menu:not(.is-hidden)) .survival-climb-panel {
  visibility: hidden;
}

.control-guide-panel {
  pointer-events: none;
  position: absolute;
  top: 254px;
  left: 26px;
  z-index: 1;
  width: 184px;
  padding: 10px 12px 12px;
  border: 3px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent),
    var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 33, 79, 0.55);
}

.control-guide-panel.is-hidden {
  display: none;
}

.game-frame:has(.menu:not(.is-hidden)) .control-guide-panel {
  visibility: hidden;
}

.control-guide-title {
  margin-bottom: 8px;
  color: #a45e00;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-guide-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  margin: 0;
}

.control-guide-list dt,
.control-guide-list dd {
  margin: 0;
}

.control-guide-list dt {
  min-width: 58px;
  padding: 2px 5px;
  border: 2px solid rgba(21, 33, 79, 0.6);
  background: #ffffff;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.control-guide-list dd {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.climb-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.climb-panel-kicker {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.climb-panel-stage {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.climb-track-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: stretch;
}

.climb-axis-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  text-align: center;
}

.climb-axis-label--goal {
  align-self: start;
  color: #2ecc71;
}

.climb-axis-label--base {
  align-self: end;
}

.climb-track {
  position: relative;
  height: 300px;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #1f4d7a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.climb-track-sky {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.08) 0,
      rgba(255, 255, 255, 0.08) 1px,
      transparent 1px,
      transparent 20px
    ),
    linear-gradient(180deg, rgba(143, 231, 255, 0.18), transparent 42%);
  pointer-events: none;
}

.climb-gas-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(
    180deg,
    rgba(180, 100, 255, 0.18),
    rgba(120, 60, 200, 0.72) 55%,
    rgba(90, 40, 170, 0.92)
  );
  transition: height 120ms linear;
}

.climb-gas-fill.is-waiting {
  height: 8% !important;
  background: linear-gradient(180deg, transparent, rgba(120, 60, 200, 0.22));
}

.climb-gas-fill.is-countdown {
  animation: climb-gas-pulse 1s ease-in-out infinite alternate;
}

.climb-gas-fill.is-active {
  box-shadow: inset 0 12px 24px rgba(255, 196, 48, 0.18);
}

@keyframes climb-gas-pulse {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 0.92;
  }
}

.climb-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
}

.climb-line--goal {
  top: 0;
  border-top: 3px dashed rgba(72, 255, 152, 0.88);
  box-shadow: 0 0 10px rgba(72, 255, 152, 0.35);
}

.climb-line--goal::after {
  content: "GOAL";
  position: absolute;
  right: 6px;
  top: 4px;
  color: rgba(72, 255, 152, 0.95);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.climb-line--gas {
  bottom: 0;
  border-bottom: 2px solid rgba(255, 220, 80, 0.95);
  box-shadow: 0 0 8px rgba(180, 100, 255, 0.45);
  transition: bottom 120ms linear;
}

.climb-line--gas::before {
  content: "GAS";
  position: absolute;
  left: 6px;
  bottom: 3px;
  color: rgba(255, 220, 80, 0.95);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.climb-marker--player {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 2;
  transform: translate(-50%, 50%);
  transition: bottom 120ms linear;
}

.climb-marker-stick {
  display: block;
  width: 14px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--rose);
  box-shadow: 2px 2px 0 rgba(21, 33, 79, 0.65);
  position: relative;
}

.climb-marker-stick::before,
.climb-marker-stick::after {
  content: "";
  position: absolute;
  background: var(--line);
}

.climb-marker-stick::before {
  width: 18px;
  height: 2px;
  left: -2px;
  top: 10px;
}

.climb-marker-stick::after {
  width: 2px;
  height: 10px;
  left: 4px;
  bottom: -2px;
  transform: rotate(18deg);
  transform-origin: top center;
  box-shadow: 8px 4px 0 var(--line);
}

.climb-stats {
  display: grid;
  gap: 5px;
}

.climb-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border: 2px solid rgba(21, 33, 79, 0.55);
  border-radius: 0;
  background: #ffffff;
}

.climb-stat-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.climb-stat-value {
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.climb-stat-value--player {
  color: var(--rose);
}

.climb-stat-value--gas {
  color: #9b59ff;
}

.climb-stat-value--goal {
  color: #2ecc71;
}

.survival-climb-panel.is-danger {
  border-color: var(--rose);
  box-shadow:
    4px 4px 0 rgba(21, 33, 79, 0.55),
    0 0 0 3px rgba(231, 67, 79, 0.28);
}

.survival-climb-panel.is-near-goal .climb-stat-value--goal {
  animation: climb-goal-near 0.8s ease-in-out infinite alternate;
}

@keyframes climb-goal-near {
  from {
    color: #2ecc71;
  }
  to {
    color: #ffd447;
  }
}

.name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hp-hearts {
  display: flex;
  gap: 4px;
  min-height: 16px;
  justify-content: center;
}

.center-hp-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.hp-group {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.hp-group-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-frame.mode-survival .hp-group-label {
  display: none;
}

.hud-stats-panel {
  position: absolute;
  bottom: 24px;
  left: 26px;
  top: auto;
  right: auto;
  z-index: 2;
  padding: 6px 8px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 33, 79, 0.45);
}

.hud-stats-panel .stats-row {
  justify-content: flex-start;
}

.hp-heart {
  color: #ff5f7e;
  font-size: 15px;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(21, 33, 79, 0.35);
}

.hp-heart.is-empty {
  color: rgba(21, 33, 79, 0.22);
  text-shadow: none;
}

.name-row strong {
  color: #ffffff;
  font-size: 11px;
  text-shadow:
    2px 0 0 var(--shadow),
    -2px 0 0 var(--shadow),
    0 2px 0 var(--shadow),
    0 -2px 0 var(--shadow);
}

.item-box {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 108px;
  place-items: stretch;
  gap: 0;
  padding: 8px 10px 7px;
  border: 3px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent),
    var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 33, 79, 0.55);
  transition:
    border-color 80ms ease,
    box-shadow 80ms ease,
    transform 80ms ease;
}

.item-stock {
  position: relative;
  width: 100%;
  min-height: 96px;
}

.item-stock-slot {
  position: absolute;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 2px;
  padding: 5px 4px 4px;
  border: 3px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent),
    rgba(255, 252, 244, 0.92);
  box-shadow: 3px 3px 0 rgba(21, 33, 79, 0.45);
  transition:
    border-color 80ms ease,
    opacity 80ms ease,
    transform 80ms ease;
}

.item-stock-slot--active {
  right: 2px;
  bottom: 0;
  width: 82px;
  min-height: 82px;
  z-index: 2;
}

.item-stock-slot--reserve {
  left: 0;
  top: 0;
  width: 62px;
  min-height: 62px;
  z-index: 1;
}

.item-stock-slot.is-empty {
  opacity: 0.62;
}

.item-stock-slot--reserve.is-empty {
  opacity: 0.48;
}

.item-stock-slot.is-filled {
  opacity: 1;
}

.item-stock-slot--active.is-filled {
  box-shadow:
    3px 3px 0 rgba(21, 33, 79, 0.45),
    0 0 0 2px rgba(247, 189, 69, 0.35);
}

.item-stock-tag {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
  user-select: none;
}

.item-stock-slot--active .item-stock-tag {
  color: var(--gold);
}

.item-stock-icon {
  width: 38px;
  height: 38px;
  max-width: 88%;
  max-height: 44px;
  margin-top: 8px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
}

.item-stock-slot--reserve .item-stock-icon {
  width: 28px;
  height: 28px;
  max-height: 32px;
  margin-top: 6px;
}

.item-stock-label {
  min-width: 100%;
  padding: 1px 3px 0;
  border-top: 2px solid rgba(21, 33, 79, 0.35);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-align: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  user-select: none;
}

.item-stock-slot--active .item-stock-label {
  font-size: 11px;
}

.item-stock-charges {
  position: absolute;
  right: 3px;
  top: 3px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  user-select: none;
}

.item-box.is-roulette {
  min-height: 104px;
}

.item-box.is-roulette {
  border-color: var(--rose);
  box-shadow:
    4px 4px 0 rgba(21, 33, 79, 0.55),
    0 0 0 4px rgba(255, 212, 71, 0.65);
  animation: item-roulette-glow 0.45s ease-in-out infinite alternate;
}

.item-box.is-roulette .item-stock {
  display: none;
}

.item-box.is-roulette .item-icon,
.item-box.is-roulette > .item-label {
  display: none !important;
}

.item-roulette {
  display: none;
  width: 100%;
  gap: 7px;
  padding: 4px 2px 2px;
  place-items: center;
}

.item-box.is-roulette .item-roulette {
  display: grid;
}

.item-roulette-label {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.item-box.is-roulette.is-settling .item-roulette-label {
  color: var(--gold);
}

.item-roulette-strip {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.item-roulette-cell {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 2px solid rgba(21, 33, 79, 0.34);
  border-radius: 0;
  background: #eafaff;
  opacity: 0.42;
  transition:
    opacity 70ms ease,
    transform 70ms ease,
    border-color 70ms ease;
}

.item-roulette-cell.is-active {
  border-color: var(--rose);
  opacity: 1;
  transform: scale(1.1);
}

.item-box.is-roulette-pulse .item-roulette-cell.is-active {
  animation: item-roulette-pop 0.1s ease-out;
}

.item-roulette-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
}

@keyframes item-roulette-glow {
  from {
    box-shadow: 0 0 10px rgba(247, 189, 69, 0.18);
  }
  to {
    box-shadow: 0 0 26px rgba(247, 189, 69, 0.42);
  }
}

@keyframes item-roulette-pop {
  from {
    transform: scale(0.82);
  }
  to {
    transform: scale(1.06);
  }
}

.item-icon {
  width: 44px;
  height: 44px;
  max-width: 76%;
  max-height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
}

.item-label {
  min-width: 100%;
  padding: 2px 5px 1px;
  border-top: 2px solid rgba(21, 33, 79, 0.42);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  user-select: none;
}

.item-charges {
  position: absolute;
  right: 5px;
  top: 5px;
  bottom: auto;
  font-size: clamp(13px, 1.5vw, 18px);
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.meter {
  height: 5px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
}

.meter i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

.cluster-buff-panel {
  flex-shrink: 0;
  align-self: center;
  padding: 5px 8px 6px;
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow: 3px 3px 0 rgba(21, 33, 79, 0.45);
}

.center-hp-row .cluster-buff-panel:not(.is-hidden) {
  margin-left: 2px;
  padding-left: 12px;
  border: 0;
  border-left: 2px solid rgba(21, 33, 79, 0.14);
  box-shadow: none;
  background: transparent;
}

.center-hp-row .cluster-buff-panel.has-buff:not(.is-hidden) {
  border-left-color: rgba(42, 157, 106, 0.55);
  background: linear-gradient(90deg, rgba(126, 240, 176, 0.12), transparent 72%);
}

.cluster-buff-panel.is-hidden {
  display: none;
}

.cluster-buff-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cluster-buff-rows {
  display: grid;
  gap: 4px;
}

.cluster-buff-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 6px;
}

.cluster-buff-label {
  color: #15214f;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.cluster-buff-pips {
  display: flex;
  gap: 3px;
}

.cluster-buff-pip {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(21, 33, 79, 0.35);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.cluster-buff-pip.is-active {
  border-color: #2a9d6a;
  background: linear-gradient(180deg, #7ef0b0 0%, #39d7ff 100%);
  box-shadow: 1px 1px 0 rgba(21, 33, 79, 0.35);
}

.cluster-buff-panel.has-buff {
  border-color: #2a9d6a;
}

.center-hud {
  position: absolute;
  top: 20px;
  left: 50%;
  display: grid;
  min-width: 0;
  transform: translateX(-50%);
  place-items: center;
  gap: 6px;
  padding: 8px 14px 10px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 33, 79, 0.45);
}

.stats-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.stat-pill {
  display: grid;
  gap: 2px;
  min-width: 96px;
  padding: 6px 12px;
  border: 2px solid rgba(21, 33, 79, 0.55);
  border-radius: 0;
  background: #ffffff;
  text-align: center;
}

.stat-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score {
  font-variant-numeric: tabular-nums;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
  line-height: 1;
  color: var(--rose);
}

.title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
  line-height: 1;
}

.round-state {
  color: #a45e00;
  font-size: 12px;
  font-weight: 800;
}

.menu {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    linear-gradient(0deg, #57b749 0 13%, #8bd565 13% 18%, transparent 18%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky) 56%, var(--sky-low) 100%);
}

.menu::before,
.menu::after {
  content: "";
  position: absolute;
  z-index: 0;
  image-rendering: pixelated;
}

.menu::before {
  top: 54px;
  left: 8%;
  width: 96px;
  height: 24px;
  background: var(--cloud);
  box-shadow:
    24px -16px 0 var(--cloud),
    56px -8px 0 var(--cloud),
    640px 30px 0 var(--cloud),
    672px 14px 0 var(--cloud),
    704px 30px 0 var(--cloud),
    930px -22px 0 var(--cloud),
    962px -38px 0 var(--cloud),
    994px -22px 0 var(--cloud),
    0 8px 0 var(--cloud-shadow),
    640px 38px 0 var(--cloud-shadow),
    930px -14px 0 var(--cloud-shadow);
}

.menu::after {
  right: -20px;
  bottom: 13%;
  width: 160px;
  height: 72px;
  background:
    linear-gradient(90deg, transparent 0 16px, #7c5433 16px 32px, transparent 32px 48px),
    linear-gradient(0deg, #3f9045 0 18px, #57b749 18px 100%);
  border: 4px solid var(--line);
  box-shadow:
    -1060px 18px 0 -8px #3f9045,
    -1010px 18px 0 -8px #57b749,
    -960px 18px 0 -8px #3f9045;
}

.menu.is-hidden {
  display: none;
}

.menu-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  border: 4px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 28px;
  box-shadow:
    8px 8px 0 var(--shadow),
    inset 0 0 0 4px rgba(255, 255, 255, 0.52);
}

.title-card {
  width: min(660px, 94vw);
  display: grid;
  justify-items: center;
  gap: 20px;
  padding: 34px 38px 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent 44%),
    rgba(255, 248, 212, 0.9);
  text-align: center;
}

.kicker {
  margin: 0 0 6px;
  color: #a45e00;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 0.95;
}

.title-logo {
  display: grid;
  gap: 0;
  margin: 0;
  color: #ffffff;
  font-family: Impact, "Arial Black", "Trebuchet MS", sans-serif;
  font-size: clamp(50px, 8vw, 92px);
  font-weight: 900;
  line-height: 0.82;
  text-transform: uppercase;
  text-shadow:
    4px 0 0 var(--line),
    -4px 0 0 var(--line),
    0 4px 0 var(--line),
    0 -4px 0 var(--line),
    7px 7px 0 var(--rose),
    11px 11px 0 var(--gold);
}

.title-logo span:last-child {
  color: #fff27a;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

.mode-row button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
}

.mode-soon {
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.82);
}

.mode-soon small {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.mode-row button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.menu-screen.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.menu-heading {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 3px 3px 0 rgba(24, 168, 216, 0.28);
}

.menu-lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.menu-actions {
  display: grid;
  gap: 10px;
}

.menu-actions.stack {
  margin-top: 8px;
}

.btn-secondary {
  background: var(--button-secondary);
  color: var(--ink);
}

.btn-secondary:hover {
  background: #e9fbff;
}

.btn-ghost {
  background: #ffffff;
  color: var(--muted);
  font-weight: 700;
}

.btn-ghost:hover {
  color: var(--ink);
  background: #ffffff;
}

.btn-compact {
  padding: 8px 12px;
  font-size: 12px;
  min-height: auto;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: #a45e00;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-hint.is-error {
  color: var(--rose);
}

.code-input {
  width: 100%;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

.code-input:focus {
  outline: none;
  box-shadow: 4px 4px 0 var(--gold);
}

.room-code-box {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--panel-blue);
}

.room-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-code-row strong {
  font-size: clamp(28px, 5vw, 36px);
  letter-spacing: 0.18em;
  color: #b9232f;
}

.lobby-players {
  margin-bottom: 18px;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 3px solid rgba(21, 33, 79, 0.7);
  border-radius: 0;
  background: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.player-list .player-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-list .player-badge {
  padding: 2px 7px;
  border-radius: 0;
  background: var(--button-secondary);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.player-list .player-status {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.player-list .player-status.is-ready {
  color: var(--green);
}

#lobby-ready.is-ready {
  border-color: var(--line);
  background: #b8ff93;
  color: var(--ink);
}

#lobby-start:not(:disabled) {
  border-color: var(--line);
  background: var(--gold);
  color: var(--ink);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 16px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.control-grid b {
  color: var(--ink);
}

.menu-lead-compact {
  margin: 0;
  max-width: 560px;
  font-size: 13px;
  text-align: center;
}

.title-rule-action {
  width: min(220px, 64%);
  margin-top: -4px;
}

.title-rule-action button {
  min-height: 54px;
}

.title-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(420px, 100%);
  margin-top: -4px;
}

.title-sub-actions button {
  min-height: 54px;
}

.menu-card.rules-card,
.menu-card.credits-card {
  width: min(820px, 96vw);
  max-height: min(700px, 92vh);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.credits-list li {
  line-height: 1.7;
}

.rules-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
  border-bottom: 4px solid var(--line);
  background: rgba(189, 241, 255, 0.72);
}

.rules-title {
  margin: 0;
}

.rules-scroll {
  overflow-y: auto;
  padding: 18px 24px 28px;
  scrollbar-gutter: stable;
}

.rules-scroll::-webkit-scrollbar {
  width: 8px;
}

.rules-scroll::-webkit-scrollbar-thumb {
  border-radius: 0;
  background: var(--cyan);
}

.rules-section {
  margin-bottom: 26px;
}

.rules-section:last-child {
  margin-bottom: 0;
}

.rules-heading {
  margin: 0 0 12px;
  color: #b9232f;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.rules-callout {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #ffffff;
}

.rules-callout p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
}

.rules-key-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  margin: 0;
}

.rules-key-grid dt {
  margin: 0;
}

.rules-key-grid dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.rules-key-grid kbd {
  display: inline-block;
  min-width: 2.4em;
  padding: 4px 8px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.rules-list {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.rules-list li + li {
  margin-top: 6px;
}

.rules-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.rules-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.rules-item-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 3px solid rgba(21, 33, 79, 0.72);
  border-radius: 0;
  background: #ffffff;
}

.rules-item-icon-wrap {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 3px solid rgba(21, 33, 79, 0.7);
  border-radius: 0;
  background: var(--panel-blue);
}

.rules-item-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.rules-item-name {
  margin: 0 0 4px;
  color: #000;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.3;
}

.rules-item-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  max-width: min(520px, 90%);
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  padding: 12px 16px;
  text-align: center;
  box-shadow: 4px 4px 0 var(--shadow);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 800px) {
  .shell {
    padding: 0;
  }

  .game-frame {
    width: 100vw;
    height: 100vh;
    max-height: none;
  }

  .hud {
    padding: 10px;
  }

  .hud-panel {
    top: 10px;
    width: 92px;
  }

  .hud-panel.left {
    left: 10px;
    top: 48px;
  }

  .hud-stats-panel {
    bottom: 10px;
    left: 10px;
    top: auto;
    right: auto;
  }

  .hud-stats-panel .stat-pill {
    min-width: 72px;
    padding: 4px 7px;
  }

  .player-status-panel {
    top: 8px;
    right: 10px;
  }

  .survival-climb-panel {
    top: 88px;
    right: 10px;
    width: 92px;
    padding: 6px 7px 8px;
    gap: 5px;
  }

  .control-guide-panel {
    display: none !important;
  }

  .climb-track {
    height: 180px;
  }

  .climb-marker-stick {
    width: 10px;
    height: 20px;
  }

  .climb-stat {
    padding: 4px 5px;
  }

  .climb-stat-value {
    font-size: 10px;
  }

  .item-box {
    min-height: 88px;
    gap: 0;
    padding: 5px 5px 4px;
    border-width: 2px;
  }

  .item-stock {
    min-height: 78px;
  }

  .item-stock-slot--active {
    width: 68px;
    min-height: 68px;
  }

  .item-stock-slot--reserve {
    width: 52px;
    min-height: 52px;
  }

  .item-stock-icon {
    width: 30px;
    height: 30px;
  }

  .item-stock-slot--reserve .item-stock-icon {
    width: 22px;
    height: 22px;
  }

  .item-stock-label {
    font-size: 9px;
  }

  .item-stock-slot--active .item-stock-label {
    font-size: 10px;
  }

  .item-icon {
    width: 32px;
    height: 32px;
  }

  .item-label {
    padding-inline: 2px;
    font-size: 10px;
  }

  .item-charges {
    right: 3px;
    top: 3px;
    font-size: 11px;
  }

  .name-row {
    font-size: 10px;
  }

  .center-hud {
    top: 8px;
    min-width: 200px;
    padding: 6px 10px 8px;
  }

  .boss-hp-panel {
    top: 10px;
    width: min(280px, 72vw);
  }

  .boss-hp-label {
    font-size: 14px;
    -webkit-text-stroke-width: 1.25px;
  }

  .boss-hp-bar {
    height: 9px;
  }

  .stat-pill {
    min-width: 78px;
    padding: 5px 8px;
  }

  .menu {
    padding: 12px;
    place-items: start center;
  }

  .title-card {
    gap: 15px;
    padding: 24px 18px;
  }

  .title-logo {
    font-size: clamp(44px, 14vw, 72px);
  }

  .mode-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .title-rule-action {
    width: 100%;
    margin-top: 0;
  }

  .menu-card {
    padding: 22px;
  }

  .menu-card.rules-card {
    padding: 0;
  }

  .room-code-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-height: 620px) {
  .menu {
    place-items: start center;
  }

  .title-card {
    gap: 12px;
    padding-block: 18px;
  }

  .title-logo {
    font-size: clamp(40px, 11vh, 66px);
  }

  .menu-lead-compact {
    font-size: 12px;
  }
}

.settings-open-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  right: auto;
  z-index: 12;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  background: #ffffff;
  color: var(--ink);
}

.settings-open-btn:hover {
  background: var(--button-secondary);
}

.settings-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(112, 216, 255, 0.72);
}

.settings-panel.is-hidden {
  display: none;
}

.settings-card {
  width: min(420px, 92vw);
  border: 4px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 28px;
  box-shadow: 8px 8px 0 var(--shadow);
}

.settings-volume {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 18px;
}

.settings-volume .field-label {
  grid-column: 1 / -1;
}

.settings-volume input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.settings-value {
  min-width: 3.2em;
  color: #b9232f;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 18px;
  padding: 10px 12px;
  border: 3px solid rgba(21, 33, 79, 0.7);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.settings-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cyan);
  flex: 0 0 auto;
}
