/* ==========================================================
   Jogo "Toque uma música" (jogo.html)
   ========================================================== */

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.btn-lg { padding: 20px 64px; font-size: 15px; }
.btn-teal-solid { background: var(--teal); color: var(--white); border-color: var(--teal); }
.btn-teal-solid:hover, .btn-teal-solid:focus-visible { background: var(--white); color: var(--teal); border-color: var(--white); }
.btn:disabled { opacity: .55; cursor: default; pointer-events: none; }

.game-page {
  min-height: 80vh;
  padding: 72px 20px 120px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(35, 99, 115, .45), transparent 70%),
    radial-gradient(700px 500px at 100% 100%, rgba(35, 99, 115, .3), transparent 70%),
    var(--ink);
  color: var(--paper);
}
.game-wrap { max-width: 820px; margin: 0 auto; }

.game-head { text-align: center; margin-bottom: 40px; }
.game-head .eyebrow { color: var(--mist); margin: 0 0 12px; max-width: none; }
.game-head h1 { color: var(--white); font-size: 64px; line-height: 1.05; margin-bottom: 16px; }
.game-head p { max-width: 560px; margin: 0 auto; color: var(--mist); }

.game-panel {
  padding: 32px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7);
}
.game-panel[hidden] { display: none; }

.panel-title {
  margin: 0 0 16px;
  color: var(--white);
  font-family: var(--display);
  font-style: normal;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.panel-title:not(:first-child) { margin-top: 32px; }

/* ---------- Escolha ---------- */
.song-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.song-list li { position: relative; }
.song-card, .mode-card {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%;
  padding: 18px 20px;
  text-align: left;
  font: inherit;
  color: var(--paper);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color .3s, border-color .3s, transform .3s var(--ease);
}
.song-card:hover, .mode-card:hover { background: rgba(255, 255, 255, .1); transform: translateY(-2px); }
.song-card[aria-checked="true"], .mode-card[aria-checked="true"] {
  background: rgba(143, 195, 211, .16);
  border-color: #8fc3d3;
  box-shadow: 0 0 0 1px #8fc3d3 inset;
}
.song-title { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.2; color: var(--white); padding-right: 40px; }
.song-sub { font-size: 14px; color: var(--mist); }
.song-level { margin-top: 6px; font-size: 11px; letter-spacing: 3px; color: #8fc3d3; }
.mode-card strong { font-family: var(--display); font-size: 16px; color: var(--white); letter-spacing: 1px; text-transform: uppercase; }
.mode-card span { font-size: 14px; color: var(--mist); line-height: 1.5; }

.song-preview {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px;
  display: grid; place-items: center; padding: 0;
  color: var(--white);
  background: rgba(255, 255, 255, .12);
  border: 0; border-radius: 50%;
  cursor: pointer;
  transition: background-color .3s, color .3s, transform .3s var(--ease);
}
.song-preview:hover { background: var(--white); color: var(--ink); transform: scale(1.1); }
.song-preview .i-stop { display: none; }
.song-preview.is-playing { background: var(--white); color: var(--ink); }
.song-preview.is-playing .i-play { display: none; }
.song-preview.is-playing .i-stop { display: block; }

.mode-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.best-line { margin: 28px 0 20px; min-height: 1.6em; font-size: 14px; color: var(--mist); text-align: center; }
#btn-start { display: block; margin: 0 auto; }

/* ---------- Partida ---------- */
.game-panel--stage { padding: 16px 16px 20px; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 6px 12px; }
.hud-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; min-width: 0; }
.hud-title { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--mist); }
.hud-combo { font-size: 14px; font-weight: 700; color: #bfe9f5; min-width: 8ch; }
.hud-tools { display: flex; gap: 8px; flex: none; }
.tool-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center; padding: 0;
  color: var(--white);
  background: rgba(255, 255, 255, .1);
  border: 0; border-radius: 50%;
  cursor: pointer;
  transition: background-color .3s, color .3s;
}
.tool-btn:hover { background: var(--white); color: var(--ink); }
.tool-btn .i-x { display: none; }
.tool-btn[aria-pressed="true"] .i-wave { display: none; }
.tool-btn[aria-pressed="true"] .i-x { display: block; }
#btn-pause[aria-pressed="true"] { background: var(--white); color: var(--ink); }

.progress { height: 3px; margin: 0 6px 12px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #8fc3d3); transform: scaleX(0); transform-origin: left; transition: transform .25s; }

.board {
  position: relative;
  height: clamp(300px, 52vh, 460px);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  background: #0d1b20;
}
.board canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 20, 24, .6);
  text-align: center;
}
.overlay[hidden] { display: none; }
.count { font-family: var(--serif); font-style: italic; font-size: 110px; line-height: 1; color: var(--white); }
.count-hint { font-family: var(--display); font-size: 16px; letter-spacing: 3px; text-transform: uppercase; color: var(--mist); }
.pause-box { display: flex; flex-direction: column; gap: 14px; min-width: 220px; }
.pause-box p { margin: 0 0 6px; font-family: var(--serif); font-style: italic; font-size: 40px; color: var(--white); text-transform: uppercase; }

.keys { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; background: #0d1b20; padding: 0 0 2px; }
.key {
  position: relative;
  height: clamp(100px, 18vh, 150px);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  padding: 0 0 12px;
  font: inherit;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #e5ecee);
  border: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 0 #aebcc1;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, transform .08s, box-shadow .08s;
}
.key-name { font-family: var(--display); font-weight: 600; font-size: 13px; }
.key-cap { font-size: 11px; font-weight: 700; padding: 2px 7px; color: var(--teal); background: rgba(35, 99, 115, .12); border-radius: 4px; }
.key.is-down { background: linear-gradient(180deg, #bfe0ea, #8fc3d3); transform: translateY(5px); box-shadow: 0 1px 0 #6e9aa8; }
.key.is-wrong { background: linear-gradient(180deg, #f6d4cf, #e9a59d); }
.key.is-target { box-shadow: 0 6px 0 #aebcc1, 0 0 0 3px #8fc3d3 inset; }

.keys-help { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--mist); }
kbd {
  display: inline-block; min-width: 1.7em; padding: 1px 6px; margin: 0 1px;
  font: 700 12px/1.6 Lato, sans-serif; color: var(--white); text-align: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); border-radius: 4px;
}

/* ---------- Resultado ---------- */
.game-panel--result { text-align: center; }
.result-title { text-align: center; outline: 0; }
.result-top { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.result-score span { display: block; font-family: var(--serif); font-style: italic; font-size: 84px; line-height: 1; color: var(--white); }
.result-score small { display: block; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--mist); margin-top: 4px; }
.result-stars { font-size: 40px; letter-spacing: 8px; color: #f4d77a; line-height: 1.4; }
.result-msg { max-width: 520px; margin: 8px auto 12px; color: var(--paper); font-size: 17px; }
.result-stats { margin: 0 0 4px; font-size: 14px; color: var(--mist); }
.result-best { margin: 0 0 20px; min-height: 1.6em; font-size: 14px; font-weight: 700; color: #bfe9f5; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 36px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, .14); }
.result-reveal { margin-bottom: 8px; }
.result-reveal:not([hidden]) { animation: revealIn .8s var(--ease) backwards; }
@keyframes revealIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* Tela trancada: convite para deixar o contato antes de ver a pontuação */
.gate-msg {
  max-width: 480px;
  margin: 4px auto 28px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--paper);
  text-align: center;
}
.gate-msg strong { color: var(--white); }
.gate-note { display: block; margin-bottom: 6px; font-size: 44px; line-height: 1; color: #8fc3d3; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes gateBob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-6px) rotate(6deg); } }
  .gate-note { animation: gateBob 2.4s ease-in-out infinite; }
}

.lead { text-align: left; padding: 28px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px; }
.lead.is-done { background: none; border: 0; padding: 0; text-align: center; }
.lead.is-done h3, .lead.is-done .lead-intro, .lead.is-done form { display: none; }
.lead-done { margin: 0; font-size: 15px; font-weight: 700; color: var(--mist); }
.lead-done.is-ok { color: #9fe0b5; }
.lead-done.is-warn { color: #f4d77a; font-weight: 400; }
.lead h3 { margin: 0 0 8px; font-size: 24px; color: var(--white); font-family: var(--serif); font-style: italic; text-transform: none; line-height: 1.3; }
.lead-intro { margin: 0 0 24px; color: var(--mist); font-size: 15px; }
.field { margin-bottom: 18px; flex: 1 1 0; min-width: 0; }
.field-row { display: flex; gap: 20px; }
.field label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--mist); }
.field input {
  display: block; width: 100%;
  padding: 10px 2px;
  font: inherit; color: var(--white);
  background: transparent;
  border: 0; border-bottom: 1px solid rgba(255, 255, 255, .4);
  border-radius: 0; outline: 0;
  transition: border-color .3s;
}
.field input::placeholder { color: rgba(255, 255, 255, .35); }
.field input:focus { border-bottom-color: #8fc3d3; box-shadow: 0 1px 0 #8fc3d3; }
.field--trap { position: absolute; left: -9999px; }
.consent { display: flex; align-items: flex-start; gap: 12px; margin: 8px 0 22px; font-size: 13px; line-height: 1.55; color: var(--mist); cursor: pointer; }
.consent input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: #8fc3d3; }
#lead-submit { width: 100%; }
.lead-msg { margin: 14px 0 0; min-height: 1.6em; font-size: 14px; }
.lead-msg.is-error { color: #f2a9a0; }
.lead-msg.is-warn { color: #f4d77a; }
.lead-msg.is-ok { color: #9fe0b5; font-weight: 700; }
.lead-or { margin: 14px 0 0; text-align: center; font-size: 14px; color: var(--mist); }
.lead-wa { color: var(--white); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lead-wa:hover { color: #bfe9f5; }

/* ---------- Responsivo ---------- */
@media (max-width: 767px) {
  .game-page { padding: 48px 12px 96px; }
  .game-head h1 { font-size: 40px; }
  .game-panel { padding: 22px 16px; }
  .game-panel--stage { padding: 12px 8px 16px; }
  .song-list, .mode-list { grid-template-columns: 1fr; }
  .board { height: clamp(280px, 46vh, 420px); }
  .key { height: 96px; padding-bottom: 8px; border-radius: 0 0 6px 6px; }
  .key-name { font-size: 10px; }
  .key-cap { display: none; }
  .keys-help { display: none; }
  .hud-title { font-size: 15px; }
  .result-score span { font-size: 64px; }
  .field-row { flex-direction: column; gap: 0; }
  .result-actions .btn { flex: 1 1 100%; }
  .lead { padding: 20px 16px; }
  .count { font-size: 88px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .board { height: 46vh; }
  .key { height: 22vh; }
}

@media (prefers-reduced-motion: reduce) {
  .song-card:hover, .mode-card:hover { transform: none; }
}
