.play-arcade-page {
  min-height: 100vh;
  overscroll-behavior: none;
}

.play-arcade-page.is-arcade-playing,
html.is-arcade-playing,
html.is-arcade-playing body {
  overflow: hidden;
  overscroll-behavior: none;
}

.arcade-main {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.arcade-bar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 16px 20px;
  align-items: center;
  margin-bottom: 18px;
}

.arcade-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent, #8ab4ff);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.arcade-back::before {
  content: '';
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.arcade-kicker {
  margin: 0 0 2px;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent, #8ab4ff);
}

.arcade-bar h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.1;
}

.arcade-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
  color: var(--muted, #bcd1ee);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.arcade-hud strong {
  color: var(--text, #e8eef9);
  font-variant-numeric: tabular-nums;
}

.arcade-mute {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(152, 186, 227, 0.28);
  background: rgba(15, 25, 40, 0.72);
  color: var(--text, #e8eef9);
  font-weight: 700;
  cursor: pointer;
}

.arcade-mute[aria-pressed="true"] {
  color: var(--muted, #bcd1ee);
}

.arcade-cabinet {
  position: relative;
  width: min(100%, 540px);
  margin: 0 auto;
  touch-action: none;
  overscroll-behavior: none;
  border-radius: 22px;
  border: 1px solid rgba(152, 186, 227, 0.22);
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(152, 186, 227, 0.14), transparent 58%),
    #070b14;
  box-shadow:
    0 18px 40px rgba(2, 4, 8, 0.42),
    inset 0 0 0 1px rgba(232, 238, 249, 0.04);
  overflow: hidden;
}

.arcade-cabinet canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: ew-resize;
  touch-action: none;
  overscroll-behavior: none;
  background: #05080f;
  user-select: none;
  -webkit-user-select: none;
}

.play-arcade-page--bugstorm .arcade-cabinet canvas {
  cursor: crosshair;
}

.arcade-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 24px;
  text-align: center;
  background: rgba(5, 8, 15, 0.78);
  backdrop-filter: blur(6px);
}

.arcade-overlay[hidden] {
  display: none;
}

.arcade-cabinet:has(#arcadeOverlay:not([hidden])) canvas {
  pointer-events: none;
}

.arcade-overlay__kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent, #8ab4ff);
}

.arcade-overlay h3 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.arcade-overlay p {
  margin: 0 0 8px;
  max-width: 28rem;
  color: var(--muted, #bcd1ee);
  font-weight: 500;
  line-height: 1.6;
}

.arcade-heat {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 0;
}

.arcade-heat button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(152, 186, 227, 0.28);
  background: rgba(15, 25, 40, 0.78);
  color: var(--muted, #bcd1ee);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.arcade-heat button[aria-pressed="true"] {
  border-color: rgba(232, 176, 92, 0.72);
  background: rgba(232, 176, 92, 0.18);
  color: #fff6d4;
  box-shadow: 0 0 16px rgba(232, 176, 92, 0.18);
}

.arcade-heat__copy {
  margin: 0 0 4px !important;
  max-width: 24rem;
  min-height: 2.6em;
  font-size: 0.86rem !important;
}

.arcade-help {
  max-width: 540px;
  margin: 14px auto 0;
  text-align: center;
  color: var(--muted, #bcd1ee);
  font-weight: 500;
  line-height: 1.6;
}

.arcade-stamp {
  width: min(100%, 16rem);
  margin: 4px 0 2px;
}

.arcade-stamp label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8c07a;
  font-weight: 800;
}

.arcade-stamp__row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.arcade-stamp input {
  width: 5.5rem;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(232, 176, 92, 0.45);
  background: rgba(7, 16, 24, 0.88);
  color: #fff6d4;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.28em;
  text-align: center;
  text-transform: uppercase;
}

.arcade-stamp__status {
  margin: 0 0 6px !important;
  min-height: 1.4em;
  font-size: 0.86rem !important;
}

.arcade-scores {
  width: min(100%, 540px);
  margin: 22px auto 0;
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(152, 186, 227, 0.22);
  background: rgba(7, 11, 20, 0.72);
}

.arcade-scores h3 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent, #8ab4ff);
}

.arcade-scores__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.arcade-scores__list li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 25, 40, 0.55);
}

.arcade-scores__list li.is-mine {
  outline: 1px solid rgba(232, 176, 92, 0.55);
  background: rgba(232, 176, 92, 0.12);
}

.arcade-scores__rank {
  font-weight: 900;
  color: #e8c07a;
  font-variant-numeric: tabular-nums;
}

.arcade-scores__name {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcade-scores__meta {
  color: var(--muted, #bcd1ee);
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.arcade-scores__empty,
.arcade-scores__note {
  margin: 10px 0 0;
  color: var(--muted, #bcd1ee);
  font-weight: 500;
  line-height: 1.5;
}

.arcade-scores__empty[hidden] {
  display: none;
}

.arcade-main--photos {
  width: min(1280px, calc(100% - 32px));
}

.arcade-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.arcade-photo-wall {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 210px;
  flex: 0 0 auto;
}

.arcade-photo-wall--right {
  gap: 0;
}

.arcade-frame {
  margin: 0;
  width: 196px;
  padding: 10px 10px 22px;
  border: 0;
  cursor: pointer;
  background:
    linear-gradient(145deg, #f3d7a4 0%, #c48a4a 42%, #8a5524 100%);
  border-radius: 4px;
  box-shadow:
    0 12px 22px rgba(2, 4, 8, 0.4),
    inset 0 1px 0 rgba(255, 244, 214, 0.55);
  transform-origin: 50% 8%;
}

.arcade-frame:hover,
.arcade-frame:focus-visible {
  z-index: 2;
  filter: brightness(1.06);
  outline: 2px solid #fff6d4;
  outline-offset: 3px;
}

.arcade-frame__mat {
  display: block;
  padding: 7px;
  background: #f7efe2;
  box-shadow: inset 0 0 0 1px rgba(90, 50, 20, 0.18);
}

.arcade-frame img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
  background: #1a120c;
  pointer-events: none;
}

.arcade-frame--1 { transform: rotate(-8deg) translateX(4px); }
.arcade-frame--2 { transform: rotate(6deg) translateX(-2px); }
.arcade-frame--3 { transform: rotate(-5deg) translateX(2px); }

.arcade-frame--1 { animation: arcade-frame-sway 5.4s ease-in-out infinite; }
.arcade-frame--2 { animation: arcade-frame-sway 6.2s ease-in-out infinite reverse; animation-delay: -1.4s; }
.arcade-frame--3 { animation: arcade-frame-sway 7s ease-in-out infinite; animation-delay: -2.2s; }

@keyframes arcade-frame-sway {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-frame--1,
  .arcade-frame--2,
  .arcade-frame--3 {
    animation: none;
  }
}

.is-arcade-playing .arcade-photo-wall {
  display: none;
}

.arcade-photo-modal {
  position: fixed;
  inset: 0;
  width: fit-content;
  height: fit-content;
  max-width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 16px 16px 18px;
  border: 0;
  border-radius: 10px;
  background:
    linear-gradient(145deg, #f3d7a4 0%, #c48a4a 42%, #8a5524 100%);
  box-shadow: 0 24px 60px rgba(2, 4, 8, 0.55);
}

.arcade-photo-modal::backdrop {
  background: rgba(5, 8, 15, 0.78);
}

.arcade-photo-modal img {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 110px);
  object-fit: contain;
  background: #120c08;
  border: 8px solid #f7efe2;
}

.arcade-photo-modal__close {
  display: block;
  margin: 0 0 10px auto;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 214, 0.45);
  background: rgba(18, 12, 8, 0.55);
  color: #fff6d4;
  font-weight: 800;
  cursor: pointer;
}

.arcade-photo-modal form {
  margin: 0;
}

.play-arcade-page--brickblaster .arcade-cabinet {
  box-shadow:
    0 18px 40px rgba(2, 4, 8, 0.42),
    0 0 28px rgba(232, 176, 92, 0.12);
}

.play-arcade-page--bugstorm .arcade-cabinet {
  box-shadow:
    0 18px 40px rgba(2, 4, 8, 0.42),
    0 0 28px rgba(90, 220, 150, 0.12);
}

.play-arcade-page--bugstorm .arcade-overlay__kicker {
  color: #5ad47a;
}

.play-arcade-page--bugstorm .arcade-scores {
  border-color: rgba(90, 212, 122, 0.28);
}

.play-arcade-page--sparkmaw .arcade-cabinet {
  box-shadow:
    0 18px 40px rgba(2, 4, 8, 0.42),
    0 0 28px rgba(232, 180, 90, 0.14);
}

.play-arcade-page--sparkmaw .arcade-overlay__kicker {
  color: #e8c07a;
}

.play-arcade-page--sparkmaw .arcade-scores {
  border-color: rgba(232, 180, 90, 0.28);
}

.play-arcade-page--sparkmaw .arcade-scores h3 {
  color: #e8c07a;
}

.play-arcade-page--sparkmaw .arcade-cabinet canvas {
  cursor: pointer;
}

@media (max-width: 820px) {
  .arcade-bar {
    grid-template-columns: 1fr auto;
  }

  .arcade-back {
    grid-column: 1;
  }

  .arcade-mute {
    grid-column: 2;
    justify-self: end;
  }

  .arcade-bar__titles,
  .arcade-hud {
    grid-column: 1 / -1;
  }

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

  .arcade-stage {
    gap: 8px;
  }

  .arcade-photo-wall {
    width: 132px;
    gap: 12px;
  }

  .arcade-frame {
    width: 124px;
    padding: 7px 7px 16px;
  }

  .arcade-frame img {
    height: 84px;
  }

@media (max-width: 560px) {
  .arcade-main {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  .arcade-cabinet {
    border-radius: 16px;
  }
}
