html {
  background: #09060f;
  min-height: 100%;
  height: 100%;
}

:root {
  color-scheme: dark;
  --bg: #09060f;
  --bg-deep: #171122;
  --panel: rgba(20, 14, 34, 0.9);
  --panel-strong: rgba(16, 12, 30, 0.96);
  --ink: #f7f4ff;
  --muted: #b9b0d5;
  --accent: #ffd84d;
  --accent-strong: #fff06a;
  --violet: #b45cff;
  --cyan: #7af7ff;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(180, 92, 255, 0.34);
  --glow-violet: 0 0 32px rgba(180, 92, 255, 0.16);
  --glow-gold: 0 0 32px rgba(255, 216, 77, 0.14);
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
  --grad-input: linear-gradient(180deg, rgba(28, 21, 42, 0.98), rgba(12, 10, 22, 0.98));
  --grad-button: linear-gradient(135deg, rgba(180, 92, 255, 0.16), rgba(255, 216, 77, 0.08));
  --grad-button-secondary: linear-gradient(180deg, rgba(22, 18, 36, 0.98), rgba(10, 8, 18, 0.98));
  --grad-panel-soft: linear-gradient(180deg, rgba(26, 19, 42, 0.96), rgba(12, 10, 22, 0.98));
  --grad-score-shell: linear-gradient(180deg, rgba(22, 18, 34, 0.98), rgba(10, 8, 18, 0.98));
  --grad-cube-button: linear-gradient(180deg, rgba(20, 16, 32, 0.96), rgba(10, 8, 18, 0.96));
  --grad-cube-button-active: linear-gradient(180deg, rgba(36, 28, 56, 0.98), rgba(16, 12, 28, 0.98));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  height: 100%;
  width: 100%;
  font-family: "Orbitron", "Rajdhani", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background-color: #09060f;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at top center, rgba(180, 92, 255, 0.2), transparent 32%),
    radial-gradient(circle at bottom center, rgba(255, 216, 77, 0.08), transparent 30%),
    linear-gradient(180deg, #06040b 0%, var(--bg) 46%, var(--bg-deep) 100%);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(122, 247, 255, 0.06), transparent 42%);
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.015) 100%);
  opacity: 1;
}

.app {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 16px 48px;
  background: #09060f;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 18%),
    radial-gradient(circle at top, rgba(180, 92, 255, 0.12), transparent 46%),
    var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow), var(--glow-violet);
  overflow: hidden;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.panel::before {
  display: none;
}

.panel::after {
  display: none;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subhead {
  margin-top: 8px;
  color: var(--muted);
  max-width: 32ch;
}

.subhead.compact {
  margin-top: 4px;
}

.start-header {
  margin-top: 8px;
}

.end-header {
  margin-top: 42px;
}

.brand-logo {
  width: min(72vw, 360px);
  height: auto;
  display: block;
  margin: 0 auto 10px;
  filter: drop-shadow(0 12px 24px rgba(180, 92, 255, 0.2));
}

.brand-logo-start {
  width: min(54vw, 240px);
  margin-bottom: 4px;
}

.brand-logo-compact {
  width: min(52vw, 240px);
  margin-bottom: 6px;
}

.start-description {
  margin-top: 4px;
  margin-bottom: 0;
}

.start-instruction {
  margin-top: 18px;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--grad-input);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 18px rgba(180, 92, 255, 0.08);
}

input::placeholder {
  color: rgba(179, 169, 207, 0.72);
}

.pin-input {
  margin-top: 24px;
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.start-button {
  width: 100%;
  margin-top: 20px;
}

.connection-inline {
  margin-top: 16px;
  color: rgba(247, 244, 255, 0.76);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 12px 18px;
  background:
    var(--grad-button),
    rgba(14, 11, 26, 0.98);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 20px rgba(180, 92, 255, 0.08);
  clip-path: none;
}

button.secondary {
  background: var(--grad-button-secondary);
  border-color: rgba(255, 255, 255, 0.16);
}

button:hover,
button:focus-visible {
  outline: none;
  border-color: rgba(255, 216, 77, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 216, 77, 0.12),
    0 0 24px rgba(255, 216, 77, 0.16);
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 216, 77, 0.22);
  background: rgba(255, 216, 77, 0.08);
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill.muted {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.tap-panel,
.log-panel {
  margin-top: 22px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--grad-panel-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.game-panel {
  margin-top: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.status-card {
  margin-top: 22px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
    rgba(14, 10, 26, 0.86);
}

.status-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.game-topbar,
.game-header,
.game-actions,
.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.game-header {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.game-actions {
  margin-top: 14px;
}

.game-actions button {
  flex: 1;
  min-width: 0;
}

.end-actions {
  margin-top: 48px;
  flex-direction: column;
}

.end-actions button {
  width: 100%;
  min-height: 72px;
  font-size: 1.05rem;
  text-transform: none;
}

.hud-row {
  margin-top: 16px;
  flex-wrap: wrap;
}

.score-panel {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.score-number {
  display: inline-block;
  min-width: 3ch;
  text-align: right;
  color: var(--accent-strong);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform-origin: 50% 50%;
}

.score-number-centered {
  text-align: center;
  margin: 0 auto 8px;
}

.score-number.is-danger {
  animation: mobile-score-pulse 600ms ease-in-out infinite;
}

.mobile-score-bar-shell {
  position: relative;
  margin-top: 10px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--grad-score-shell);
}

.mobile-score-bar-fill {
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 100, 100, 0.92) 0%, rgba(255, 216, 77, 0.95) 52%, rgba(110, 255, 158, 0.96) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 22px rgba(255, 216, 77, 0.2);
  transform-origin: 0 50%;
  transition:
    width 180ms ease,
    transform 180ms ease;
}

.mobile-score-bar-fill.is-danger {
  animation: mobile-score-bar-pulse 600ms ease-in-out infinite;
}

.tap-header,
.log-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.playfield-layout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

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

.cube-selector-start {
  grid-column: 1 / 3;
}

.cube-selector-end {
  grid-column: 3 / 5;
}

.cube-type-button {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  color: var(--muted);
  background: var(--grad-cube-button);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  clip-path: none;
  opacity: 0.86;
}

.cube-type-button.is-active {
  border-color: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  background: var(--grad-cube-button-active);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(180, 92, 255, 0.2),
    0 0 18px rgba(180, 92, 255, 0.28),
    0 0 34px rgba(255, 216, 77, 0.12);
  opacity: 1;
}

.cube-type-icon {
  width: 46px;
  height: 46px;
  object-fit: contain;
  opacity: 0.98;
  transition: transform 160ms ease;
}

.cube-type-button.is-active .cube-type-icon {
  transform: scale(1.08);
}


.cube-type-button:not(.is-active):hover,
.cube-type-button:not(.is-active):focus-visible {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  opacity: 0.86;
}

.cube-type-left_hand {
  color: #9ce8ff;
}

.cube-type-right_hand {
  color: #ffb57e;
}

.cube-type-head {
  color: #d1b3ff;
}

.cube-type-avoid {
  color: #ff7b7b;
}

.pointer-preview {
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.06em;
}

.tap-pad {
  position: relative;
  overflow: hidden;
  width: 100%;
  grid-column: 1 / -1;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at top, rgba(180, 92, 255, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(24, 18, 40, 0.98), rgba(8, 8, 14, 0.98));
  touch-action: manipulation;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 22px rgba(180, 92, 255, 0.08);
}

.tap-pad::before,
.tap-pad::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.tap-pad::before {
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
}

.tap-pad::after {
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 216, 77, 0.72), transparent);
  opacity: 0.9;
}

.tap-grid {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.035), transparent 72%);
  pointer-events: none;
}

.trackpad-depth-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.trackpad-depth-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trackpad-depth-svg line {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  filter: none;
}

.trackpad-depth-plane {
  position: absolute;
  inset: 25%;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 24px rgba(180, 92, 255, 0.08);
  pointer-events: none;
  z-index: 1;
}

.trackpad-depth-plane::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.beat-wave {
  position: absolute;
  inset: -12%;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(circle at center, rgba(255, 240, 106, 0.12) 0%, rgba(255, 240, 106, 0.04) 30%, transparent 54%),
    linear-gradient(180deg, rgba(162, 77, 255, 0.04), transparent 38%, rgba(255, 214, 111, 0.05) 100%);
  transform: scale(0.82);
}

.beat-wave.is-pulsing {
  animation: beat-wave-pulse 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.beat-wave.is-strong-pulsing {
  animation: beat-wave-strong-pulse 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes beat-wave-pulse {
  0% {
    opacity: 0.02;
    transform: scale(0.82);
  }

  20% {
    opacity: 0.16;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes beat-wave-strong-pulse {
  0% {
    opacity: 0.04;
    transform: scale(0.8);
    filter: saturate(1);
  }

  22% {
    opacity: 0.18;
    transform: scale(1.04);
    filter: saturate(1.12);
  }

  100% {
    opacity: 0;
    transform: scale(1.24);
    filter: saturate(1);
  }
}

.strong-beat-fill {
  position: absolute;
  inset: 0;
  opacity: var(--strong-fill-opacity, 0);
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle at center, rgba(255, 227, 84, 0.24) 0%, rgba(255, 216, 77, 0.12) 58%, rgba(255, 203, 46, 0.08) 100%);
  clip-path: circle(calc(var(--strong-fill-progress, 0) * 72%) at 50% 50%);
  transition:
    opacity 120ms linear,
    clip-path 120ms linear;
}

.defender-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition:
    left 120ms linear,
    top 120ms linear,
    opacity 120ms linear;
  z-index: 3;
}

.defender-marker.hidden {
  opacity: 0;
}

.defender-marker.head {
  width: 26px;
  height: 26px;
}

.defender-marker.hand {
  width: 22px;
  height: 22px;
}

.defender-marker-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.96;
  filter:
    brightness(0)
    saturate(0)
    invert(1)
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.22));
}

.defender-marker.left-hand .defender-marker-icon,
.defender-marker.right-hand .defender-marker-icon {
  transform: scale(0.95);
}

.cube-ghost {
  position: absolute;
  width: 52px;
  height: 52px;
  margin-left: -26px;
  margin-top: -26px;
  opacity: 1;
  transition:
    left var(--travel-ms, 6000ms) linear,
    top var(--travel-ms, 6000ms) linear,
    opacity var(--travel-ms, 6000ms) linear;
  pointer-events: none;
  z-index: 4;
}

.cube-ghost.is-queued {
  opacity: 1;
}

.cube-ghost.is-instantiated {
  opacity: var(--travel-start-opacity, 0.5);
}

.cube-ghost.is-traveling {
  opacity: var(--travel-end-opacity, 0.1);
}

.cube-ghost.is-missed {
  opacity: 1;
  transform: scale(0.08);
}

.cube-visual {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: var(--cube-icon-image), var(--cube-border-image);
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-size: 54% 54%, 100% 100%;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.18));
  transform: scale(1);
  transition: transform var(--travel-ms, 6000ms) linear;
}

.cube-ghost.is-instantiated .cube-visual {
  transform: scale(var(--travel-start-scale, 0.75));
}

.cube-ghost.is-traveling .cube-visual {
  transform: scale(var(--travel-end-scale, 0.1));
}

.cube-ghost.cube-type-left_hand .cube-visual,
.cube-particle.cube-type-left_hand .cube-visual {
  filter: drop-shadow(0 8px 20px rgba(255, 60, 220, 0.3));
}

.cube-ghost.cube-type-right_hand .cube-visual,
.cube-particle.cube-type-right_hand .cube-visual {
  filter: drop-shadow(0 8px 20px rgba(70, 255, 150, 0.3));
}

.cube-ghost.cube-type-head .cube-visual,
.cube-particle.cube-type-head .cube-visual {
  filter: drop-shadow(0 8px 20px rgba(255, 232, 40, 0.28));
}

.cube-ghost.cube-type-avoid .cube-visual,
.cube-particle.cube-type-avoid .cube-visual {
  filter: drop-shadow(0 8px 20px rgba(255, 80, 60, 0.3));
}

.cube-particle.is-error {
  opacity: 0.9;
}

.cube-particle {
  position: absolute;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  pointer-events: none;
  z-index: 4;
  animation: cube-particle-burst 700ms ease-out forwards;
}

.score-delta {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 12;
  color: #89ffb1;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.36);
  opacity: 1;
}

.score-delta.is-negative {
  color: #ff7878;
}

.score-delta.is-moving {
  transition:
    left 200ms cubic-bezier(0.16, 1, 0.3, 1),
    top 200ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 200ms ease;
  opacity: 0;
}

@keyframes mobile-score-pulse {
  0% {
    transform: scale(1);
  }

  16% {
    transform: scale(1.5);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes mobile-score-bar-pulse {
  0% {
    transform: scaleY(1);
  }

  16% {
    transform: scaleY(1.5);
  }

  100% {
    transform: scaleY(1);
  }
}

@keyframes cube-particle-burst {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform:
      translate3d(var(--particle-x), var(--particle-y), 0)
      scale(0.25)
      rotate(var(--particle-rot));
  }
}

.log-output {
  min-height: 120px;
  margin-top: 14px;
  padding: 14px;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(10, 9, 16, 0.98), rgba(5, 5, 10, 0.98));
  color: #fff4b5;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.log-panel.compact,
.compact-button {
  margin-top: 18px;
}

@media (max-width: 640px) {
  .app {
    padding: 12px 10px 28px;
  }

  .panel {
    padding: 16px;
    border-radius: 22px;
  }

  .panel::after {
    top: 14px;
    right: 14px;
    width: 68px;
  }

  h1 {
    font-size: 1.45rem;
    line-height: 1.05;
  }

  .subhead {
    font-size: 0.94rem;
  }

  .row,
  .game-topbar,
  .tap-header,
  .log-header {
    align-items: flex-start;
  }

  .row button,
  .game-topbar button {
    width: 100%;
  }

  .game-topbar {
    flex-direction: column;
  }

  .end-actions {
    flex-direction: column;
  }

  .tap-panel,
  .status-card,
  .log-panel {
    padding: 14px;
    border-radius: 18px;
  }

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

  .tap-pad {
    min-height: 0;
    background:
      radial-gradient(circle at top, rgba(180, 92, 255, 0.14), transparent 42%),
      linear-gradient(180deg, rgba(24, 18, 40, 0.98), rgba(8, 8, 14, 0.98));
  }

  .strong-beat-fill {
    opacity: var(--strong-fill-opacity, 0);
  }

  .tap-pad::after {
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 10px;
  }

  .trackpad-depth-plane {
    border-radius: 0;
  }

  .trackpad-depth-plane::before {
    inset: 7px;
  }

  .pointer-preview,
  .pill,
  .field span,
  button {
    font-size: 0.82rem;
  }

  .cube-type-button {
    min-height: 52px;
  }

  .cube-type-icon {
    width: 40px;
    height: 40px;
  }

  .cube-type-button:not(.is-active) {
    opacity: 0.58;
  }

  .cube-type-button:focus,
  .cube-type-button:active {
    outline: none;
  }

  .log-output {
    min-height: 96px;
    font-size: 0.8rem;
  }
}

@media (orientation: landscape) {
  .app {
    width: min(100%, 1040px);
    padding: 8px 6px 16px;
  }

  .game-header {
    margin-bottom: 0;
  }

  .game-header .brand-logo-compact {
    width: min(18vw, 96px);
    margin-bottom: 0;
  }

  .game-actions {
    margin-top: 8px;
  }

  .score-panel {
    margin-top: 8px;
  }

  .score-number {
    font-size: 1.6rem;
  }

  .mobile-score-bar-shell {
    height: 12px;
    margin-top: 8px;
  }

  .tap-panel {
    margin-top: 12px;
    padding: 12px;
  }

  .playfield-layout {
    grid-template-columns: minmax(70px, 90px) minmax(0, 1fr) minmax(70px, 90px);
    align-items: center;
    gap: 6px;
  }

  .cube-selector {
    display: grid;
    width: auto;
    grid-template-columns: 1fr;
    align-content: stretch;
    gap: 6px;
  }

  .cube-selector-flat {
    grid-template-columns: 1fr;
  }

  .cube-selector-start {
    order: 1;
    grid-column: 1;
  }

  .tap-pad {
    order: 2;
    grid-column: 2;
    aspect-ratio: 1 / 0.68;
    width: 100%;
    max-width: min(78vh, 560px);
    max-height: 60vh;
    justify-self: center;
  }

  .cube-selector-end {
    order: 3;
    grid-column: 3;
  }

  .cube-type-button {
    min-height: 0;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    padding: 4px;
  }

  .cube-type-icon {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .beat-wave {
    display: none !important;
  }

  .score-number.is-danger,
  .mobile-score-bar-fill.is-danger,
  .cube-particle {
    animation: none !important;
  }
}
