/* ===================================================================
   Online Metronome — Digital electronic device (Boss DB-90 inspired)
   Independent file, no shared code with /fretboard/.
   =================================================================== */

:root {
  /* Device colors */
  --body-1: #2a2a2d;
  --body-2: #1c1c1e;
  --body-3: #101012;
  --body-edge: #0a0a0c;
  --silkscreen: #6b6b70;

  /* LCD colors */
  --lcd-bg-1: #1c2920;
  --lcd-bg-2: #0a140e;
  --lcd-on: #6cff8c;
  --lcd-on-glow: rgba(108, 255, 140, 0.45);
  --lcd-dim: rgba(108, 255, 140, 0.18);
  --lcd-off: rgba(108, 255, 140, 0.06);

  /* LEDs */
  --led-red: #ff3a30;
  --led-red-glow: rgba(255, 58, 48, 0.65);
  --led-amber: #ffaa44;
  --led-amber-glow: rgba(255, 170, 68, 0.6);

  /* Buttons */
  --btn-rubber: #1a1a1c;
  --btn-rubber-hi: #2e2e30;
  --btn-play: #d63a2e;
  --btn-play-hi: #ff6b5e;
  --btn-play-shadow: #5a1208;

  /* Text */
  --text: #d5d5d8;        /* device LCD / silkscreen light grey — keep for the dark device */
  --text-dim: #8a8a90;
  --text-faint: #555558;

  /* ----- Page background = Tomato Hero cream (the device floats on it) ----- */
  --bg-1: #faf6f1;
  --bg-2: #f3eee5;

  /* ----- Cream-world chrome around the device ----- */
  --surface: #ffffff;
  --surface-2: #faf6ed;
  --border: #e8dfcc;
  --border-soft: #f0e9da;
  --ink: #1f1a14;
  --ink-2: #5c5547;
  --ink-dim: #6e6557;
  --accent: #e85f4d;
  --accent-2: #d44a39;
  --accent-glow: rgba(232, 95, 77, 0.30);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "PingFang SC", "Hiragino Sans", "Noto Sans CJK", sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 235, 220, 0.55) 0%, transparent 70%),
    var(--bg-1);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow-x: hidden;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px) clamp(12px, 3vw, 24px) 60px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  z-index: 1000;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ============ Top bar ============ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lang-switcher {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%),
    linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 22px;
  max-width: 160px;
}
.lang-switcher:hover { border-color: var(--accent); }
.lang-switcher:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.lang-switcher option {
  background: #ffffff;
  color: var(--ink);
}
.brand {
  font-family: Georgia, serif;
  font-size: clamp(14px, 3.6vw, 17px);
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.5px;
  text-shadow: none;
  font-weight: 700;
}
.brand:hover { opacity: 0.85; }
.nav-link {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: 0.5px;
}
.nav-link:hover { color: var(--accent); }

.page-title {
  font-family: Georgia, serif;
  text-align: center;
  font-size: clamp(26px, 6vw, 42px);
  color: var(--ink);
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  text-shadow: none;
}
.page-sub {
  text-align: center;
  color: var(--ink-dim);
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: 0.8px;
  margin-bottom: clamp(20px, 5vw, 32px);
  padding: 0 8px;
}

/* ============ DEVICE ============ */
.device-stage {
  display: flex;
  justify-content: center;
  margin: 0 auto clamp(24px, 5vw, 40px);
}

.device {
  position: relative;
  width: clamp(280px, 92vw, 380px);
  padding: 18px 18px 24px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, var(--body-1) 0%, var(--body-2) 55%, var(--body-3) 100%);
  box-shadow:
    /* outer drop shadow */
    0 24px 50px rgba(0, 0, 0, 0.7),
    0 8px 20px rgba(0, 0, 0, 0.55),
    /* outer edge highlight */
    inset 0 1.5px 1.5px rgba(255, 255, 255, 0.10),
    inset 0 -1.5px 1.5px rgba(0, 0, 0, 0.85),
    inset 1.5px 0 1.5px rgba(255, 255, 255, 0.04),
    inset -1.5px 0 1.5px rgba(0, 0, 0, 0.6),
    /* subtle inner glow at top */
    inset 0 30px 50px rgba(255, 255, 255, 0.025);
}
/* Subtle plastic texture noise */
.device::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='5'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.6;
  pointer-events: none;
}

/* ============ Top edge (jack + LED bar + battery) ============ */
.top-edge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 10px;
  min-height: 22px;
}

/* Headphone jack icon */
.jack-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.jack-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a4a4d 0%, #1a1a1c 60%, #08080a 100%);
  box-shadow:
    inset 0 -1px 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 1px rgba(0, 0, 0, 0.7);
}
.jack-hole {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: #000;
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.9);
}

/* Battery icon */
.battery-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: 8px;
  padding: 1.5px 2px;
  border: 1px solid rgba(180, 180, 190, 0.4);
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.3);
  flex: 0 0 auto;
}
.batt-cell {
  display: inline-block;
  width: 3px;
  height: 4px;
  background: var(--lcd-on);
  box-shadow: 0 0 2px rgba(108, 255, 140, 0.55);
}
.batt-tip {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5px;
  height: 4px;
  background: rgba(180, 180, 190, 0.4);
  border-radius: 0 1px 1px 0;
}

/* ============ LED bar (centred between jack & battery) ============ */
.led-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
}
.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #5a0c08 0%, #2a0604 60%, #100302 100%);
  box-shadow:
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.65),
    inset 0 1px 0.5px rgba(255, 100, 80, 0.05);
  transition: all 0.08s ease-out;
}
.led.accent {
  background:
    radial-gradient(circle at 35% 30%, #6a1408 0%, #340804 60%, #150402 100%);
}
.led.on {
  background:
    radial-gradient(circle at 35% 30%, #ffb0a0 0%, var(--led-red) 35%, #aa1808 100%);
  box-shadow:
    inset 0 -1px 1px rgba(80, 0, 0, 0.55),
    inset 0 1px 1px rgba(255, 200, 180, 0.6),
    0 0 8px var(--led-red-glow),
    0 0 18px var(--led-red-glow);
}
.led.amber.on {
  background:
    radial-gradient(circle at 35% 30%, #ffe4ad 0%, var(--led-amber) 35%, #aa6a18 100%);
  box-shadow:
    inset 0 -1px 1px rgba(80, 40, 0, 0.55),
    inset 0 1px 1px rgba(255, 230, 200, 0.6),
    0 0 8px var(--led-amber-glow),
    0 0 18px var(--led-amber-glow);
}

/* ============ LED labels (tiny "1 2 3 4" silkscreen below LEDs) ============ */
.led-labels {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-family: Georgia, serif;
  font-size: 7px;
  letter-spacing: 1px;
  color: rgba(120, 120, 125, 0.6);
  text-transform: uppercase;
  margin: -6px 0 8px;
  min-height: 10px;
}
.led-labels span {
  width: 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ============ Phillips screws (decorative, 4 corners) ============ */
.screw {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%,
      #6a6a6e 0%,
      #404044 35%,
      #1c1c1e 80%,
      #0a0a0c 100%);
  box-shadow:
    inset -1px -1px 1.5px rgba(0, 0, 0, 0.7),
    inset 1px 1px 1px rgba(255, 255, 255, 0.18),
    0 1px 1px rgba(0, 0, 0, 0.5);
  z-index: 10;
}
.screw::before,
.screw::after {
  content: '';
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
}
.screw::before {
  /* horizontal line of + */
  top: 50%;
  left: 18%;
  right: 18%;
  height: 0.8px;
  transform: translateY(-50%);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.18);
}
.screw::after {
  /* vertical line of + */
  left: 50%;
  top: 18%;
  bottom: 18%;
  width: 0.8px;
  transform: translateX(-50%);
  box-shadow: -1px 0 0 rgba(255, 255, 255, 0.18);
}
.screw-tl { top: 10px; left: 10px; }
.screw-tr { top: 10px; right: 10px; transform: rotate(45deg); }
.screw-bl { bottom: 12px; left: 10px; transform: rotate(70deg); }
.screw-br { bottom: 12px; right: 10px; transform: rotate(25deg); }

/* ============ Brand label (silkscreen) ============ */
.brand-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--silkscreen);
  text-transform: uppercase;
  margin-bottom: 12px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.brand-mark { font-style: italic; }
.brand-sep { opacity: 0.4; }
.brand-model { font-weight: 600; letter-spacing: 2.5px; }

/* ============ LCD Screen (recessed glass display) ============ */
.screen {
  position: relative;
  border-radius: 6px;
  padding: 3px;
  background: linear-gradient(180deg, #050608 0%, #0c0e10 100%);
  box-shadow:
    /* deep recess into device */
    inset 0 2px 4px rgba(0, 0, 0, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.05),
    inset 2px 0 3px rgba(0, 0, 0, 0.55),
    inset -2px 0 3px rgba(0, 0, 0, 0.55),
    /* outer bezel highlight (top edge of recess) */
    0 1px 0 rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}
.screen-bezel {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.85),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04);
  /* glass reflection — diagonal sweep across top half */
  background:
    linear-gradient(155deg,
      rgba(255, 255, 255, 0.06) 0%,
      rgba(255, 255, 255, 0.02) 22%,
      transparent 45%);
  z-index: 3;
}
.screen-bg {
  position: relative;
  border-radius: 4px;
  padding: 14px 16px 12px;
  background:
    radial-gradient(ellipse at 50% 0%, #243528 0%, transparent 60%),
    linear-gradient(180deg, var(--lcd-bg-1) 0%, var(--lcd-bg-2) 100%);
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 0 12px rgba(0, 0, 0, 0.55);
}
/* Subtle scanlines */
.screen-scan {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, 0.18) 2px,
      rgba(0, 0, 0, 0.18) 3px);
  pointer-events: none;
}
/* Subtle pixel grid */
.screen-grid {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, 0.10) 2px,
      rgba(0, 0, 0, 0.10) 3px);
  pointer-events: none;
}

.screen-content {
  position: relative;
  z-index: 2;
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
}

.screen-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.screen-row-top {
  align-items: baseline;
  margin-bottom: 4px;
}
.screen-row-mid {
  font-size: 11px;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.screen-row-bot {
  font-size: 11px;
  letter-spacing: 1px;
  align-items: center;
}

.screen-bpm {
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  font-weight: 700;
  font-size: clamp(48px, 12vw, 64px);
  line-height: 1;
  letter-spacing: 3px;
  color: var(--lcd-on);
  text-shadow:
    0 0 8px var(--lcd-on-glow),
    0 0 16px rgba(108, 255, 140, 0.25);
  display: inline-block;
  font-variant-numeric: tabular-nums;
  min-width: 3.4ch;
  text-align: right;
}
.screen-unit {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--lcd-on);
  text-shadow: 0 0 6px var(--lcd-on-glow);
  opacity: 0.85;
}

.screen-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}
.screen-meta-label {
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--lcd-dim);
  text-transform: uppercase;
}
.screen-meta-val {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--lcd-on);
  text-shadow: 0 0 6px var(--lcd-on-glow);
  text-transform: uppercase;
}

.screen-tempo-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  color: var(--lcd-on);
  text-shadow: 0 0 4px var(--lcd-on-glow);
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.beat-dots {
  display: inline-flex;
  gap: 6px;
}
.beat-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lcd-off);
  box-shadow: inset 0 0 0 0.5px rgba(108, 255, 140, 0.15);
  transition: all 0.08s ease-out;
}
.beat-pip.accent { /* slightly different to mark beat 1 visually */ }
.beat-pip.active {
  background: var(--lcd-on);
  box-shadow: 0 0 6px var(--lcd-on-glow);
}
.beat-pip.accent.active {
  background: var(--lcd-on);
  box-shadow: 0 0 10px var(--lcd-on-glow);
}

/* ============ BPM tune row (primary BPM control: -10 / -1 / +1 / +10) ============ */
.tune-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.btn-tune {
  height: 38px;
  border: none;
  border-radius: 5px;
  background:
    linear-gradient(180deg,
      var(--btn-rubber-hi) 0%,
      var(--btn-rubber) 50%,
      #0c0c0e 100%);
  color: var(--text);
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 2px 3px rgba(0, 0, 0, 0.45);
  transition: all 0.08s ease-out;
  -webkit-user-select: none;
  user-select: none;
}
.btn-tune:hover {
  background:
    linear-gradient(180deg, #353538 0%, #1f1f22 50%, #0e0e10 100%);
}
.btn-tune:active, .btn-tune.pressed {
  background:
    linear-gradient(180deg, #18181a 0%, #0c0c0e 100%);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(1px);
}
.btn-tune:focus-visible {
  outline: 2px solid var(--lcd-on);
  outline-offset: 2px;
}

/* ============ Control row (knob + function buttons) ============ */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* --- Tempo knob --- */
.knob-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.knob {
  --knob-angle: -27deg;
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%,
      #4a4a4d 0%,
      #2a2a2c 40%,
      #16161a 80%,
      #08080a 100%);
  box-shadow:
    /* base shadow */
    0 6px 14px rgba(0, 0, 0, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.55),
    /* outer ring highlight */
    inset 0 1.5px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.6);
  cursor: grab;
  touch-action: none;
}
.knob:active { cursor: grabbing; }
.knob:focus-visible {
  outline: 2px solid var(--lcd-on);
  outline-offset: 4px;
}
.knob-face {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%,
      #3a3a3d 0%,
      #1c1c1e 50%,
      #0a0a0c 100%);
  /* notched grip pattern (radial dashes) */
  background-image:
    radial-gradient(circle at 30% 25%, #3a3a3d 0%, #1c1c1e 50%, #0a0a0c 100%),
    repeating-conic-gradient(
      from 0deg,
      rgba(255, 255, 255, 0.08) 0deg 2deg,
      transparent 2deg 12deg);
  background-blend-mode: normal, screen;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    inset 0 -2px 3px rgba(0, 0, 0, 0.7);
  transform: rotate(var(--knob-angle));
  transition: transform 0.06s linear;
}
.knob-dot {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--led-red);
  box-shadow:
    0 0 6px rgba(255, 58, 48, 0.7),
    0 0 12px rgba(255, 58, 48, 0.4);
}
.knob-grip {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from 0deg,
      transparent 0deg 12deg,
      rgba(0, 0, 0, 0.3) 12deg 14deg);
  pointer-events: none;
}
.knob-label {
  font-family: Georgia, serif;
  font-size: 8px;
  letter-spacing: 2.5px;
  color: var(--silkscreen);
  text-transform: uppercase;
}

/* --- Function buttons --- */
.fn-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex: 1 1 auto;
}
.btn-fn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 44px;
  border: none;
  border-radius: 6px;
  background:
    linear-gradient(180deg,
      var(--btn-rubber-hi) 0%,
      var(--btn-rubber) 50%,
      #0c0c0e 100%);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.5);
  transition: all 0.08s ease-out;
}
.btn-fn:hover {
  background:
    linear-gradient(180deg, #353538 0%, #1f1f22 50%, #0e0e10 100%);
}
.btn-fn:active, .btn-fn.pressed {
  background:
    linear-gradient(180deg, #18181a 0%, #0c0c0e 100%);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(1px);
}
.btn-fn:focus-visible {
  outline: 2px solid var(--lcd-on);
  outline-offset: 2px;
}
.btn-fn-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.btn-fn-sub {
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-transform: lowercase;
}

/* ============ Play button (big red) ============ */
.btn-play {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  padding: 0;
  border: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%,
      var(--btn-play-hi) 0%,
      var(--btn-play) 40%,
      var(--btn-play-shadow) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow:
    /* outer ring shadow */
    0 8px 18px rgba(214, 58, 46, 0.45),
    0 4px 8px rgba(0, 0, 0, 0.6),
    /* inner edges */
    inset 0 2px 2px rgba(255, 255, 255, 0.35),
    inset 0 -3px 5px rgba(0, 0, 0, 0.5);
  transition: all 0.1s ease-out;
}
.btn-play:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 22px rgba(214, 58, 46, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.6),
    inset 0 2px 2px rgba(255, 255, 255, 0.35),
    inset 0 -3px 5px rgba(0, 0, 0, 0.5);
}
.btn-play:active { transform: translateY(1px); }
.btn-play:focus-visible {
  outline: 2px solid var(--lcd-on);
  outline-offset: 4px;
}
.btn-play svg { width: 30px; height: 30px; position: relative; z-index: 1; }
.btn-play .icon-stop { display: none; }
.btn-play.playing .icon-play { display: none; }
.btn-play.playing .icon-stop { display: block; }
.btn-play-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(214, 58, 46, 0.0);
  pointer-events: none;
  transition: all 0.15s;
}
.btn-play.playing .btn-play-ring {
  border-color: rgba(214, 58, 46, 0.55);
  animation: ring-pulse 1s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0.2; }
}

/* ============ Speaker grille (denser dot pattern) ============ */
.speaker-grille {
  margin: 18px auto 0;
  width: 62%;
  height: 28px;
  border-radius: 4px;
  background:
    radial-gradient(circle at center,
      rgba(0, 0, 0, 0.92) 0.7px,
      transparent 1.2px) 0 0 / 4px 4px,
    radial-gradient(circle at center,
      rgba(0, 0, 0, 0.92) 0.7px,
      transparent 1.2px) 2px 2px / 4px 4px,
    linear-gradient(180deg, #0a0a0c 0%, #06060a 100%);
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    inset 1px 0 1px rgba(0, 0, 0, 0.4),
    inset -1px 0 1px rgba(0, 0, 0, 0.4);
}

/* ============ Status LED (small dot) ============ */
.status-led {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6cff8c 0%, #1e7028 80%);
  box-shadow:
    0 0 4px rgba(108, 255, 140, 0.6),
    0 0 8px rgba(108, 255, 140, 0.3);
}

/* ============ Info section ============ */
.info {
  max-width: 640px;
  margin: clamp(20px, 5vw, 40px) auto 0;
  padding: 0 8px;
}
.info h2 {
  font-family: Georgia, serif;
  color: var(--ink);
  font-size: clamp(18px, 4.5vw, 22px);
  margin: 28px 0 12px;
  letter-spacing: 0.5px;
  text-shadow: none;
}
.info p, .info li {
  font-size: clamp(14px, 3.6vw, 15px);
  line-height: 1.75;
  color: var(--ink-2);
  opacity: 1;
}
.info ol, .info ul {
  padding-left: 22px;
  margin-bottom: 12px;
}
.info ol li, .info ul li { margin-bottom: 6px; }
.info strong { color: var(--accent); font-weight: 600; }
.info em { color: var(--ink-dim); font-style: italic; }
.bpm-list { list-style: none; padding-left: 0; }
.bpm-list li { padding-left: 0; }

.bpm-preset-grid {
  list-style: none;
  padding-left: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.bpm-preset-grid li { margin: 0; }
.bpm-preset-grid a {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent-2);
  font-family: 'Menlo', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: all 0.15s;
}
.bpm-preset-grid a:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 95, 77, 0.10);
}
.bpm-preset-grid a span {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-dim);
  margin-top: 2px;
  letter-spacing: 0.3px;
}

/* ============ Footer ============ */
.site-footer {
  max-width: 640px;
  margin: 56px auto 0;
  padding: 24px 12px 0;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}
.site-footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  color: var(--ink-dim);
}
.site-footer a {
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer a:hover { color: var(--accent); }
.site-footer .sub {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.6;
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ RWD ============ */

/* Smaller phones — tighten paddings */
@media (max-width: 360px) {
  .device {
    padding: 14px 14px 20px;
    border-radius: 18px;
  }
  .screen-bg {
    padding: 12px 12px 10px;
  }
  .screen-bpm {
    font-size: clamp(42px, 13vw, 56px);
  }
  .knob { width: 68px; height: 68px; }
  .btn-fn { height: 40px; }
  .btn-play { width: 64px; height: 64px; }
  .btn-play svg { width: 26px; height: 26px; }
}

/* Tablet portrait — device stays centered, info uses more space */
@media (min-width: 700px) {
  .device {
    width: clamp(340px, 56vw, 400px);
  }
}

/* Desktop — device + info side by side */
@media (min-width: 980px) {
  .app {
    max-width: 1080px;
  }
  .device-stage {
    margin-bottom: 0;
  }
  .info {
    max-width: none;
    margin-top: 20px;
  }
}

/* Landscape phone — compact vertical, allow scroll */
@media (max-height: 600px) and (orientation: landscape) {
  .app {
    padding-top: 12px;
    padding-bottom: 40px;
  }
  .page-title {
    font-size: clamp(20px, 4vw, 28px);
    margin-bottom: 2px;
  }
  .page-sub {
    margin-bottom: 16px;
  }
}
