/* =========================================
   LOCAL GAME STYLES: Relative Pitch - Diatonic Chords (C, Dm, Em)
   ========================================= */

:root {
  --game-purple: #a78bfa;
  --game-purple-shadow: #7c3aed;
  --game-pink: #f472b6;
  --game-pink-shadow: #db2777;
}

/* --- Layout Panels --- */
.statusPanel {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.controlsPanel, .answerPanel, .analysisCard {
  background: var(--bg-surface);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 10px;
  padding-bottom: 14px;
  box-shadow: var(--shadow-soft);
}

body.light-theme .controlsPanel,
body.light-theme .answerPanel,
body.light-theme .analysisCard {
  border-color: rgba(0, 0, 0, 0.05);
}

/* --- Game Titles --- */
.gameMainTitle {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  margin: 0;
  padding: 0 12px;
}

.modalGameTitle {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 20px;
}

.modalGameSubtitle {
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* --- Answer Panel override --- */
.answerPanel { padding: 16px; background: transparent; border: none; box-shadow: none; margin-top: 0; }

/* --- Status Area --- */
.statusRow { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.statusText { text-align: center; width: 100%; background: var(--bg-base); padding: 16px; border-radius: var(--radius-sm); border: 2px solid rgba(255,255,255,0.05); }
.phaseTitle { font-size: 22px; font-weight: 900; color: var(--text-main); margin-bottom: 6px; }
.feedbackLine { font-size: 16px; color: var(--text-muted); min-height: 24px; font-weight: 500; }
.feedbackLine strong { color: #fff; font-weight: 800; background: var(--accent); padding: 2px 6px; border-radius: 6px; }
body.light-theme .statusText { border-color: rgba(0,0,0,0.05); }

/* --- Game Controls Grid --- */
.actionsGrid {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  width: 100%;
}

.actionsGrid .icon-btn {
  flex: 0 0 52px;
  height: 52px;
  padding: 0;
  font-size: 22px;
}

.actionsGrid .flex-text-btn {
  flex: 1 1 0;
  padding: 0 4px;
  font-size: 14px;
  white-space: nowrap;
}

.mainActionRow { display: flex; gap: 6px; }

/* --- Local Game Buttons --- */
.btn-purple {
  background: var(--game-purple);
  color: #fff;
  border: 2px solid var(--game-purple-shadow);
  box-shadow: 0 4px 0 var(--game-purple-shadow);
}
.btn-pink {
  background: var(--game-pink);
  color: #fff;
  border: 2px solid var(--game-pink-shadow);
  box-shadow: 0 4px 0 var(--game-pink-shadow);
}

#replayBtn.pulse { --ringColor: rgba(244, 114, 182, 0.4); }

.default-btn {
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: 0 4px 0 #1e293b;
}
.default-btn:active:not(:disabled) { box-shadow: 0 0px 0 #1e293b; }

.secondary-btn {
  background: var(--bg-base);
  color: var(--text-main);
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 4px 0 var(--bg-elevated);
  font-size: 14px;
}
.secondary-btn:not(:disabled) { background: var(--bg-elevated); color: #fff; box-shadow: 0 4px 0 var(--bg-elevated); }
.secondary-btn:active:not(:disabled) { box-shadow: 0 0px 0 var(--bg-elevated); transform: translateY(4px); }

.next-btn {
  background: var(--bg-base);
  color: var(--text-main);
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 4px 0 var(--bg-elevated);
  flex: 1;
}
.next-btn:disabled {
  opacity: 0.5;
  background: var(--bg-surface);
  color: var(--text-muted);
  border-color: var(--bg-elevated);
  box-shadow: 0 4px 0 var(--bg-elevated);
  cursor: not-allowed;
}

.nextReady {
  background: var(--next-orange) !important;
  color: #fff !important;
  border-color: var(--next-shadow) !important;
  box-shadow: 0 4px 0 var(--next-shadow) !important;
  --ringColor: rgba(255, 127, 42, 0.4);
  animation: ringPulse 1.5s ease-in-out infinite;
}
.nextReady:active:not(:disabled) { box-shadow: 0 0px 0 var(--next-shadow) !important; transform: translateY(4px); }

/* --- Local Inputs --- */
input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%;
  height: 50px;
  background: var(--bg-base);
  border: 2px solid var(--bg-elevated);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 700;
  outline: none;
  -webkit-appearance: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus { border-color: var(--accent); }

.inlineControl { display: flex; flex-direction: column; gap: 6px; width: 100%; }

/* --- Chord Reference Cards (intro modal) --- */
.chordRefGrid {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 14px 0 12px;
}

.chordRefCard {
  flex: 1;
  background: var(--bg-base);
  border: 2px solid var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.35s ease, background 0.35s ease;
}

.chordRefCard.is-cycling {
  border-color: var(--info-teal);
  background: rgba(16, 185, 129, 0.08);
}

.chordRefRoman {
  font-size: 12px;
  font-weight: 900;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  font-family: Georgia, 'Times New Roman', serif;
  transition: color 0.35s ease;
}

.chordRefCard.is-cycling .chordRefRoman { color: var(--info-teal); }
.chordRefCard.is-cycling .chordRefName  { color: var(--info-teal); }

.chordRefName {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
  transition: color 0.35s ease;
}

.chordRefNotes {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.chordRefQuality {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.65;
}

/* --- Intro cycle keyboard & label --- */
.intro-cycle-keyboard {
  margin-top: 0;
}

.intro-cycle-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 1px;
  font-family: Georgia, 'Times New Roman', serif;
  transition: opacity 0.3s ease;
  min-height: 1.4em;
}

/* --- Chord Display Keyboard (post-answer reveal) --- */
.chord-display-area {
  margin-top: 14px;
  width: 100%;
  animation: cdeFadeIn 0.25s ease-out;
}

@keyframes cdeFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chord-display-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.selectorKeyboard {
  width: 100%;
  background: var(--bg-base);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 2px solid var(--bg-elevated);
}

/* Pulse animation for active keys in intro selector mode */
@keyframes pulseActiveWhite {
  0%   { fill: #ffffff; }
  50%  { fill: #dcfce7; }
  100% { fill: #ffffff; }
}
@keyframes pulseActiveBlack {
  0%   { fill: #0f172a; }
  50%  { fill: #14532d; }
  100% { fill: #0f172a; }
}

/* --- Answers Grid (3 buttons) --- */
.answerGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.noteBtn {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 2px solid var(--bg-elevated);
  border-radius: var(--radius-sm);
  height: 88px;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 6px 0 var(--bg-elevated);
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.chord-name {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.chord-roman {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-family: Georgia, 'Times New Roman', serif;
}

.noteBtn.correct  .chord-roman,
.noteBtn.incorrect .chord-roman { color: rgba(255, 255, 255, 0.75); }
.noteBtn:active:not(:disabled) {
  transform: translateY(6px);
  box-shadow: 0 0px 0 var(--bg-elevated);
}
.noteBtn.chosen {
  border-color: var(--accent-shadow);
  background: var(--bg-elevated);
  box-shadow: 0 6px 0 var(--accent-shadow);
}
.noteBtn.correct  { background: var(--info-teal); border-color: var(--info-shadow); color: #fff; box-shadow: 0 6px 0 var(--info-shadow); }
.noteBtn.incorrect { background: var(--danger); border-color: var(--danger-shadow); color: #fff; box-shadow: 0 6px 0 var(--danger-shadow); }
.noteBtn:disabled { opacity: 1; cursor: default; }

/* --- Score & Analysis --- */
.analysis { padding: 0; background: transparent; border: none; box-shadow: none; }
.scoreCardNarrow { max-width: 100%; }
.inside-modal { background: transparent; border: none; box-shadow: none; padding: 0; }
.analysisLabel { font-size: 18px; font-weight: 900; color: var(--text-main); margin-top: 12px; margin-bottom: 4px; text-align: center; }
.scoreMeta { text-align: center; font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }
.scoreActions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.scoreGrid { display: grid; gap: 8px; }
.scoreItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-elevated);
}
.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); }

.perNoteGrid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.perNoteItem {
  background: var(--bg-base);
  border: 2px solid var(--bg-elevated);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
}
