/* ============================================================
   rhythm-game.css — Bard's Challenge Rhythm Mini-Game
   Prefix: .rg-  |  Fonts: Cinzel, Crimson Text
   ============================================================ */

/* ─── SETUP SCREEN ─── */
.rg-setup {
  position: relative;
  max-width: 680px;
  width: 92%;
  margin: 0 auto;
  padding: 40px 48px;
  background: linear-gradient(180deg, rgba(26,20,8,0.95) 0%, rgba(13,10,4,0.98) 100%);
  border: 2px solid rgba(212,165,69,0.4);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 0 60px rgba(0,0,0,0.7), inset 0 1px 0 rgba(212,165,69,0.15);
  color: #e8d5a3;
  animation: rg-slide-in 0.4s ease-out;
}

.rg-setup-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d0a04 0%, #1a1408 50%, #0d0a04 100%);
  padding: 20px;
}

.rg-setup-title {
  font-family: 'Cinzel', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #d4a545;
  letter-spacing: 4px;
  margin-bottom: 32px;
  text-shadow: 0 0 20px rgba(212,165,69,0.3);
}

.rg-setup-section {
  margin-bottom: 20px;
}

.rg-setup-label {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: #b8a67a;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}

/* ─── SONG LIST ─── */
.rg-song-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  min-height: 120px;
}

.rg-song-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(26,20,8,0.8);
  border: 1px solid rgba(212,165,69,0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.rg-song-card:hover {
  border-color: rgba(212,165,69,0.35);
  background: rgba(212,165,69,0.05);
  transform: translateX(4px);
}
.rg-song-card.active {
  border-color: #d4a545;
  background: rgba(212,165,69,0.12);
  box-shadow: 0 0 16px rgba(212,165,69,0.2);
}

.rg-song-info {
  text-align: left;
}
.rg-song-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #e8d5a3;
}
.rg-song-meta {
  font-size: 0.8rem;
  color: #b8a67a;
  margin-top: 4px;
}
.rg-song-badge {
  font-size: 0.75rem;
  color: #d4a545;
  background: rgba(212,165,69,0.15);
  padding: 4px 12px;
  border-radius: 5px;
  letter-spacing: 1px;
  font-weight: 600;
  white-space: nowrap;
}
.rg-song-best {
  color: #d4a545;
  font-weight: 600;
  margin-left: 10px;
  font-size: 0.8rem;
}

/* ─── DIFFICULTY TABS ─── */
.rg-tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(212,165,69,0.25);
}
.rg-tab {
  flex: 1;
  padding: 12px 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8a7a5a;
  background: rgba(13,10,4,0.8);
  border: none;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.rg-tab:not(:last-child) {
  border-right: 1px solid rgba(212,165,69,0.15);
}
.rg-tab:hover {
  color: #d4a545;
  background: rgba(212,165,69,0.08);
}
.rg-tab.active {
  color: #1a1408;
  background: linear-gradient(135deg, #b8860b, #d4a545);
  box-shadow: 0 0 16px rgba(212,165,69,0.25);
}
.rg-tab .rg-tab-count {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 1px;
  margin-top: 2px;
  opacity: 0.7;
}
.rg-tab.active .rg-tab-count {
  opacity: 0.85;
}
/* Color accents for tabs */
.rg-tab[data-tab="easy"].active { background: linear-gradient(135deg, #388e3c, #4caf50); }
.rg-tab[data-tab="medium"].active { background: linear-gradient(135deg, #b8860b, #d4a545); }
.rg-tab[data-tab="hard"].active { background: linear-gradient(135deg, #c62828, #e74c3c); }

/* Tab content panels */
.rg-tab-panel {
  display: none;
}
.rg-tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rg-tab-fade 0.25s ease-out;
}
@keyframes rg-tab-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Legacy diff buttons (kept for future use) */
.rg-diff-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.rg-diff-btn {
  padding: 10px 20px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: #b8a67a;
  background: rgba(26,20,8,0.85);
  border: 1px solid rgba(212,165,69,0.25);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.rg-diff-btn:hover {
  border-color: rgba(212,165,69,0.5);
  color: #d4a545;
}
.rg-diff-btn.active {
  background: linear-gradient(135deg, #b8860b, #d4a545);
  color: #1a1408;
  border-color: #d4a545;
  box-shadow: 0 0 12px rgba(212,165,69,0.3);
}

/* ─── GENERIC BUTTONS ─── */
.rg-btn {
  display: inline-block;
  padding: 12px 36px;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1a1408;
  background: linear-gradient(135deg, #b8860b, #d4a545);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(212,165,69,0.3);
  margin-top: 20px;
}
.rg-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(212,165,69,0.45);
}

.rg-btn-back {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 28px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #b8a67a;
  background: rgba(26,20,8,0.85);
  border: 1px solid rgba(212,165,69,0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.rg-btn-back:hover {
  border-color: rgba(212,165,69,0.5);
  color: #d4a545;
}

.rg-loading {
  color: #b8a67a;
  font-size: 0.85rem;
  padding: 12px;
  font-style: italic;
}

/* ─── GAME CANVAS CONTAINER (FULLSCREEN) ─── */
.rg-game {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #0d0a04;
  overflow: hidden;
}

#rg-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ─── QUIT BUTTON (during gameplay) ─── */
.rg-quit-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #b8a67a;
  background: rgba(13,10,4,0.85);
  border: 1px solid rgba(212,165,69,0.25);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}
.rg-quit-btn:hover {
  color: #d4a545;
  border-color: rgba(212,165,69,0.5);
  background: rgba(26,20,8,0.95);
  transform: scale(1.1);
}

/* ─── RESULTS OVERLAY ─── */
.rg-results-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  animation: rg-fade-in 0.5s ease-out;
}

.rg-results-card {
  background: linear-gradient(180deg, rgba(26,20,8,0.97) 0%, rgba(13,10,4,0.99) 100%);
  border: 2px solid rgba(212,165,69,0.5);
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
  animation: rg-slide-in 0.4s ease-out;
  color: #e8d5a3;
}

.rg-results-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: #d4a545;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.rg-results-grade {
  font-family: 'Cinzel', serif;
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 4px;
}
.rg-grade-s { color: #ffd96a; text-shadow: 0 0 30px rgba(255,217,106,0.5), 0 0 60px rgba(255,217,106,0.3); animation: rg-glow 2s ease-in-out infinite; }
.rg-grade-a { color: #4CAF50; text-shadow: 0 0 20px rgba(76,175,80,0.4); }
.rg-grade-b { color: #2196F3; text-shadow: 0 0 20px rgba(33,150,243,0.4); }
.rg-grade-c { color: #e8d5a3; }
.rg-grade-d { color: #ff6b6b; text-shadow: 0 0 20px rgba(255,107,107,0.4); }

.rg-results-score {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: #d4a545;
  margin-bottom: 16px;
}

.rg-results-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.9rem;
  color: #b8a67a;
  margin-bottom: 20px;
}
.rg-results-stats div {
  padding: 6px;
  background: rgba(212,165,69,0.06);
  border-radius: 4px;
}

.rg-results-pct {
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  color: #b8a67a;
  margin-bottom: 16px;
}

.rg-new-best {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffd96a;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255,217,106,0.5), 0 0 40px rgba(255,217,106,0.3);
  animation: rg-glow 1.5s ease-in-out infinite;
}

.rg-prev-best {
  margin: 12px 0 16px;
  padding: 12px 16px;
  background: rgba(212,165,69,0.06);
  border: 1px solid rgba(212,165,69,0.15);
  border-radius: 8px;
}

.rg-prev-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: #b8a67a;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.rg-prev-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.rg-results-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── ANIMATIONS ─── */
@keyframes rg-slide-in {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes rg-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes rg-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(255,217,106,0.5), 0 0 40px rgba(255,217,106,0.2); }
  50%      { text-shadow: 0 0 40px rgba(255,217,106,0.7), 0 0 80px rgba(255,217,106,0.4); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .rg-setup {
    max-width: 95vw;
    padding: 32px 28px;
  }
  .rg-tab {
    font-size: 0.8rem;
    padding: 10px 6px;
    letter-spacing: 1px;
  }
}
@media (max-width: 480px) {
  .rg-setup {
    padding: 24px 16px;
    width: 96%;
  }
  .rg-setup-title {
    font-size: 1.5rem;
  }
  .rg-tab {
    font-size: 0.7rem;
    padding: 8px 4px;
    letter-spacing: 0.5px;
  }
  .rg-song-card {
    padding: 12px 14px;
  }
  .rg-song-title {
    font-size: 0.85rem;
  }
  .rg-results-card {
    padding: 24px 20px;
  }
  .rg-results-grade {
    font-size: 3rem;
  }
}
