:root {
  --bg: #FAFAF9;
  --bg-alt: #F5F5F4;
  --surface: #FFFFFF;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --text: #1E293B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: rgba(79, 70, 229, 0.08);
  --secondary: #F97316;
  --accent: #EC4899;
  --success: #059669;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { transform: translateX(0); }
.toast-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

.page { max-width: 960px; margin: 0 auto; padding: 0 32px; }

#header.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.metro-section { padding: 16px 0 32px; display: flex; flex-direction: column; align-items: center; }

.metro-display {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 24px;
}

.metro-bpm-display {
  text-align: center; margin-bottom: 20px;
}
.metro-bpm {
  font-size: 64px; font-weight: 700; color: var(--text);
  line-height: 1;
  font-family: 'DM Serif Display', Georgia, serif;
}
.metro-bpm-label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text-muted); letter-spacing: 0.1em;
  margin-top: 4px;
}

.metro-beat-dots {
  display: flex; gap: 10px; align-items: center;
}
.metro-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--border);
  transition: all 0.1s ease;
}
.metro-dot.active { background: var(--primary); transform: scale(1.4); box-shadow: 0 0 12px rgba(79,70,229,0.4); }
.metro-dot.accent { background: var(--accent); transform: scale(1.5); box-shadow: 0 0 16px rgba(236,72,153,0.4); }

.metro-controls { width: 100%; max-width: 480px; }

.metro-slider-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.metro-slider-row input[type="range"] {
  flex: 1; accent-color: var(--primary);
}
.metro-bpm-input {
  width: 64px; padding: 6px 8px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text); outline: none;
}
.metro-bpm-input:focus { border-color: var(--primary); }

.metro-presets {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 16px;
}
.metro-preset {
  padding: 6px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.15s ease;
}
.metro-preset:hover { border-color: var(--primary); color: var(--primary); }
.metro-preset.active { background: var(--primary); border-color: var(--primary); color: white; }

.metro-btn-sm {
  width: 32px; height: 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%;
  font-family: inherit; font-size: 18px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.metro-btn-sm:hover { border-color: var(--primary); color: var(--primary); }

.metro-time-sig {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px; justify-content: center;
}
.metro-time-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.metro-time-sig select {
  padding: 8px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 14px; color: var(--text); outline: none;
}

.btn-metro-play {
  width: 100%; padding: 14px;
  background: var(--primary); color: white;
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn-metro-play:hover { background: var(--primary-hover); box-shadow: var(--shadow); }
.btn-metro-play.playing { background: var(--accent); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #A5B4FC; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4F46E5; }
::selection { background: rgba(79, 70, 229, 0.2); color: #1E293B; }

.guide-section {
  margin-top: 16px; margin-bottom: 64px;
  background: #ffffff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.guide-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 20px; background: none; border: none; cursor: pointer; transition: background 0.15s ease;
}
.guide-toggle:hover { background: var(--bg-alt); }
.guide-toggle-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #1E293B; }
.guide-toggle.open .toggle-arrow { transform: rotate(180deg); }
.toggle-arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.guide-list { padding: 0 20px 20px; }
.guide-list.hidden { display: none; }
.guide-item { padding: 16px 0; border-top: 1px solid var(--border); }
.guide-item:first-child { border-top: 1px solid var(--border); }
.guide-item-title { font-size: 14px; font-weight: 600; color: #1E293B; margin-bottom: 6px; }
.guide-item-body { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }

@media (max-width: 768px) {
  .page { padding: 0 16px; }
  .metro-bpm { font-size: 48px; }
}
