:root {
  --bg-color: #0f1115;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent-color: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --white-key: #ffffff;
  --black-key: #18181b;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.08), transparent 25%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
}

.header {
  text-align: center;
}

.header h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 40px rgba(255,255,255,0.1);
}

.header .accent {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 400;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.25rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  width: min(100%, 1080px);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  color: var(--text-main);
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 14px 0 var(--accent-glow);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn.playing {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.5);
}

.primary-btn.playing:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.secondary-btn {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.select-css {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.select-css:hover {
  background: rgba(255, 255, 255, 0.1);
}
.select-css option {
  background: var(--bg-color);
  color: var(--text-main);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
}

.lesson-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(100%, 1080px);
}

.lesson-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.section-kicker {
  color: var(--accent-color);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.lesson-header h2 {
  font-size: 1.6rem;
  line-height: 1.1;
}

.lesson-description {
  color: var(--text-muted);
  line-height: 1.6;
}

.lesson-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.lesson-progress-text {
  font-weight: 600;
}

.song-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sequence-chip {
  min-width: 74px;
  padding: 0.9rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.sequence-chip:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.sequence-chip.is-current {
  border-color: var(--accent-color);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.24), rgba(99, 102, 241, 0.1));
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.22);
}

.sequence-chip.is-complete {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.08));
}

.sequence-chip.is-missed {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.12);
}

.sequence-key {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.sequence-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-main);
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.piano-wrapper {
  padding: 2.5rem;
  background: linear-gradient(180deg, #1e1e24 0%, #0a0a0c 100%);
  border-radius: 24px;
  box-shadow: 
    0 30px 60px -10px rgba(0,0,0,0.8),
    inset 0 2px 0 rgba(255,255,255,0.1),
    inset 0 -5px 15px rgba(0,0,0,0.5);
  border: 1px solid #333;
}

.piano {
  display: flex;
  list-style: none;
  position: relative;
  /* To give the keys a grounding base */
  border-top: 12px solid #000;
  border-radius: 4px;
}

.key {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  user-select: none;
  transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
  /* Hardware acceleration for smoother animations */
  transform: translateZ(0); 
}

.white {
  width: 70px;
  height: 320px;
  background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
  background-color: var(--white-key);
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 
    inset 0 1px 0px white,
    inset 0 -2px 5px rgba(0,0,0,0.2),
    0 2px 4px rgba(0,0,0,0.2);
  z-index: 1;
  padding-bottom: 1.5rem;
}

.white:active, .white.active {
  transform: translateY(4px) rotateX(2deg);
  background: linear-gradient(180deg, #fff 0%, #e2e8f0 100%);
  box-shadow: 
    inset 0 1px 0px white,
    inset 0 -1px 2px rgba(0,0,0,0.1),
    0 1px 2px rgba(0,0,0,0.1);
  border-bottom: 2px solid var(--accent-color);
}
.white.active {
  box-shadow: 
    inset 0 0 20px rgba(99, 102, 241, 0.2),
    0 4px 15px var(--accent-glow);
}

.black {
  width: 44px;
  height: 190px;
  background: linear-gradient(180deg, #333 0%, #000 100%);
  background-color: var(--black-key);
  margin-left: -22px;
  margin-right: -22px;
  z-index: 2;
  border-radius: 0 0 6px 6px;
  box-shadow: 
    inset 0 2px 2px rgba(255,255,255,0.2),
    inset 0 -1px 2px rgba(0,0,0,0.8),
    2px 2px 6px rgba(0,0,0,0.5);
  padding-bottom: 1.5rem;
}

.black:active, .black.active {
  transform: translateY(2px) rotateX(2deg);
  background: linear-gradient(180deg, #222 0%, #000 100%);
  box-shadow: 
    inset 0 1px 1px rgba(255,255,255,0.1),
    inset 0 -1px 1px rgba(0,0,0,0.8),
    1px 1px 3px rgba(0,0,0,0.5);
}
.black.active {
  box-shadow: 
    inset 0 -10px 15px rgba(99, 102, 241, 0.4),
    0 4px 15px var(--accent-glow);
}

.key-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.keyboard-hint {
  font-size: 0.75rem;
  font-weight: 800;
  color: #cbd5e1;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.white.active .keyboard-hint {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.black .keyboard-hint {
  color: #333;
  background: #222;
  border: 1px solid #444;
  color: #94a3b8;
}

.black.active .keyboard-hint {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

@media (max-width: 800px) {
  .app-container {
    padding: 1rem;
    gap: 1.5rem;
  }

  .glass-panel {
    padding: 1.1rem 1rem;
  }

  .controls,
  .lesson-panel {
    width: 100%;
  }

  .lesson-header h2 {
    font-size: 1.35rem;
  }

  .song-sequence {
    gap: 0.55rem;
  }

  .sequence-chip {
    min-width: 62px;
    padding: 0.8rem 0.65rem;
  }
  
  .white {
    width: 50px;
    height: 250px;
  }
  
  .black {
    width: 30px;
    height: 150px;
    margin-left: -15px;
    margin-right: -15px;
  }
}
