/* ===== 音乐小工具 — 共享样式 ===== */

/* Tool card on hub page */
.tool-card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.tool-card:active {
  transform: translateY(-1px);
}
.tool-card .tool-icon {
  font-size: 36px;
  margin-bottom: 0.5rem;
}
.tool-card .tool-name {
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
}
.tool-card .tool-badge {
  font-size: 12px;
  color: var(--accent);
  margin-top: 0.25rem;
}
.tool-card.coming-soon {
  opacity: 0.55;
  cursor: default;
}
.tool-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
}

/* Tool container */
.tool-container {
  max-width: 480px;
  margin: 0 auto;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Tool page section — mobile-first padding */
.tool-page-section {
  padding: clamp(0.75rem, 2vw, 1.5rem) 0 2rem;
}

/* Content / 引流区 */
.tool-content-section {
  padding: 1.5rem 0 2.5rem;
  background: rgba(139,168,154,0.05);
}

/* Breadcrumb */
.tool-back {
  font-size: 15px;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 1rem;
  min-height: 36px;
  line-height: 2.2;
}
.tool-back:hover {
  color: var(--primary);
}

/* BPM display */
.bpm-display {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}
.bpm-value {
  font-size: clamp(48px, 14vw, 64px);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -1px;
}
.bpm-label {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Slider */
.bpm-slider {
  width: 100%;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 5px;
  outline: none;
}
.bpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.bpm-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #fff;
}
.bpm-btn {
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
}
.bpm-btn:hover {
  background: var(--card-bg);
}
.bpm-btn:active {
  background: var(--border);
}

/* Start/Stop button */
.btn-start {
  display: block;
  width: 100%;
  min-height: 56px;
  font-size: 22px;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  background: var(--btn-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, opacity 0.3s;
}
.btn-start:hover {
  background: var(--btn-primary-hover);
}
.btn-start:active {
  transform: scale(0.98);
}
.btn-start.is-running {
  background: var(--accent);
}
.btn-start.is-running:hover {
  background: #D07850;
}

/* Blocked message — handshake failed */
.mt-blocked {
  text-align: center;
  padding: 0.75rem;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.6;
  animation: mtFadeIn 0.5s ease;
}
@keyframes mtFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Time signature selector */
.ts-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding: 0.5rem 0;
}
.ts-btn {
  min-width: 52px;
  min-height: 36px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.ts-btn:hover {
  background: var(--card-bg);
}
.ts-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Beat indicator */
.beat-indicator {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2.5vw, 12px);
  padding: 0.5rem 0;
}
.beat-dot {
  width: clamp(12px, 3.5vw, 16px);
  height: clamp(12px, 3.5vw, 16px);
  border-radius: 50%;
  background: var(--border);
  transition: background 0.05s, transform 0.05s;
}
.beat-dot.active {
  background: var(--accent);
  transform: scale(1.5);
  box-shadow: 0 0 8px rgba(232, 146, 106, 0.5);
}
.beat-dot--accent {
  width: clamp(14px, 4vw, 18px);
  height: clamp(14px, 4vw, 18px);
  border: 2px solid var(--primary);
}

/* Preset buttons */
.preset-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}
.preset-btn {
  min-width: 60px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.preset-btn:hover {
  background: var(--card-bg);
}
.preset-btn:active {
  background: var(--border);
}

/* Tap + Volume row */
.tap-volume-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 0.5rem 0;
}
.tap-volume-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.tap-volume-col label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Tap tempo */
.tap-btn {
  min-width: 80px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.tap-btn:hover {
  background: var(--card-bg);
}
.tap-result {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

/* Volume */
.volume-slider {
  width: 120px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #fff;
}
.volume-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #fff;
}

/* About section */
.about-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  text-align: center;
}
.about-section .qr-img {
  width: 140px;
  height: 140px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Speed reference */
.speed-ref {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* ===== Ultra-small screens (≤360px) ===== */
@media (max-width: 360px) {
  .ts-btn {
    min-width: 46px;
    font-size: 13px;
    min-height: 34px;
  }
  .ts-row {
    gap: 3px;
  }
  .bpm-btn {
    min-width: 36px;
    font-size: 18px;
  }
  .preset-btn {
    min-width: 50px;
    font-size: 14px;
  }
  .tap-volume-row {
    gap: 12px;
  }
  .volume-slider {
    width: 90px;
  }
  .tool-container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card { transition: none; }
  .beat-dot { transition: none; }
}

/* Orientation + octave controls */
.keyboard-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}
.keyboard-orient-group {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.keyboard-orient-btn {
  min-width: 52px;
  min-height: 36px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.keyboard-orient-btn:first-child { border-right: 1px solid var(--border); }
.keyboard-orient-btn:hover { background: var(--card-bg); }
.keyboard-orient-btn.active {
  background: var(--primary);
  color: #fff;
}

.keyboard-octave-select {
  display: flex;
  align-items: center;
  gap: 4px;
}
.keyboard-octave-select label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: 2px;
}
.keyboard-octave-btn {
  min-width: 36px;
  min-height: 34px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.keyboard-octave-btn:hover { background: var(--card-bg); }
.keyboard-octave-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Keyboard wrapper */
.keyboard-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  margin: 0.5rem 0;
}
.keyboard-keys {
  position: relative;
  width: 100%;
  height: clamp(150px, 32vw, 260px);
  min-height: 130px;
}

/* White keys */
.keyboard-whites {
  display: flex;
  height: 100%;
  width: 100%;
}
.keyboard-white-key {
  flex: 1 0 0;
  min-width: 0;
  background: #ffffff;
  border: 1px solid #d0d0d0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: clamp(4px, 1.2vw, 10px);
  font-size: clamp(9px, 1.5vw, 13px);
  color: #999;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.08s;
  position: relative;
  z-index: 1;
}
.keyboard-white-key:hover { background: #f5f7fa; }
.keyboard-white-key.active { background: #e0eaf5; }
.keyboard-white-key:last-child { border-radius: 0 0 8px 0; }
.keyboard-white-key:first-of-type { border-radius: 0 0 0 8px; }

/* Black keys */
.keyboard-blacks {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 62%;
  pointer-events: none;
  z-index: 2;
}
.keyboard-black-key {
  position: absolute;
  top: 0;
  height: 100%;
  background: #2c2c2c;
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(3px, 0.8vw, 6px);
  font-size: clamp(7px, 1.1vw, 11px);
  color: #ddd;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.08s;
}
.keyboard-black-key:hover { background: #3d3d3d; }
.keyboard-black-key.active { background: #555; }

/* Bottom row: volume + keyboard hint */
.keyboard-bottom-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 0.5rem 0;
}
.keyboard-key-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Portrait mode (vertical keys) ===== */
.keyboard-wrapper.portrait {
  overflow: hidden;
}
.keyboard-wrapper.portrait .keyboard-keys {
  position: relative;
  height: clamp(320px, 65vh, 480px);
}
.keyboard-wrapper.portrait .keyboard-whites {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}
.keyboard-wrapper.portrait .keyboard-white-key {
  flex: 1 0 0;
  min-height: 0;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding-left: clamp(6px, 2vw, 10px);
  padding-bottom: 0;
  font-size: clamp(10px, 1.5vw, 14px);
}
.keyboard-wrapper.portrait .keyboard-blacks {
  position: absolute;
  left: auto;
  right: 0;
  top: 0;
  height: 100%;
  width: 35%;
  pointer-events: none;
  z-index: 2;
}
.keyboard-wrapper.portrait .keyboard-black-key {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 3px 0 0 3px;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  padding-bottom: 0;
  font-size: clamp(8px, 1.2vw, 11px);
}

/* ===== Ultra-small screens ===== */
@media (max-width: 360px) {
  .keyboard-controls { gap: 8px; }
  .keyboard-orient-btn { min-width: 44px; font-size: 13px; }
  .keyboard-octave-btn { min-width: 30px; font-size: 13px; }
  .keyboard-bottom-row { gap: 16px; }
  .keyboard-keys { height: clamp(120px, 36vw, 180px); }
}

/* ===== 调音器 ===== */

/* Mic unavailable tip */
.tuner-mic-tip {
  text-align: center;
  padding: 0.5rem;
  color: var(--accent);
  font-size: 14px;
  background: rgba(232,146,106,0.1);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

/* Instrument selector — scrollable row */
.tuner-instrument-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0.5rem 0;
}
.tuner-instrument-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tuner-instrument-cat {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  opacity: 0.7;
  min-width: 36px;
}
.tuner-instrument-btn {
  flex-shrink: 0;
  min-width: 64px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  padding: 0 12px;
}
.tuner-instrument-btn:hover { background: var(--card-bg); }
.tuner-instrument-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Direction labels */
.tuner-strings-label {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0 0.25rem;
}
.tuner-direction {
  font-size: 13px;
  color: var(--text-secondary);
}

/* String cards grid */
.tuner-strings-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.25rem 0 0.5rem;
}
.tuner-string-card {
  min-width: 60px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
}
.tuner-string-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.tuner-string-card:active {
  transform: scale(0.95);
}
.tuner-string-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(232,146,106,0.4);
  animation: tunerPulse 0.3s ease;
}
@keyframes tunerPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.tuner-string-number {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.tuner-string-note {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}
.tuner-string-freq {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Meter section */
.tuner-meter-section {
  padding: 0.5rem 0;
}
.tuner-note-display {
  text-align: center;
  padding: 0.25rem 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tuner-note-name {
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}
.tuner-note-cents {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Meter bar */
.tuner-meter-bar {
  position: relative;
  height: 32px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  margin-top: 0.25rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.tuner-meter-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  user-select: none;
  -webkit-user-select: none;
}
.tuner-meter-flat {
  flex: 0 0 35%;
  background: linear-gradient(to right, #e07060, #e8a076);
}
.tuner-meter-ok {
  flex: 0 0 30%;
  background: linear-gradient(to right, #7dad71, #8bba7d);
}
.tuner-meter-sharp {
  flex: 0 0 35%;
  background: linear-gradient(to right, #e8a076, #e07060);
}
.tuner-meter-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #333;
  border-radius: 2px;
  left: 50%;
  transform: translateX(-50%);
  transition: left 0.12s ease-out;
  z-index: 1;
}
.tuner-meter-needle::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #333;
  border-radius: 50%;
}

/* Reference stop button */
.tuner-stop-btn {
  min-width: 120px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.1s;
}
.tuner-stop-btn:hover { background: rgba(232,146,106,0.08); }
.tuner-stop-btn:active { background: rgba(232,146,106,0.15); }

/* Mode toggle */
.tuner-mode-row {
  display: flex;
  gap: 0;
  justify-content: center;
  padding: 0.75rem 0 0.25rem;
}
.tuner-mode-btn {
  min-width: 90px;
  min-height: 40px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.tuner-mode-btn:first-child {
  border-radius: 8px 0 0 8px;
}
.tuner-mode-btn:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}
.tuner-mode-btn:hover { background: var(--card-bg); }
.tuner-mode-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============================================================
   Drum machine
   ============================================================ */

/* Card grouping */
.drum-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.75rem 0.5rem;
  margin-bottom: 0.75rem;
}

/* Pattern selector */
.drum-pattern-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 0 0 0.75rem;
}
.drum-pattern-btn {
  min-width: 72px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  padding: 0 14px;
  transition: background 0.1s, color 0.1s;
}
.drum-pattern-btn:hover { background: var(--card-bg); }
.drum-pattern-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* BPM slider row */
.drum-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.25rem 0;
}

/* BPM extras: presets + tap in one row */
.drum-bpm-extras {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

/* Yamaha accompaniment card */
.drum-accomp-card {
  background: linear-gradient(135deg, rgba(139,168,154,0.06), rgba(139,168,154,0.02));
  border-color: rgba(139,168,154,0.2);
  text-align: center;
}

.drum-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 6px;
}

.drum-section-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2px 0;
  flex-wrap: wrap;
}

/* Toggle item (label + switch stacked) */
.drum-toggle-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text);
  min-width: 48px;
}

/* Main variation buttons */
.drum-main-btn {
  min-width: 76px;
  min-height: 42px;
  padding: 6px 18px;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
  letter-spacing: 1px;
}
.drum-main-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.drum-main-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(139,168,154,0.3);
}
.drum-main-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.drum-main-btn:active:not(:disabled),
.drum-main-btn.pressed {
  transform: scale(0.95);
}

/* Settings row: volume */
.drum-settings-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0.25rem 0;
  margin-bottom: 0.75rem;
}
.drum-setting-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Start row */
.drum-start-row {
  padding: 0;
}

/* Toggle switch */
.drum-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.drum-switch input { display: none; }
.drum-switch-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}
.drum-switch-slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.drum-switch input:checked + .drum-switch-slider {
  background: var(--primary);
}
.drum-switch input:checked + .drum-switch-slider::after {
  transform: translateX(18px);
}

/* Tool gating timer */
.tool-gating-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.25rem 0;
  font-size: 14px;
}
.tool-gating-timer-label {
  color: var(--text-secondary);
}
.tool-gating-timer-value {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.tool-gating-timer-value.urgent {
  animation: toolGatingBlink 1s infinite;
}
@keyframes toolGatingBlink {
  50% { opacity: 0.4; }
}

/* Tool gating activation overlay */
.tool-gating-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.tool-gating-box {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.tool-gating-icon {
  font-size: 48px;
  margin-bottom: 0.5rem;
}
.tool-gating-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.tool-gating-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}
.tool-gating-code-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.tool-gating-code-input {
  width: 140px;
  padding: 8px 12px;
  font-size: 22px;
  text-align: center;
  letter-spacing: 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-family: monospace;
}
.tool-gating-code-input:focus {
  border-color: var(--primary);
}
.tool-gating-code-btn {
  min-width: 72px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--btn-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.tool-gating-code-btn:hover {
  background: var(--btn-primary-hover);
}
.tool-gating-code-btn:active {
  transform: scale(0.97);
}
.tool-gating-error {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 0.5rem;
  min-height: 20px;
}
.tool-gating-hint {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== 琴友码页面 ===== */
.qinyou-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.qinyou-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.qinyou-icon {
  font-size: 48px;
  margin-bottom: 0.5rem;
}
.qinyou-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.qinyou-code-display {
  display: inline-block;
  background: var(--bg);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 1rem 2rem;
  margin: 1rem 0;
}
.qinyou-code-digit {
  font-size: clamp(56px, 14vw, 80px);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 12px;
  font-variant-numeric: tabular-nums;
  font-family: monospace;
}
.qinyou-expiry {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.qinyou-tools-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.qinyou-tool-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  line-height: 48px;
  transition: background 0.15s, border-color 0.15s;
}
.qinyou-tool-btn:hover {
  background: var(--card-bg);
  border-color: var(--primary);
}
.qinyou-tool-btn:active {
  background: var(--border);
}
.qinyou-qr {
  display: block;
  width: 160px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1rem auto;
}
.qinyou-notice {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 0.5rem;
}
.qinyou-error-msg {
  font-size: 16px;
  color: var(--accent);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Tool gating QR image in overlay */
.tool-gating-qr {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 0 auto 0.75rem;
}

/* Ultra-small screens */
@media (max-width: 360px) {
  .tuner-string-card {
    min-width: 50px;
    min-height: 72px;
  }
  .tuner-string-number { font-size: 18px; }
  .tuner-string-note { font-size: 12px; }
  .tuner-string-freq { font-size: 10px; }
  .tuner-strings-grid { gap: 4px; }
  .tuner-mode-btn { min-width: 72px; font-size: 14px; }
}
