* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  gap: 24px;
  overflow-x: hidden;
}

/* ── Nav ── */
.site-nav {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(0,0,0,0.2);
  border-radius: 15px;
  position: relative;
  z-index: 100;
}
.site-nav .nav-brand {
  font-size: 1.1em;
  font-weight: bold;
  color: white;
  text-decoration: none;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.site-nav .nav-links { display: flex; gap: 10px; align-items: center; }
.site-nav .nav-links a {
  color: white;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.95em;
  background: rgba(255,255,255,0.15);
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: background 0.2s ease;
}
.site-nav .nav-links a:hover,
.site-nav .nav-links a:focus,
.site-nav .nav-links a.active { background: rgba(255,255,255,0.3); }

/* ── Hamburger button ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav backdrop ── */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
}

/* ── Mobile nav panel ── */
@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) {
  .hamburger-btn { display: flex; }

  .site-nav .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    background: #16213e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 12px;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
  }
  .site-nav .nav-links.open { display: flex; }

  .site-nav .nav-links a {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 1em;
    justify-content: flex-start;
  }
  .profile-link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px !important;
    font-size: 1em !important;
    border-radius: 10px;
  }
}

/* ── Shared ── */
.hidden { display: none !important; }

/* ── Ads ── */
.ad-container {
  margin: 0 auto;
  text-align: center;
  max-width: 728px;
  width: 100%;
  min-height: 90px;
  max-height: 100px;
  overflow: hidden;
}

/* ── Welcome screen ── */
#welcomeScreen {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: center;
}
.welcome-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: center;
}
.welcome-icon { font-size: 3em; }
.welcome-card h1 { font-size: 1.5em; font-weight: 800; }
.welcome-sub { font-size: 0.9em; color: rgba(255,255,255,0.55); margin-bottom: 8px; }
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}
.welcome-register-btn {
  background: #63c68a;
  border: none;
  border-radius: 20px;
  color: #0d1b2a;
  cursor: pointer;
  font-family: inherit;
  font-size: 1em;
  font-weight: 800;
  padding: 13px 32px;
  width: 100%;
  transition: background 0.2s ease;
}
.welcome-register-btn:hover,
.welcome-register-btn:focus { background: #78d49d; }
.welcome-signin-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-family: inherit;
  font-size: 1em;
  font-weight: 700;
  padding: 13px 32px;
  width: 100%;
  transition: background 0.2s ease;
}
.welcome-signin-btn:hover,
.welcome-signin-btn:focus { background: rgba(255,255,255,0.14); }
.welcome-anon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  padding: 12px 4px;
  min-height: 44px;
  text-decoration: underline;
  transition: color 0.2s ease;
}
.welcome-anon-btn:hover,
.welcome-anon-btn:focus { color: rgba(255,255,255,0.6); }

/* ── Profile screen ── */
#profileScreen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#profileLocalSection,
#profileAccountSection {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.profile-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Profile setting row (mute toggle etc.) ── */
.profile-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  gap: 16px;
}
.profile-setting-label {
  color: rgba(255,255,255,0.85);
  font-size: 1em;
  font-weight: 600;
}
.profile-toggle {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 600;
  padding: 8px 20px;
  min-height: 44px;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.profile-toggle:hover,
.profile-toggle:focus {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.3);
}
.profile-toggle--muted {
  background: rgba(255,100,100,0.18);
  border-color: rgba(255,100,100,0.4);
  color: rgba(255,150,150,0.95);
}
.profile-toggle--muted:hover,
.profile-toggle--muted:focus {
  background: rgba(255,100,100,0.28);
  border-color: rgba(255,100,100,0.55);
}

/* ── How to Play / Privacy Policy screens ── */
#howToPlayScreen,
#privacyPolicyScreen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Stats screen ── */
#statsScreen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#statsCards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stats-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stats-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stats-icon { font-size: 1.4em; }
.stats-mode-label {
  font-size: 1em;
  font-weight: 700;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 14px 8px;
}
.stats-val {
  font-size: 1.6em;
  font-weight: 800;
  color: white;
}
.stats-label {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
}
.stats-global {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 18px 24px;
}
.stats-global-label {
  font-size: 0.9em;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
}
.stats-global-val {
  font-size: 2em;
  font-weight: 800;
  color: #63c68a;
}
/* ── Fret Rush stats ─────────────────────────────────────────── */
.stats-section-title {
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  padding-top: 4px;
}
.stats-empty {
  color: rgba(255,255,255,0.4);
  font-size: 0.9em;
  text-align: center;
  padding: 8px 0;
}
.fr-stats-grid { grid-template-columns: repeat(2, 1fr); }

.fr-run-history {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}
.fr-run-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  font-size: 0.85em;
  padding: 6px 8px;
  border-radius: 8px;
}
.fr-run-row:not(.fr-run-head):nth-child(even) { background: rgba(255,255,255,0.04); }
.fr-run-head {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
}

.fr-aggregate { display: flex; flex-direction: column; gap: 12px; }

.fr-notes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fr-note-block {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fr-note-block-title {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 2px;
}
.fr-note-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fr-note-name {
  font-weight: 700;
  font-size: 0.95em;
  color: white;
}
.fr-note-val {
  font-size: 0.85em;
  color: rgba(255,255,255,0.55);
}

/* ── Fret Rush feedback card ─────────────────────────────────── */
.fr-feedback-card {
  background: rgba(99, 198, 138, 0.1);
  border: 1px solid rgba(99, 198, 138, 0.35);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fr-feedback-title {
  font-size: 0.9em;
  font-weight: 700;
  color: #63c68a;
}
.fr-feedback-line {
  font-size: 0.88em;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
  margin: 0;
}
.fr-feedback-dismiss {
  align-self: flex-start;
  background: rgba(99,198,138,0.2);
  border: 1px solid rgba(99,198,138,0.4);
  border-radius: 20px;
  color: #63c68a;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82em;
  font-weight: 600;
  padding: 6px 16px;
  transition: background 0.2s ease;
}
.fr-feedback-dismiss:hover { background: rgba(99,198,138,0.35); }

/* ── Stats badge ─────────────────────────────────────────────── */
.profile-link.has-feedback-badge { position: relative; }
.profile-link.has-feedback-badge::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: #e07878;
  border-radius: 50%;
  pointer-events: none;
}

.reset-stats-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  padding: 10px 20px;
  width: 100%;
  transition: all 0.2s ease;
}
.reset-stats-btn:hover,
.reset-stats-btn:focus {
  border-color: #e07878;
  color: #e07878;
}

/* ── Profile link on mode selection ── */
.profile-link {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  padding: 8px 18px;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: background 0.2s ease;
}
.profile-link:hover,
.profile-link:focus { background: rgba(255,255,255,0.3); color: white; }

/* ── Mode selection screen ── */
#modeSelection {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

#modeSelection h2 {
  font-size: 1em;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  margin-top: -16px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.mode-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 22px 20px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.mode-card:hover,
.mode-card:focus {
  background: rgba(255,255,255,0.14);
  border-color: rgba(122,179,245,0.4);
  transform: translateY(-2px);
}
.mode-card.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.mode-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.8em;
  opacity: 0.2;
  pointer-events: none;
  line-height: 1;
}
.mode-card h3 { font-size: 1.05em; font-weight: 700; padding-right: 5.5em; }
.mode-card p  { font-size: 0.82em; color: rgba(255,255,255,0.55); line-height: 1.4; padding-right: 5.5em; }
.mode-card .coming-soon {
  font-size: 0.7em;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.coming-soon-section {
  width: 100%;
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.coming-soon-label {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.25);
}

/* ── Portrait overlay ── */
.portrait-overlay {
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.portrait-back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 600;
  padding: 10px 18px;
  min-height: 44px;
}
.portrait-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: white;
  text-align: center;
  padding: 24px;
}
.portrait-icon {
  font-size: 4em;
  animation: rotate-hint 2s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(90deg); }
}
.portrait-message p {
  font-size: 1.1em;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}

/* ── Game screen ── */
#gameScreen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  background: none;
  border: none;
  border-radius: 0;
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  font-weight: 700;
  padding: 0 12px;
  min-height: 44px;
  opacity: 0.9;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.back-btn:hover,
.back-btn:focus { opacity: 0.6; }

.reveal-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 26px;
  padding: 3px 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.reveal-btn:hover,
.reveal-btn:focus {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.9);
}

.mode-title {
  flex: 1;
  text-align: center;
  font-size: 1.1em;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
}

.game-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ── Scale picker ── */
.scale-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.scale-pill {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 0.8em;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 44px;
  transition: all 0.15s ease;
}
.scale-pill:hover,
.scale-pill:focus {
  background: rgba(255,255,255,0.14);
  color: white;
}
.scale-pill.active {
  background: rgba(122,179,245,0.25);
  border-color: rgba(122,179,245,0.6);
  color: white;
}

.question {
  font-size: 1.2em;
  font-weight: 700;
  text-align: center;
  min-height: 1.5em;
  color: #f0e68c;
}
.question.shake { animation: shake 0.4s ease-in-out; }

/* Groups note box and its plural suffix flush together */
.task-note-unit {
  display: inline-flex;
  align-items: center;
}
.task-note-unit .task-label {
  margin-left: 3px;
}

/* ── Task row (Find Notes fixed-layout instruction) ─────────── */
.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  font-size: 1.1em;
  font-weight: 700;
  min-height: 1.5em;
}
.task-section {
  display: flex;
  align-items: center;
  gap: 0.3em;
  white-space: nowrap;
}
.task-fret-range {
  display: flex;
  align-items: center;
  gap: 0.3em;
}
.task-label {
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  font-size: 0.9em;
}
.task-box {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #f0e68c;
  padding: 2px 10px;
  min-width: 2.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.task-box--wrong {
  background: rgba(224, 120, 120, 0.15);
  border-color: rgba(224, 120, 120, 0.4);
  color: #e07878;
}
/* Reserve space even when hidden so the task row doesn't shift height */
.task-box--wrong.hidden {
  display: inline-block !important;
  visibility: hidden;
}
.task-box--found {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.07);
  min-width: 7em;
}
.task-box--fr-note {
  font-size: 1.3em;
  min-width: 2.8em;
  padding: 2px 14px;
}
.task-box--correct {
  background: rgba(99, 198, 138, 0.25);
  border-color: rgba(99, 198, 138, 0.6);
  color: #63c68a;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.task-box--pop {
  animation: fr-note-pop 0.25s ease-out;
}
@keyframes fr-note-pop {
  0%   { transform: scale(1);    opacity: 1; }
  40%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* ── Variant toggle — iOS segmented control ─────────────────── */
.variant-toggle {
  display: inline-flex;
  background: rgba(0,0,0,0.3);
  border-radius: 22px;
  padding: 3px;
  gap: 0;
}
.variant-btn {
  background: transparent;
  border: none;
  border-radius: 19px;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-height: 34px;
  padding: 6px 22px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.variant-btn:hover:not(:disabled) {
  color: rgba(255,255,255,0.75);
}
.variant-btn--active {
  background: rgba(122,179,245,0.28);
  color: #a8d0f5;
  box-shadow: 0 1px 5px rgba(0,0,0,0.3);
}
.variant-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Countdown timer state ──────────────────────────────────── */
.timer--countdown { color: #7ab3f5; font-weight: 700; }
.timer--urgent    { color: #e07878; animation: timer-pulse 0.5s ease-in-out infinite alternate; }
@keyframes timer-pulse {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

/* ── Timed end screen ───────────────────────────────────────── */
.timed-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 16px;
  min-height: 300px;
}
.timed-end-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 340px;
}
.timed-end-title {
  font-size: 1.2em;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}
.timed-end-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.timed-end-metric {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.timed-end-metric--highlight {
  background: rgba(122,179,245,0.15);
  border-color: rgba(122,179,245,0.35);
}
.timed-end-val {
  font-size: 1.6em;
  font-weight: 700;
  color: #f0e68c;
  font-variant-numeric: tabular-nums;
}
.timed-end-metric--highlight .timed-end-val { color: #7ab3f5; font-size: 2em; }
.timed-end-label {
  font-size: 0.75em;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}
.timed-end-vs {
  font-size: 0.88em;
  color: rgba(255,255,255,0.55);
  text-align: center;
}
.timed-end-vs--record { color: #63c68a; font-weight: 700; }
.timed-end-actions {
  display: flex;
  gap: 12px;
}
.timed-end-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: 600;
  padding: 10px 24px;
  transition: background 0.15s;
}
.timed-end-btn:hover { background: rgba(255,255,255,0.2); }
.timed-end-btn--primary {
  background: rgba(122,179,245,0.25);
  border-color: rgba(122,179,245,0.45);
  color: #7ab3f5;
}
.timed-end-btn--primary:hover { background: rgba(122,179,245,0.4); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ── Fret Rush lockout state ── */
.fretboard-wrap.fr-locked {
  opacity: 0.5;
  pointer-events: none;
  outline: 2px solid rgba(224, 120, 120, 0.6);
  outline-offset: -9px;
  border-radius: 6px;
  animation: lockout-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes lockout-pulse {
  from { outline-color: rgba(224, 120, 120, 0.3); }
  to   { outline-color: rgba(224, 120, 120, 0.8); }
}
.question.fr-locked-question { color: #e07878; }

.fretboard-wrap { width: 100%; margin-bottom: -20px; }
svg#fretboard   { width: 100%; display: block; }

#hitZones { transition: opacity 0.25s ease; }
#hitZones.fading { opacity: 0; }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 10px 18px;
}
.score-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.score-label {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
}
.score-val {
  display: inline-block;
  font-size: 1.6em;
  font-weight: 800;
  color: white;
}
.score-val.pop { animation: pop 0.3s ease-out; }

@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.task-feedback-wrapper {
  position: relative;
  width: 100%;
}
.feedback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9em;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.feedback:not(:empty) {
  opacity: 1;
  pointer-events: auto;
}

.action-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.next-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-size: 1em;
  font-weight: 700;
  padding: 12px 32px;
  flex: 1;
  transition: background 0.2s ease;
}
.next-btn:hover,
.next-btn:focus { background: rgba(255,255,255,0.22); }
.next-btn--start {
  background: #63c68a;
  border-color: #63c68a;
  color: #0d1b2a;
}
.next-btn--start:hover,
.next-btn--start:focus { background: #78d49d; }
.share-btn {
  background: rgba(122,179,245,0.18);
  border: 1px solid rgba(122,179,245,0.4);
  border-radius: 20px;
  color: #7ab3f5;
  cursor: pointer;
  font-size: 1em;
  font-weight: 700;
  padding: 12px 24px;
  flex: 1;
  transition: background 0.2s ease;
}
.share-btn:hover,
.share-btn:focus { background: rgba(122,179,245,0.28); }
.play-btn {
  background: rgba(122,179,245,0.18);
  border: 1px solid rgba(122,179,245,0.4);
  border-radius: 20px;
  color: #7ab3f5;
  cursor: pointer;
  font-size: 1em;
  font-weight: 700;
  padding: 12px 32px;
  flex: 1;
  transition: background 0.2s ease;
}
.play-btn:hover,
.play-btn:focus { background: rgba(122,179,245,0.28); }

/* ── Responsive: 768px ── */
@media (max-width: 768px) {
  body { padding: 16px 12px; gap: 16px; }

  .site-nav { padding: 10px 14px; }
  .site-nav .nav-links a { padding: 6px 12px; font-size: 0.85em; }

  .game-card { padding: 20px; gap: 16px; }

  .score-val { font-size: 1.3em; }
  .score-row { padding: 8px 14px; }

  .next-btn, .share-btn, .play-btn { padding: 11px 16px; font-size: 0.95em; }

  #modeSelection { gap: 20px; }
  .mode-card { padding: 18px 16px; }
}

/* ── Responsive: 480px ── */
@media (max-width: 480px) {
  body { padding: 12px 10px; gap: 12px; }

  .site-nav { padding: 8px 12px; }

  .welcome-card { padding: 28px 20px; }
  #welcomeScreen { max-width: 100%; }

  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { padding: 16px 14px; }

  .profile-card { padding: 24px 20px; }

  .stats-grid { gap: 8px; }
  .stats-item { padding: 10px 6px; }
  .stats-val { font-size: 1.3em; }
  .stats-global { padding: 14px 18px; }

  .score-val { font-size: 1.15em; }
  .game-card { padding: 14px; gap: 12px; }
  .action-row { flex-wrap: wrap; }
  .next-btn, .share-btn, .play-btn { font-size: 0.9em; padding: 10px 12px; }
}

/* ── Landscape mobile: compact game screen ── */
@media (max-height: 500px) and (orientation: landscape) {
  body { padding: 8px 10px; gap: 8px; }

  .site-nav { padding: 6px 12px; }
  .site-nav .nav-brand { font-size: 0.85em; }

  #gameScreen { gap: 8px; }
  .game-card { padding: 10px 14px; gap: 8px; }

  .question { font-size: 1em; min-height: 1.2em; }

  .score-row { padding: 6px 12px; }
  .score-val { font-size: 1.1em; }
  .score-label { font-size: 0.6em; }

  .feedback { font-size: 0.85em; }

  .next-btn, .share-btn, .play-btn { padding: 9px 16px; font-size: 0.9em; }


  /* Hide nav entirely during gameplay — game-header has back button */
  body.game-active .site-nav { display: none; }
  body.game-active { padding: 4px 10px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); gap: 4px; }
  body.game-active #gameScreen { gap: 4px; }
  body.game-active .game-card { padding: 8px 12px; gap: 4px; }
  body.game-active .question { min-height: 0; }
  body.game-active .fretboard-wrap { margin-top: -16px; margin-bottom: -18px; }
  body.game-active .score-row { padding: 4px 12px; }
  body.game-active .score-val { font-size: 1em; }
}

/* ══════════════════════════════════════════════════════════════
   Content pages (How to Play, Privacy Policy)
   ══════════════════════════════════════════════════════════════ */
.content-container {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  max-width: 900px;
  width: 100%;
  text-align: left;
}
.content-container h1 { text-align: center; margin-bottom: 10px; }
.content-container .subtitle {
  text-align: center;
  opacity: 0.85;
  margin-bottom: 40px;
  font-size: 1.1em;
}
.content-container h2 {
  font-size: 1.4em;
  margin-top: 36px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.content-container h3 {
  font-size: 1.1em;
  margin-top: 22px;
  margin-bottom: 6px;
}
.content-container p {
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 12px;
}
.content-container ul,
.content-container ol {
  line-height: 1.8;
  opacity: 0.9;
  padding-left: 25px;
  margin-bottom: 12px;
}
.content-container a { color: #7ab3f5; }
.content-container a:hover { color: white; }

.mode-detail-card {
  background: rgba(255,255,255,0.08);
  border-radius: 15px;
  padding: 22px;
}
.mode-detail-card .mode-icon { font-size: 2em; margin-bottom: 8px; }
.mode-detail-card h3 { margin: 0 0 10px 0; font-size: 1.1em; }
.mode-detail-card p  { margin: 0; font-size: 0.92em; opacity: 0.88; }

.tip-box {
  background: rgba(78,205,196,0.15);
  border-left: 4px solid #4ecdc4;
  border-radius: 0 10px 10px 0;
  padding: 15px 20px;
  margin: 15px 0;
}
.tip-box p { margin: 0; }

.faq-item { margin-bottom: 22px; }
.faq-item h3 { margin-bottom: 6px; }

.page-footer {
  margin-top: 30px;
  padding: 20px;
  text-align: center;
  opacity: 0.6;
  font-size: 0.9em;
}
.page-footer a { color: white; opacity: 0.7; text-decoration: none; }
.page-footer a:hover { opacity: 1; }

.cta-btn {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 14px 40px;
  border-radius: 25px;
  text-decoration: none;
  font-size: 1.05em;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid rgba(255,255,255,0.25);
  transition: background 0.2s ease;
}
.cta-btn:hover { background: rgba(255,255,255,0.28); color: white; }

@media (max-width: 768px) {
  .content-container { padding: 24px 18px; }
}

/* ── Auth screen ─────────────────────────────────────────────── */
#authScreen,
#resetPasswordScreen {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

/* Hide site-nav on focused auth screens — back button handles navigation */
body:has(#authScreen:not(.hidden)) .site-nav,
body:has(#resetPasswordScreen:not(.hidden)) .site-nav {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 9px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: 700;
  padding: 10px;
  transition: background 0.2s, color 0.2s;
}
.auth-tab--active {
  background: rgba(255,255,255,0.12);
  color: white;
}

.auth-error {
  background: rgba(224,120,120,0.15);
  border: 1px solid rgba(224,120,120,0.4);
  border-radius: 10px;
  color: #e07878;
  font-size: 0.88em;
  padding: 10px 14px;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-field label {
  color: rgba(255,255,255,0.6);
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  color: white;
  font-family: inherit;
  font-size: 1em;
  padding: 13px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  /* Prevent iOS zoom on focus (needs font-size >= 16px equivalent) */
  -webkit-appearance: none;
}
.auth-input::placeholder { color: rgba(255,255,255,0.3); }
.auth-input:focus {
  border-color: rgba(122,179,245,0.7);
  background: rgba(255,255,255,0.11);
}

.auth-submit {
  background: rgba(122,179,245,0.25);
  border: 1px solid rgba(122,179,245,0.5);
  border-radius: 12px;
  color: #7ab3f5;
  cursor: pointer;
  font-family: inherit;
  font-size: 1em;
  font-weight: 700;
  margin-top: 4px;
  min-height: 48px;
  padding: 13px;
  transition: background 0.2s;
  width: 100%;
}
.auth-submit:hover:not(:disabled) { background: rgba(122,179,245,0.38); }
.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Profile account section (logged-in state) ── */
.profile-account-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0 4px;
}
.profile-account-label {
  color: rgba(255,255,255,0.5);
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-account-username {
  color: white;
  font-size: 1.2em;
  font-weight: 700;
}
.profile-save-btn {
  background: #63c68a;
  border: none;
  border-radius: 14px;
  color: #0d1b2a;
  cursor: pointer;
  font-family: inherit;
  font-size: 1em;
  font-weight: 800;
  min-height: 52px;
  padding: 14px;
  width: 100%;
  transition: background 0.2s ease;
}
.profile-save-btn:hover:not(:disabled),
.profile-save-btn:focus:not(:disabled) { background: #78d49d; }
.profile-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.profile-logout-btn {
  background: rgba(255, 80, 80, 0.1);
  border: 1px solid rgba(255, 80, 80, 0.3);
  border-radius: 14px;
  color: rgba(255, 120, 120, 0.9);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: 700;
  min-height: 52px;
  padding: 14px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
  width: 100%;
}
.profile-logout-btn:hover,
.profile-logout-btn:focus {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.5);
}

.profile-success {
  background: rgba(99,198,138,0.12);
  border: 1px solid rgba(99,198,138,0.35);
  border-radius: 10px;
  color: #63c68a;
  font-size: 0.88em;
  font-weight: 600;
  padding: 10px 14px;
  text-align: center;
}

.auth-skip {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  padding: 4px 0;
  text-align: center;
  transition: color 0.2s;
  width: 100%;
}
.auth-skip:hover { color: rgba(255,255,255,0.7); }

.auth-intro {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 8px;
}

.auth-forgot {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 0 0;
  text-align: center;
  transition: color 0.2s;
  width: 100%;
}
.auth-forgot:hover { color: rgba(255,255,255,0.6); }

.auth-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  color: #86efac;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 14px 16px;
  text-align: center;
}

/* ── Toast ── */
.app-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  color: #fff;
  padding: 12px 20px 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.app-toast--success   { border-left: 4px solid #22c55e; }
.app-toast--error     { border-left: 4px solid #ef4444; }
.app-toast--milestone { border-left: 4px solid #f59e0b; }

/* ── Leaderboard CTA banner ── */
.leaderboard-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(122,179,245,0.08);
  border: 1px solid rgba(122,179,245,0.2);
  border-radius: 14px;
  color: rgba(255,255,255,0.65);
  font-size: 0.88em;
  padding: 14px 20px;
  width: 100%;
  max-width: 900px;
}
.leaderboard-cta-btn {
  background: rgba(122,179,245,0.2);
  border: 1px solid rgba(122,179,245,0.45);
  border-radius: 20px;
  color: #7ab3f5;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 700;
  padding: 6px 18px;
  white-space: nowrap;
  transition: background 0.2s;
}
.leaderboard-cta-btn:hover { background: rgba(122,179,245,0.35); }

/* ── Leaderboard screen ── */
#leaderboardScreen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.leaderboard-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.leaderboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.leaderboard-mode-tabs {
  display: flex;
  gap: 16px;
}
.leaderboard-mode-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: 700;
  padding: 4px 0 6px;
  transition: color 0.15s, border-color 0.15s;
}
.leaderboard-mode-tab--active {
  border-bottom-color: #7ab3f5;
  color: #7ab3f5;
}
.leaderboard-mode-tab:hover:not(.leaderboard-mode-tab--active) { color: rgba(255,255,255,0.7); }

.leaderboard-period-tabs {
  display: flex;
  gap: 12px;
}
.leaderboard-period-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 0 6px;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s;
}
.leaderboard-period-tab--active {
  border-bottom-color: #7ab3f5;
  color: #7ab3f5;
}
.leaderboard-period-tab:hover:not(.leaderboard-period-tab--active) { color: rgba(255,255,255,0.7); }

#leaderboardContent { min-height: 80px; }
.leaderboard-loading,
.leaderboard-empty {
  color: rgba(255,255,255,0.4);
  font-size: 0.88em;
  padding: 16px 0;
  margin: 0;
}
.leaderboard-table { display: flex; flex-direction: column; gap: 4px; }
.leaderboard-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  font-size: 0.9em;
}
.leaderboard-row--me {
  background: rgba(122,179,245,0.12);
  border: 1px solid rgba(122,179,245,0.3);
}
.leaderboard-rank {
  color: rgba(255,255,255,0.4);
  font-size: 0.85em;
  text-align: center;
}
.leaderboard-name { color: rgba(255,255,255,0.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-value { color: #7ab3f5; font-variant-numeric: tabular-nums; }
.leaderboard-meta  { color: rgba(255,255,255,0.4); font-size: 0.85em; text-align: right; }
.leaderboard-divider {
  text-align: center;
  color: rgba(255,255,255,0.2);
  padding: 4px 0;
  font-size: 0.8em;
  letter-spacing: 0.1em;
}

/* ── Bottom nav (mobile UI) ─────────────────────────────────── */
.site-nav,
.nav-backdrop {
  display: none !important;
}

.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(15, 20, 40, 0.97);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-bottom: env(safe-area-inset-bottom);
  justify-content: space-around;
  align-items: stretch;
}

.bottom-nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: color 0.15s ease;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-tab:active { opacity: 0.7; }

.bottom-nav-tab.active {
  color: #7ab3f5;
}

.bottom-nav-icon {
  font-size: 1.4em;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Push content above the bottom nav */
body {
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

/* Hide bottom nav during game screen */
body.in-game .bottom-nav {
  display: none;
}

/* Hide ad banner in mobile UI (stripped at build time, hidden at runtime for testing) */
body.mobile-ui .ad-container {
  display: none;
}

/* ── Native touch feel ───────────────────────────────────────── */

/* Prevent rubber-band / overscroll bounce — dead giveaway of a WebView app */
html.mobile-ui {
  overscroll-behavior: none;
}
body.mobile-ui {
  touch-action: pan-y;
}


/* Kill the scrollbar on native app only — keep it on web */
body.native-app,
html.native-app {
  scrollbar-width: none;
}
body.native-app ::-webkit-scrollbar,
html.native-app ::-webkit-scrollbar {
  display: none;
}
html.native-app {
  overflow-y: auto;
  scrollbar-gutter: auto;
}

/* Remove grey tap flash on all interactive elements */
body.mobile-ui * {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent text selection on tap — looks very web-like when it triggers */
body.mobile-ui {
  -webkit-user-select: none;
  user-select: none;
}

/* Re-allow selection inside text inputs */
body.mobile-ui input,
body.mobile-ui textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* Kill the 300ms tap delay on all interactive elements */
body.mobile-ui button,
body.mobile-ui input,
body.mobile-ui select,
body.mobile-ui textarea,
body.mobile-ui [role="button"],
body.mobile-ui .mode-card,
body.mobile-ui .bottom-nav-tab {
  touch-action: manipulation;
}

/* Prevent iOS long-press callout (copy/open link bubbles) on non-input elements */
body.mobile-ui *:not(input):not(textarea) {
  -webkit-touch-callout: none;
}

/* Safe area top — ensure content clears the status bar / Dynamic Island */
body.mobile-ui {
  padding-top: max(16px, env(safe-area-inset-top));
}

/* Mobile app title — native app only, never shown on web */
.mobile-app-header { display: none; }
body.native-app .mobile-app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2px 0 6px;
  font-size: 1.15em;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: white;
}
body.native-app.in-game .mobile-app-header { display: none; }

/* Hide headers on secondary screens — bottom nav tab is the heading */
body.mobile-ui #statsScreen .game-header,
body.mobile-ui #profileScreen .game-header,
body.mobile-ui #leaderboardScreen .game-header {
  display: none;
}

/* Hide back buttons on secondary screens — bottom nav handles navigation */

body.mobile-ui .game-header {
  justify-content: space-between;
  min-height: 44px;
}


/* ══════════════════════════════════════════════════════════════
   4-panel game layout (web + mobile)
   ══════════════════════════════════════════════════════════════ */

/* Lock the viewport during gameplay — no scroll, fill the screen */
body.game-active {
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  gap: 0;
}

body.game-active #gameScreen {
  height: 100%;
  max-width: 100%;
  flex: 1;
  gap: 0;
  overflow: hidden;
}

/* Panel 1: Header — compact, fixed height */
body.game-active .game-header {
  flex-shrink: 0;
  padding: 0 8px;
  min-height: 44px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* Strip card styling — panels handle their own look */
body.game-active .game-card {
  flex: 1;
  min-height: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  padding: 0;
  gap: 0;
  box-shadow: none;
  overflow: hidden;
}

/* Panel 2: Question */
.game-panel-question {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px 6px;
  min-height: 72px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* Panel 3: Fretboard — takes all remaining vertical space */
.fretboard-panel {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 6px 0;
}

.fretboard-panel .fretboard-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.fretboard-panel svg#fretboard {
  width: 100%;
  max-height: 100%;
  height: auto;
}

/* Panel 4: Score row */
body.game-active .score-row {
  flex-shrink: 0;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

/* Post-round overlay — frosted glass over the fretboard */
/* Hidden by default; shown via :has() when Share or Play buttons appear */
.fretboard-panel .action-row {
  display: none;
}

.fretboard-panel .action-row:has(.share-btn:not(.hidden), .play-btn:not(.hidden)) {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(10, 18, 40, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 8px;
  padding: 24px;
}

.fretboard-panel .next-btn,
.fretboard-panel .share-btn,
.fretboard-panel .play-btn {
  width: 100%;
  max-width: 260px;
  justify-content: center;
}

.leaderboard-load-more {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: block;
  font-family: inherit;
  font-size: 0.88em;
  font-weight: 600;
  margin: 16px auto 0;
  min-height: 44px;
  padding: 10px 28px;
  transition: background 0.15s, color 0.15s;
}
.leaderboard-load-more:hover:not(:disabled),
.leaderboard-load-more:focus:not(:disabled) {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
}
.leaderboard-load-more:disabled { opacity: 0.4; cursor: not-allowed; }
