/*
 * BrainSync Binaural Beats Generator — app.css
 *
 * Dark meditative palette, mirrored from web/style.css and web/player/player.css.
 * Mobile-first, responsive. Standalone tool — no shared stylesheet dependency.
 */

/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --bg:       #070912;
  --bg2:      #0d1124;
  --card:     #121734;
  --line:     #222a52;
  --text:     #eef1ff;
  --muted:    #a3acd6;
  --accent:   #7c9cff;   /* blue  — delta/theta/alpha */
  --accent2:  #5ad1c5;   /* teal  — alpha/calm */
  --focus:    #c79bff;   /* violet — beta/gamma */

  /* current-band colour — overridden by JS via data-band attribute */
  --band-color: var(--accent);
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #141a3a 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ─── Band-colour theming (data-band on <body>) ─────────────────────────────── */
body[data-band="delta"],
body[data-band="theta"],
body[data-band="alpha"]  { --band-color: var(--accent);  }
body[data-band="beta"]   { --band-color: var(--accent2); }
body[data-band="gamma"]  { --band-color: var(--focus);   }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ─── Nav ────────────────────────────────────────────────────────────────────── */
.tool-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  transition: color .15s;
}
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }
.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 14px var(--accent);
}
.nav-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(124,156,255,.08);
  border: 1px solid rgba(124,156,255,.2);
  border-radius: 9px;
  padding: 6px 12px;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-cta:hover {
  background: rgba(124,156,255,.16);
  border-color: var(--accent);
  color: var(--text);
}
@media (max-width: 480px) { .nav-cta { display: none; } }

/* ─── Main ───────────────────────────────────────────────────────────────────── */
main { flex: 1; padding: 28px 0 56px; }

/* Page title */
.page-title {
  text-align: center;
  margin-bottom: 32px;
}
.page-title h1 {
  font-size: clamp(22px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.1;
}
.page-title h1 .grad {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-title p {
  color: var(--muted);
  font-size: 15px;
  margin-top: 8px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Headphone notice ───────────────────────────────────────────────────────── */
.headphone-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(124,156,255,.07);
  border: 1px solid rgba(124,156,255,.22);
  border-radius: 13px;
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.headphone-notice svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--accent);
  margin-top: 1px;
}
.headphone-notice strong { color: var(--accent); }
.headphone-notice .hn-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  display: block;
}

/* ─── Generator card ─────────────────────────────────────────────────────────── */
.gen-card {
  background: linear-gradient(180deg, var(--card), #0c1130);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 24px;
  margin-bottom: 24px;
}

/* ── Preset band row ── */
.preset-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1 1 0;
  min-width: 54px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), #0e1330);
  cursor: pointer;
  color: var(--text);
  transition: border-color .18s, background .18s, transform .12s;
}
.preset-btn:hover { transform: translateY(-1px); border-color: var(--band-color); }
.preset-btn:focus-visible { outline: 2px solid var(--band-color); outline-offset: 2px; }
.preset-btn .pb-name { font-size: 12px; font-weight: 700; }
.preset-btn .pb-hz   { font-size: 10.5px; color: var(--muted); }
.preset-btn .pb-goal { font-size: 10px; color: var(--muted); margin-top: 1px; }
.preset-btn.active {
  border-color: var(--band-color);
  background: linear-gradient(180deg, rgba(124,156,255,.10), #0e1330);
  box-shadow: 0 0 0 1px var(--band-color), inset 0 1px 0 rgba(255,255,255,.04);
}
/* Per-preset active colours */
.preset-btn[data-band="delta"].active,
.preset-btn[data-band="theta"].active,
.preset-btn[data-band="alpha"].active { border-color: var(--accent);  box-shadow: 0 0 0 1px var(--accent),  inset 0 1px 0 rgba(255,255,255,.04); }
.preset-btn[data-band="beta"].active  { border-color: var(--accent2); box-shadow: 0 0 0 1px var(--accent2), inset 0 1px 0 rgba(255,255,255,.04); }
.preset-btn[data-band="gamma"].active { border-color: var(--focus);   box-shadow: 0 0 0 1px var(--focus),   inset 0 1px 0 rgba(255,255,255,.04); }

/* ── Sliders section ── */
.sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  margin-bottom: 22px;
}
@media (max-width: 520px) {
  .sliders-grid { grid-template-columns: 1fr; gap: 18px; }
}
.slider-group label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.slider-group label .sl-val {
  font-variant-numeric: tabular-nums;
  color: var(--band-color);
  font-weight: 700;
  font-size: 14px;
}

/* Custom range input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--band-color);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--band-color);
  cursor: pointer;
  transition: box-shadow .15s;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--band-color);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--band-color);
  cursor: pointer;
}
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(124,156,255,.4);
}

.sl-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Frequency readout ── */
.freq-readout {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 8px 18px;
  text-align: center;
}
.freq-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 80px;
}
.freq-col .fc-label {
  font-size: 10.5px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.freq-col .fc-val {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.fc-val.left-freq  { color: var(--accent); }
.fc-val.right-freq { color: var(--focus);  }
.fc-val.beat-freq  { color: var(--band-color); }
.freq-sep { color: var(--line); font-size: 20px; font-weight: 300; align-self: center; }

/* ── Noise bed toggle ── */
.noise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(124,156,255,.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.noise-row .nr-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 180px;
}
.noise-label { font-size: 13.5px; font-weight: 600; }
.noise-sub   { font-size: 11.5px; color: var(--muted); }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex: none;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: var(--line);
  cursor: pointer;
  transition: background .2s;
}
.toggle input:checked + .toggle-track { background: var(--band-color); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgba(124,156,255,.4); }

/* Noise volume slider (shown when noise is on) */
.noise-vol-wrap {
  display: none;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 120px;
}
.noise-vol-wrap.visible { display: flex; }
.noise-vol-wrap span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.noise-vol-wrap input[type="range"] { flex: 1; }

/* ── Waveform canvas ── */
.viz-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #060810;
  border: 1px solid var(--line);
  margin-bottom: 22px;
}
#waveCanvas {
  display: block;
  width: 100%;
  height: 110px;
}

/* ── Play button ── */
.play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #06122b;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .12s, filter .15s;
  letter-spacing: .2px;
  margin-bottom: 14px;
}
.play-btn:hover  { filter: brightness(1.08); transform: translateY(-1px); }
.play-btn:active { transform: translateY(0);  filter: brightness(.96); }
.play-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.play-btn:disabled { opacity: .5; cursor: default; transform: none; }
.play-btn svg { width: 20px; height: 20px; flex: none; }

/* Band-specific play button gradients */
body[data-band="delta"] .play-btn,
body[data-band="theta"] .play-btn,
body[data-band="alpha"] .play-btn { background: linear-gradient(120deg, var(--accent), var(--accent2)); }
body[data-band="beta"]            .play-btn { background: linear-gradient(120deg, var(--accent2), var(--accent)); }
body[data-band="gamma"]           .play-btn { background: linear-gradient(120deg, var(--focus), var(--accent)); }

/* Status row */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.status-row .status-detail { flex: 1; line-height: 1.4; }
.status-row .status-detail strong { color: var(--band-color); }

/* ─── Unsupported banner ─────────────────────────────────────────────────────── */
.unsupported {
  display: none;
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.unsupported h2 { color: var(--text); margin-bottom: 10px; font-size: 22px; }
.unsupported p  { font-size: 15px; max-width: 460px; margin: 0 auto; }
.unsupported a  { color: var(--accent); text-decoration: underline; }
body.no-audio .unsupported { display: block; }
body.no-audio .gen-card,
body.no-audio .headphone-notice { display: none; }

/* ─── App funnel banner ───────────────────────────────────────────────────────── */
.app-funnel {
  background: linear-gradient(135deg, #16204e, #101533);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 32px;
}
.app-funnel h2 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.app-funnel p  { color: var(--muted); font-size: 14px; max-width: 480px; margin: 0 auto 20px; }
.funnel-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.funnel-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #000;
  border: 1px solid #2a2f55;
  border-radius: 13px;
  padding: 10px 16px;
  min-width: 160px;
  transition: transform .15s, border-color .15s;
}
.funnel-badge:hover { transform: translateY(-2px); border-color: var(--accent); }
.funnel-badge svg { width: 24px; height: 24px; flex: none; }
.funnel-badge .b-sm { font-size: 10.5px; color: #c9cdf0; line-height: 1; }
.funnel-badge .b-lg { font-size: 16px; font-weight: 600; line-height: 1.2; }
.funnel-links { font-size: 13px; color: var(--muted); margin-top: 14px; }
.funnel-links a { color: var(--accent); text-decoration: underline; }
.funnel-links a:hover { color: var(--text); }

/* ─── Explainer section ─────────────────────────────────────────────────────── */
.explainer {
  margin-bottom: 32px;
}
.explainer h2 {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  letter-spacing: -.2px;
  margin-bottom: 14px;
}
.explainer p {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.explainer p:last-child { margin-bottom: 0; }
.explainer a { color: var(--accent); text-decoration: underline; }
.explainer .band-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
}
.explainer .band-table th,
.explainer .band-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.explainer .band-table th {
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.explainer .band-table td { color: var(--text); }
.explainer .band-table tr:last-child td { border-bottom: none; }
.explainer .band-table td:first-child { color: var(--accent); font-weight: 700; }
.safety-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(199,155,255,.06);
  border: 1px solid rgba(199,155,255,.18);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.55;
}
.safety-note svg { width: 18px; height: 18px; flex: none; color: var(--focus); margin-top: 1px; }

/* ─── FAQ ────────────────────────────────────────────────────────────────────── */
.faq-section h2 {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  letter-spacing: -.2px;
  margin-bottom: 16px;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}
.faq-item {
  background: linear-gradient(180deg, var(--card), #0e1330);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 17px 20px;
  font-size: 15px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px;
  font-weight: 300;
  color: var(--accent);
  flex: none;
  margin-left: 12px;
  transition: transform .2s;
  line-height: 1;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item summary:hover { color: var(--accent); }
.faq-item p,
.faq-item div.faq-body {
  padding: 0 20px 17px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.faq-item a { color: var(--accent); text-decoration: underline; }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  margin-top: auto;
  text-align: center;
}
.footer-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.footer-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #000;
  border: 1px solid #2a2f55;
  border-radius: 13px;
  padding: 10px 16px;
  min-width: 160px;
  transition: transform .15s, border-color .15s;
}
.footer-badge:hover { transform: translateY(-2px); border-color: var(--accent); }
.footer-badge svg { width: 24px; height: 24px; flex: none; }
.footer-badge .b-sm { font-size: 10.5px; color: #c9cdf0; line-height: 1; }
.footer-badge .b-lg { font-size: 16px; font-weight: 600; line-height: 1.2; }
.footer-fine {
  font-size: 12.5px;
  color: #6b73a0;
  line-height: 1.7;
}
.footer-fine a { color: var(--muted); text-decoration: underline; }

/* ─── Sticky mobile CTA ──────────────────────────────────────────────────────── */
.sticky-cta {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(8,10,22,.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  gap: 10px;
  z-index: 50;
}
.sticky-cta a {
  flex: 1;
  text-align: center;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #06122b;
  font-weight: 700;
  border-radius: 11px;
  padding: 12px;
  font-size: 14px;
  transition: filter .15s;
}
.sticky-cta a:hover { filter: brightness(1.08); }
@media (max-width: 640px) {
  .sticky-cta { display: flex; }
  body { padding-bottom: 66px; }
}

/* ─── Responsive tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .gen-card { padding: 18px 14px; }
  .preset-row { gap: 6px; }
  .preset-btn { padding: 9px 4px; }
  .preset-btn .pb-name { font-size: 11px; }
  .freq-readout { gap: 6px 12px; }
  .freq-col .fc-val { font-size: 17px; }
}
