/* =====================================================
   LOCAL GAME STYLES: Relative Pitch Snake
   Builds on top of ../../shared/global.css
   ===================================================== */

:root {
  --ref-purple:        #a78bfa;
  --ref-purple-shadow: #7c3aed;
  --snake-gold:  #facc15;
  --snake-green: #34d399;
  --snake-blue:  #38bdf8;
}

/* ─── Title ─── */
.gameMainTitle {
  text-align: center; font-size: 22px; font-weight: 900;
  color: var(--text-main); margin: 0; padding: 0 12px;
}
.diffBadge {
  display: inline-block; font-size: 13px; font-weight: 800;
  padding: 2px 10px; border-radius: 20px; margin-left: 8px;
  vertical-align: middle;
}
.diffBadge--int { background: var(--ref-purple); color: #fff; }

/* ─── Modal titles ─── */
.modalGameTitle {
  text-align: center; font-size: 22px; font-weight: 900;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.4px;
}
.modalGameSubtitle {
  text-align: center; font-size: 16px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 10px;
}

/* ─── Panels ─── */
.controlsPanel, .analysisCard {
  background: var(--bg-surface); border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md); padding: 12px 12px; box-shadow: var(--shadow-soft);
}
body.light-theme .controlsPanel,
body.light-theme .analysisCard { border-color: rgba(0,0,0,0.06); }

/* ─── Nav actions row (single line, collapses to icons individually) ─── */
.navActionsRow {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
}
.navBtn {
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.navBtn .ib-icon  { font-size: 19px; flex-shrink: 0; line-height: 1; display: none; }
.navBtn .ib-label {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.navBtn.icon-only {
  flex: 0 0 auto;
  width: 52px;
  padding: 0;
}
.navBtn.icon-only .ib-label { display: none; }
.navBtn.icon-only .ib-icon  { display: inline; }
.navBtn:disabled { opacity: 0.4; cursor: not-allowed; }

.default-btn   { background: var(--bg-elevated); color: var(--text-main); border: 2px solid transparent; box-shadow: 0 4px 0 rgba(0,0,0,0.25); }
.secondary-btn { background: var(--bg-elevated); color: var(--text-main); border: 2px solid var(--bg-elevated); box-shadow: 0 4px 0 rgba(0,0,0,0.2); font-size: 14px; }
.secondary-btn:active:not(:disabled) { box-shadow: 0 0px 0 transparent; transform: translateY(4px); }

/* ─── Power-up key (above the game, below the nav row) ─── */
.powerupKey {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: var(--bg-surface);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}
body.light-theme .powerupKey { border-color: rgba(0,0,0,0.06); }
.powerupKeyItem {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.powerupKeyItem img { width: 20px; height: 20px; flex-shrink: 0; }

/* ─── Score footer (below the grid, its own space — never over tiles) ─── */
.scoreFooter {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.scoreFooterItem strong { color: var(--text-main); font-weight: 900; }
.scoreFooterItem--high strong { color: var(--snake-gold); }

/* ─── Canvas ─── */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-md);
}

#gameCanvas {
  background-color: var(--bg-base);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  display: block;
  width: 100%;
  height: 100%;
}
body.light-theme #gameCanvas { border-color: rgba(0,0,0,0.06); }

.pause-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-modal); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.pause-card { text-align: center; padding: 0 24px; }
.pause-card h3 { font-size: 22px; font-weight: 900; color: var(--accent); margin-bottom: 10px; }
.pause-card p  { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.4; }

.ready-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-modal); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.ready-card {
  font-size: 24px; font-weight: 900; color: #fff;
  padding: 14px 28px; border-radius: var(--radius-md);
  background: var(--accent); border: 2px solid var(--accent-shadow);
  box-shadow: 0 4px 0 var(--accent-shadow);
  animation: readyPulse 1.6s ease-in-out infinite;
}
@keyframes readyPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
.ready-instructions {
  position: absolute;
  left: 12px; right: 12px; bottom: 14px;
  margin: 0;
  text-align: center;
  font-size: 12px; font-weight: 700; line-height: 1.4;
  color: rgba(255,255,255,0.85);
}

.countdown-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-modal); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.countdown-card {
  font-size: 64px; font-weight: 900; color: #fff;
}
.countdown-card.countdown-pop {
  animation: countdownPop 0.7s ease-out;
}
@keyframes countdownPop {
  0%   { transform: scale(0.4); opacity: 0; }
  30%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Directional controls: keyboard-style cross, spanning the grid's width ─── */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, calc(54px * var(--control-scale)));
  gap: 8px;
  max-width: 420px;
  width: 100%;
  margin: 4px auto 0;
}
.d-btn {
  background-color: var(--bg-surface); color: var(--text-muted);
  border: 2px solid rgba(255,255,255,0.08); border-radius: var(--radius-sm);
  font-size: 1.3rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: manipulation;
  transition: background-color 0.1s ease, transform 0.05s ease;
}
body.light-theme .d-btn { border-color: rgba(0,0,0,0.06); }
.d-btn:active { background-color: var(--accent); color: #fff; transform: scale(0.96); }

.btn-up    { grid-column: 2; grid-row: 1; }
.btn-left  { grid-column: 1; grid-row: 2; }
.btn-down  { grid-column: 2; grid-row: 2; }
.btn-right { grid-column: 3; grid-row: 2; }

.d-btn.pulse-blue {
  animation: dpadPulseBlue 0.35s ease-out;
}
@keyframes dpadPulseBlue {
  0%   { background-color: var(--snake-blue); color: #fff; transform: scale(0.94); box-shadow: 0 0 0 0 rgba(56,189,248,0.6); }
  60%  { background-color: var(--snake-blue); color: #fff; }
  100% { background-color: var(--bg-surface); color: var(--text-muted); transform: scale(1); box-shadow: 0 0 0 8px rgba(56,189,248,0); }
}

/* ─── Score card (in results modal) ─── */
.scoreCardNarrow { max-width: 100%; }
.inside-modal    { background: transparent; border: none; box-shadow: none; padding: 0; }
.scoreGrid       { display: grid; gap: 8px; }
.scoreGridVertical { grid-template-columns: 1fr; }
.scoreItem {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-base); border-radius: var(--radius-sm); padding: 8px 12px;
}
.scoreK { font-size: 13px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.scoreV { font-size: 20px; font-weight: 900; }
.text-correct   { color: var(--info-teal); }
.text-incorrect { color: var(--danger); }
.text-accent    { color: var(--accent); }

.gameOverReason { text-align: center; font-size: 15px; color: var(--text-muted); margin-bottom: 14px; }

.scoreActions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.scoreActions input {
  background: var(--bg-base); border: 2px solid var(--bg-elevated); border-radius: var(--radius-sm);
  color: var(--text-input); padding: 10px 12px; font-size: 14px; width: 100%;
}

.newHighScoreBlock { margin-top: 16px; padding-top: 14px; border-top: 2px dashed rgba(255,255,255,0.1); }
body.light-theme .newHighScoreBlock { border-top-color: rgba(0,0,0,0.1); }
.newHighScoreBanner {
  text-align: center; font-size: 18px; font-weight: 900; color: var(--snake-gold); margin-bottom: 10px;
}
.newHighScoreSaved { text-align: center; font-weight: 800; color: var(--info-teal); margin-top: 8px; }
.nameFilterError { text-align: center; font-weight: 700; font-size: 13px; color: #f87171; margin-top: 8px; }

/* ─── Highscore list ─── */
.highscorePanelTitle {
  text-align: center; font-size: 16px; font-weight: 900;
  color: var(--text-main); margin: 0 0 10px;
}
.highscoreList {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 460px; /* ~10 rows before scrolling kicks in */
  overflow-y: auto;
}
.highscoreRow {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-base); border-radius: var(--radius-sm); padding: 8px 12px;
}
.highscoreRank { font-weight: 900; color: var(--ref-purple); width: 28px; flex-shrink: 0; }
.highscoreName { flex: 1; font-weight: 700; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.highscoreScore { font-weight: 900; color: var(--accent); }
.highscoreDate { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

@media (max-width: 480px) {
  .highscoreDate { display: none; }
}
