/* The controls around the clock. One system:
   - a quiet control sits in a bottom corner (the radio pill, the timer chip, the settings button)
   - each opens a card above itself, one at a time
   - everything is rounded: pills hold things, small round dots mark state
   - green only. Filled means focus, or on. Outlined means a break, or off. */

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 1px solid var(--acid); outline-offset: 2px; }
[hidden] { display: none !important; }

.i-pause, [aria-pressed="true"] > svg .i-play, .running > svg .i-play { display: none; }
[aria-pressed="true"] > svg .i-pause, .running > svg .i-pause { display: inline; }

/* ---------- the docks: what sits in the bottom corners ---------- */
.dock {
  position: fixed;
  z-index: 3;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--acid);
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.dock-left { left: max(16px, env(safe-area-inset-left, 0px)); }
.dock-right { right: max(16px, env(safe-area-inset-right, 0px)); }

.pill, .chip, .dock .round {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 8, 4, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0.6;
  transition: opacity 0.25s, border-color 0.25s;
}
.pill:hover, .pill:focus-within, .chip:hover, .dock .round:hover,
.pill.open, .chip[aria-expanded="true"], .dock .round[aria-expanded="true"] { opacity: 1; border-color: rgba(var(--acid-rgb), 0.42); }
/* the control whose card is open is filled in, like anything else that's on */
.chip[aria-expanded="true"] { background: var(--acid); border-color: var(--acid); color: var(--void); font-weight: 600; }
.pill.open { border-color: var(--acid); }

/* at rest they fade away (and then stop being drawn at all, blur included); a timer that's under way
   stays, faintly, so the time left is a glance away */
body.idle .dock > * { opacity: 0; visibility: hidden; transition: opacity 0.9s ease, visibility 0s 0.9s; }
body.idle.timing .chip { opacity: 0.42; visibility: visible; }
body.idle .chip-settings { opacity: 0.3; visibility: visible; }     /* always there, so the settings can always be found */

/* the radio: play, what's tuned, next */
.pill { display: flex; align-items: center; gap: 2px; padding: 0 3px; max-width: min(360px, calc(100vw - 172px)); }
.pill-play, .pill-btn { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.pill-play { border: 1px solid rgba(var(--acid-rgb), 0.5); }
.pill-play[aria-pressed="true"] { background: var(--acid); border-color: var(--acid); color: var(--void); }
.pill-btn { opacity: 0.7; }
.pill-btn:hover { opacity: 1; }
.pill-text {
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 8px;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
}
.pill-name { flex: none; }
.pill-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.pill-sub:empty { display: none; }

/* three bars that move while the radio plays */
.eq { flex: none; display: none; align-items: flex-end; gap: 2px; width: 10px; height: 10px; }
.eq b { width: 2px; height: 100%; background: currentColor; transform-origin: bottom; animation: eq 1.1s ease-in-out infinite; }
.eq b:nth-child(2) { animation-duration: 0.8s; animation-delay: -0.3s; }
.eq b:nth-child(3) { animation-duration: 1.3s; animation-delay: -0.6s; }
.pill[data-status="playing"] .eq { display: flex; }
@keyframes eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

/* the timer at a glance */
.chip { display: flex; align-items: center; gap: 8px; padding: 0 13px 0 12px; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.chip-kind { display: none; letter-spacing: 0.14em; }
.chip-settings { letter-spacing: 0.14em; text-transform: inherit; }
.chip-settings svg { flex: none; }
.dot { flex: none; width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; background: currentColor; }
[data-kind="short"] .dot, [data-kind="long"] .dot { background: transparent; }
.running .dot { animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }

.round { flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--acid); }
.round:hover { border-color: rgba(var(--acid-rgb), 0.42); }
.round-small { width: 30px; height: 30px; }
.i-shrink, [aria-pressed="true"] > svg .i-expand { display: none; }
[aria-pressed="true"] > svg .i-shrink { display: inline; }

/* ---------- the cards ---------- */
.card {
  position: fixed;
  z-index: 4;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 62px);
  width: 316px;
  max-height: calc(100dvh - 86px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 16px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(3, 11, 6, 0.76);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font: 400 10px/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s 0.18s;
}
.card.open { opacity: 1; visibility: visible; transform: none; transition: opacity 0.18s ease, transform 0.18s ease; }
.card:focus { outline: none; }
#card-clock { width: 348px; }      /* room for a three-way choice beside its label */
.card-left { left: max(16px, env(safe-area-inset-left, 0px)); }
.card-right { right: max(16px, env(safe-area-inset-right, 0px)); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 22px; }
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border: 1px solid var(--acid);
  border-radius: 999px;
  color: var(--acid);
  font-size: 9px;
  letter-spacing: 0.16em;
}
[data-kind="focus"] > .card-head .badge, .badge.on { background: var(--acid); color: var(--void); font-weight: 600; }
/* a card's name: just a label. No outline, because an outline says "press me" and it isn't a button. */
.badge-plain { height: auto; padding: 0; border: 0; border-radius: 0; color: var(--dim); }
.link { color: var(--dim); text-decoration: none; letter-spacing: inherit; text-transform: inherit; transition: color 0.2s; }
.link:hover { color: var(--acid); }

/* the timer */
.pips { display: flex; gap: 5px; }
.pips i { width: 7px; height: 7px; border: 1px solid rgba(var(--acid-rgb), 0.4); border-radius: 50%; }
.pips i.done { background: var(--acid); border-color: var(--acid); }
.pips i.now { border-color: var(--acid); }
.time {
  margin: 20px 0 16px -2px;
  color: var(--acid);
  font: 300 56px/1 var(--mono);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.meter { height: 6px; border-radius: 999px; overflow: hidden; background: rgba(var(--acid-rgb), 0.1); }
.meter i { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--acid); }
[data-kind="short"] .meter i, [data-kind="long"] .meter i { background: transparent; border: 1px solid var(--acid); }
.meter i.none { border: 0; }

.actions { display: flex; gap: 8px; margin: 16px 0 12px; }
.go {
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--acid);
  border-radius: 999px;
  background: var(--acid);
  color: var(--void);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: inherit;
  transition: filter 0.2s;
}
.go:hover { filter: brightness(1.12); }
[data-kind="short"] .go, [data-kind="long"] .go { background: transparent; color: var(--acid); font-weight: 400; }
.actions .round { width: 38px; height: 38px; opacity: 0.8; }
/* End: says what it does in words, because "reset" as an icon didn't say "and the clock comes back" */
.end {
  flex: none; height: 38px; padding: 0 15px 0 13px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--acid);
  letter-spacing: 0.16em; text-transform: inherit; opacity: 0.85; transition: border-color 0.2s, opacity 0.2s;
}
.end:hover { opacity: 1; border-color: rgba(var(--acid-rgb), 0.42); }
.end[hidden] { display: none; }
.actions .round:hover { opacity: 1; }

/* a row that opens to show more */
.more { border-top: 1px solid var(--line); }
.more summary { display: flex; align-items: center; gap: 10px; height: 42px; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more-sum { margin-left: auto; color: var(--dim); letter-spacing: 0.08em; }
.chev { flex: none; color: var(--dim); transition: transform 0.2s; }
.more[open] .chev { transform: rotate(90deg); }
.more[open] { padding-bottom: 6px; }

/* a label and its control */
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; }

.step { display: flex; align-items: center; color: var(--acid); }
.step button { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; font-size: 13px; line-height: 1; }
.step button:hover { border-color: var(--acid); }
.step button:disabled { opacity: 0.3; cursor: default; border-color: var(--line); }
.step output { min-width: 66px; text-align: center; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }

/* pick one of a few: the chosen one is filled */
.seg { display: flex; padding: 2px; border: 1px solid rgba(var(--acid-rgb), 0.4); border-radius: 999px; }
.seg button { height: 24px; padding: 0 11px; border-radius: 999px; color: var(--dim); font-size: 9px; letter-spacing: 0.12em; text-transform: inherit; white-space: nowrap; transition: color 0.18s, background 0.18s; }
.seg button:hover { color: var(--acid); }
.seg button[aria-pressed="true"] { background: var(--acid); color: var(--void); font-weight: 600; }

.switch { flex: none; width: 34px; height: 18px; padding: 3px; border: 1px solid rgba(var(--acid-rgb), 0.4); border-radius: 999px; display: flex; color: var(--acid); }
.switch i { width: 10px; height: 10px; border: 1px solid currentColor; border-radius: 50%; opacity: 0.6; transition: transform 0.18s, background 0.18s, opacity 0.18s; }
.switch[aria-checked="true"] { border-color: var(--acid); }
.switch[aria-checked="true"] i { transform: translateX(16px); background: currentColor; opacity: 1; box-shadow: 0 0 10px rgba(var(--acid-rgb), 0.7); }


/* the radio */
.screen { position: relative; height: 204px; margin: 14px 0 8px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #000; transition: height 0.25s ease, margin 0.25s ease; }
/* Off air: the space closes up. It's folded to nothing, not removed, so the player inside keeps its place. */
.screen:not(.live) { height: 0; margin: 10px 0 0; border-width: 0; visibility: hidden; }
.screen-player, .screen-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.screen-note { position: absolute; inset: 0; margin: 0; padding: 0 26px; display: grid; place-items: center; text-align: center; color: var(--dim); line-height: 1.7; letter-spacing: 0.06em; text-transform: none; pointer-events: none; }
.screen.loaded .screen-note { display: none; }

.stations { display: grid; }
.stations button { display: grid; grid-template-columns: 7px 1fr auto; align-items: center; column-gap: 12px; padding: 9px 0; text-align: left; letter-spacing: inherit; text-transform: inherit; }
.stations button + button { border-top: 1px solid rgba(var(--acid-rgb), 0.08); }
.stations .dot { grid-row: span 2; background: transparent; border-color: rgba(var(--acid-rgb), 0.4); color: var(--acid); }
.stations b { font-weight: 400; color: var(--ink); transition: color 0.2s; }
.stations span { color: var(--dim); font-size: 8px; letter-spacing: 0.1em; opacity: 0.6; }
.stations small { grid-column: 2 / -1; margin-top: 4px; font-size: 10px; color: var(--dim); letter-spacing: 0.04em; text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stations button:hover b, .stations [aria-pressed="true"] b { color: var(--acid); }
.stations [aria-pressed="true"] .dot { border-color: var(--acid); }
.stations .live .dot { background: var(--acid); box-shadow: 0 0 10px rgba(var(--acid-rgb), 0.7); }

.volume { gap: 12px; color: var(--acid); border-top: 1px solid var(--line); margin-top: 4px; min-height: 46px; }
.volume svg { flex: none; }
.volume-noise { border-top: 0; margin-top: 0; min-height: 34px; }
.noise { border-top: 1px solid var(--line); margin-top: 4px; min-height: 48px; }
.noise-pick { display: flex; align-items: center; gap: 8px; color: var(--acid); }
#noise-play[aria-pressed="true"] { background: var(--acid); border-color: var(--acid); color: var(--void); }
.noise-mark { flex: none; }
.volume output { flex: none; width: 24px; text-align: right; color: var(--dim); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.range { flex: 1; min-width: 0; height: 22px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; --at: 60%; }
.range::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--acid) var(--at), rgba(var(--acid-rgb), 0.2) var(--at)); }
.range::-moz-range-track { height: 2px; background: rgba(var(--acid-rgb), 0.2); }
.range::-moz-range-progress { height: 2px; background: var(--acid); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; margin-top: -4px; border: 0; border-radius: 50%; background: var(--acid); }
.range::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--acid); }

/* ---------- the strip along the top, and the note when a segment ends ---------- */
.strip { position: fixed; z-index: 2; top: 0; left: 0; right: 0; height: 2px; opacity: 0; pointer-events: none; transition: opacity 0.6s; }
body.timing .strip { opacity: 0.6; }
.strip i { display: block; width: 0; height: 100%; background: var(--acid); }
.strip[data-kind="short"] i, .strip[data-kind="long"] i { background: repeating-linear-gradient(90deg, var(--acid) 0 6px, transparent 6px 11px); }

.toast {
  position: fixed;
  z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 22px);
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border: 1px solid rgba(var(--acid-rgb), 0.42);
  border-radius: 999px;
  background: rgba(3, 11, 6, 0.8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--acid);
  font: 400 10px/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- the hint under the egg timer ---------- */
.hint {
  position: fixed;
  z-index: 2;
  left: 0;
  top: 0;
  transform: translate(calc(var(--x, 50vw) - 50%), var(--y, 80vh));
  padding: 10px 12px;
  color: var(--acid);
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.55;
  transition: opacity 0.3s;
}
.hint.glide { transition: opacity 0.3s, transform 0.45s ease; }      /* moving aside with the clock, for a card */
.hint:hover { opacity: 1; }
.hint kbd { display: inline-block; margin: 0 0.5em; padding: 4px 7px; border: 1px solid rgba(var(--acid-rgb), 0.55); border-radius: 999px; font: inherit; letter-spacing: 0.14em; }
body.stream .hint { display: none; }

/* The Chrome extension has no radio yet: YouTube's player can't load inside an extension page. The pill
   plays the focus noise instead, and the card keeps just the noise and the touch sounds. */
body.extension #radio-next, body.extension .screen, body.extension #radio-stations,
body.extension #card-sound .volume:not(.volume-noise), body.extension .opt-pulse { display: none; }

/* ---------- a slow GPU: no blur ----------
   Blurring what's behind a control means re-blurring the moving clock every frame. When the look has
   had to lower its quality (body.lite), the controls sit on a plain dark backing instead. */
body.lite .pill, body.lite .chip, body.lite .dock .round, body.lite .card, body.lite .toast { -webkit-backdrop-filter: none; backdrop-filter: none; }
body.lite .pill, body.lite .chip, body.lite .dock .round { background: rgba(2, 8, 4, 0.82); }
body.lite .card, body.lite .toast { background: rgba(3, 11, 6, 0.94); }

/* ---------- narrow windows: no room for the word beside the timer and the radio, so the settings
   chip is just its icon ---------- */
@media (max-width: 720px) {
  .chip-settings { width: 36px; padding: 0; justify-content: center; }
  .chip-label { display: none; }
}

/* ---------- phones: the cards become sheets across the bottom ---------- */
@media (max-width: 560px) {
  .dock { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
  .dock-left { left: 12px; }
  .dock-right { right: 12px; }
  .pill-sub { display: none; }
  body.card-open .hint { opacity: 0; pointer-events: none; }      /* the sheet covers that part of the screen */
  .card, #card-clock { left: 12px; right: 12px; width: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 58px); max-height: calc(100dvh - 76px); }
}
@media (pointer: coarse) {
  .pill, .chip, .dock .round { height: 40px; }
  .dock .round { width: 40px; }
  .chip-settings { min-width: 40px; }
  .pill-play, .pill-btn { width: 32px; height: 32px; }
  .step button { width: 32px; height: 32px; }
  .opt { min-height: 44px; }
  .seg button { height: 30px; }
}

/* ---------- stream view: just the clock, and the timer's readout if it's looping ---------- */
body.stream .dock-left, body.stream .card, body.stream .toast, body.stream #clock-open { display: none; }
body.stream .dock-right { display: none; }
body.stream.timing .dock-right { display: flex; pointer-events: none; }
body.stream .chip, body.stream.idle .chip { opacity: 0.8; padding: 0 16px 0 14px; }
body.stream .chip-kind { display: inline; }

@media (prefers-reduced-motion: reduce) {
  .dock > *, body.idle .dock > *, .card, .card.open, .toast, .hint, .hint.glide, .switch i, .chev, .seg button, .screen { transition: none; }
  .eq b, .running .dot { animation: none; }
}
