/* ============================================================================
   LOCAL LOOP — styles.css
   Minimalist high-contrast black & white studio UI.
   Mobile-first · zero dependencies · zero external requests.
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Surfaces & ink */
  --bg:            #0A0A0A;
  --surface:       #141414;
  --surface-2:     #1B1B1B;
  --surface-3:     #222222;
  --text:          #FFFFFF;
  --text-dim:      #A1A1AA;
  --text-faint:    #52525B;
  --border:        #262626;
  --border-strong: #3F3F46;

  /* Inverted (active) states */
  --accent:        #FFFFFF;
  --accent-ink:    #000000;

  /* Geometry */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --tap:       44px;          /* minimum comfortable tap target */
  --maxw:      860px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur:  180ms;

  /* Elevation */
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-2: 0 14px 40px rgba(0, 0, 0, 0.6);

  /* Type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding-left: 1.15rem; }

a {
  color: var(--text);
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

img, svg, video { display: block; max-width: 100%; }

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.38em;
}

kbd { color: var(--text-dim); }

/* Form controls inherit the type system */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* Unified focus ring — keyboard only */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Never let [hidden] get overridden by display rules below */
[hidden] { display: none !important; }

/* ==========================================================================
   3. UTILITIES
   ========================================================================== */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Tabular numerals so countdowns and timestamps never jitter */
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  letter-spacing: 0.01em;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   4. TOP BAR
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.82);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.brand__accent { color: var(--text-dim); font-weight: 500; }

.topbar__tag {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   5. LAYOUT WRAPPER
   ========================================================================== */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 14px 48px;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   6. AD SLOTS  (reserved space → no Cumulative Layout Shift)
   ========================================================================== */
.ad-slot {
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px dashed #1F1F1F;
  border-radius: var(--radius);
  background: #0D0D0D;
  overflow: hidden;
}

.ad-slot__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #333338;
  user-select: none;
}

/* ==========================================================================
   7. PLAYER SHELL
   ========================================================================== */
.player {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 68px;
}

/* ==========================================================================
   8. DROPZONE
   ========================================================================== */
.dropzone {
  min-height: 190px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: #6B6B75;
  background: var(--surface-2);
}

.dropzone:active { transform: scale(0.995); }

/* Applied by JS on dragenter/dragover */
.dropzone.is-dragging {
  border-color: var(--accent);
  border-style: solid;
  background: #1A1A1A;
}

.dropzone__icon {
  color: var(--text-dim);
  margin-bottom: 8px;
  transition: color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.dropzone:hover .dropzone__icon,
.dropzone.is-dragging .dropzone__icon {
  color: var(--text);
  transform: translateY(-2px);
}

.dropzone__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone__sub {
  font-size: 13.5px;
  color: var(--text-dim);
}

.dropzone__link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.dropzone__note {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 34ch;
}

/* ==========================================================================
   9. STAGE (video / audio panel)
   ========================================================================== */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
}

.stage__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Overlay chips on the stage */
.stage__change {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(10, 10, 10, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.stage__change:hover { background: rgba(30, 30, 30, 0.95); border-color: #52525B; }

.stage__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  pointer-events: none;
}

/* ---------- Screen-off audio panel ---------- */
.audio-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  background: radial-gradient(120% 120% at 50% 0%, #141414 0%, #050505 70%);
}

.audio-panel__bars {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  margin-bottom: 10px;
}

.audio-panel__bars span {
  display: block;
  width: 4px;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transform-origin: center;
  animation: eq 1.15s var(--ease) infinite alternate;
}

.audio-panel__bars span:nth-child(1) { animation-delay: -0.90s; }
.audio-panel__bars span:nth-child(2) { animation-delay: -0.65s; }
.audio-panel__bars span:nth-child(3) { animation-delay: -0.40s; }
.audio-panel__bars span:nth-child(4) { animation-delay: -0.15s; }
.audio-panel__bars span:nth-child(5) { animation-delay: -0.55s; }

@keyframes eq {
  from { transform: scaleY(0.18); opacity: 0.45; }
  to   { transform: scaleY(1);    opacity: 1;    }
}

.audio-panel__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.audio-panel__sub {
  font-size: 12px;
  color: var(--text-dim);
  max-width: 32ch;
}

/* ==========================================================================
   10. CONTROLS — shared shell
   ========================================================================== */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

/* ==========================================================================
   11. TIMELINE / SCRUBBER
   ========================================================================== */
.scrub {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scrub__times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 2px;
}

.scrub__times .mono { font-weight: 500; }

/* ---------- Range input base ---------- */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;                 /* generous hit area */
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

/* WebKit / Blink */
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--range-progress, 0%),
    #2A2A2A var(--range-progress, 0%),
    #2A2A2A 100%
  );
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.range:hover::-webkit-slider-thumb,
.range:focus-visible::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.16);
}
.range:active::-webkit-slider-thumb { transform: scale(1.2); }

/* Firefox */
.range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #2A2A2A;
}
.range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}
.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.range--scrub { height: 26px; }

/* ==========================================================================
   12. TRANSPORT ROW
   ========================================================================== */
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Forces a clean line break between transport and toggle pills on mobile */
.transport__spacer {
  flex-basis: 100%;
  height: 0;
}

/* ---------- Icon buttons ---------- */
.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.icon-btn--play {
  min-width: 60px;
  min-height: 60px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 6px 22px rgba(255, 255, 255, 0.14);
}
.icon-btn--play:hover { background: #F0F0F0; border-color: #F0F0F0; }

.icon-btn--sm {
  min-width: 38px;
  min-height: 38px;
  background: transparent;
  border-color: transparent;
}
.icon-btn--sm:hover { background: var(--surface-2); border-color: var(--border); }

/* Play / pause icon swap driven by data-playing */
.icon-btn--play .i-pause { display: none; }
.icon-btn--play[data-playing="true"] .i-play  { display: none; }
.icon-btn--play[data-playing="true"] .i-pause { display: block; }

/* Skip labels */
.skip-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Mute / unmute icon swap driven by data-muted */
#btn-mute .i-mute { display: none; }
#btn-mute[data-muted="true"] .i-vol  { display: none; }
#btn-mute[data-muted="true"] .i-mute { display: block; }

/* ==========================================================================
   13. PILLS (toggle & action buttons)
   ========================================================================== */
.pill {
  min-height: var(--tap);
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

.pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.pill:active { transform: scale(0.96); }

/* Active / pressed toggle state → sharp inverted pill */
.pill[aria-pressed="true"],
.pill.is-active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.pill[aria-pressed="true"]:hover,
.pill.is-active:hover { background: #EDEDED; border-color: #EDEDED; }

.pill:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.pill--ghost {
  background: transparent;
  color: var(--text-dim);
}
.pill--ghost:hover { background: var(--surface-2); color: var(--text); }

.pill--sm {
  min-height: 40px;
  padding: 0 13px;
  font-size: 12.5px;
}

/* ==========================================================================
   14. SECONDARY ROW (volume + speed)
   ========================================================================== */
.secondary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.field--select {
  justify-content: space-between;
  padding: 4px 0;
}

.field__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.range--volume {
  flex: 1 1 auto;
  min-width: 80px;
}

/* ---------- Select ---------- */
.select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 40px;
  padding: 0 34px 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23A1A1AA' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}
.select:hover { border-color: var(--border-strong); background-color: var(--surface-3); }
.select option { background: #141414; color: #FFFFFF; }

/* ==========================================================================
   15. PANELS (A–B loop & sleep timer)
   ========================================================================== */
.panel {
  padding: 14px;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.panel__row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel__row--wrap { flex-wrap: wrap; }

/* ---------- A–B timestamp chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ---------- Sleep timer ---------- */
.sleep__count {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sleep__custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.input {
  flex: 1 1 120px;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-faint); }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--accent); background: var(--surface-3); }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hide native number spinners for a cleaner field */
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ==========================================================================
   16. BELOW-THE-FOLD GUIDE / SEO CONTENT
   ========================================================================== */
.guide {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.guide__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 2px;
}

.guide__card {
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide__card h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
}

.guide__card p,
.guide__card li {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-dim);
}

.guide__card ol,
.guide__card ul { display: flex; flex-direction: column; gap: 6px; }

.guide__card strong { color: var(--text); font-weight: 600; }

.guide__note {
  padding: 11px 13px;
  font-size: 12.5px !important;
  color: var(--text-dim);
  background: #0E0E0E;
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ---------- FAQ ---------- */
.faq__heading {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

.faq {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.faq details {
  border-bottom: 1px solid var(--border);
}
.faq details:last-child { border-bottom: 0; }

.faq summary {
  position: relative;
  padding: 15px 44px 15px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur) var(--ease);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--surface-2); }

/* Custom + / − indicator */
.faq summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-dim);
  transition: transform var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.faq details[open] summary::after {
  content: "−";
  color: var(--text);
}

.faq details p {
  padding: 0 16px 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}

/* ==========================================================================
   17. FOOTER
   ========================================================================== */
.footer {
  padding: 24px 0 8px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* ==========================================================================
   18. OLED BLACKOUT OVERLAY
   ========================================================================== */
.blackout {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;          /* true black → OLED pixels switch off */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  animation: blackout-in 220ms var(--ease);
}

@keyframes blackout-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.blackout__hint {
  padding: 0 24px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: #FFFFFF;
  opacity: 0.16;                /* deliberately dim — readable, never blinding */
  user-select: none;
  animation: hint-pulse 4.5s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.10; }
  50%      { opacity: 0.22; }
}

/* ==========================================================================
   19. RESPONSIVE — TABLET & DESKTOP ENHANCEMENTS
   ========================================================================== */
@media (min-width: 560px) {
  .secondary {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
  }
  .field--select { justify-content: flex-end; }
  .sleep__custom .input { flex: 0 1 160px; }
}

@media (min-width: 720px) {
  body { font-size: 15.5px; }

  .wrap { padding: 24px 20px 56px; gap: 20px; }

  .topbar__inner { padding: 12px 20px; }

  .dropzone { min-height: 220px; }

  .controls { padding: 18px; gap: 14px; }

  /* Remove the forced line break — toggles sit on the right */
  .transport {
    justify-content: flex-start;
    gap: 10px;
  }
  .transport__spacer {
    flex: 1 1 auto;
    flex-basis: auto;
  }

  .panel { padding: 16px 18px; }

  .guide__card { padding: 22px 22px; gap: 12px; }
  .guide__title { font-size: 24px; }
  .guide__card h3 { font-size: 16px; }
  .guide__card p,
  .guide__card li { font-size: 14px; }
}

@media (min-width: 900px) {
  .stage { border-radius: 20px; }
  .icon-btn--play { min-width: 64px; min-height: 64px; }
}

/* ==========================================================================
   20. MOBILE TWEAKS — sticky compact controls & bigger targets
   ========================================================================== */
@media (max-width: 640px) {
  .topbar__tag { display: none; }

  .pill,
  .sleep-preset,
  .icon-btn--sm {
    min-height: 44px;           /* thumb-friendly on touch devices */
  }
  .icon-btn--sm { min-width: 44px; }

  /* Keep transport reachable while scrolling the player */
  .controls {
    position: sticky;
    bottom: 0;
    z-index: 20;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: rgba(20, 20, 20, 0.94);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    backdrop-filter: saturate(140%) blur(16px);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.55);
    margin-bottom: calc(-1 * env(safe-area-inset-bottom));
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .scrub__times { font-size: 11.5px; }

  .stage { aspect-ratio: 4 / 3; border-radius: var(--radius); }

  .audio-panel__bars { height: 32px; }
  .audio-panel__sub { display: none; }

  .faq summary { padding: 14px 44px 14px 14px; }
}

/* Very small phones */
@media (max-width: 360px) {
  .pill { padding: 0 11px; font-size: 12px; }
  .brand__accent { display: none; }
  .stage { aspect-ratio: 1 / 1; }
}

/* Landscape phones — cap stage height so controls stay visible */
@media (max-height: 480px) and (orientation: landscape) {
  .stage { aspect-ratio: 21 / 9; max-height: 56vh; }
}

/* ==========================================================================
   21. ACCESSIBILITY & PREFERENCES
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .audio-panel__bars span { transform: scaleY(0.5); }
}

@media (prefers-contrast: more) {
  :root {
    --text-dim: #D4D4D8;
    --text-faint: #A1A1AA;
    --border: #3F3F46;
    --border-strong: #71717A;
  }
}

/* Windows High Contrast / forced colors */
@media (forced-colors: active) {
  .pill,
  .icon-btn,
  .dropzone,
  .panel,
  .controls,
  .guide__card,
  .faq { border: 1px solid CanvasText; }

  .pill[aria-pressed="true"],
  .pill.is-active,
  .icon-btn--play {
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }
}

/* Print — the player is pointless on paper, keep the guide readable */
@media print {
  .topbar,
  .ad-slot,
  .player,
  .blackout,
  .skip-link,
  .footer { display: none !important; }

  body { background: #fff; color: #000; }
  .guide__card,
  .faq { border-color: #ccc; background: #fff; }
  .guide__card p,
  .guide__card li,
  .faq details p { color: #333; }
  .faq details { border-color: #ddd; }
  .faq details:not([open]) p { display: block; }
}