:root {
  --ink: #171311;
  --ink-soft: #241913;
  --paper: #ffe6ad;
  --cream: #fff8e8;
  --sun: #ffbf2f;
  --ember: #ff6b12;
  --ember-deep: #d64200;
  --flare: #ffec9e;
  --danger: #ff3d00;
  --line: rgba(255, 244, 209, 0.16);
  --panel: rgba(34, 22, 16, 0.88);
  --panel-strong: rgba(24, 16, 12, 0.94);
  --shadow-hard: 0 14px 0 rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 22px 50px rgba(0, 0, 0, 0.38);
  --radius-card: 26px;
  --radius-pill: 999px;
  --radius-small: 18px;
  --display-font: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --body-font: "Trebuchet MS", Verdana, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--body-font);
  color: var(--cream);
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 191, 47, 0.42), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(255, 107, 18, 0.18), transparent 24%),
    linear-gradient(180deg, #5e1e00 0%, #31120b 30%, #130d0d 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 230, 173, 0.06) 34% 36%, transparent 36% 42%, rgba(255, 107, 18, 0.05) 42% 44%, transparent 44% 100%);
  mix-blend-mode: screen;
}

body::after {
  background:
    radial-gradient(circle at center, transparent 0 56%, rgba(0, 0, 0, 0.16) 100%);
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 10px 10px, 10px 10px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.92), transparent 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  gap: 18px;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.poster-panel,
.info-card {
  border: 3px solid rgba(255, 235, 179, 0.22);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 224, 138, 0.04), rgba(255, 224, 138, 0)),
    var(--panel);
  box-shadow: var(--shadow-hard), var(--shadow-soft);
}

.poster-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
  backdrop-filter: blur(12px);
}

.poster-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow,
.info-kicker,
.overlay-kicker,
.share-label {
  margin: 0 0 6px;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sun);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display-font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.7rem);
  line-height: 0.9;
  max-width: 7ch;
}

h2 {
  font-size: clamp(1.8rem, 5vw, 3.3rem);
  line-height: 0.92;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 0.98;
}

p {
  margin: 0;
  line-height: 1.45;
}

.sound-toggle,
.hud-mini-button,
.arcade-button,
.touch-button {
  appearance: none;
  border: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease,
    opacity 120ms ease;
}

.sound-toggle,
.hud-mini-button,
.arcade-button {
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sound-toggle {
  align-self: flex-start;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  background:
    linear-gradient(180deg, var(--flare), #ffd66e);
  box-shadow:
    0 6px 0 rgba(111, 54, 0, 0.8),
    0 10px 24px rgba(255, 160, 51, 0.22);
}

.sound-toggle:hover,
.hud-mini-button:hover,
.arcade-button:hover,
.touch-button:hover {
  filter: brightness(1.04);
}

.sound-toggle:active,
.hud-mini-button:active,
.arcade-button:active,
.touch-button:active,
.sound-toggle.is-muted,
.touch-button.is-pressed {
  transform: translateY(2px);
}

.sound-toggle.is-muted {
  background: linear-gradient(180deg, #ccb67b, #a99258);
  box-shadow:
    0 4px 0 rgba(58, 46, 22, 0.88),
    0 8px 18px rgba(0, 0, 0, 0.2);
}

.play-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  min-height: min(72svh, 720px);
  border-radius: calc(var(--radius-card) - 6px);
  overflow: hidden;
  border: 3px solid rgba(255, 228, 167, 0.24);
  background:
    radial-gradient(circle at 50% 86%, rgba(255, 213, 95, 0.18), transparent 18%),
    linear-gradient(180deg, #633009 0%, #2b140f 36%, #120d0e 100%);
}

#gameCanvas,
.flash-layer,
.overlay-screen,
.hud {
  position: absolute;
  inset: 0;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.flash-layer {
  background:
    radial-gradient(circle at center, rgba(255, 250, 229, 0.9), rgba(255, 150, 52, 0.18) 48%, transparent 72%);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.hud {
  display: grid;
  align-content: space-between;
  padding: 12px;
  pointer-events: none;
}

.hud.hidden,
.overlay-screen.hidden,
.touch-controls.hidden {
  display: none;
}

.hud-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.hud-row-bottom {
  align-items: flex-end;
}

.hud-chip,
.hud-status {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(15, 11, 10, 0.64);
  border: 2px solid rgba(255, 232, 186, 0.16);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.hud-chip {
  flex: 1 1 0;
}

.hud-status {
  flex: 1 1 auto;
}

.hud-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 235, 193, 0.72);
}

.hud-chip strong,
.hud-status strong {
  display: block;
  font-family: var(--display-font);
  font-size: 1.16rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

.hud-mini-button {
  pointer-events: auto;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, #fff0ad, #ffc85c);
  box-shadow:
    0 4px 0 rgba(113, 60, 0, 0.8),
    0 10px 18px rgba(0, 0, 0, 0.24);
}

.overlay-screen {
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 200, 95, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(12, 10, 10, 0.18), rgba(18, 10, 10, 0.84));
}

.overlay-card {
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 218, 109, 0.08), rgba(255, 218, 109, 0)),
    var(--panel-strong);
  border: 3px solid rgba(255, 228, 167, 0.22);
  box-shadow: var(--shadow-hard), var(--shadow-soft);
}

.overlay-copy,
.control-copy {
  color: rgba(255, 246, 224, 0.84);
}

.overlay-copy {
  margin-top: 10px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.stat-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 230, 173, 0.1);
  min-width: 0;
}

.stat-card span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 234, 194, 0.72);
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--display-font);
  font-size: clamp(1rem, 3vw, 1.5rem);
  line-height: 1;
}

.arcade-button {
  min-height: 56px;
  padding: 14px 18px;
  border-radius: 20px;
  width: 100%;
  box-shadow:
    0 6px 0 rgba(91, 38, 0, 0.9),
    0 14px 24px rgba(0, 0, 0, 0.3);
}

.primary-button {
  background:
    linear-gradient(180deg, var(--sun), #ff9a19);
}

.secondary-button {
  background:
    linear-gradient(180deg, #fff1b0, #f5d57a);
}

.overlay-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.control-copy {
  margin-top: 14px;
  font-size: 0.94rem;
}

.share-panel {
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 229, 172, 0.1);
}

.share-text {
  margin-top: 8px;
  white-space: pre-wrap;
  color: rgba(255, 246, 222, 0.9);
}

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

.touch-button {
  min-height: 64px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 231, 173, 0.95), rgba(255, 188, 78, 0.95));
  box-shadow:
    0 7px 0 rgba(96, 44, 0, 0.86),
    0 12px 22px rgba(0, 0, 0, 0.26);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  touch-action: none;
  user-select: none;
}

.info-panel {
  display: grid;
  gap: 14px;
}

.info-card {
  padding: 18px;
}

.info-card p + p,
.info-card p + .info-list,
.info-card h3 + p {
  margin-top: 10px;
}

.info-list {
  display: grid;
  gap: 12px;
}

.info-list p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.info-list p:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.info-list span {
  color: rgba(255, 239, 203, 0.74);
}

.info-list strong {
  font-family: var(--display-font);
  letter-spacing: 0.04em;
}

.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;
}

button:focus-visible {
  outline: 3px solid var(--flare);
  outline-offset: 3px;
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 560px) minmax(0, 320px);
    align-items: start;
    justify-content: center;
  }

  .poster-panel {
    padding: 18px;
  }

  .touch-controls {
    grid-template-columns: repeat(2, minmax(0, 160px));
    justify-content: center;
  }
}

@media (max-width: 620px) {
  .poster-panel,
  .info-card {
    border-radius: 22px;
  }

  .play-stage {
    min-height: auto;
  }

  .overlay-card {
    padding: 18px;
  }

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

  .hud-row {
    gap: 6px;
  }

  .hud-chip,
  .hud-status {
    padding: 8px 10px;
  }

  .hud-chip strong,
  .hud-status strong {
    font-size: 1rem;
  }
}

@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;
  }
}
