/* ============================================================
   Hearth & Habit
   Tokens, layout, components.
   The stage is always dark so the LEDs read properly.
   The chrome flips between a warm paper surface and a
   charcoal surface depending on the hour.
   ============================================================ */

:root {
  --accent: #E0714A;
  --accent-soft: rgba(224, 113, 74, 0.16);
  --accent-line: rgba(224, 113, 74, 0.42);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --blur: saturate(150%) blur(18px);

  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Nanum Myeongjo", serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", "Roboto Mono", Menlo, monospace;

  --panel-w: 350px;
  --gap: 18px;
}

body[data-theme="night"] {
  color-scheme: dark;
  --ink: #F3F0E8;
  --ink-soft: rgba(243, 240, 232, 0.62);
  --ink-faint: rgba(243, 240, 232, 0.34);
  --surface: rgba(23, 21, 19, 0.74);
  --surface-2: rgba(243, 240, 232, 0.06);
  --surface-3: rgba(243, 240, 232, 0.11);
  --line: rgba(243, 240, 232, 0.13);
  --line-strong: rgba(243, 240, 232, 0.26);
  --stage-top: #0A0908;
  --stage-bottom: #16100C;
  --veil: rgba(8, 7, 6, 0.55);
}

body[data-theme="day"] {
  color-scheme: light;
  --ink: #201E1B;
  --ink-soft: rgba(32, 30, 27, 0.62);
  --ink-faint: rgba(32, 30, 27, 0.36);
  --surface: rgba(250, 249, 244, 0.86);
  --surface-2: rgba(32, 30, 27, 0.05);
  --surface-3: rgba(32, 30, 27, 0.09);
  --line: rgba(32, 30, 27, 0.11);
  --line-strong: rgba(32, 30, 27, 0.24);
  --stage-top: #1B1713;
  --stage-bottom: #33241A;
  --veil: rgba(20, 15, 11, 0.34);
  --accent: #C0532C;
  --accent-soft: rgba(192, 83, 44, 0.14);
  --accent-line: rgba(192, 83, 44, 0.4);
  --shadow: 0 18px 40px rgba(52, 38, 26, 0.22);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: #0A0908;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; border: 0; background: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- stage ---------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(to bottom, var(--stage-top) 0%, var(--stage-top) 46%, var(--stage-bottom) 100%);
  transition: background 1.2s ease;
}

.stage-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 108%, transparent 38%, var(--veil) 100%),
    radial-gradient(90% 60% at 50% -10%, rgba(0, 0, 0, 0.5), transparent 60%);
  transition: background 1.2s ease;
}

/* ---------- boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: radial-gradient(70% 60% at 50% 60%, rgba(30, 18, 10, 0.55), rgba(6, 5, 4, 0.94));
  backdrop-filter: blur(4px);
  transition: opacity 0.6s ease, visibility 0.6s;
}
.boot.is-out { opacity: 0; visibility: hidden; pointer-events: none; }

.boot-inner {
  text-align: center;
  padding: 0 28px;
  max-width: 420px;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.boot-mark {
  width: 46px;
  height: 46px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 62%, #FFD9A0, #E0714A 42%, #7A2B12 78%, transparent 80%);
  box-shadow: 0 0 46px rgba(224, 113, 74, 0.55);
  animation: pulse 3.4s ease-in-out infinite;
}

.boot-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: #F5F1E8;
}

.boot-copy {
  margin: 0 0 28px;
  color: rgba(245, 241, 232, 0.6);
  font-size: 15px;
  line-height: 1.6;
}

.boot-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: rgba(245, 241, 232, 0.36);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.09); opacity: 1; }
}

/* ---------- topbar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-flame {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 64%, #FFE0AE, var(--accent) 46%, rgba(122, 43, 18, 0.85) 76%, transparent 79%);
  box-shadow: 0 0 20px rgba(224, 113, 74, 0.45);
  animation: pulse 3.4s ease-in-out infinite;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  /* The bar floats straight on the canvas, which is dark in both
     themes, so this text stays light instead of following --ink. */
  color: #F3F0E8;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.brand-tag {
  font-size: 11.5px;
  color: rgba(243, 240, 232, 0.42);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .caret { width: 9px; height: 9px; opacity: 0.6; }

.icon-btn.round {
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface-2);
  border-color: transparent;
}
.icon-btn.round:hover { background: var(--surface-3); }
.icon-btn.round.sm { width: 34px; height: 34px; }
.icon-btn.round.sm svg { width: 16px; height: 16px; }

.lang { position: relative; }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 138px;
  margin: 0;
  padding: 5px;
  list-style: none;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  animation: rise 0.18s ease both;
}
.lang-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--ink-soft);
}
.lang-menu button:hover { background: var(--surface-2); color: var(--ink); }
.lang-menu button[aria-selected="true"] { color: var(--accent); font-weight: 600; }

/* ---------- scene rail ---------- */

.rail {
  position: fixed;
  z-index: 35;
  left: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  gap: 7px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.rail-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.rail-btn:hover { background: var(--surface-2); color: var(--ink); }
.rail-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.rail-index {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  opacity: 0.55;
}
.rail-btn.is-on .rail-index { opacity: 0.8; }

/* ---------- panel ---------- */

.panel {
  position: fixed;
  z-index: 38;
  top: calc(74px + env(safe-area-inset-top));
  right: 18px;
  width: var(--panel-w);
  max-height: calc(100vh - 160px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.panel-grip { display: none; }

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 7px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.tab {
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-faint);
  transition: background 0.18s, color 0.18s;
}
.tab:hover { color: var(--ink-soft); }
.tab.is-on { background: var(--surface-3); color: var(--ink); }

.panel-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Without a reserved gutter the panel gains and loses 8px of width as
     the track list grows past the scroll threshold, which reflows the
     filter chips onto a different number of rows. */
  scrollbar-gutter: stable;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.pane { display: none; animation: rise 0.22s ease both; }
.pane.is-on { display: block; }

.pane-copy {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.pane-note {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}
.pane-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

/* ---------- player ---------- */

.now {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.now-art {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 78%, rgba(255, 190, 120, 0.32), rgba(224, 113, 74, 0.14) 55%, transparent 74%);
  border: 1px solid var(--line);
}

.bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.bars i {
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.45;
}
.now-art.is-live .bars i { animation: eq 0.9s ease-in-out infinite; opacity: 1; }
.now-art.is-live .bars i:nth-child(2) { animation-delay: 0.15s; }
.now-art.is-live .bars i:nth-child(3) { animation-delay: 0.3s; }
.now-art.is-live .bars i:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq {
  0%, 100% { height: 5px; }
  50% { height: 17px; }
}

.now-meta { min-width: 0; }
.now-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seek { margin-bottom: 10px; }
.seek-time {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transition: transform 0.15s;
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 14px;
}

.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(224, 113, 74, 0.34);
  transition: transform 0.15s, filter 0.2s;
}
.play-btn:hover { filter: brightness(1.07); }
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 22px; height: 22px; }
.play-btn .ic-pause { display: none; }
.play-btn.is-playing .ic-play { display: none; }
.play-btn.is-playing .ic-pause { display: block; }

#shuffleBtn.is-on, #repeatBtn.is-on { color: var(--accent); background: var(--accent-soft); }
.repeat-one {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  transform: translate(0, 0.5px);
  display: none;
}
#repeatBtn { position: relative; }
#repeatBtn[data-repeat="one"] .repeat-one { display: block; }
#repeatBtn[data-repeat="one"] svg { opacity: 0.35; }

#muteBtn .cross { display: none; }
#muteBtn.is-muted .wave { display: none; }
#muteBtn.is-muted .cross { display: block; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.row-label { font-size: 12.5px; color: var(--ink-soft); flex: none; width: 74px; }
.row-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  width: 26px;
  text-align: right;
  flex: none;
}
.volume { margin-bottom: 0; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 0.18s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.track {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.16s;
}
.track:hover { background: var(--surface-2); }
.track.is-on { background: var(--accent-soft); }

.track-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-faint);
}
.track.is-on .track-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.track-name {
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.track.is-on .track-name { color: var(--accent); font-weight: 600; }
.track-group {
  font-size: 10.5px;
  color: var(--ink-faint);
  flex: none;
  letter-spacing: 0.02em;
}

/* ---------- buttons ---------- */

.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  transition: all 0.18s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(224, 113, 74, 0.3);
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.07); }
.btn-ghost { border-color: var(--line); color: var(--ink-soft); }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; }
.wide { width: 100%; }

.btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.btn-row .btn { flex: 1; }
.btn-row .counter { flex: none; }

.counter {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

/* ---------- timer ---------- */

.timer { text-align: center; padding: 6px 0 4px; }
.timer-phase {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.timer-clock {
  font-family: var(--font-mono);
  font-size: 54px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
}

.log {
  position: relative;
  height: 10px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.log-burn {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #7A2B12, #E0714A 60%, #FFC98A);
  box-shadow: 0 0 14px rgba(224, 113, 74, 0.6);
  transition: width 0.3s linear;
}
.timer-hint {
  margin: 10px 0 16px;
  font-size: 12px;
  color: var(--ink-faint);
}

.preset { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.stat strong {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- burn ---------- */

textarea {
  width: 100%;
  padding: 12px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.6;
  resize: none;
  transition: border-color 0.2s;
}
textarea:focus { outline: none; border-color: var(--accent-line); }
textarea::placeholder { color: var(--ink-faint); }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  transition: all 0.16s;
}
.check input:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l3 3 6-6.6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 100%;
}

/* ---------- palette ---------- */

.palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.swatch {
  height: 52px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 7px 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
  transition: transform 0.16s, box-shadow 0.16s;
}
.swatch:hover { transform: translateY(-2px); }
.swatch.is-on { box-shadow: 0 0 0 2px var(--ink), 0 0 20px rgba(0, 0, 0, 0.3); }

/* ---------- background layer ---------- */

.layer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.layer:has(+ .picker-menu:not([hidden])) { margin-bottom: 0; }

/* A native select popup is drawn by the browser, so none of the theme
   variables reach it: in night mode it opens as a bright panel with
   near white text on a near white background. This is a plain listbox
   that expands in flow instead, which also avoids being clipped by the
   scrolling panel it lives inside. */

.picker-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.18s;
}
.picker-btn:hover { border-color: var(--line-strong); background: var(--surface-3); }
.picker-btn[aria-expanded="true"] { border-color: var(--accent-line); }
.picker-btn .caret {
  width: 10px;
  height: 10px;
  flex: none;
  opacity: 0.5;
  transition: transform 0.2s;
}
.picker-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

.picker-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-menu {
  list-style: none;
  margin: 7px 0 12px;
  padding: 4px;
  max-height: 210px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  animation: rise 0.16s ease both;
}
.picker-menu::-webkit-scrollbar { width: 8px; }
.picker-menu::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.picker-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 6px;
  text-align: left;
  transition: background 0.14s;
}
.picker-opt:hover { background: var(--surface-3); }
.picker-opt[aria-selected="true"] { background: var(--accent-soft); }

.picker-opt-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-opt[aria-selected="true"] .picker-opt-name {
  color: var(--accent);
  font-weight: 600;
}
.picker-opt-group {
  flex: none;
  font-size: 10.5px;
  color: var(--ink-faint);
}

#layerBtn { flex: none; }
#layerBtn .ic-off { display: none; }
#layerBtn.is-on { color: var(--accent); background: var(--accent-soft); }
#layerBtn.is-on .ic-on { display: none; }
#layerBtn.is-on .ic-off { display: block; }

#layerState { width: 96px; font-size: 11.5px; color: var(--ink-faint); }

/* The top bar gets crowded on a phone, and the browsers that matter
   there either run the app full screen already or do not support the
   fullscreen request at all. */
@media (max-width: 880px) {
  .desk-only { display: none; }
}

/* ---------- quote card ---------- */

.quote-card {
  position: fixed;
  z-index: 45;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 40px));
  padding: 26px 26px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  animation: card 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes card {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 22px)) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.quote-kicker {
  margin: 0 0 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.quote-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.quote-by {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.quote-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
}
.quote-close:hover { background: var(--surface-2); color: var(--ink); }
.quote-close svg { width: 15px; height: 15px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  font-size: 13px;
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.ui-restore {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  font-size: 12.5px;
  color: var(--ink-soft);
  opacity: 0.5;
  transition: opacity 0.25s;
}
.ui-restore:hover { opacity: 1; }

/* ---------- hidden interface ---------- */

body[data-ui="off"] .topbar { opacity: 0; transform: translateY(-14px); pointer-events: none; }
body[data-ui="off"] .rail { opacity: 0; transform: translateY(14px); pointer-events: none; }
body[data-ui="off"] .panel { opacity: 0; transform: translateX(20px); pointer-events: none; }

/* ---------- mobile ---------- */

@media (max-width: 880px) {
  .brand-tag { display: none; }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 68vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(0);
  }
  .panel[data-open="false"] { transform: translateY(calc(100% - 64px - env(safe-area-inset-bottom))); }

  .panel-grip {
    display: block;
    position: relative;
    width: 100%;
    height: 20px;
    flex: none;
    touch-action: none;
    cursor: grab;
  }
  .panel-grip::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 99px;
    background: var(--line-strong);
    transition: background 0.2s;
  }
  .panel-grip:active { cursor: grabbing; }
  .panel-grip:active::before { background: var(--accent); }

  /* The tab strip doubles as a drag surface, so the browser must not
     claim the gesture for scrolling first. */
  .panel-tabs { touch-action: none; }

  .panel.is-dragging { transition: none; }
  .panel.is-dragging ~ .rail,
  body:has(.panel.is-dragging) .rail { transition: none; }

  .panel-body { max-height: calc(68vh - 108px); }

  .rail {
    left: 12px;
    right: 12px;
    /* Set from JS against the sheet's real height. The old value assumed
       the sheet was always 68vh tall, so a short panel left a gap and a
       tall one overlapped. */
    bottom: var(--rail-bottom, calc(78px + env(safe-area-inset-bottom)));
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: var(--radius-lg);
    transition: bottom 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail-btn { flex: none; }
  .rail-index { display: none; }

  .toast { bottom: calc(var(--rail-bottom, 78px) + 58px); }
  .ui-restore { bottom: calc(20px + env(safe-area-inset-bottom)); }

  .timer-clock { font-size: 46px; }
  .boot-title { font-size: 32px; }
}

@media (max-width: 380px) {
  .tab { font-size: 11.5px; padding: 0 2px; }
  .brand-name { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
