/* PongTone — estilos globais, mobile-first, temas calmos */

/* —— Tema: Claro suave (predefinição) —— */
:root,
[data-theme="claro"] {
  --primary: #2d6a9f;
  --primary-hover: #245580;
  --secondary: #4a7c6f;
  --secondary-hover: #3d665c;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-raised: #f8fafc;
  --text: #1e2a38;
  --text-muted: #5c6b7a;
  --border: #c8d4e0;
  --focus: #2d6a9f;
  --success: #3d7a5c;
  --warning: #8a6d3b;
  --error: #9b4d4d;
  --accent: #4a7c6f;
  --danger: #9b4d4d;
  --game-field: #2a3544;
  --game-field-line: rgba(255, 255, 255, 0.12);
  --game-text: #e8edf2;
  --ball: #e8dcc8;
  --paddle-player: #6ba3c7;
  --paddle-opponent: #a67d7d;
  --zone-active: rgba(107, 163, 199, 0.25);
  --zone-border: #6ba3c7;
  --feedback-hit: rgba(61, 122, 92, 0.35);
  --feedback-miss: rgba(155, 77, 77, 0.2);
  --shadow: 0 4px 20px rgba(30, 42, 56, 0.06);
  --overlay: rgba(30, 42, 56, 0.45);
  --radius: 12px;
  --btn-min-h: 56px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --theme-transition: none;
}

/* —— Tema: Escuro calmo —— */
[data-theme="escuro"] {
  --primary: #7eb8da;
  --primary-hover: #9ecce8;
  --secondary: #8fb9a8;
  --secondary-hover: #a5c9bb;
  --bg: #1a222d;
  --surface: #252f3d;
  --surface-raised: #2e3a4a;
  --text: #e8edf2;
  --text-muted: #9aa8b8;
  --border: #3d4d5e;
  --focus: #7eb8da;
  --success: #7ab896;
  --warning: #c4a86a;
  --error: #c98a8a;
  --accent: #8fb9a8;
  --danger: #c98a8a;
  --game-field: #151b24;
  --game-field-line: rgba(255, 255, 255, 0.1);
  --game-text: #e8edf2;
  --ball: #d4c8b4;
  --paddle-player: #6ba3c7;
  --paddle-opponent: #9a7a7a;
  --zone-active: rgba(126, 184, 218, 0.2);
  --zone-border: #7eb8da;
  --feedback-hit: rgba(122, 184, 150, 0.3);
  --feedback-miss: rgba(201, 138, 138, 0.18);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  --overlay: rgba(0, 0, 0, 0.55);
}

/* —— Tema: Alto contraste —— */
[data-theme="alto-contraste"] {
  --primary: #ffeb3b;
  --primary-hover: #fff176;
  --secondary: #ffffff;
  --secondary-hover: #e0e0e0;
  --bg: #000000;
  --surface: #111111;
  --surface-raised: #1a1a1a;
  --text: #ffffff;
  --text-muted: #e0e0e0;
  --border: #ffffff;
  --focus: #ffeb3b;
  --success: #76ff03;
  --warning: #ffeb3b;
  --error: #ff5252;
  --accent: #ffeb3b;
  --danger: #ff5252;
  --game-field: #000000;
  --game-field-line: #ffffff;
  --game-text: #ffffff;
  --ball: #ffeb3b;
  --paddle-player: #ffffff;
  --paddle-opponent: #ff5252;
  --zone-active: rgba(255, 235, 59, 0.35);
  --zone-border: #ffeb3b;
  --feedback-hit: rgba(118, 255, 3, 0.25);
  --feedback-miss: rgba(255, 82, 82, 0.2);
  --shadow: none;
  --overlay: rgba(0, 0, 0, 0.75);
}

/* Compatibilidade legado */
body.high-contrast:not([data-theme]) {
  --primary: #ffeb3b;
  --bg: #000000;
  --surface: #111111;
  --text: #ffffff;
  --text-muted: #e0e0e0;
  --border: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body.game-active {
  overflow: hidden;
  touch-action: none;
  position: fixed;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}

body.game-active .app {
  max-width: none;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(1rem + var(--safe-top)) 1.25rem calc(2rem + var(--safe-bottom));
}

/* —— Ecrãs —— */
.screen {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.screen--active {
  display: flex;
}

.screen--game.screen--active {
  max-width: none;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  gap: 0;
}

/* Animações decorativas (desactivadas com reduce-motion) */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen--active:not(.screen--game) {
  animation: fadeIn 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .screen--active:not(.screen--game) {
    animation: none;
  }
}

body.reduce-motion .screen--active:not(.screen--game),
body.reduce-motion .screen--active:not(.screen--game) {
  animation: none;
}

body.reduce-motion .btn:active,
body.reduce-motion .vbtn:active,
body.reduce-motion .mode-card:active {
  transform: none;
}

/* —— Home (maquete) —— */
.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.home-brand--compact {
  font-size: 1rem;
}

.home-brand__icon {
  width: 2rem;
  height: 2rem;
  color: var(--primary);
}

.home-hero {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 1.5rem;
  padding: 1rem 0;
}

.home-hero__divider {
  width: 3rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 1rem auto;
}

.home-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 400px;
  margin: 1.25rem auto 0;
}

.btn--hero {
  width: 100%;
}

.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 520px;
  margin: 0 auto 1.25rem;
}

@media (min-width: 600px) {
  .home-shortcuts {
    grid-template-columns: repeat(5, 1fr);
  }
}

.shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 88px;
  padding: 0.85rem 0.5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

.shortcut-card__icon {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--primary);
}

.shortcut-card:hover, .shortcut-card:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.home-newcomer {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
}

.home-newcomer__icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  color: var(--accent);
}

.home-newcomer p {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.btn--link {
  background: transparent;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  min-height: 44px;
  font-size: 0.95rem;
  margin: 0.5rem auto 0;
  display: block;
}

/* —— Onboarding —— */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.onboarding[hidden] {
  display: none !important;
}

.onboarding__card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.onboarding__card h2 {
  margin: 0 0 0.75rem;
  color: var(--primary);
}

.onboarding__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* —— Fluxo por passos —— */
.flow-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.btn--inline {
  width: auto;
  min-width: auto;
  align-self: flex-start;
  margin: 0;
}

.flow-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 280px;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.flow-tip svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 0.1rem;
}

.flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto 1rem;
  max-width: 480px;
}

.flow-steps--compact {
  margin-bottom: 0.75rem;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  position: relative;
  opacity: 0.5;
}

.flow-step--active {
  opacity: 1;
}

.flow-step__num {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 2px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
}

.flow-step--active .flow-step__num {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}

[data-theme="alto-contraste"] .flow-step--active .flow-step__num {
  color: #000;
}

.flow-step__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
}

.flow-step--active .flow-step__label {
  color: var(--primary);
}

.how-to-text {
  font-size: 1.15rem;
  line-height: 1.55;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  color: var(--text);
}

.mode-card__ribbon {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.badge--simple {
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  color: var(--primary);
  border-color: var(--primary);
}

.badge--guided {
  background: color-mix(in srgb, var(--success) 15%, var(--surface));
  color: var(--success);
  border-color: var(--success);
}

.badge--help {
  background: color-mix(in srgb, var(--warning) 15%, var(--surface));
  color: var(--warning);
  border-color: var(--warning);
}

.badge--advanced {
  background: color-mix(in srgb, var(--secondary) 15%, var(--surface));
  color: var(--secondary);
  border-color: var(--secondary);
}

@media (min-width: 700px) {
  .mode-cards {
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
  }
  .mode-card:nth-child(4),
  .mode-card:nth-child(5) {
    grid-column: span 1;
  }
}

/* —— Hero / cabeçalho —— */
.screen-header {
  text-align: center;
}

.hero-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 0 auto 1rem;
  max-width: 520px;
  box-shadow: var(--shadow);
}

.hero-card__tagline {
  margin: 0.75rem 0 0;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.logo {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  margin: 0.25rem 0 0;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.screen-header h2 {
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  margin: 0.5rem 0;
}

.hint {
  color: var(--text-muted);
  margin: 0;
  font-size: 1rem;
}

.hint--center {
  text-align: center;
}

.hint--inline {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.flow-badge {
  display: inline-block;
  background: var(--primary);
  color: var(--surface);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

[data-theme="alto-contraste"] .flow-badge,
body.high-contrast .flow-badge {
  color: #000;
}

.landscape-hint {
  text-align: center;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin: 0 auto;
  max-width: 480px;
}

/* —— Botões —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: var(--btn-min-h);
  min-width: 48px;
  padding: 0.85rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
  touch-action: manipulation;
}

.btn__icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
}

.btn:hover, .btn:focus-visible {
  background: var(--surface-raised);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

[data-theme="alto-contraste"] .btn--primary,
body.high-contrast .btn--primary {
  color: #000;
}

.btn--primary:hover, .btn--primary:focus-visible {
  background: var(--primary-hover);
}

.btn--accent {
  background: var(--secondary);
  color: var(--surface);
  border-color: var(--secondary);
}

[data-theme="alto-contraste"] .btn--accent {
  color: #000;
}

.btn--large {
  min-height: 64px;
  font-size: 1.15rem;
  width: 100%;
}

.btn--danger {
  border-color: var(--error);
  color: var(--error);
}

.btn--back {
  margin-top: 0.5rem;
  align-self: center;
  min-width: 200px;
}

.btn--icon {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.btn-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.btn-grid--main {
  margin-top: 0.5rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* —— Badges —— */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
}

.badge--access {
  background: transparent;
  border-color: var(--border);
}

.badge--recommended {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

[data-theme="alto-contraste"] .badge--recommended {
  color: #000;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

/* —— Perfis —— */
.profiles-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  min-height: 64px;
  touch-action: manipulation;
  width: 100%;
}

.profile-card:hover, .profile-card:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.profile-card__name {
  font-weight: 700;
  font-size: 1.15rem;
}

.profile-card__meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.profile-card__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.profile-card__actions .btn {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  font-size: 0.95rem;
}

/* —— Cartões de modo —— */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 600px) {
  .mode-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 1.25rem 1.5rem;
  min-height: 130px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  touch-action: manipulation;
  position: relative;
}

.mode-card:hover, .mode-card:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.mode-card--recommended {
  border-color: var(--primary);
  background: var(--surface-raised);
}

.mode-card__header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.mode-card__icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  color: var(--primary);
}

.mode-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  flex: 1;
}

.mode-card__desc {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* —— Configurações em cartões —— */
.settings-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.settings-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow);
}

.settings-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text);
  padding: 0;
  border: none;
}

.settings-card .setting-group {
  margin-bottom: 0;
}

.settings-card .setting-group legend {
  display: none;
}

.settings-form {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.setting-group {
  border: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.setting-group legend {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  padding: 0;
}

.radio-label, .toggle-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0.35rem 0;
  font-size: 1.05rem;
  cursor: pointer;
}

.radio-label input, .toggle-label input {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.setting-group--inline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  display: block;
  max-width: 480px;
  margin: 0.5rem auto 0.35rem;
  font-weight: 600;
}

.field-input {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  min-height: 52px;
  background: var(--surface);
  color: var(--text);
}

.field-textarea {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 80px;
  background: var(--surface);
  color: var(--text);
}

.toast {
  text-align: center;
  color: var(--success);
  font-weight: 600;
  margin: 0;
}

.tilt-setup {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.confirm-toggles {
  max-width: 480px;
  margin: 0 auto;
}

/* —— Jogo —— */
.game-hud {
  padding: 0.5rem 0.75rem;
  padding-top: calc(0.5rem + var(--safe-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.game-hud__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn--trainer {
  min-height: 44px;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.hud-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.hud-stat {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  text-align: center;
  min-width: 0;
}

.hud-stat__label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.hud-stat__value {
  display: block;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-stat--success .hud-stat__value {
  color: var(--success);
}

.hud-stat--miss .hud-stat__value {
  color: var(--error);
}

.instruction-banner {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
}

.instruction-banner__main {
  margin: 0;
  font-size: clamp(1rem, 3vw, 1.15rem);
  font-weight: 700;
  color: var(--primary);
  line-height: 1.35;
}

.instruction-banner__sub {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.game-hud__direction {
  margin: 0.35rem 0 0;
  font-weight: 600;
  color: var(--text);
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  padding: 0.4rem 0.65rem;
  background: var(--surface-raised);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.game-canvas-wrap {
  flex: 1;
  min-height: 180px;
  display: flex;
  background: var(--game-field);
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  flex: 1;
  cursor: pointer;
  touch-action: none;
}

/* —— Controlos por modo —— */
.game-mode-controls {
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.game-mode-controls[hidden] {
  display: none !important;
}

.mode-controls[hidden] {
  display: none !important;
}

.mode-controls {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  align-items: stretch;
}

.mode-controls--hit {
  justify-content: center;
}

.btn--hit {
  flex: 1;
  max-width: 320px;
  min-height: 72px;
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 40%, transparent);
}

.btn--hit:focus:not(:focus-visible) {
  outline: none;
}

.btn--hit:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.btn--hit--waiting {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn--hit--ready {
  background: var(--primary-hover, var(--primary));
  box-shadow: 0 0 0 3px var(--focus);
  filter: brightness(1.08);
}

.btn--hit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

[data-theme="alto-contraste"] .btn--hit {
  color: #000;
}

[data-theme="alto-contraste"] .btn--hit--ready {
  outline-color: #ffeb3b;
}

.mode-controls--direction {
  flex-direction: row;
}

.mode-controls--direction .vbtn--dir {
  flex: 1;
  min-height: 64px;
  font-size: 0.95rem;
  font-weight: 700;
}

.mode-controls--direction .vbtn--dir.vbtn--active {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

[data-theme="alto-contraste"] .mode-controls--direction .vbtn--dir.vbtn--active {
  color: #000;
}

.mode-controls--racket .vbtn--move {
  flex: 1;
  min-height: 60px;
  font-size: 1rem;
  font-weight: 700;
}

.vbtn--dir, .vbtn--move {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
}

.vbtn--dir:focus:not(:focus-visible),
.vbtn--move:focus:not(:focus-visible) {
  outline: none;
}

.vbtn--dir:focus-visible,
.vbtn--move:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.vbtn--dir:active, .vbtn--move:active {
  transform: scale(0.98);
}

body.reduce-motion .vbtn--dir:active,
body.reduce-motion .vbtn--move:active {
  transform: none;
}

/* Legado — oculto */
.virtual-buttons {
  display: none !important;
}

.game-controls {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.game-controls .btn {
  flex: 1;
}

/* —— Painel formador —— */
.trainer-panel {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.trainer-panel[hidden] {
  display: none !important;
}

.trainer-panel__inner {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.trainer-panel__title {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 1.25rem;
}

.trainer-panel__hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.trainer-panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.trainer-panel__grid .trainer-btn {
  min-height: 56px;
  font-size: 1rem;
  width: 100%;
}

.trainer-panel__grid .trainer-btn[data-trainer="end"],
.trainer-panel__grid .trainer-btn[data-trainer="pause"] {
  grid-column: 1 / -1;
}

/* —— Resultados —— */
.results-header {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.results-header__title {
  font-size: 1.5rem;
  margin: 0 0 0.35rem;
  color: var(--success);
}

.results-header__subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 1rem;
}

.results-suggestion {
  max-width: 480px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.98rem;
  color: var(--text-muted);
}

.results-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 480px) {
  .results-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

.metric-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.metric-card__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-card__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.metric-card--highlight {
  border-color: var(--primary);
}

.results-summary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.results-summary dl {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}

.results-summary dt {
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}

.results-summary dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.results-details {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* —— Histórico —— */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.history-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.history-item__date {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.history-item__meta {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.history-item__badge {
  display: inline-block;
  margin-left: 0.35rem;
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 2rem;
}

/* —— Sobre —— */
.about-content {
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  padding: 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.6;
}

.about-content p {
  margin: 0 0 1rem;
}

.about-content p:last-child {
  margin-bottom: 0;
}

/* —— Responsivo —— */
@media (max-width: 599px) {
  .hud-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .mode-controls--direction {
    flex-direction: column;
  }

  .trainer-panel__grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .app:not(.screen--game) {
    padding: 2rem;
  }

  .btn-grid--main {
    max-width: 400px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .instruction-banner__sub {
    display: none;
  }

  .game-controls {
    padding: 0.5rem;
  }

  .game-controls .btn {
    min-height: 48px;
  }
}

@media (orientation: portrait) and (max-width: 599px) {
  .screen--game.screen--active .game-controls .btn--danger {
    flex: 0.8;
  }
}

/* Sem transições rápidas de tema */
html {
  transition: var(--theme-transition);
}
