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

:root {
  --bg: #0b0f1a;
  --bg-card: #141a2a;
  --bg-card-active: #1d2a4a;
  --fg: #e8eaf0;
  --fg-dim: #7a8099;
  --accent: #7da0ff;
  --accent-glow: rgba(125, 160, 255, 0.25);
  --border: #22293a;
  --danger: #ff7a7a;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { opacity: 0.85; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.site-header .logo {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.site-nav a {
  color: var(--fg-dim);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--fg); }

main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.hero { margin-bottom: 2rem; }
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.hero p {
  color: var(--fg-dim);
  font-size: 1.05rem;
}

.btn {
  padding: 0.55rem 1.1rem;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--fg-dim); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn.on {
  background: var(--bg-card-active);
  border-color: var(--accent);
  color: var(--fg);
}

.control-label {
  color: var(--fg-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  white-space: nowrap;
}

.preset-bar {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.preset-btn, .timer-btn {
  padding: 0.42rem 0.95rem;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.86rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.preset-btn:hover, .timer-btn:hover { border-color: var(--fg-dim); }
.preset-btn.active, .timer-btn.active {
  background: var(--bg-card-active);
  border-color: var(--accent);
}

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.timer-group, .action-group {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.action-group { gap: 0.5rem; }

.timer-display {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  margin-left: 0.5rem;
  min-width: 5rem;
}

.help-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.help-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.help-btn:hover, .help-btn[aria-expanded="true"] {
  color: var(--fg);
  border-color: var(--accent);
}
.help-popover {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 0;
  background: var(--bg-card-active);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  width: max-content;
  max-width: min(280px, calc(100vw - 2rem));
  font-size: 0.85rem;
  color: var(--fg);
  line-height: 1.55;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
  display: none;
}
.help-popover strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.88rem;
}
.help-popover.open { display: block; }
.help-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 8px;
  width: 10px;
  height: 10px;
  background: var(--bg-card-active);
  border-left: 1px solid var(--accent);
  border-top: 1px solid var(--accent);
  transform: rotate(45deg);
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--accent);
  color: #0b0f1a;
  padding: 0.7rem 1.3rem;
  border-radius: 22px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  box-shadow: 0 6px 24px rgba(125, 160, 255, 0.35);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mixer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}

.category-label {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-top: 1.2rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.category-label:first-child { margin-top: 0; }

.sound-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 0.9rem 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sound-card:hover { border-color: var(--fg-dim); }
.sound-card.active {
  background: var(--bg-card-active);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 4px 14px rgba(125, 160, 255, 0.12);
}

.sound-icon {
  font-size: 2.2rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.55rem;
  filter: grayscale(1);
  opacity: 0.55;
  transition: filter 0.25s, opacity 0.25s;
}
.sound-card.active .sound-icon {
  filter: none;
  opacity: 1;
}

.sound-name {
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.85rem;
  color: var(--fg);
}

.sound-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
}
.sound-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg-dim);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.sound-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg-dim);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.sound-card.active .sound-slider::-webkit-slider-thumb {
  background: var(--accent);
  transform: scale(1.1);
}
.sound-card.active .sound-slider::-moz-range-thumb {
  background: var(--accent);
  transform: scale(1.1);
}

.sound-index {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.sound-index h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--fg);
}
.sound-index-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.sound-index-list a {
  display: block;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg-dim);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-size: 0.92rem;
  line-height: 1.5;
}
.sound-index-list a:hover {
  border-color: var(--accent);
  background: var(--bg-card-active);
  color: var(--fg);
}
.sound-index-list strong {
  color: var(--fg);
  margin-right: 0.3rem;
}
.sound-index-note {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

.doc {
  max-width: 760px;
  margin: 0 auto;
}
.doc h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  margin-bottom: 0.4rem;
}
.doc .lead {
  font-size: 1.1rem;
  color: var(--fg-dim);
  margin-bottom: 2rem;
}
.doc .meta {
  color: var(--fg-dim);
  font-size: 0.88rem;
  margin-bottom: 2rem;
}
.doc section {
  margin-bottom: 2rem;
}
.doc h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.doc p {
  margin-bottom: 0.8rem;
  color: var(--fg);
}
.doc ul {
  list-style: disc;
  padding-left: 1.4rem;
  margin-bottom: 0.8rem;
}
.doc li {
  margin-bottom: 0.4rem;
}
.doc a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.doc a:hover { text-decoration-color: var(--accent); }
.doc strong { color: var(--fg); }
.doc em { font-style: italic; color: var(--fg-dim); }

.sound-landing {
  max-width: 780px;
  margin: 0 auto;
}
.sound-hero {
  text-align: center;
  padding: 1rem 0 1.8rem;
}
.sound-hero-icon {
  font-size: 4rem;
  display: block;
  line-height: 1;
  margin-bottom: 0.6rem;
}
.sound-hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  margin-bottom: 0.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sound-hero .lead {
  color: var(--fg-dim);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto;
}

.single-player {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 3rem;
}
.big-play-btn {
  background: var(--accent);
  color: #0b0f1a;
  border: none;
  border-radius: 40px;
  padding: 0.95rem 2.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s, transform 0.1s;
  margin-bottom: 1.3rem;
  letter-spacing: 0.02em;
}
.big-play-btn:hover { filter: brightness(1.1); }
.big-play-btn:active { transform: scale(0.98); }
.big-play-btn.playing { background: var(--fg-dim); color: var(--fg); }

.single-volume-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 380px;
  margin: 0 auto;
}
.single-volume-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.single-volume-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.single-volume-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.volume-label {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  min-width: 3rem;
  text-align: right;
  font-size: 0.92rem;
}

.sound-landing section { margin-bottom: 2.2rem; }
.sound-landing h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}
.sound-landing p {
  margin-bottom: 0.8rem;
  color: var(--fg);
  line-height: 1.75;
}
.sound-landing ul {
  list-style: disc;
  padding-left: 1.4rem;
  margin-bottom: 0.8rem;
}
.sound-landing li {
  margin-bottom: 0.45rem;
  line-height: 1.7;
}
.sound-landing strong { color: var(--fg); }

.faq-list { display: flex; flex-direction: column; gap: 0.6rem; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--fg);
  list-style: none;
  padding-right: 1.5rem;
  position: relative;
  line-height: 1.5;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: -1px;
  color: var(--fg-dim);
  font-weight: 300;
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: '−'; color: var(--accent); }
.faq-item .faq-answer {
  margin-top: 0.7rem;
  color: var(--fg-dim);
  line-height: 1.7;
}

.related-sounds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.7rem;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.95rem 0.7rem;
  text-align: center;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s;
}
.related-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-active);
}
.related-card .icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 0.3rem;
  line-height: 1;
}
.related-card .name {
  font-size: 0.88rem;
  color: var(--fg);
}

.cta-box {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card-active));
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  margin-top: 2.5rem;
}
.cta-box p {
  color: var(--fg);
  margin-bottom: 1rem;
  font-size: 1rem;
}
.cta-box .btn {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #0b0f1a;
  border: none;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
}
.cta-box .btn:hover { filter: brightness(1.1); border-color: transparent; }

.error-page {
  text-align: center;
  padding: 4rem 1rem;
}
.error-code {
  font-size: clamp(4rem, 14vw, 7rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}
.error-message {
  font-size: 1.1rem;
  color: var(--fg);
  margin-bottom: 0.8rem;
}
.error-uri {
  color: var(--fg-dim);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.error-uri code {
  background: var(--bg-card);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
}
.error-page .btn {
  display: inline-block;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem 1.5rem;
  color: var(--fg-dim);
  font-size: 0.9rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.footer-col h4 {
  color: var(--fg);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.footer-col p { font-size: 0.88rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.3rem; }
.footer-col a { color: var(--fg-dim); text-decoration: none; }
.footer-col a:hover { color: var(--fg); }
.footer-copy {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem;
}

@media (max-width: 600px) {
  main { padding: 1.5rem 1rem 2rem; }
  .mixer-grid { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 0.7rem; }
  .sound-card { padding: 0.95rem 0.7rem 0.7rem; }
  .sound-icon { font-size: 1.9rem; }
  .sound-name { font-size: 0.85rem; }
  .action-bar { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .timer-group, .action-group { justify-content: flex-start; }
}
