:root {
  --mobile-viewport-height: 100dvh;
  --bg-top: #f5ede3;
  --bg-bottom: #d8e3f1;
  --panel: rgba(255, 252, 246, 0.92);
  --panel-border: rgba(84, 88, 102, 0.16);
  --card: rgba(255, 255, 255, 0.62);
  --card-border: rgba(84, 88, 102, 0.08);
  --soft-surface: rgba(255, 255, 255, 0.68);
  --soft-surface-strong: rgba(255, 255, 255, 0.86);
  --secondary-bg: rgba(255, 255, 255, 0.95);
  --action-bg: rgba(255, 255, 255, 0.86);
  --action-bg-active: rgba(255, 245, 239, 0.96);
  --resource-panel: rgba(255, 252, 246, 0.78);
  --resource-pill: rgba(255, 255, 255, 0.72);
  --overlay: rgba(31, 42, 54, 0.36);
  --word-bg: rgba(255, 255, 255, 0.92);
  --word-match: rgba(232, 247, 236, 0.98);
  --word-text: #1f2a36;
  --word-border: rgba(62, 76, 93, 0.12);
  --word-match-text: #2f7a57;
  --arena-top: rgba(173, 210, 235, 0.45);
  --arena-bottom: rgba(247, 239, 224, 0.85);
  --text: #1f2a36;
  --muted: #5f6a76;
  --accent: #cd5c36;
  --accent-dark: #9f4123;
  --danger: #a83b32;
  --good: #2f7a57;
  --gold: #d8ab3f;
  --shadow: 0 20px 45px rgba(45, 58, 72, 0.15);
}

body[data-theme="dark"] {
  --bg-top: #0d1220;
  --bg-bottom: #1b2440;
  --panel: rgba(18, 24, 40, 0.9);
  --panel-border: rgba(92, 116, 171, 0.18);
  --card: rgba(24, 31, 51, 0.88);
  --card-border: rgba(92, 116, 171, 0.16);
  --soft-surface: rgba(22, 29, 47, 0.9);
  --soft-surface-strong: rgba(24, 31, 51, 0.94);
  --secondary-bg: rgba(26, 34, 55, 0.96);
  --action-bg: rgba(23, 31, 50, 0.94);
  --action-bg-active: rgba(38, 48, 77, 0.98);
  --resource-panel: rgba(18, 24, 40, 0.76);
  --resource-pill: rgba(26, 34, 55, 0.9);
  --overlay: rgba(4, 7, 14, 0.62);
  --word-bg: rgba(240, 246, 255, 0.96);
  --word-match: rgba(173, 245, 221, 0.94);
  --word-text: #18233a;
  --word-border: rgba(125, 155, 212, 0.26);
  --word-match-text: #114b44;
  --arena-top: rgba(34, 79, 133, 0.42);
  --arena-bottom: rgba(16, 23, 41, 0.92);
  --text: #e7edf8;
  --muted: #9fb0cf;
  --accent: #16c6c9;
  --accent-dark: #0fa0a3;
  --danger: #ff7c8b;
  --good: #63ddb5;
  --gold: #f0c35d;
  --shadow: 0 24px 50px rgba(2, 6, 14, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.75), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input {
  font: inherit;
}

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

.app-shell {
  width: min(1040px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: block;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

#start-screen,
#game-over-screen {
  margin: 0 auto;
  padding: 48px;
  text-align: center;
}

#start-screen {
  max-width: 760px;
}

#game-over-screen {
  max-width: 580px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.03em;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 16px;
}

h3 {
  margin-bottom: 10px;
}

.lead,
.shop-help,
.shop-item p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}

.lead {
  margin-bottom: 32px;
}

.player-name-group {
  margin-bottom: 24px;
  text-align: left;
}

.text-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--soft-surface);
  color: var(--text);
}

.text-input::placeholder {
  color: var(--muted);
}

.text-input:focus {
  outline: 2px solid rgba(205, 92, 54, 0.22);
  outline-offset: 2px;
}

.leaderboard-panel {
  margin-top: 28px;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--soft-surface);
  text-align: left;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.leaderboard-header .eyebrow {
  margin-bottom: 8px;
}

.leaderboard-difficulty {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--soft-surface-strong);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-weight: 700;
}

.leaderboard-empty,
.game-over-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.game-over-note {
  margin-bottom: 20px;
}

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

.leaderboard-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--card-border);
}

.leaderboard-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 8px;
}

.leaderboard-rank {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.leaderboard-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.leaderboard-score {
  font-weight: 700;
  color: var(--accent-dark);
}

.leaderboard-stats {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.difficulty-picker {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  text-align: left;
}

.difficulty-picker .hud-label {
  margin-bottom: 10px;
}

.difficulty-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--soft-surface);
  cursor: pointer;
}

.difficulty-option + .difficulty-option {
  margin-top: 10px;
}

.difficulty-option input {
  margin: 0;
  accent-color: var(--accent);
}

.difficulty-name {
  font-weight: 700;
}

.difficulty-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.95rem;
}

.primary-button,
.secondary-button,
.action-button {
  border-radius: 18px;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.primary-button,
.secondary-button {
  border: 0;
  padding: 14px 28px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.primary-button {
  background: linear-gradient(180deg, #e47a50, var(--accent));
  color: #fff;
  box-shadow: 0 10px 24px rgba(205, 92, 54, 0.35);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: linear-gradient(180deg, #db6e43, var(--accent-dark));
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--secondary-bg);
  border: 1px solid rgba(84, 88, 102, 0.14);
  color: var(--text);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-1px);
}

#game-screen.active {
  display: grid;
  gap: 16px;
  position: relative;
}

.hud {
  display: grid;
  grid-template-columns: 1fr 2.6fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 18px 20px;
  align-items: stretch;
}

.hud-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 86px;
}

.hud-card-full {
  grid-column: 1 / -1;
}

.hud-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.label-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.currency-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.simple-icon {
  line-height: 1;
  font-size: 1rem;
  display: inline-block;
  flex: 0 0 auto;
}

.score-mark {
  color: #8d5c14;
}

.flame-mark {
  filter: saturate(1.02);
}

.spark-mark {
  color: #6a7f97;
}

.tnt-mark {
  filter: saturate(1.02);
}

.slow-mark {
  color: #466d98;
}

.pause-mark {
  color: #59648c;
}

.accuracy-mark {
  color: #2f7a57;
}

.shop-mark {
  color: #4f8a62;
}

.coin-icon {
  display: inline-block;
  line-height: 1;
  font-size: 0.95rem;
}

.coin-icon.gold {
  filter: saturate(1.05);
}

.coin-icon.silver {
  color: #94a0b2;
  text-shadow: 0 0 0.5px #7a8798;
}

.typed-display {
  min-height: 1.5em;
  color: var(--good);
  word-break: break-word;
  font-size: 1.2rem;
}

.hearts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.heart {
  color: #d64f62;
  font-size: 1.2rem;
  line-height: 1;
}

.heart.empty {
  color: rgba(214, 79, 98, 0.22);
}

.heart-summary {
  display: none;
}

.arena {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  background:
    linear-gradient(180deg, var(--arena-top), var(--arena-bottom)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18) 2px, transparent 2px, transparent 64px);
}

.word-layer {
  position: relative;
  min-height: 520px;
}

.word {
  position: absolute;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--word-bg);
  border: 1px solid var(--word-border);
  box-shadow: 0 10px 18px rgba(47, 58, 71, 0.12);
  color: var(--word-text);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.word.matching {
  background: var(--word-match);
  border-color: rgba(47, 122, 87, 0.3);
  color: var(--word-match-text);
}

.word.warning {
  color: var(--danger);
}

.ground {
  position: absolute;
  inset: auto 0 0;
  height: 16px;
  background: linear-gradient(180deg, #8cc384, #5d8f57);
}

.action-panel {
  padding: 16px 18px 18px;
}

.action-panel-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.status-chip,
.command-prompt {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.95rem;
}

.status-chip {
  background: var(--soft-surface-strong);
  border: 1px solid var(--card-border);
}

.status-chip.good {
  color: var(--good);
}

.status-chip.bad {
  color: var(--danger);
}

.status-chip.warn {
  color: var(--gold);
}

.command-prompt {
  flex: 1;
  text-align: right;
  color: var(--muted);
  background: var(--soft-surface);
}

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

.action-button {
  border: 1px solid var(--card-border);
  background: var(--action-bg);
  color: var(--text);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 8px;
}

.action-button:hover,
.action-button:focus-visible,
.action-button.active {
  border-color: rgba(205, 92, 54, 0.36);
  background: var(--action-bg-active);
  transform: translateY(-1px);
}

.action-number {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.action-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.action-icon {
  font-size: 1.1rem;
  min-height: 1.2em;
}

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

.resource-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 18px;
  background: var(--resource-panel);
}

.mobile-typing-bar,
.shop-balance {
  display: none;
}

.resource-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--resource-pill);
  border: 1px solid var(--card-border);
}

.resource-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.shop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.shop-overlay.active {
  display: flex;
}

.shop-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.shop-dialog {
  position: relative;
  width: min(760px, calc(100vw - 40px));
  padding: 24px;
  z-index: 1;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.shop-help {
  margin-bottom: 22px;
}

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

.shop-item {
  background: var(--resource-pill);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--card-border);
}

.shop-item p {
  min-height: 3.2em;
  margin-bottom: 14px;
}

.shop-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 20px, 1040px);
  }

  #start-screen,
  #game-over-screen {
    padding: 34px 24px;
  }

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

  .hud-card-full {
    grid-column: auto;
  }

  .hud-card-full {
    grid-column: 1 / -1;
  }

  .action-panel-top {
    flex-direction: column;
    align-items: stretch;
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: stretch;
  }

  .command-prompt {
    text-align: left;
  }

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

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

@media (max-width: 560px) {
  .hud {
    grid-template-columns: 1fr;
  }

  .action-menu {
    grid-template-columns: 1fr;
  }

  .shop-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 600px) {
  body {
    min-height: var(--mobile-viewport-height);
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    min-height: var(--mobile-viewport-height);
    display: block;
    padding:
      calc(env(safe-area-inset-top) + 8px)
      10px
      calc(env(safe-area-inset-bottom) + 8px);
  }

  #game-screen.active {
    height: calc(
      var(--mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px
    );
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    overflow: hidden;
  }

  body.game-playing {
    background: #020817;
  }

  body.game-playing .app-shell {
    padding:
      calc(env(safe-area-inset-top) + 6px)
      6px
      calc(env(safe-area-inset-bottom) + 6px);
  }

  body.game-playing #game-screen.active {
    height: calc(
      var(--mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 12px
    );
    padding: 18px 16px 16px;
    gap: 12px;
    border: 1px solid rgba(113, 159, 229, 0.35);
    border-radius: 32px;
    background:
      radial-gradient(circle at 50% -10%, rgba(47, 114, 202, 0.34), transparent 34%),
      linear-gradient(145deg, #071633, #020917 70%);
    box-shadow:
      inset 0 1px 0 rgba(207, 229, 255, 0.3),
      inset 0 0 0 3px rgba(53, 88, 145, 0.14),
      0 18px 34px rgba(0, 4, 16, 0.42);
  }

  .hud {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.45fr) minmax(0, 0.9fr);
    gap: 8px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .hud-card {
    display: none;
    min-height: 52px;
    padding: 6px 10px;
    border-radius: 18px;
    text-align: center;
  }

  .hud-card-score,
  .hud-card-hearts,
  .hud-card-accuracy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .hud-card .hud-label {
    margin: 0;
  }

  .hud-card .label-with-icon {
    justify-content: center;
  }

  .hud-card-score .hud-label > span:last-child,
  .hud-card-accuracy .hud-label > span:last-child,
  .hud-card-hearts .hud-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .hud-card-score .score-mark,
  .hud-card-accuracy .accuracy-mark {
    font-size: 1rem;
  }

  .hud-card-score .score-mark {
    color: #f2c84b;
  }

  .hud-card strong {
    font-size: 0.85rem;
  }

  body.game-playing .hud-card {
    min-height: 34px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.game-playing .hud-card strong,
  body.game-playing .heart-summary .heart-total {
    color: #f2f6ff;
    font-size: 1rem;
  }

  body.game-playing .hud-card-score .score-mark,
  body.game-playing .hud-card-accuracy .accuracy-mark,
  body.game-playing .heart-summary {
    font-size: 1.15rem;
  }

  .hearts {
    min-height: 0;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 2px;
  }

  .heart {
    font-size: 0.85rem;
  }

  .hearts .heart {
    display: none;
  }

  .heart-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #d64f62;
    font-size: 1rem;
    line-height: 1;
  }

  .heart-summary .heart-total {
    color: var(--text);
    font-size: 0.85rem;
  }

  .arena,
  .word-layer {
    min-height: 0;
    height: 100%;
  }

  .arena {
    border-radius: 20px;
  }

  body.game-playing .arena {
    border: 1px solid rgba(121, 190, 255, 0.48);
    border-radius: 22px;
    background:
      radial-gradient(circle at 8% 12%, rgba(126, 204, 255, 0.72) 0 2px, transparent 3px),
      radial-gradient(circle at 30% 28%, rgba(126, 204, 255, 0.5) 0 1px, transparent 2px),
      radial-gradient(circle at 64% 18%, rgba(126, 204, 255, 0.45) 0 1px, transparent 2px),
      radial-gradient(circle at 88% 10%, rgba(126, 204, 255, 0.62) 0 1px, transparent 2px),
      radial-gradient(circle at 16% 66%, rgba(126, 204, 255, 0.38) 0 1px, transparent 2px),
      radial-gradient(circle at 74% 54%, rgba(126, 204, 255, 0.42) 0 1px, transparent 2px),
      linear-gradient(180deg, rgba(25, 77, 130, 0.9), rgba(2, 18, 42, 0.98)),
      repeating-linear-gradient(90deg, rgba(126, 193, 255, 0.26), rgba(126, 193, 255, 0.26) 2px, transparent 2px, transparent 18%);
    box-shadow:
      inset 0 1px 0 rgba(192, 225, 255, 0.34),
      inset 0 -26px 44px rgba(0, 0, 0, 0.3);
  }

  .word {
    padding: 7px 12px;
    font-size: 0.95rem;
  }

  body.game-playing .word {
    border-color: rgba(187, 216, 255, 0.8);
    box-shadow: 0 8px 16px rgba(0, 8, 26, 0.38);
  }

  .ground {
    height: 10px;
  }

  body.game-playing .ground {
    background: linear-gradient(180deg, #c9ff87, #61cb72 58%, #1c8d5b);
    box-shadow: 0 -3px 13px rgba(137, 255, 164, 0.48);
  }

  .action-panel {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .action-panel-top,
  .action-number,
  .action-count,
  .resource-footer {
    display: none;
  }

  .action-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .action-button {
    min-height: 48px;
    padding: 6px 4px;
    border-radius: 16px;
    text-align: center;
    justify-items: center;
    align-content: center;
    gap: 4px;
  }

  body.game-playing .action-button {
    min-height: 52px;
    border-color: rgba(87, 143, 213, 0.38);
    background: linear-gradient(145deg, #0a2041, #04132c);
    box-shadow: inset 0 1px 0 rgba(187, 218, 255, 0.12);
  }

  .action-icon {
    min-height: 1em;
    font-size: 1.2rem;
  }

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

  .mobile-typing-bar {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 14px;
    border-radius: 16px;
  }

  body.game-playing .mobile-typing-bar {
    min-height: 50px;
    border-color: rgba(87, 143, 213, 0.38);
    background: linear-gradient(145deg, #081d3c, #031126);
    box-shadow: inset 0 1px 0 rgba(187, 218, 255, 0.1);
  }

  #mobile-typing-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-transform: none;
  }

  #mobile-typing-input::placeholder {
    color: var(--muted);
    opacity: 1;
  }

  body.game-playing #mobile-typing-input {
    color: #f2f6ff;
  }

  body.game-playing #mobile-typing-input::placeholder {
    color: #96a9cf;
  }

  #mobile-typing-input:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 48%, transparent);
    outline-offset: 7px;
    border-radius: 4px;
  }

  .shop-overlay {
    position: fixed;
    inset: 0;
    align-items: flex-start;
    overflow-y: auto;
    padding:
      calc(env(safe-area-inset-top) + 12px)
      10px
      calc(env(safe-area-inset-bottom) + 12px);
  }

  .shop-dialog {
    width: 100%;
    max-height: calc(var(--mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    margin: auto 0;
    padding: 18px;
    overflow-y: auto;
  }

  .shop-balance {
    display: flex;
    gap: 8px;
    margin: 14px 0 0;
  }

  .shop-balance-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--resource-pill);
    font-size: 0.84rem;
  }

  .shop-help {
    margin-top: 16px;
  }

  #start-screen,
  #game-over-screen {
    padding: 28px 18px;
    border-radius: 20px;
  }
}
