/* GetOnKey App Styles - matches landing page design tokens */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0f;
  --ink-light: #12121a;
  --ink-lighter: #1a1a28;
  --cream: #fafaf7;
  --cream-dim: rgba(250, 250, 247, 0.7);
  --gold: #e8b931;
  --gold-dim: #c49a1d;
  --gold-glow: rgba(232, 185, 49, 0.3);
  --coral: #ff6b5a;
  --coral-glow: rgba(255, 107, 90, 0.3);
  --teal: #2dd4a8;
  --teal-glow: rgba(45, 212, 168, 0.3);
  --purple: #8b5cf6;
  --slate: #64748b;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.08);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--ink);
  color: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 100;
}

/* ===== APP SHELL ===== */
#app {
  position: relative;
  z-index: 1;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ===== HEADER / NAV ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 15, 0.85);
}

.app-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
  cursor: pointer;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mic-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--slate);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}

.mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  transition: background 0.3s;
}

.mic-dot.active {
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
  animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== SONG LIBRARY ===== */
.library-screen {
  padding-bottom: 4rem;
}

.library-hero {
  text-align: center;
  padding: 4rem 2rem 3rem;
  position: relative;
}

.library-hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 185, 49, 0.08) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.library-hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.library-hero h1 .accent { color: var(--gold); }

.library-hero p {
  color: var(--slate);
  font-size: 1.1rem;
  margin-top: 0.75rem;
  position: relative;
  z-index: 1;
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.song-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 1.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.song-card:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
}

.song-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s;
}

.song-card:hover::after {
  opacity: 1;
}

.song-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.song-icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--glass);
}

.song-difficulty {
  display: flex;
  gap: 3px;
}

.diff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}

.diff-dot.filled {
  border: none;
}

.song-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.song-card .song-artist {
  color: var(--slate);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.song-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--slate);
}

.song-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* First card rounded corners */
.song-card:first-child { border-radius: 16px 0 0 0; }
.song-card:nth-child(2) { border-radius: 0 16px 0 0; }

/* ===== MIC PERMISSION MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--ink-light);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 3rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.modal-card h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.modal-card p {
  color: var(--slate);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ===== BUTTONS ===== */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}

.btn-gold:hover {
  background: var(--gold-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--gold-glow);
}

.btn-glass {
  background: var(--glass);
  color: var(--cream);
  border: 1px solid var(--glass-border);
}

.btn-glass:hover {
  background: var(--glass-hover);
}

.btn-teal {
  background: var(--teal);
  color: var(--ink);
}

.btn-teal:hover {
  background: #25b892;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--teal-glow);
}

.btn-coral {
  background: transparent;
  color: var(--coral);
  border: 1px solid rgba(255, 107, 90, 0.3);
}

.btn-coral:hover {
  background: rgba(255, 107, 90, 0.1);
}

/* ===== PLAYER SCREEN ===== */
.player-screen {
  height: 100vh;
  overflow: hidden;
}

.player-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(10px);
}

.player-song-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-song-info h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.player-song-info .song-key {
  font-size: 0.8rem;
  color: var(--slate);
  background: var(--glass);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.score-live {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 80px;
  text-align: right;
}

.combo-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: var(--teal);
  min-width: 60px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s;
}

.combo-display.active {
  opacity: 1;
}

/* ===== PITCH CANVAS ===== */
.pitch-canvas-container {
  flex: 1;
  position: relative;
  background: var(--ink);
  overflow: hidden;
}

#pitchCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Note labels on left side */
.note-labels {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 2rem 0;
  z-index: 10;
  background: linear-gradient(90deg, rgba(10,10,15,0.9) 0%, transparent 100%);
}

.note-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  color: var(--slate);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ===== LYRICS BAR ===== */
.lyrics-bar {
  padding: 1.5rem 2rem;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lyrics-current {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.lyrics-current .sung {
  color: var(--gold);
  transition: color 0.15s;
}

.lyrics-current .upcoming {
  color: var(--slate);
}

.lyrics-current .active-word {
  color: var(--cream);
  text-shadow: 0 0 20px rgba(232, 185, 49, 0.3);
}

/* Rating popup */
.rating-popup {
  position: absolute;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  animation: ratingFloat 0.8s ease-out forwards;
  z-index: 20;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

@keyframes ratingFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-30px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ===== COUNTDOWN ===== */
.countdown-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(4px);
  z-index: 30;
}

.countdown-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 8rem;
  font-weight: 700;
  color: var(--gold);
  animation: countPulse 1s ease-out;
  text-shadow: 0 0 40px var(--gold-glow);
}

@keyframes countPulse {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== RESULTS SCREEN ===== */
.results-screen {
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.results-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

.results-content {
  position: relative;
  z-index: 1;
  max-width: 500px;
  width: 100%;
}

.results-song-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  color: var(--slate);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.grade-display {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  border: 3px solid;
  position: relative;
}

.grade-letter {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 4.5rem;
  font-weight: 700;
}

.results-percentage {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.results-label {
  color: var(--slate);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.stat-box {
  padding: 1.25rem 0.75rem;
  text-align: center;
  background: var(--ink-light);
}

.stat-box .stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
}

.stat-box .stat-lbl {
  font-size: 0.7rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
  display: block;
}

.results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

/* ===== VOLUME SLIDER ===== */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--slate);
}

.volume-control input[type="range"] {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  background: var(--glass);
  border-radius: 2px;
  outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .song-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  .song-card:first-child { border-radius: 16px 16px 0 0; }
  .song-card:nth-child(2) { border-radius: 0; }
  .song-card:last-child { border-radius: 0 0 16px 16px; }

  .player-top-bar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .lyrics-current {
    font-size: 1.2rem;
  }

  .results-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-actions {
    flex-direction: column;
  }

  .note-labels {
    display: none;
  }
}

/* ===== LOADING STATE ===== */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--glass);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== TRANSITIONS ===== */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

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