:root {
  color-scheme: dark;
  --ink: #eaf2f2;
  --muted: #91a8ab;
  --line: rgba(194, 220, 219, 0.16);
  --panel: rgba(18, 33, 42, 0.76);
  --accent: #b7e0d9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% 5%, rgba(84, 117, 127, 0.28), transparent 38%),
    linear-gradient(145deg, #152630 0%, #0b151c 70%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.weather { position: fixed; inset: 0; pointer-events: none; opacity: .28; }
.weather span { position: absolute; inset: -30%; background: repeating-linear-gradient(105deg, transparent 0 18px, rgba(190, 222, 221, .13) 19px, transparent 20px 38px); animation: rain 3.4s linear infinite; }
.weather span:nth-child(2) { opacity: .6; transform: translateX(30%); animation-duration: 4.8s; }
.weather span:nth-child(3) { opacity: .35; transform: translateX(-25%); animation-duration: 6.3s; }
@keyframes rain { to { translate: -140px 180px; } }

main { position: relative; width: min(920px, calc(100% - 40px)); margin: 0 auto; padding: 9vh 0 50px; }
header { margin-bottom: 54px; }
.eyebrow, .step { margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .24em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(58px, 11vw, 112px); font-weight: 400; letter-spacing: -.055em; line-height: .9; }
h1 em { color: var(--accent); font-weight: 400; }
.lead { margin: 30px 0 0; color: #b7c6c8; font-size: clamp(15px, 2vw, 18px); line-height: 1.8; }

.studio, .player-panel { padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 4px; background: var(--panel); box-shadow: 0 28px 90px rgba(0, 0, 0, .25); backdrop-filter: blur(16px); }
.player-panel { margin-top: 18px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 400; }
.status { padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 12px; }
.status.busy::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin: 48px 0; }
.control { display: block; }
.label-row, .range-labels { display: flex; justify-content: space-between; }
.label-row { margin-bottom: 24px; font-size: 14px; }
.label-row output { color: var(--accent); font-variant-numeric: tabular-nums; }
.range-labels { margin-top: 10px; color: #71868a; font-size: 11px; }
input[type="range"] { width: 100%; height: 3px; appearance: none; background: #3b5056; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; appearance: none; border: 4px solid #15272f; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.mode-toggle { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: -12px 0 28px; padding: 18px 0; border-top: 1px solid var(--line); cursor: pointer; }
.mode-toggle span { display: grid; gap: 5px; }
.mode-toggle strong { font-size: 14px; font-weight: 600; }
.mode-toggle small { color: var(--muted); font-size: 12px; }
.mode-toggle input { position: relative; width: 46px; height: 26px; flex: 0 0 auto; appearance: none; border: 1px solid #52676b; border-radius: 99px; background: #263a40; cursor: pointer; transition: background .2s, border-color .2s; }
.mode-toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #91a8ab; transition: transform .2s, background .2s; }
.mode-toggle input:checked { border-color: var(--accent); background: rgba(183, 224, 217, .24); }
.mode-toggle input:checked::after { transform: translateX(20px); background: var(--accent); }
.mode-toggle input:disabled { cursor: not-allowed; opacity: .5; }

.generate { width: 100%; display: flex; justify-content: space-between; padding: 20px 22px; border: 0; border-radius: 2px; background: var(--accent); color: #102228; font: inherit; font-weight: 700; cursor: pointer; transition: transform .2s, background .2s; }
.generate:hover { transform: translateY(-2px); background: #d0eee8; }
.generate:disabled { cursor: wait; opacity: .55; transform: none; }
.button-time { font-variant-numeric: tabular-nums; opacity: .65; }

.blackout-trigger { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin-top: 14px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 2px; background: rgba(0, 0, 0, .22); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.blackout-trigger span { color: #050505; font-size: 15px; text-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
.blackout-trigger:hover { border-color: rgba(183, 224, 217, .4); background: rgba(0, 0, 0, .38); color: var(--ink); }
.blackout-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.blackout-screen { position: fixed; z-index: 9999; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; }
.blackout-screen:focus { outline: 0; }
.blackout-screen[hidden] { display: none; }

.download { color: var(--accent); font-size: 13px; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 3px; }
audio { width: 100%; margin-top: 34px; filter: sepia(.2) saturate(.6); }
footer { position: relative; padding: 0 20px 34px; color: #60777c; text-align: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
footer a { color: inherit; text-underline-offset: 3px; }

@media (max-width: 640px) {
  main { padding-top: 7vh; }
  header { margin-bottom: 34px; }
  .controls { grid-template-columns: 1fr; gap: 34px; margin: 38px 0; }
  .section-heading { align-items: center; }
  .status { max-width: 120px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .weather span, .status.busy::before { animation: none; }
  .generate, .blackout-trigger, .mode-toggle input, .mode-toggle input::after { transition: none; }
}
