:root {
  color-scheme: dark;
  --ink: #16132d;
  --night: #211b47;
  --night-soft: #302862;
  --violet: #5146a8;
  --table: #4646a8;
  --table-light: #6965d7;
  --coral: #ff745c;
  --orange: #ffad4a;
  --cream: #fff2d0;
  --cyan: #63e6e2;
  --success: #75e19c;
  --danger: #ff4f6d;
  --safe-top: max(10px, env(safe-area-inset-top));
  --safe-right: max(12px, env(safe-area-inset-right));
  --safe-bottom: max(10px, env(safe-area-inset-bottom));
  --safe-left: max(12px, env(safe-area-inset-left));
  --edge: 3px solid var(--ink);
  font-family: "Arial Black", "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
}

body {
  min-width: 280px;
  color: var(--cream);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button,
select {
  color: inherit;
  font: inherit;
  touch-action: manipulation;
}

button {
  border: 0;
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.game-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 240px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 72% 25%, rgba(99, 230, 226, 0.13) 0 9%, transparent 27%),
    linear-gradient(150deg, #332967 0 32%, var(--night) 32% 71%, #17142e 71%);
}

.screen,
.overlay {
  position: absolute;
  inset: 0;
}

.screen {
  z-index: 1;
}

.brand-kicker,
.panel-kicker,
.hud-caption {
  margin: 0;
  color: var(--cyan);
  font-size: clamp(0.58rem, 1.35vw, 0.82rem);
  letter-spacing: 0.16em;
  line-height: 1.15;
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  color: var(--cream);
  font-size: clamp(3rem, 10.4vh, 6.9rem);
  font-style: italic;
  font-weight: 1000;
  letter-spacing: -0.085em;
  line-height: 0.76;
  text-transform: uppercase;
  transform: skew(-4deg);
  text-shadow: 4px 5px 0 var(--ink);
}

.brand-title span {
  color: var(--coral);
}

.action-button,
.icon-button,
.text-button,
.level-card-button {
  -webkit-appearance: none;
  appearance: none;
}

.action-button {
  min-width: min(24vw, 240px);
  min-height: 46px;
  padding: 0.72rem 1.35rem;
  border: var(--edge);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: clamp(0.78rem, 1.55vw, 1.05rem);
  font-weight: 1000;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms linear;
}

.action-button:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(3px, 3px);
}

.action-button--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  background: var(--coral);
  color: var(--cream);
}

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

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 44px;
  min-height: 42px;
  padding: 0.45rem 0.78rem;
  border: 2px solid rgba(255, 242, 208, 0.64);
  border-radius: 7px;
  background: rgba(22, 19, 45, 0.88);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.text-button {
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  background: transparent;
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-transform: uppercase;
}

/* Loading */
.loading-screen {
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: clamp(8px, 1.8vh, 16px);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--night);
}

.loading-mark {
  display: flex;
  align-items: center;
  height: 34px;
  gap: 11px;
}

.loading-paddle {
  display: block;
  width: 22px;
  height: 29px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  transform: rotate(18deg);
}

.loading-paddle--right {
  background: var(--cyan);
  transform: rotate(-18deg);
}

.loading-ball {
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  animation: loading-bounce 0.85s steps(4, end) infinite alternate;
}

.loading-label {
  margin: 0;
  color: rgba(255, 242, 208, 0.78);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.75rem, 1.5vw, 0.92rem);
}

.loading-track {
  width: min(320px, 52vw);
  height: 9px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #0e0c21;
}

.loading-progress {
  display: block;
  width: 16%;
  height: 100%;
  background: var(--cyan);
  transition: width 160ms linear;
}

@keyframes loading-bounce {
  from { transform: translateX(-10px) translateY(-6px); }
  to { transform: translateX(10px) translateY(6px); }
}

/* Home */
.home-screen {
  overflow: hidden;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.utility-bar {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  right: var(--safe-right);
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.language-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.32rem 0.48rem 0.32rem 0.68rem;
  border: 2px solid rgba(255, 242, 208, 0.64);
  border-radius: 7px;
  background: rgba(22, 19, 45, 0.88);
  color: var(--cream);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.language-control select {
  min-height: 30px;
  max-width: 128px;
  border: 0;
  border-left: 1px solid rgba(255, 242, 208, 0.35);
  border-radius: 0;
  padding: 0 1.55rem 0 0.5rem;
  background: var(--night);
}

.home-copy {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(47%, 560px);
  height: 100%;
  padding-left: clamp(12px, 4vw, 62px);
}

.home-copy .brand-kicker {
  margin-bottom: clamp(8px, 2vh, 17px);
}

.home-subtitle {
  max-width: 450px;
  margin: clamp(14px, 3vh, 28px) 0 clamp(15px, 3.2vh, 30px);
  color: rgba(255, 242, 208, 0.8);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.78rem, 1.65vw, 1.1rem);
  font-weight: 700;
  line-height: 1.35;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: clamp(9px, 1.5vw, 16px);
}

.home-scene {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  width: 63%;
  height: 100%;
  overflow: hidden;
  border-left: 5px solid var(--ink);
  background:
    linear-gradient(162deg, transparent 0 37%, rgba(255, 255, 255, 0.07) 37% 39%, transparent 39%),
    linear-gradient(#403880 0 45%, #28204e 45% 100%);
  clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%);
}

.crowd {
  position: absolute;
  inset: 23% 0 auto;
  height: 23%;
  opacity: 0.78;
  background:
    radial-gradient(circle, #756bb2 0 25%, transparent 27%) 0 0 / 27px 24px,
    radial-gradient(circle, #9a5882 0 25%, transparent 27%) 12px 11px / 31px 25px;
}

.home-table {
  position: absolute;
  right: 1%;
  bottom: -14%;
  width: 90%;
  height: 59%;
  border: 7px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 49.5%, var(--cream) 49.5% 50.5%, transparent 50.5%),
    var(--table);
  clip-path: polygon(32% 0, 68% 0, 100% 100%, 0 100%);
  transform: perspective(580px) rotateX(10deg);
}

.home-net {
  position: absolute;
  right: 13%;
  bottom: 37%;
  width: 70%;
  height: 13%;
  border: 4px solid var(--ink);
  background: repeating-linear-gradient(90deg, rgba(255, 242, 208, 0.75) 0 2px, transparent 2px 13px), rgba(22, 19, 45, 0.82);
  transform: skewX(-8deg);
}

.home-paddle {
  position: absolute;
  right: 27%;
  bottom: 6%;
  width: min(16vw, 138px);
  aspect-ratio: 0.82;
  border: 7px solid var(--ink);
  border-radius: 50% 50% 44% 44%;
  background: var(--coral);
  transform: rotate(-28deg);
}

.home-paddle::after {
  content: "";
  position: absolute;
  left: 42%;
  top: 83%;
  width: 28%;
  height: 52%;
  border: 5px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 9px 9px;
  background: var(--orange);
}

.home-ball {
  position: absolute;
  right: 46%;
  bottom: 54%;
  width: clamp(13px, 2vw, 25px);
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: -26px 13px 0 -8px rgba(255, 242, 208, 0.35);
  animation: home-ball-drift 1.7s steps(6, end) infinite alternate;
}

.score-light {
  position: absolute;
  width: 8px;
  height: 21%;
  background: var(--cyan);
  opacity: 0.55;
  transform: rotate(52deg);
}

.score-light--one { top: -3%; right: 28%; }
.score-light--two { top: 5%; right: 15%; background: var(--coral); }

@keyframes home-ball-drift {
  from { transform: translate(-8px, -6px); }
  to { transform: translate(13px, 10px); }
}

/* Level selection */
.levels-screen {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2vh, 18px);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background:
    linear-gradient(115deg, rgba(99, 230, 226, 0.08) 0 23%, transparent 23%),
    var(--night);
}

.panel-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: clamp(11px, 2vw, 24px);
  min-height: 66px;
  padding: 4px clamp(4px, 2vw, 24px);
}

.panel-header h2,
.overlay-card h2,
.orientation-card h2,
.result-card h2 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.35rem, 4.5vh, 2.7rem);
  font-style: italic;
  letter-spacing: -0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.panel-header p:last-child {
  margin: 0.32rem 0 0;
  color: rgba(255, 242, 208, 0.68);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.7rem, 1.45vw, 0.9rem);
}

.back-button {
  flex: 0 0 auto;
  width: 48px;
  padding: 0;
  font-size: 1.4rem;
}

.level-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(92px, 1fr);
  gap: clamp(6px, 1.25vw, 14px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 clamp(4px, 2vw, 24px) 5px;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.level-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--level-accent, var(--violet));
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  text-align: left;
}

.level-card-button {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto clamp(30px, 4vw, 48px) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 4px 7px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: clamp(8px, 1.25vw, 14px);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.level-card::after {
  content: "";
  position: absolute;
  right: -19px;
  bottom: -24px;
  width: 78px;
  height: 78px;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: var(--paddle-color, var(--coral));
  opacity: 0.83;
}

.level-card-button:active:not(:disabled) {
  transform: translate(2px, 2px);
}

.level-card.is-locked,
.level-card.locked,
.level-card-button:disabled,
.level-card-button.is-locked {
  background: #3c385b;
  color: rgba(255, 242, 208, 0.52);
  filter: saturate(0.15);
  cursor: default;
}

.level-number {
  position: relative;
  z-index: 1;
  align-self: center;
  font-size: clamp(1.35rem, 4vh, 2.2rem);
  font-style: italic;
  font-weight: 1000;
  line-height: 0.9;
}

.level-avatar {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--paddle-color, var(--coral));
}

.level-avatar::before {
  content: "";
  position: absolute;
  inset: 22% 27% 38%;
  border-radius: 50%;
  background: currentColor;
}

.level-avatar::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: 13%;
  left: 18%;
  height: 34%;
  border-radius: 50% 50% 30% 30%;
  background: currentColor;
}

.level-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  min-width: 0;
}

.level-name,
.level-copy strong,
.level-card strong {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  font-size: clamp(0.72rem, 1.45vw, 1rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.level-trait,
.level-copy span,
.level-copy small,
.level-card small {
  position: relative;
  z-index: 1;
  align-self: start;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.58rem, 1.1vw, 0.76rem);
  font-weight: 800;
  line-height: 1.18;
}

.level-copy span,
.level-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-stars {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  color: var(--cream);
  font-size: clamp(0.68rem, 1.25vw, 0.9rem);
  letter-spacing: 0.08em;
  text-shadow: 1px 2px 0 var(--ink);
}

.level-card.is-complete {
  outline: 2px solid var(--cream);
  outline-offset: -6px;
}

/* Match */
.game-screen {
  background: #131027;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #211b47;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.match-hud {
  position: absolute;
  z-index: 3;
  top: var(--safe-top);
  right: var(--safe-right);
  left: var(--safe-left);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  pointer-events: none;
}

.opponent-chip,
.rally-chip,
.scoreboard {
  border: 2px solid rgba(255, 242, 208, 0.62);
  border-radius: 7px;
  background: rgba(22, 19, 45, 0.9);
}

.opponent-chip {
  justify-self: start;
  min-width: 128px;
  max-width: min(31vw, 290px);
  padding: 0.45rem 0.72rem;
}

.opponent-chip strong {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: clamp(0.7rem, 1.55vw, 0.98rem);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 152px;
  padding: 0.28rem 0.82rem 0.35rem;
  border-color: var(--cream);
  text-align: center;
}

.scoreboard > div {
  display: grid;
  min-width: 48px;
}

.scoreboard strong {
  font-size: clamp(1.35rem, 5.3vh, 2.45rem);
  font-style: italic;
  line-height: 0.9;
}

.score-divider {
  margin: 0 5px;
  color: var(--coral);
  font-size: clamp(1.3rem, 4.5vh, 2.1rem);
}

.match-tools {
  display: flex;
  justify-self: end;
  align-items: stretch;
  gap: 6px;
  pointer-events: auto;
}

.rally-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 0.35rem 0.65rem;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.63rem, 1.3vw, 0.82rem);
  font-weight: 900;
  text-transform: uppercase;
}

.compact-button {
  width: 44px;
  padding: 0;
  font-size: 1rem;
}

.match-callout {
  position: absolute;
  z-index: 4;
  top: 43%;
  left: 50%;
  padding: 0.55rem 1rem;
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  font-size: clamp(1rem, 4vw, 2.35rem);
  font-style: italic;
  text-transform: uppercase;
  transform: translate(-50%, -50%) skew(-4deg);
  pointer-events: none;
}

.touch-hint {
  position: absolute;
  z-index: 3;
  bottom: calc(var(--safe-bottom) + 2px);
  left: 50%;
  max-width: 80vw;
  margin: 0;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  background: rgba(22, 19, 45, 0.75);
  color: rgba(255, 242, 208, 0.78);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.58rem, 1.15vw, 0.76rem);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Results and overlays */
.result-screen {
  display: grid;
  place-items: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background:
    linear-gradient(135deg, rgba(99, 230, 226, 0.13) 0 20%, transparent 20% 80%, rgba(255, 116, 92, 0.13) 80%),
    var(--night);
}

.result-card,
.overlay-card,
.orientation-card {
  width: min(560px, 88vw);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
  padding: clamp(16px, 4vh, 34px) clamp(18px, 4vw, 42px);
  border: 4px solid var(--ink);
  border-radius: 13px;
  background: var(--night-soft);
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
}

.result-card h2 {
  color: var(--coral);
  font-size: clamp(2rem, 8vh, 4.4rem);
  text-shadow: 3px 3px 0 var(--ink);
}

.result-score {
  margin: clamp(7px, 1.5vh, 13px) 0 0;
  color: var(--cream);
  font-size: clamp(1.55rem, 6vh, 3rem);
  font-style: italic;
  line-height: 1;
}

.result-stars {
  margin: clamp(6px, 1.7vh, 13px) 0;
  color: var(--orange);
  font-size: clamp(1.2rem, 4.6vh, 2.25rem);
  letter-spacing: 0.12em;
  text-shadow: 2px 2px 0 var(--ink);
}

.result-message,
.overlay-card > p:not(.panel-kicker),
.orientation-card > p:not(.panel-kicker) {
  margin: 0.45rem auto clamp(9px, 2vh, 17px);
  color: rgba(255, 242, 208, 0.76);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(0.7rem, 1.45vw, 0.94rem);
  line-height: 1.35;
}

.result-actions,
.overlay-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 1.4vw, 13px);
}

.result-actions .action-button,
.overlay-actions .action-button {
  min-width: min(19vw, 180px);
}

.overlay {
  z-index: 10;
  place-items: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: rgba(12, 10, 27, 0.88);
}

.pause-overlay,
.orientation-gate {
  display: grid;
}

.orientation-gate {
  z-index: 50;
  background: var(--night);
}

.orientation-card {
  width: min(520px, 88vw);
}

.rotate-device {
  position: relative;
  width: 92px;
  height: 72px;
  margin: 0 auto 10px;
}

.rotate-device span {
  position: absolute;
  top: 9px;
  left: 21px;
  width: 50px;
  height: 67px;
  border: 5px solid var(--cream);
  border-radius: 9px;
  transform: rotate(67deg);
}

.rotate-device::after {
  content: "↻";
  position: absolute;
  top: -13px;
  right: -3px;
  color: var(--cyan);
  font-family: system-ui, sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
}

noscript {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--night);
  color: var(--cream);
  text-align: center;
}

/* Lower-height phones: preserve the whole match UI at 390px and below. */
@media (max-height: 470px) {
  :root {
    --safe-top: max(6px, env(safe-area-inset-top));
    --safe-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .utility-bar { gap: 5px; }
  .language-control { min-height: 36px; padding-block: 0.16rem; }
  .icon-button { min-height: 36px; }
  .home-copy { padding-left: clamp(8px, 3vw, 32px); }
  .brand-title { font-size: clamp(2.7rem, 16vh, 4.45rem); }
  .home-subtitle { margin-block: 10px 13px; }
  .action-button { min-height: 40px; padding-block: 0.54rem; }
  .panel-header { min-height: 58px; }
  .level-grid { grid-auto-rows: minmax(78px, 1fr); }
  .level-card-button { padding: 7px; }
  .match-hud { gap: 5px; }
  .scoreboard { min-width: 126px; padding-block: 0.2rem; }
  .scoreboard strong { font-size: clamp(1.2rem, 6.8vh, 1.75rem); }
  .opponent-chip { padding-block: 0.32rem; }
  .rally-chip,
  .compact-button { min-height: 36px; height: 36px; }
  .result-card,
  .overlay-card,
  .orientation-card { padding-block: 12px; }
  .result-card h2 { font-size: clamp(1.7rem, 9vh, 2.65rem); }
  .result-message { margin-bottom: 7px; }
}

/* Five opponent cards leave very little horizontal room on landscape phones.
   Collapse the decorative avatar through the common 844/915px phone widths
   so opponent names stay readable instead of being ellipsized. */
@media (max-width: 960px) {
  .language-control > span,
  .sound-button [data-sound-label],
  .rally-chip > span,
  .touch-hint {
    display: none;
  }

  .language-control { padding-left: 0.25rem; }
  .home-copy { width: 53%; }
  .home-scene { width: 58%; }
  .level-grid { gap: 5px; padding-inline: 2px; }
  .level-card-button { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .level-avatar { display: none; }
  .level-trait,
  .level-copy span,
  .level-copy small { display: none; }
  .level-stars { grid-column: 1 / -1; }
  .opponent-chip { min-width: 102px; max-width: 26vw; }
  .opponent-chip .hud-caption { display: none; }
  .scoreboard { min-width: 118px; }
  .scoreboard > div { min-width: 38px; }
}

@media (orientation: portrait) {
  #orientationGate {
    display: grid !important;
  }

  #gameRoot > :not(#orientationGate) {
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (hover: hover) and (pointer: fine) {
  .action-button:hover,
  .icon-button:hover:not(:disabled),
  .level-card-button:hover:not(:disabled) {
    filter: brightness(1.08);
  }
}

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

/* Runtime quality classes intentionally remove decorative GPU work. */
html[data-quality="low"] .crowd,
html[data-quality="low"] .score-light,
html[data-quality="low"] .home-ball,
html[data-quality="emergency"] .crowd,
html[data-quality="emergency"] .score-light,
html[data-quality="emergency"] .home-ball,
.quality-low .crowd,
.quality-emergency .crowd {
  display: none;
}

html[data-quality="low"] .home-scene,
html[data-quality="emergency"] .home-scene,
.quality-low .home-scene,
.quality-emergency .home-scene {
  background: #302862;
}

html[data-quality="emergency"] .game-root,
.quality-emergency .game-root {
  background: var(--night);
}
