:root {
  --ink: #1e293b;
  --bg: #faf7f2;
  --surface: #ffffff;
  --line: #e7dfd2;
  --bodhran-wood: #78350f;
  --bodhran-skin: #fef3c7;
  --music-purple: #9333ea;
  --music-amber: #d97706;
  --music-teal: #0d9488;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Lexend", system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(120, 53, 15, 0.08);
  --shadow-hover: 0 16px 36px rgba(120, 53, 15, 0.16);
  --radius-lg: 20px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #2b1406;
  color: #fff;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 3px solid #f59e0b;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: #fff;
}

.brand-icon {
  font-size: 2.2rem;
  background: rgba(245, 158, 11, 0.2);
  padding: 0.4rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: -0.01em;
}

.brand p {
  font-size: 0.8rem;
  color: #fed7aa;
}

.controls-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tab-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.25rem;
  border-radius: 999px;
  gap: 0.3rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #fed7aa;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  background: #f59e0b;
  color: #2b1406;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.25);
}

.game-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.2rem;
  width: 100%;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

.section-intro {
  margin-bottom: 1.5rem;
}

.section-intro h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--bodhran-wood);
}

.section-desc {
  color: #64748b;
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

/* ================== TAB 1: BODHRÁN SEQUENCER ================== */
.sequencer-header {
  margin-bottom: 1.2rem;
}

.seq-controls-bar {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.6rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.bpm-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
}

.bpm-control input[type="range"] {
  accent-color: var(--music-amber);
  cursor: pointer;
}

.preset-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
}

.preset-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: #fef3c7;
  border-color: #d97706;
}

.sequencer-stage {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
}

.sequencer-grid {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow-x: auto;
}

.seq-track {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.track-label {
  width: 140px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--bodhran-wood);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.step-buttons {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.step-btn {
  width: 38px;
  height: 48px;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.step-btn:hover {
  background: #fefce8;
  border-color: #f59e0b;
}

.step-btn.active {
  background: #f59e0b;
  border-color: #b45309;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.step-btn.current {
  outline: 3px solid #9333ea;
  filter: brightness(1.15);
}

.step-btn:nth-child(4n+1) {
  border-left: 3px solid #94a3b8;
}

.bodhran-visualizer {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
}

.bodhran-drum {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: #b45309;
  padding: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.1s;
}

.bodhran-drum.hit {
  transform: scale(1.08);
}

.drum-skin {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fef9c3;
  border: 3px dashed #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tipper-stick {
  font-size: 2.8rem;
  transition: transform 0.1s;
}

.tipper-stick.strike {
  transform: rotate(-35deg);
}

.drum-legend {
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
}

/* ================== TAB 2: JIG VS REEL ================== */
.metres-stage {
  max-width: 760px;
  margin: 0 auto;
}

.metres-hud {
  display: flex;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.metres-card {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.pulse-visualizer {
  display: flex;
  gap: 1rem;
}

.pulse-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.15s;
}

.pulse-dot.pulse {
  background: #f59e0b;
  transform: scale(1.4);
  box-shadow: 0 0 12px #f59e0b;
}

.mnemonic-hint {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  font-size: 0.92rem;
  color: #854d0e;
}

.metre-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}

.metre-choice-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.2rem 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.metre-choice-btn:hover {
  background: #fefce8;
  border-color: #d97706;
  transform: translateY(-3px);
}

.metre-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--bodhran-wood);
}

.metre-choice-btn small {
  font-size: 0.75rem;
  color: #64748b;
}

.metre-choice-btn.correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
}

.metre-choice-btn.wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
}

.metres-feedback {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.95rem;
  color: #166534;
}

.metres-footer {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

/* ================== TAB 3: BEAT TAPPER ================== */
.tapper-stage {
  max-width: 500px;
  margin: 0 auto;
}

.tapper-hud {
  display: flex;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.tapper-card {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.metronome-pendulum-wrap {
  width: 120px;
  height: 100px;
  display: flex;
  justify-content: center;
  position: relative;
}

.metronome-pendulum {
  width: 6px;
  height: 90px;
  background: #78350f;
  border-radius: 3px;
  transform-origin: bottom center;
  transform: rotate(0deg);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tap-target-btn {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 6px solid #b45309;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(217, 119, 6, 0.35);
  transition: transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.tap-target-btn:active {
  transform: scale(0.92);
}

.tap-rating-label {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--bodhran-wood);
}

/* ================== TAB 4: QUIZ ================== */
.quiz-stage {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-hud {
  display: flex;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.quiz-card {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.quiz-badge {
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  text-transform: uppercase;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--bodhran-wood);
  line-height: 1.3;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quiz-opt-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.quiz-opt-btn:hover {
  background: #fefce8;
  border-color: #f59e0b;
  transform: translateY(-2px);
}

.quiz-opt-btn.correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #14532d !important;
}

.quiz-opt-btn.wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #7f1d1d !important;
}

.quiz-feedback {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.4;
}

.quiz-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-action {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 800;
  background: var(--bodhran-wood);
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: #5c2406;
  transform: translateY(-2px);
}

.btn-large {
  font-size: 1rem;
  padding: 0.75rem 1.8rem;
}

.btn-secondary {
  background: #ffffff;
  color: var(--bodhran-wood);
  border: 1.5px solid var(--line);
}

.btn-secondary:hover {
  background: #fefce8;
}

@media (max-width: 900px) {
  .sequencer-stage, .metre-choices, .quiz-options {
    grid-template-columns: 1fr;
  }
}
