:root {
  --bg: #171717;
  --panel: #202020;
  --panel-2: #272727;
  --court: #101010;
  --text: #f7f7f7;
  --muted: #b8b8b8;
  --gold: #ffb700;
  --gold-soft: rgba(255, 183, 0, 0.1);
  --line: rgba(255, 183, 0, 0.18);
  --button: #ffb700;
  --button-text: #171717;
  --cyan: #41d6ff;
  --blue: #5a7dff;
  --orange: #ff9a3d;
  --yellow: #ffe45c;
  --green: #60e36e;
  --purple: #c77dff;
  --red: #ff5c5c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 183, 0, 0.08), transparent 28%),
    radial-gradient(circle at 86% 85%, rgba(65, 214, 255, 0.07), transparent 30%),
    var(--bg);
  color: var(--text);
}

.app {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.panel {
  width: 100%;
  height: 100%;
  background: var(--panel);
  border: 1px solid rgba(255, 183, 0, 0.2);
  padding: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel__header,
.header-actions,
.title-row {
  display: flex;
  align-items: center;
}

.panel__header {
  justify-content: space-between;
  gap: 16px;
}

.panel__header > div {
  min-width: 0;
  flex: 1;
}

.header-actions {
  flex: 0 0 auto;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow,
.help,
.stat__label,
.mini-stats span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-row h1 {
  margin: 0;
  font-size: 20px;
}

.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--gold-soft);
}

.stat__label {
  font-size: 0.8rem;
}

.stat strong,
.mini-stats strong,
.target-score {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Buttons ---------------------------------------------------------------- */

button {
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

button:focus-visible {
  outline: 3px solid rgba(255, 183, 0, 0.55);
  outline-offset: 2px;
}

.secondary-button,
.option-button {
  border: 1px solid rgba(255, 183, 0, 0.22);
  background: var(--gold-soft);
  color: var(--text);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.icon-button svg:not(.flag-icon) {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

#sound-toggle .sound-mute,
#sound-toggle.is-off .sound-wave {
  display: none;
}

#sound-toggle.is-off .sound-mute {
  display: inline;
}

#sound-toggle.is-off {
  color: var(--muted);
}

.btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 8px 20px rgba(255, 183, 0, 0.18);
}

.btn--ghost {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn--ghost:hover {
  border-color: rgba(255, 183, 0, 0.5);
}

.btn--wide {
  width: 100%;
  margin-bottom: 12px;
}

.btn-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}

.btn-row--wrap {
  flex-wrap: wrap;
  justify-content: center;
}

.btn-stack {
  display: grid;
  gap: 8px;
  max-width: 340px;
  margin: 0 auto;
}

/* Court ------------------------------------------------------------------ */

.game-shell {
  width: 100%;
  min-height: 0;
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(116px, 170px);
  justify-content: center;
  align-items: start;
  gap: 14px;
}

.court-wrap {
  position: relative;
  width: min(100%, calc(100vw - 230px));
  height: min(calc(100dvh - 190px), 78dvh);
  aspect-ratio: 16 / 9;
  align-self: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.court {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 16px;
  background: var(--court);
  box-shadow:
    inset 0 0 0 1px rgba(255, 183, 0, 0.16),
    0 20px 45px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.serve-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.78);
  font-size: 0.86rem;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  animation: hint-pulse 1.6s ease-in-out infinite;
}

@keyframes hint-pulse {
  50% { border-color: rgba(255, 183, 0, 0.55); }
}

.court-serve-button {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  min-width: 96px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 0 0 1px rgba(255, 183, 0, 0.24), 0 10px 22px rgba(0, 0, 0, 0.3);
}

@media (pointer: fine) {
  .court-serve-button {
    display: none;
  }
}

.rotate-hint {
  display: none;
}

.side-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(17, 17, 17, 0.45);
}

.target-score {
  display: block;
  font-size: 2.1rem;
  line-height: 1;
}

.mini-stats {
  display: grid;
  gap: 8px;
}

.mini-stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.help {
  margin: 16px 0 0;
  line-height: 1.5;
}

/* Overlay & modal -------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(16, 16, 16, 0.62);
  z-index: 10;
}

.hidden,
.overlay.hidden {
  display: none;
}

.modal {
  width: min(100%, 760px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(255, 183, 0, 0.26);
  border-radius: 18px;
  background: rgba(32, 32, 32, 0.97);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: modal-in 180ms ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

.overlay[data-tone="good"] .modal {
  border-color: rgba(96, 227, 110, 0.4);
}

.overlay[data-tone="bad"] .modal {
  border-color: rgba(255, 92, 92, 0.4);
}

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

.modal-header > div:first-child {
  min-width: 0;
}

.modal h2 {
  margin: 2px 0 0;
  font-size: 1.6rem;
}

.overlay[data-tone="good"] h2 {
  color: var(--green);
}

.overlay[data-tone="bad"] h2 {
  color: var(--red);
}

.overlay-options {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.language-menu {
  position: relative;
}

.flag-icon {
  width: 24px;
  height: 16px;
  display: block;
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 174px;
  max-height: min(360px, calc(100dvh - 120px));
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #202020;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  z-index: 20;
}

.language-option {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: start;
}

.language-option:hover,
.language-option.active {
  background: rgba(255, 183, 0, 0.1);
}

/* Mode cards ------------------------------------------------------------- */

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

.mode-card {
  width: 100%;
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 183, 0, 0.16);
  color: var(--text);
  text-align: start;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.mode-card:hover,
.mode-card:focus-visible {
  background: #303030;
  border-color: rgba(255, 183, 0, 0.5);
  transform: translateY(-1px);
}

.mode-copy,
.mode-copy > * {
  display: block;
  min-width: 0;
}

.mode-title {
  font-weight: 800;
  font-size: 1.02rem;
}

.mode-copy small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.mode-meta {
  margin-top: 6px;
  font-style: normal;
  font-size: 0.8rem;
  color: var(--gold);
}

.mode-preview {
  position: relative;
  width: 72px;
  aspect-ratio: 1;
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(255, 183, 0, 0.18) 34px 37px),
    #111111;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 183, 0, 0.14);
}

.mode-preview::before,
.mode-preview::after {
  content: "";
  position: absolute;
  border-radius: 3px;
}

.mode-preview--quick::before {
  width: 7px;
  height: 30px;
  left: 8px;
  top: 21px;
  background: var(--cyan);
  box-shadow: 49px -6px 0 var(--gold);
}

.mode-preview--quick::after {
  width: 11px;
  height: 11px;
  left: 30px;
  top: 30px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: -8px 3px 0 -2px rgba(255, 228, 92, 0.35), -15px 6px 0 -3px rgba(255, 228, 92, 0.15);
}

.mode-preview--campaign::before {
  width: 10px;
  height: 22px;
  left: 31px;
  top: 10px;
  background: #555;
  box-shadow: 0 30px 0 #555;
}

.mode-preview--campaign::after {
  width: 14px;
  height: 14px;
  left: 50px;
  top: 29px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--purple);
  box-shadow: -40px 0 0 -2px var(--cyan);
}

.mode-preview--survival::before {
  width: 7px;
  height: 34px;
  left: 8px;
  top: 19px;
  background: var(--cyan);
}

.mode-preview--survival::after {
  width: 7px;
  height: 56px;
  right: 6px;
  top: 8px;
  background: #5a5a5f;
  box-shadow: -26px 18px 0 -18px var(--orange), -34px -6px 0 -18px var(--purple);
}

.mode-preview--daily {
  display: grid;
  place-items: center;
}

.mode-preview--daily::before {
  width: 40px;
  height: 36px;
  left: 16px;
  top: 20px;
  border: 2px solid var(--gold);
  border-top-width: 9px;
  border-radius: 6px;
  background: transparent;
}

.mode-preview--daily::after {
  width: 10px;
  height: 10px;
  left: 31px;
  top: 36px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 10px var(--orange);
}

.mode-preview--duel::before {
  width: 7px;
  height: 38px;
  left: 8px;
  top: 17px;
  background: var(--green);
  box-shadow: 49px 0 0 var(--red);
}

.mode-preview--duel::after {
  width: 10px;
  height: 10px;
  left: 31px;
  top: 18px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: -8px 16px 0 rgba(255, 183, 0, 0.38), 8px 32px 0 rgba(255, 183, 0, 0.16);
}

.mode-preview--profile {
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: radial-gradient(circle, rgba(255, 183, 0, 0.18), transparent 70%), #111;
}

/* Forms ------------------------------------------------------------------ */

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

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

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #151515;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.seg__btn {
  flex: 1 1 0;
  min-width: 64px;
  min-height: 40px;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.seg__btn:hover {
  background: rgba(255, 183, 0, 0.08);
}

.seg__btn.is-active {
  background: var(--button);
  color: var(--button-text);
}

.toggle-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-align: start;
  font-weight: 700;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #444;
  transition: background 150ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ddd;
  transition: transform 150ms ease;
}

.toggle-row[aria-pressed="true"] .switch {
  background: var(--button);
}

.toggle-row[aria-pressed="true"] .switch::after {
  transform: translateX(20px);
  background: #171717;
}

[dir="rtl"] .toggle-row[aria-pressed="true"] .switch::after {
  transform: translateX(-20px);
}

[dir="rtl"] .switch::after {
  left: auto;
  right: 3px;
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.hint--lead {
  margin: -6px 0 14px;
}

/* Campaign --------------------------------------------------------------- */

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

.level-tile {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 118px;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 183, 0, 0.16);
  color: var(--text);
  text-align: start;
  transition: border-color 120ms ease, transform 120ms ease;
}

.level-tile:not(:disabled):hover,
.level-tile:focus-visible {
  border-color: rgba(255, 183, 0, 0.55);
  transform: translateY(-1px);
}

.level-tile.is-done {
  background: linear-gradient(160deg, rgba(255, 183, 0, 0.1), transparent 60%), var(--panel-2);
}

.level-tile.is-locked {
  opacity: 0.45;
}

.level-tile__num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
}

.level-tile__name {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
}

.level-tile__tags,
.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.tag--ai {
  background: rgba(255, 183, 0, 0.12);
  color: var(--gold);
}

.tags-row .tag {
  font-size: 0.82rem;
  padding: 4px 10px;
}

.stars {
  color: var(--gold);
  letter-spacing: 0.1em;
  font-size: 0.95rem;
}

.stars__empty {
  color: rgba(255, 255, 255, 0.15);
}

.daily-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(255, 154, 61, 0.12), transparent 60%), var(--panel-2);
  border: 1px solid rgba(255, 154, 61, 0.3);
}

.daily-card__streak {
  margin: 4px 0 0;
  color: var(--gold);
  font-weight: 700;
}

/* Profile & results ------------------------------------------------------ */

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

.stat-tile {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-tile span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-tile strong {
  color: var(--gold);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.ach-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-2);
  opacity: 0.5;
}

.ach.is-unlocked {
  opacity: 1;
  border: 1px solid rgba(255, 183, 0, 0.3);
}

.ach__icon {
  font-size: 1.4rem;
  width: 32px;
  text-align: center;
  flex: 0 0 auto;
}

.ach strong,
.ach small {
  display: block;
}

.ach small {
  color: var(--muted);
  margin-top: 2px;
}

.ach-list--compact {
  grid-template-columns: 1fr;
}

.result {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.result .stat-grid,
.result .ach-list {
  width: 100%;
}

.result-score {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 3.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.result-score__l {
  color: var(--cyan);
}

.result-score__r {
  color: var(--gold);
}

.result-stars .stars {
  font-size: 2.2rem;
}

.badge {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
}

.badge--best {
  background: rgba(96, 227, 110, 0.14);
  color: var(--green);
}

.pause-score {
  margin: 0 0 16px;
  text-align: center;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Toasts ----------------------------------------------------------------- */

.toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 30;
  pointer-events: none;
  width: min(92vw, 420px);
}

.toast {
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(24, 24, 24, 0.95);
  border: 1px solid rgba(255, 183, 0, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font-weight: 700;
  text-align: center;
  animation: toast-in 220ms ease-out;
  transition: opacity 400ms ease, transform 400ms ease;
}

.toast--out {
  opacity: 0;
  transform: translateY(-8px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 760px) {
  .panel {
    padding: 16px;
  }

  .panel__header {
    align-items: flex-start;
  }

  .stat--level,
  .side-card,
  .help {
    display: none;
  }

  .game-shell {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    margin-top: 12px;
    gap: 8px;
  }

  .court-wrap {
    width: min(calc(100vw - 32px), calc((100dvh - 210px) * 16 / 9));
    height: auto;
    max-height: calc(100dvh - 210px);
  }

  .court-serve-button {
    min-width: 76px;
    min-height: 38px;
    font-size: 0.8rem;
  }

  .modal {
    padding: 16px;
  }

  .modal-header {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .language-dropdown {
    left: 0;
    right: auto;
  }

  .mode-grid,
  .ach-list {
    grid-template-columns: 1fr;
  }

  .mode-card {
    grid-template-columns: 54px minmax(0, 1fr);
    padding: 8px;
  }

  .mode-preview {
    width: 54px;
  }

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

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

  .stat-grid--compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .game-shell {
    align-content: start;
  }

  .court-wrap {
    width: min(calc(100vw - 32px), calc((100dvh - 240px) * 16 / 9));
    max-height: calc(100dvh - 240px);
  }

  .rotate-hint {
    display: block;
    width: calc(100vw - 32px);
    max-width: 520px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(17, 17, 17, 0.76);
    font-size: 0.78rem;
    text-align: center;
  }
}

@media (min-width: 900px) and (orientation: landscape) {
  .panel {
    display: grid;
    grid-template-columns: minmax(0, calc(100dvh * 1.55)) clamp(245px, 26vw, 340px);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "court header"
      "court side"
      "court help"
      "court .";
    align-items: start;
    justify-content: center;
    gap: 18px 24px;
  }

  .panel__header {
    grid-area: header;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .game-shell {
    grid-area: court;
    margin-top: 0;
    display: contents;
  }

  .court-wrap {
    grid-area: court;
    width: 100%;
    height: min(calc(100dvh - 52px), calc((100vw - 410px) * 0.5625));
    max-width: 100%;
  }

  .side-card {
    grid-area: side;
    width: 100%;
  }

  .help {
    grid-area: help;
    margin: 0;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .panel {
    padding: 8px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "court header"
      "court side";
    align-items: start;
    gap: 8px 12px;
  }

  .panel__header {
    grid-area: header;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .title-row,
  .help,
  .rotate-hint {
    display: none;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .stat--level {
    display: inline-flex;
  }

  .game-shell {
    display: contents;
  }

  .court-wrap {
    grid-area: court;
    justify-self: center;
    width: auto;
    max-width: 100%;
    height: min(calc(100dvh - 16px), calc((100vw - 186px) * 0.5625));
  }

  .side-card {
    display: grid;
    grid-area: side;
    gap: 6px;
    padding: 10px;
  }

  .target-score {
    font-size: 1.4rem;
  }

  .mini-stats div {
    padding: 4px 0;
  }

  .modal {
    max-height: calc(100dvh - 16px);
  }

  .overlay {
    padding: 8px;
  }
}

@media (max-width: 430px) {
  .serve-hint {
    bottom: 10px;
    font-size: 0.78rem;
  }

  .stat-grid--compact .stat-tile strong {
    font-size: 1.05rem;
  }
}
