/* =========================================================================
   GEMA — Duolingo Music × BandLab Gamified UI in Dark Wood & Specular Bronze
   ========================================================================= */

:root {
  --ground:  #0D0D0A;
  --ground2: #271E11;
  --ground3: #3B3123;
  --line:    #3A3227;
  --line2:   #4C4236;
  --ivory:   #F2E9DC;
  --muted:   #9E9382;
  --dim:     #6E6354;
  --b1:      #C89353;
  --b2:      #A47A41;
  --b3:      #7A5C33;
  --b4:      #503D22;
  --jade:    #5FA98A;
  --stop:    #C4553F;

  --bronze-hi:  #E8C989;
  --bronze-mid: #C89353;
  --bronze-low: #7A5C33;
  --surface-hi: #2E2417;
  --surface-lo: #211710;

  --radius-card: 22px;
}

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

html, body {
  min-height: 100vh;
  background-color: var(--ground);
  background-image:
    radial-gradient(1000px 650px at 50% -10%, var(--ground2) 0%, var(--ground) 65%);
  color: var(--ivory);
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  user-select: none;
}

.hidden { display: none !important; }

/* Atmosphere */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 18%, transparent 58%, rgba(0, 0, 0, 0.55) 100%);
}

.glow-top {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 220px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(200, 147, 83, 0.22) 0%, rgba(200, 147, 83, 0) 70%);
  filter: blur(28px);
  z-index: 0;
}

.mono, .mono-val {
  font-family: "DM Mono", ui-monospace, Menlo, monospace;
}

.bronze-text {
  background: linear-gradient(180deg, #F0D59A 0%, var(--bronze-mid) 55%, var(--b2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.jade-text { color: var(--jade); }

/* Surfaces */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(200, 147, 83, 0.07) 0%, rgba(200, 147, 83, 0) 32%),
    linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 32px -14px rgba(0, 0, 0, 0.8);
}

.well {
  background: linear-gradient(180deg, #14100b, #0c0a07);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.65);
}

.bronze-edge {
  border-color: var(--b1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(200, 147, 83, 0.4),
    0 18px 48px -10px rgba(200, 147, 83, 0.35);
}

/* =========================================================================
   1. CLEAN TOP HEADER (Logo only + Tactile Mode Pills + MIDI Button)
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 12, 9, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

/* Duolingo / BandLab Segmented Nav Pills */
.nav-pills {
  display: flex;
  gap: 6px;
  background: #14100b;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease;
}

.nav-pill:hover { color: var(--ivory); }

.nav-pill.active {
  background: linear-gradient(180deg, var(--bronze-hi) 0%, var(--bronze-mid) 55%, var(--bronze-low) 100%);
  color: #1A1208;
  box-shadow: 0 2px 0 #4a351b, 0 4px 12px rgba(200, 147, 83, 0.3);
}

/* Compact MIDI Button */
.midi-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #1A140E;
  border: 1px solid var(--line2);
  border-bottom: 3px solid #0B0805;
  color: var(--ivory);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s;
}

.midi-btn:hover { border-color: var(--b1); }
.midi-btn:active { transform: translateY(2px); border-bottom-width: 1px; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
}

.dot.ok {
  background: var(--jade);
  box-shadow: 0 0 10px var(--jade);
}

.dot.bad {
  background: var(--stop);
  box-shadow: 0 0 8px var(--stop);
}

/* =========================================================================
   2. CENTERED STAGE SHELL & FLOATING PILL DECKS
   ========================================================================= */
.app-shell {
  position: relative;
  z-index: 5;
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 18px 28px;
}

.stage-view, .sound-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Floating Pill Control Deck */
.control-deck {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-radius: 18px;
}

.pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-spacer { flex: 1; }

/* Tactile 3D Song & Mode Pills */
.song-pill {
  padding: 8px 15px;
  border-radius: 14px;
  background: #17120C;
  border: 1px solid var(--line2);
  border-bottom: 3px solid #0B0906;
  color: var(--muted);
  font-family: "Fraunces", serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
}

.song-pill:hover {
  color: var(--ivory);
  border-color: var(--b2);
}

.song-pill.active {
  background: linear-gradient(180deg, #3A2C1B, #251B10);
  color: var(--bronze-hi);
  border-color: var(--b1);
  border-bottom: 3px solid var(--b3);
  box-shadow: 0 4px 14px -4px rgba(200, 147, 83, 0.35);
}

.song-pill:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

/* Quick Action Chips (Speed, Wait, Guide, Upload) */
.chip-btn {
  padding: 6px 11px;
  border-radius: 11px;
  background: #14100B;
  border: 1px solid var(--line);
  border-bottom: 2px solid #090705;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
}

.chip-btn:hover {
  color: var(--ivory);
  border-color: var(--line2);
}

.chip-btn.active {
  background: rgba(200, 147, 83, 0.18);
  color: var(--bronze-hi);
  border-color: var(--b1);
}

.upload-chip {
  color: var(--bronze-hi);
  border-style: dashed;
}

/* =========================================================================
   3. DUOLINGO-STYLE PROGRESS & STREAK HUD
   ========================================================================= */
.game-hud {
  padding: 10px 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Tactile 3D Round Play FAB */
.play-fab {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(180deg, var(--bronze-hi) 0%, var(--bronze-mid) 52%, var(--bronze-low) 100%);
  border: 1px solid #F3DCAA;
  border-bottom: 4px solid #4A351B;
  color: #1A1208;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(200, 147, 83, 0.35);
  transition: transform 0.08s ease, filter 0.12s;
}

.play-fab:hover { filter: brightness(1.08); }
.play-fab:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.play-fab.playing {
  background: linear-gradient(180deg, #6CC09D 0%, var(--jade) 60%, #3A7A60 100%);
  border-color: #B8F2DA;
  border-bottom-color: #214A39;
  color: #092218;
  box-shadow: 0 6px 16px rgba(95, 169, 138, 0.35);
}

/* Chunky Duolingo Progress Bar with Top Specular Shine */
.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 16px;
  background: #120E0A;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  padding: 2px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--b2), var(--bronze-mid) 50%, var(--bronze-hi));
  transition: width 0.14s ease-out;
}

.progress-shine {
  position: absolute;
  top: 2px;
  left: 6px;
  right: 6px;
  height: 3.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
}

.progress-caption {
  font-size: 12px;
  color: var(--muted);
  min-width: 68px;
  text-align: right;
}

/* Gamified Streak & Score Badges */
.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 14px;
  background: #14100B;
  border: 1px solid var(--line);
}

.streak-badge.on-fire {
  border-color: var(--jade);
  background: rgba(95, 169, 138, 0.12);
  box-shadow: 0 0 18px rgba(95, 169, 138, 0.25);
  animation: pulseBadge 0.55s ease-in-out infinite alternate;
}

@keyframes pulseBadge {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}

.flame-icon, .star-icon {
  font-size: 16px;
  line-height: 1;
}

.stat-num {
  font-size: 17px;
  font-weight: 700;
}

.mult-pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(95, 169, 138, 0.2);
  color: var(--jade);
  font-weight: 600;
}

/* =========================================================================
   4. UNIFIED INSTRUMENT STAGE (Falling Note Highway + Authentic SVG Saron)
   ========================================================================= */
.instrument-stage {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: 26px;
  background:
    radial-gradient(110% 60% at 50% 0%, rgba(200, 147, 83, 0.09) 0%, transparent 55%),
    linear-gradient(180deg, #1A140E 0%, #100C08 65%, #0C0906 100%);
}

.instrument-stage.fever-glow {
  border-color: var(--b1);
  box-shadow:
    0 0 0 1px rgba(200, 147, 83, 0.35),
    0 18px 50px -12px rgba(200, 147, 83, 0.32);
}

/* Top Highway (Aligned 1:1 with SVG Saron below) */
.highway {
  position: relative;
  width: 100%;
  height: 290px;
  overflow: hidden;
}

.lane-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent 0%, rgba(200, 147, 83, 0.14) 30%, rgba(200, 147, 83, 0.25) 86%, transparent 100%);
  pointer-events: none;
}

.beat-lines-layer,
.notes-layer,
.popups-layer,
.fx-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fx-canvas {
  width: 100%;
  height: 100%;
  z-index: 12;
}

.popups-layer { z-index: 15; }
.notes-layer { z-index: 10; }

.beat-line {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 1px;
  background: rgba(200, 147, 83, 0.1);
}

.beat-line.bar-divider {
  height: 1.5px;
  background: rgba(200, 147, 83, 0.24);
}

/* Playhead & Target Slots at 86% height */
.playhead {
  position: absolute;
  top: 86%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--b1) 15%, var(--bronze-hi) 50%, var(--b1) 85%, transparent);
  box-shadow: 0 0 14px rgba(232, 201, 137, 0.5);
  z-index: 8;
  pointer-events: none;
}

/* Note: playhead spans 10%..90%, while hit-slots use highway-wide left% via highway parent */
.playhead {
  left: 0;
  right: 0;
}

.hit-slot {
  position: absolute;
  top: 50%;
  width: 58px;
  height: 26px;
  border-radius: 10px;
  transform: translate(-50%, -50%);
  background: rgba(18, 14, 10, 0.85);
  border: 2px solid rgba(200, 147, 83, 0.45);
  transition: transform 0.08s ease, border-color 0.08s ease, box-shadow 0.08s ease;
}

.hit-slot.slot-perfect {
  border-color: var(--jade);
  background: rgba(95, 169, 138, 0.28);
  transform: translate(-50%, -50%) scale(1.22);
  box-shadow: 0 0 22px var(--jade);
}

.hit-slot.slot-good {
  border-color: var(--bronze-hi);
  background: rgba(232, 201, 137, 0.25);
  transform: translate(-50%, -50%) scale(1.16);
  box-shadow: 0 0 18px var(--bronze-hi);
}

.hit-slot.slot-miss {
  border-color: var(--stop);
  background: rgba(196, 85, 63, 0.25);
  box-shadow: 0 0 14px var(--stop);
}

/* 3D Tactile Falling Note Tile (Duolingo Music Pill Style) */
.note-tile {
  position: absolute;
  width: 56px;
  height: 36px;
  border-radius: 12px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, var(--bronze-hi) 0%, var(--bronze-mid) 65%, var(--b2) 100%);
  border: 1.5px solid #FFF2D0;
  border-bottom: 4px solid #4A351B;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 5px 14px rgba(0, 0, 0, 0.6),
    0 0 14px rgba(200, 147, 83, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-size: 18px;
  font-weight: 700;
  color: #1A1208;
  will-change: top;
}

.note-tile.hit-perfect {
  background: var(--jade);
  border-color: #D2FCEB;
  color: #072217;
  transform: translate(-50%, -50%) scale(1.32);
  opacity: 0;
  transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.note-tile.hit-good {
  background: var(--bronze-hi);
  transform: translate(-50%, -50%) scale(1.24);
  opacity: 0;
  transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.note-tile.hit-miss {
  background: #5E2B22;
  border-color: var(--stop);
  color: var(--ivory);
  opacity: 0.32;
}

/* Floating Gamified Hit Callout Popup ("PERFECT! +100") */
.hit-popup {
  position: absolute;
  top: 76%;
  transform: translate(-50%, -50%);
  font-family: "Fraunces", serif;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  animation: floatUpPop 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hit-popup.perfect {
  background: rgba(95, 169, 138, 0.22);
  border: 1.5px solid var(--jade);
  color: #B4F7DA;
  box-shadow: 0 4px 16px rgba(95, 169, 138, 0.4);
}

.hit-popup.good {
  background: rgba(200, 147, 83, 0.22);
  border: 1.5px solid var(--bronze-hi);
  color: var(--bronze-hi);
}

.hit-popup.miss {
  background: rgba(196, 85, 63, 0.22);
  border: 1.5px solid var(--stop);
  color: #F7ADA0;
}

@keyframes floatUpPop {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  22%  { opacity: 1; transform: translate(-50%, -14px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(0.95); }
}

/* =========================================================================
   5. AUTHENTIC ILLUSTRATED SVG SARON & INTERACTIVE BAR STATES
   ========================================================================= */
.saron-svg-wrap {
  width: 100%;
  padding: 0 0 10px;
}

.saron-svg {
  width: 100%;
  height: auto;
  display: block;
}

.svg-bar {
  cursor: pointer;
  transform-origin: center center;
  transform-box: fill-box;
  transition: transform 0.07s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.1s ease;
}

.svg-bar:hover {
  filter: brightness(1.08);
}

/* Pre-glow when a note is approaching within 550ms */
.svg-bar.target-next .bar-glow-ring {
  stroke: var(--bronze-hi);
  fill: rgba(232, 201, 137, 0.14);
}

/* Physical Strike Flash & Spring Recoil */
.svg-bar.struck {
  transform: scale(0.965) translateY(3px);
  filter: drop-shadow(0 0 18px rgba(232, 201, 137, 0.85));
}

.svg-bar.struck .bar-face {
  fill: url(#grad-bonang-lit);
}

.svg-bar.struck-perfect {
  transform: scale(0.96) translateY(3px);
  filter: drop-shadow(0 0 22px rgba(95, 169, 138, 0.95));
}

.svg-bar.struck-perfect .bar-face {
  fill: url(#grad-bonang-jade);
}

. svg-bar.struck-perfect .bar-glow-ring {
  stroke: var(--jade);
}

.bar-cipher-txt {
  font-family: "Fraunces", serif;
  font-size: 32px;
  font-weight: 700;
  fill: #1A1208;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.9;
}

.bar-sub-txt {
  font-family: "DM Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  fill: #F2E9DC;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.72;
}

/* =========================================================================
   6. DUOLINGO-STYLE 3-STAR VICTORY OVERLAY
   ========================================================================= */
.victory-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(10, 8, 6, 0.86);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.victory-card {
  width: 360px;
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: popModal 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popModal {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.stars-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 42px;
}

.v-star {
  filter: grayscale(1) opacity(0.3);
  transform: scale(0.85);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.v-star.earned {
  filter: drop-shadow(0 0 16px rgba(232, 201, 137, 0.85));
  transform: scale(1.12);
}

.victory-title {
  font-family: "Fraunces", serif;
  font-size: 26px;
  color: var(--ivory);
}

.victory-score {
  font-size: 32px;
  font-weight: 700;
}

.victory-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.v-pill {
  background: #14100B;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v-pill span {
  font-size: 11px;
  color: var(--muted);
}

.v-pill strong {
  font-size: 15px;
}

.btn-3d {
  padding: 13px 20px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s;
}

.btn-bronze-3d {
  background: linear-gradient(180deg, var(--bronze-hi) 0%, var(--bronze-mid) 55%, var(--bronze-low) 100%);
  color: #1A1208;
  border: 1px solid #F5DFB0;
  border-bottom: 4px solid #4A351B;
  box-shadow: 0 8px 20px rgba(200, 147, 83, 0.35);
}

.btn-bronze-3d:hover { filter: brightness(1.07); }
.btn-bronze-3d:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

/* =========================================================================
   7. BANDLAB-STYLE SOUND & CALIBRATION VIEW
   ========================================================================= */
.sound-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.macro-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.macro-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.macro-name {
  font-family: "Fraunces", serif;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ivory);
}

.macro-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.mono-val {
  font-size: 12.5px;
  color: var(--bronze-hi);
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #120E0A;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--bronze-hi), var(--bronze-mid));
  border: 2px solid #FFF5DC;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
}

.bar-mixer-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mixer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.per-bar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.bar-calib-box {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.bar-calib-cipher {
  font-family: "Fraunces", serif;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.midi-num-input {
  width: 56px;
  background: #14100b;
  color: var(--ivory);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 3px 5px;
  text-align: center;
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

/* Collapsible Hardware Drawer */
.hw-drawer {
  padding: 14px 18px;
}

.hw-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.hw-summary::-webkit-details-marker { display: none; }

.hw-body {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hw-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.select-box {
  background: #14100b;
  color: var(--ivory);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12.5px;
  width: 100%;
}

.midi-log {
  height: 120px;
  overflow-y: auto;
  padding: 10px 12px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.midi-log .hit-cipher {
  color: var(--bronze-hi);
  font-weight: 600;
}

@media (max-width: 768px) {
  .macro-grid, .hw-controls { grid-template-columns: 1fr; }
  .per-bar-grid { grid-template-columns: repeat(3, 1fr); }
  .highway { height: 230px; }
}
