/* ============================================================
     RESET & BASE
  ============================================================ */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg:        #0d0d0f;
    --surface:   #16161c;
    --border:    #2a2a38;
    --accent:    #7b5ef8;
    --accent2:   #e05a7a;
    --text:      #e8e8f0;
    --muted:     #7b7b9c;
    --glow-hit:  0 0 18px 6px rgba(123,94,248,0.85);
    --glow-kick: 0 0 22px 8px rgba(224,90,122,0.85);
    --radius:    10px;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 12px 32px;
    user-select: none;
  }


  h1 { font-size: 1.5rem; letter-spacing: .12em; color: var(--accent); margin-bottom: 4px; }
  .subtitle { font-size: .78rem; color: var(--muted); margin-bottom: 18px; letter-spacing: .06em; }


  /* ============================================================
     DRUM STAGE — top-down grid layout
  ============================================================ */
  .stage {
    background-image: url('./assets/images/drum-kit-living-room.png');
    background-size: contain; /* Or 'cover', depending on image dimensions */
    background-position: center;
    background-repeat: no-repeat;
    background-color: #252525;
    position: relative;
    width: 100%;          /* Changed from 640px */
    max-width: 640px;     /* Added */
    aspect-ratio: 640 / 400; /* Added: This forces the box to keep its rectangle shape! */
    height: auto;         /* Changed from 400px */
    border: 1px solid var(--border);
    border-radius: 20px;
    margin-bottom: 22px;
    overflow: visible;
  }

  /* Each pad is absolutely positioned */
  .drum {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 50%; /* Makes the clickable area a circle */
    /* TEMPORARY: Add a border so you can see the hotspots while you position them 
  border: 2px solid rgba(255, 0, 0, 0.5);*/
  }

  .drum img {
    display: block;
    pointer-events: none;
    /* drop-shadow will become the "hit" glow — applied via .hit class */
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
    transition: filter .12s ease, transform .12s ease;
  }

  /* Hit animation — added/removed via JS */
  .drum.hit { animation: hotspotHit .18s ease forwards;}
  .drum.hit-kick { animation: hotspotHit .18s ease forwards;}

  /* Create a semi-transparent flash and a glowing box-shadow */
@keyframes hotspotHit {
  0%   { background-color: rgba(123,94,248, 0); box-shadow: 0 0 0 transparent; }
  40%  { background-color: rgba(123,94,248, 0.4); box-shadow: var(--glow-hit); }
  100% { background-color: rgba(123,94,248, 0); box-shadow: 0 0 0 transparent; }
}

@keyframes hotspotHitKick {
  0%   { background-color: rgba(224,90,122, 0); box-shadow: 0 0 0 transparent; }
  40%  { background-color: rgba(224,90,122, 0.4); box-shadow: var(--glow-kick); }
  100% { background-color: rgba(224,90,122, 0); box-shadow: 0 0 0 transparent; }
}

  @keyframes drumHit {
    0%   { transform: scale(1); }
    40%  { transform: scale(.93); }
    100% { transform: scale(1); }
  }

  /* Hotkey badge */
  .drum .badge {
    margin-top: 8px;
    background: rgba(6, 0, 31, 0.791);
    color: #ffffff;
    font-size: .70rem;
    font-weight: 600;
    letter-spacing: .08em;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
  }
  .drum .label {
    font-size: .62rem;
    color: var(--muted);
    margin-top: 2px;
    pointer-events: none;
    letter-spacing: .04em;
  }

  /* ── Individual drum positions (Responsive Percentages) ── */
#pad-crash { 
  left: 17%; 
  top: 9%; 
  width: 22%; 
  height: 23%; 
}

#pad-hihat { 
  left: 11%; 
  top: 33%; 
  width: 19%; 
  height: 23%; 
}

#pad-tom1 { 
  left: 38%; 
  top: 23%; 
  width: 13%; 
  height: 20%; 
}

#pad-tom2 { 
  left: 54%; 
  top: 23%; 
  width: 13%; 
  height: 20%; 
}

#pad-ride { 
  right: 8%; 
  top: 15%; 
  width: 25%; 
  height: 30%; 
}

#pad-snare { 
  left: 30%; 
  top: 43%; 
  width: 17%; 
  height: 28%; 
}

#pad-floortom { 
  right: 18%; 
  top: 45%; 
  width: 20%; 
  height: 28%; 
}

#pad-kick { 
  left: 46%; 
  top: 66%; 
  width: 10%; 
  height: 23%; 
}

  /* ============================================================
   ONBOARDING INSTRUCTIONS
============================================================ */
.instructions {
  width: 100%;
  max-width: 640px;
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.mode-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mode-icon {
  font-size: 1.5rem;
  background: var(--bg);
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
}

.mode-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-text strong {
  font-size: 0.85rem;
  color: var(--text);
  letter-spacing: 0.03em;
}

.mode-text span {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

  /* ============================================================
     CONTROLS PANEL
  ============================================================ */
  .panel {
    width: 100%;
    max-width: 640px;     /* Added */
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 20px;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 12px;
  }

  .panel-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .panel-label {
    font-size: .72rem;
    color: var(--muted);
    letter-spacing: .06em;
    text-transform: uppercase;
    min-width: 50px;
  }

  select {
    background: #1e1e2a;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: .82rem;
    cursor: pointer;
    outline: none;
  }
  select:focus { border-color: var(--accent); }

  button {
    background: #1e1e2a;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 16px;
    font-size: .82rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
  }
  button:hover { background: #28283a; border-color: var(--accent); }

  button.active  { background: var(--accent); border-color: var(--accent); color: #fff; }
  button.danger  { background: var(--accent2); border-color: var(--accent2); color: #fff; }
  button:disabled { opacity: .4; cursor: not-allowed; }

  .status-pill {
    font-size: .72rem;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: transparent;
  }
  .status-pill.recording { border-color: var(--accent2); color: var(--accent2); animation: pulse 1s infinite; }
  .status-pill.playing   { border-color: #5ef8a0; color: #5ef8a0; }

  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

  /* Pattern description strip */
  #pattern-info {
    background: rgba(123, 94, 248, 0.08); /* Faint purple background */
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 50px;
  }

  .track-icon {
    font-size: 1.8rem;
    background: var(--bg);
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  }

  .track-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .track-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text); /* Pure white text, no longer muted */
    letter-spacing: 0.03em;
  }

  .track-desc {
    font-size: 0.75rem;
    color: #a0a0b5; /* Slightly lighter than muted, highly legible */
  }

  .track-desc strong {
    color: var(--accent2); /* Make the song name pop with your pink accent */
  }

  /* ============================================================
   VINYL SPIN ANIMATION
============================================================ */
@keyframes spinVinyl {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* We will add and remove this class using JavaScript */
.track-icon.spin {
  animation: spinVinyl 5s linear infinite;
}

  .divider { border: none; border-top: 1px solid var(--border); }


/* ============================================================
   FULLSCREEN BUTTON & MODE
============================================================ */
/* ============================================================
   FULLSCREEN BUTTON & MODE
============================================================ */
/* 1. Default State (Expand Button at the bottom) */
.fullscreen-btn {
  position: absolute;
  bottom: 12px; /* Positioned at the bottom */
  top: auto;    /* Clears any top positioning */
  right: 12px;
  background: rgba(22, 22, 28, 0.8);
  color: var(--text);
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

/* Hover effect for the default button */
.fullscreen-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* 2. Fullscreen State (Close Button at the top) */
.stage.fullscreen-mode .fullscreen-btn {
  top: 12px;    /* Moves it to the top */
  bottom: auto; /* Clears the bottom positioning */
}

/* Hover effect for the close button */
.stage.fullscreen-mode .fullscreen-btn:hover {
  background: var(--accent2);
}

/* Base Fullscreen State (for Desktops or Landscape Phones) */
.stage.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  z-index: 9999;
  border-radius: 0;
  margin: 0;
  background-color: #111; /* Darker background to hide the rest of the site */
}

/* If the phone is held vertically, rotate the stage 90 degrees! */
@media (orientation: portrait) {
  .stage.fullscreen-mode {
    top: 50%;
    left: 50%;
    width: 100vh;  /* Swap height and width */
    height: 100vw;
    transform: translate(-50%, -50%) rotate(90deg);
  }
}

/* ============================================================
   MOBILE RESPONSIVENESS (Simple Reorder)
============================================================ */
@media (max-width: 600px) {
  /* Swap the visual order so the Stage is above the Panel */
  h1 { order: 1; }
  .subtitle { order: 2; }
  .instructions { order: 3; flex-direction: column; }
  .stage { order: 4; margin-bottom: 20px; }
  .panel { order: 5; margin-bottom: 0; }

  /* Stack the panel rows neatly */
  .panel-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .panel-label { margin-bottom: -4px; }
  
  /* Shrink the badges slightly on mobile */
  .drum .badge { transform: scale(0.8); }
}