/* WhiteNoise prototype — tokens mirror the Figma "Colors" and "Spacing & Radius" collections */
:root {
  --bg-base: #eef1fa;
  --bg-surface: #ffffff;
  --bg-surface-alt: #e4e8f6;
  --bg-hero: #4b3fcf;
  --bg-hero-tile: #5b50de;
  --brand-primary: #4b3fcf;
  --brand-accent: #5ec8f2;
  --brand-on-primary: #ffffff;
  --text-primary: #1e1b4b;
  --text-secondary: #7c80a8;
  --text-on-hero: #ffffff;
  --text-on-hero-muted: #c9c5ff;
  --line-border: #dce1f0;
  --line-ring: #6a5fe8;
  --state-danger: #e5484d;

  /* Logo (Pipo baby sleep) — light-theme variant */
  --logo-tile: #4c3dcc;
  --logo-moon: #ffffff;
  --logo-eye: #4c3dcc;
  --logo-cheek: #85bfff;
  --logo-word: #4c3dcc;
  --logo-sub: #85bfff;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 20px;
  --radius-2xl: 22px;
  --radius-pill: 30px;
  --radius-sheet: 36px;

  --shadow-card: 0 8px 24px rgba(74, 64, 207, 0.08);
  --shadow-primary: 0 10px 24px -6px rgba(74, 64, 207, 0.3);
  --shadow-tabbar: 0 -4px 20px rgba(31, 26, 77, 0.08);
  --shadow-floating: 0 12px 24px rgba(26, 13, 102, 0.35);
  --shadow-knob: 0 2px 4px rgba(0, 0, 0, 0.15);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg-base: #14113a;
  --bg-surface: #211c5a;
  --bg-surface-alt: #2b2572;
  --bg-hero: #2e2680;
  --bg-hero-tile: #3a3194;
  --brand-primary: #7a70ff;
  --text-primary: #ffffff;
  --text-secondary: #a9a5e3;
  --text-on-hero-muted: #b7b2f0;
  --line-border: #332d7c;
  --line-ring: #4c43a8;
  --state-danger: #ff6b6e;
  --logo-word: #ffffff;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
/* Hide scrollbars everywhere in the app; scrolling still works (touch, wheel, keyboard). */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
p, h1, h2, h3 { margin: 0; }
.icon { width: 24px; height: 24px; flex-shrink: 0; display: block; }

/* ---------- Device shell ---------- */
.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-base);
}
.statusbar { display: none; }

@media (min-width: 600px) and (min-height: 700px) {
  body {
    display: grid;
    place-items: center;
    background: #d9dcef;
    min-height: 100vh;
  }
  :root[data-theme="dark"] body { background: #0a0820; }
  .app {
    width: 393px;
    height: 852px;
    border-radius: 48px;
    box-shadow: 0 30px 80px rgba(20, 17, 58, 0.35), 0 0 0 10px #111;
    --safe-top: 46px;
    --safe-bottom: 20px;
  }
  .statusbar {
    position: absolute; z-index: 50; top: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 26px 8px 30px; pointer-events: none;
    font-weight: 600; font-size: 16px; color: var(--sb-color, var(--text-primary));
  }
  .statusbar .ind { display: flex; gap: 6px; align-items: center; }
  .statusbar .sig { display: flex; gap: 2px; align-items: flex-end; }
  .statusbar .sig i { width: 3px; border-radius: 1px; background: currentColor; display: block; }
  .statusbar .bat { width: 25px; height: 12px; border: 1px solid currentColor; border-radius: 4px; padding: 1px 2px; display: flex; align-items: center; }
  .statusbar .bat i { height: 8px; width: 17px; border-radius: 2px; background: currentColor; display: block; }
  .app::after {
    content: ""; position: absolute; z-index: 50; left: 50%; bottom: 8px; transform: translateX(-50%);
    width: 134px; height: 5px; border-radius: 3px; background: var(--hi-color, var(--text-primary)); pointer-events: none;
  }
}

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  background: var(--bg-base);
  overflow: hidden;
}
.screen.active { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(110px + var(--safe-bottom)); }
.screen.hero-bg { background: var(--bg-hero); color: var(--text-on-hero); }

.rings { position: absolute; pointer-events: none; overflow: visible; }
.rings circle, .rings ellipse { fill: none; stroke: var(--line-ring); stroke-width: 1; }


/* ---------- Brand logo ---------- */
.brand-logo { display: block; height: 32px; width: calc(32px * 12252 / 4201.21); flex-shrink: 0; }
/* On the purple hero surfaces (both themes) the tile inverts so the mark stays visible. */
.brand-logo.on-hero { --logo-tile: #eef1fa; --logo-moon: #4b3fcf; --logo-eye: #eef1fa; --logo-word: #eef1fa; --logo-cheek: #85bfff; --logo-sub: #85bfff; }
.hero-header .brand-logo { height: 36px; width: calc(36px * 12252 / 4201.21); }
.settings-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 0 0; }
.settings-brand .version { padding: 0; }

/* ---------- Orbs ---------- */
.orb-wrap { position: relative; display: grid; place-items: center; }
.orb-wrap > .rings { left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: -1; }
.orb-wrap > .orb { z-index: 1; }
.link-muted { font-size: 13px; font-weight: 500; color: var(--text-on-hero-muted); padding: 6px 0; }
.orb {
  position: relative; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.orb .orb-inner {
  border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-hero-tile);
  box-shadow: 0 14px 30px rgba(20, 12, 90, 0.35);
}

.sheet {
  position: relative; z-index: 2;
  background: var(--bg-surface); color: var(--text-primary);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 32px 24px calc(28px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 20px;
}
.overline { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-primary); }
.h1 { font-size: 28px; font-weight: 600; }
.body { font-size: 14px; color: var(--text-secondary); }
.caption { font-size: 12px; color: var(--text-secondary); }
.heading { display: flex; flex-direction: column; gap: 6px; }

.textfield {
  display: flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 16px;
  background: var(--bg-base);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.textfield:focus-within { border-color: var(--brand-primary); }
.textfield .icon { width: 22px; height: 22px; color: var(--brand-primary); }
.textfield input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 16px; font-weight: 600; color: var(--text-primary); caret-color: var(--brand-primary);
}
.textfield input::placeholder { color: var(--text-secondary); font-weight: 400; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 58px; width: 100%;
  background: var(--brand-primary); color: var(--brand-on-primary);
  border-radius: var(--radius-xl);
  font-size: 16px; font-weight: 600;
  box-shadow: var(--shadow-primary);
  transition: transform .1s, opacity .15s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }
.btn-primary .icon { width: 18px; height: 18px; }
.btn-ghost { height: 52px; width: 100%; border-radius: var(--radius-xl); font-weight: 600; color: var(--text-secondary); }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--bg-hero); color: var(--text-on-hero);
  border-radius: 0 0 var(--radius-sheet) var(--radius-sheet);
  padding: calc(var(--safe-top) + 18px) 24px 26px;
  display: flex; flex-direction: column; gap: 18px;
}
.hero .rings { right: -270px; top: -258px; width: 640px; height: 576px; }
.hero > *:not(.rings) { position: relative; z-index: 1; }
.hero-header { display: flex; justify-content: space-between; align-items: center; }
.avatar-btn {
  width: 44px; height: 44px; border-radius: 22px;
  background: var(--bg-hero-tile); border: 2px solid var(--text-on-hero);
  display: grid; place-items: center; color: var(--text-on-hero);
}
.avatar-btn .icon { width: 22px; height: 22px; }
.greeting h1 { font-size: 28px; font-weight: 600; line-height: 1.3; }
.greeting p { font-size: 14px; color: var(--text-on-hero-muted); margin-top: 4px; }

.continue-card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--bg-hero-tile); border-radius: var(--radius-2xl);
  text-align: left; width: 100%;
}
.continue-card .ic {
  width: 48px; height: 48px; border-radius: 16px; background: rgba(255, 255, 255, 0.14);
  display: grid; place-items: center; color: var(--text-on-hero); flex-shrink: 0;
}
.continue-card .txt { flex: 1; min-width: 0; }
.continue-card .t1 { font-size: 16px; font-weight: 600; }
.continue-card .t2 { font-size: 12px; color: var(--text-on-hero-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-btn {
  width: 44px; height: 44px; border-radius: 22px; flex-shrink: 0;
  background: var(--brand-accent); color: #ffffff; display: grid; place-items: center;
}
.play-btn .icon { width: 20px; height: 20px; }

.section { padding: 22px 24px 0; display: flex; flex-direction: column; gap: 16px; }
.title-row { display: flex; justify-content: space-between; align-items: center; }
.title-row h2 { font-size: 20px; font-weight: 600; }
.title-row button { font-size: 13px; font-weight: 500; color: var(--brand-primary); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -24px; padding: 0 24px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 16px; border-radius: var(--radius-lg);
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
}
.chip.selected { background: var(--brand-primary); color: var(--brand-on-primary); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  min-height: 116px; padding: 13px 10px 13px 12px;
  background: var(--bg-surface); border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card); text-align: left;
  transition: transform .1s;
}
.tile:active { transform: scale(0.97); }
.tile .ic {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--bg-surface-alt); color: var(--brand-primary);
  display: grid; place-items: center;
}
.tile .ic .icon { width: 22px; height: 22px; }
.tile .n { font-size: 13px; font-weight: 600; line-height: 1.3; }
.tile .d { line-height: 1.3; }
.tile .d { font-size: 12px; color: var(--text-secondary); }
.tile.selected { background: var(--bg-hero); box-shadow: none; }
.tile.selected .ic { background: var(--bg-hero-tile); color: var(--text-on-hero); }
.tile.selected .n { color: var(--text-on-hero); }
.tile.selected .d { color: var(--text-on-hero-muted); }
.tile .eq { display: none; }
.tile.selected.playing .eq { display: flex; gap: 2px; align-items: flex-end; height: 12px; margin-left: auto; }
.eq i { width: 3px; background: var(--brand-accent); border-radius: 2px; animation: eq 1s ease-in-out infinite; display: block; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 12px; } }
.tile-top { display: flex; width: 100%; align-items: flex-start; }


/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between;
  padding: 12px 30px calc(12px + var(--safe-bottom));
  min-height: 90px;
  background: var(--bg-surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-tabbar);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-secondary); font-size: 11px; font-weight: 500; min-width: 56px; }
.tab.active { color: var(--brand-primary); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 24px 8px;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: grid; place-items: center;
  background: var(--bg-surface); border: 1px solid var(--line-border); color: var(--text-primary);
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn.tinted { background: var(--bg-hero-tile); border: 0; color: var(--text-on-hero); }
.icon-btn.placeholder { visibility: hidden; }

/* ---------- Sleep Timer ---------- */
#timer .scroll { display: flex; flex-direction: column; align-items: center; padding-bottom: calc(24px + var(--safe-bottom)); }
#timer.from-tab .scroll { padding-bottom: calc(110px + var(--safe-bottom)); }
.pill-sound {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px;
  background: var(--bg-surface); border-radius: 20px; box-shadow: var(--shadow-card);
  font-size: 13px; font-weight: 600;
}
.pill-sound .icon { width: 18px; height: 18px; color: var(--brand-primary); }
.pill-sound .chg { color: var(--brand-primary); font-weight: 500; }

.dial { position: relative; width: 250px; height: 250px; margin-top: 20px; touch-action: none; user-select: none; }
.dial svg { position: absolute; inset: 0; overflow: visible; }
.dial .track { fill: none; stroke: var(--bg-surface-alt); stroke-width: 35; }
.dial .progress { fill: none; stroke: var(--brand-primary); stroke-width: 18; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 125px 125px; }
.dial .face {
  position: absolute; left: 35px; top: 35px; width: 180px; height: 180px; border-radius: 50%;
  background: var(--bg-surface); box-shadow: 0 16px 32px rgba(74, 64, 207, 0.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dial .face .v { font-size: 60px; font-weight: 600; line-height: 1; }
.dial .face .u { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-top: 4px; }
.dial .knob {
  position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: #fff; border: 5px solid var(--brand-primary); box-shadow: var(--shadow-knob);
  cursor: grab;
}
.presets { display: flex; gap: 11px; justify-content: center; padding: 18px 0; margin-top: 6px; }
.preset {
  width: 60px; height: 78px; border-radius: var(--radius-pill);
  background: var(--bg-surface); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.preset .v { font-size: 20px; font-weight: 600; color: var(--brand-primary); }
.preset .u { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.preset.selected { background: var(--bg-hero); box-shadow: none; }
.preset.selected .v { color: var(--text-on-hero); }
.preset.selected .u { color: var(--text-on-hero-muted); }

.card {
  width: 100%;
  background: var(--bg-surface); border-radius: var(--radius-2xl); box-shadow: var(--shadow-card);
  padding: 4px 16px;
}
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--line-border); }
.row .ic {
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--bg-surface-alt); color: var(--brand-primary); display: grid; place-items: center;
}
.row .ic .icon { width: 20px; height: 20px; }
.row .txt { flex: 1; min-width: 0; }
.row .t1 { font-size: 14px; font-weight: 600; }
.row .t2 { font-size: 12px; color: var(--text-secondary); }
.row .val { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.row .val .icon { width: 16px; height: 16px; }

.toggle {
  position: relative; width: 50px; height: 30px; border-radius: 15px; flex-shrink: 0;
  background: var(--bg-surface-alt); transition: background .2s;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-knob); transition: transform .2s;
}
.toggle[aria-checked="true"] { background: var(--brand-primary); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }

.timer-body { width: 100%; padding: 0 24px; display: flex; flex-direction: column; align-items: center; }
.timer-body .card { margin-top: 6px; }
.timer-body .btn-primary { margin-top: 24px; }

/* ---------- Now Playing ---------- */
#playing .rings { width: 1000px; height: 1000px; }
/* Fill the whole screen: the orb area grows to take the free height, controls sit near the bottom. */
#playing .content {
  position: relative; z-index: 1; flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden; padding-bottom: calc(28px + var(--safe-bottom));
}
#playing .topbar { width: 100%; flex-shrink: 0; }
#playing .topbar h1 { font-size: 16px; }
.orb-np-wrap { flex: 1 1 0; min-height: 190px; width: 100%; container-type: size; }
.orb-np {
  --orb: clamp(170px, min(86cqh, 82cqw), 340px);
  width: var(--orb); height: var(--orb); background: rgba(255, 255, 255, 0.08);
  will-change: transform;
}
.orb-np .mid { width: calc(var(--orb) * 0.79); height: calc(var(--orb) * 0.79); border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); }
.orb-np .orb-inner { width: calc(var(--orb) * 0.58); height: calc(var(--orb) * 0.58); }
.orb-np .icon { width: calc(var(--orb) * 0.23); height: calc(var(--orb) * 0.23); color: var(--text-on-hero); }
#playing .rings circle { vector-effect: non-scaling-stroke; }
.np-title { text-align: center; padding-top: 8px; flex-shrink: 0; }
.np-title h2 { font-size: 28px; font-weight: 600; }
.np-title p { font-size: 14px; color: var(--text-on-hero-muted); }
.remaining { width: 100%; padding: clamp(16px, 3.5cqh, 32px) 24px 0; flex-shrink: 0; }
.remaining .row-r { display: flex; justify-content: space-between; align-items: flex-end; }
.remaining .time { font-size: 40px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.remaining .of { font-size: 13px; font-weight: 500; color: var(--text-on-hero-muted); padding-bottom: 6px; }
.bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand-accent); border-radius: 4px; width: 0; transition: width .3s linear; }
.volume { width: 100%; display: flex; align-items: center; gap: 14px; padding: clamp(18px, 3.5cqh, 32px) 24px 0; flex-shrink: 0; color: var(--text-on-hero-muted); }
.volume .icon { width: 20px; height: 20px; }
input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 24px; background: transparent; margin: 0;
  --pct: 57%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, #fff var(--pct), rgba(255, 255, 255, 0.18) var(--pct));
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: #fff; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-top: -8px;
  box-shadow: var(--shadow-knob);
}
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }
.controls { display: flex; align-items: center; gap: 40px; padding-top: clamp(20px, 4cqh, 40px); flex-shrink: 0; }
.ctrl { width: 58px; height: 58px; border-radius: var(--radius-xl); background: var(--bg-hero-tile); display: grid; place-items: center; color: var(--text-on-hero); }
.ctrl.fav { color: var(--brand-accent); }
.big-play {
  width: 84px; height: 84px; border-radius: 42px; background: #fff; color: #4b3fcf;
  display: grid; place-items: center; box-shadow: var(--shadow-floating);
}
.big-play .icon { width: 32px; height: 32px; }

.lock-overlay {
  position: absolute; inset: 0; z-index: 40; display: none;
  flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px;
  padding-bottom: calc(60px + var(--safe-bottom));
  background: rgba(14, 10, 50, 0.55); color: #fff; text-align: center;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.lock-overlay.show { display: flex; }
.lock-ring {
  position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14);
}
.lock-ring svg.prog { position: absolute; inset: 0; transform: rotate(-90deg); }
.lock-ring svg.prog circle { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 251; stroke-dashoffset: 251; }
.lock-ring.holding svg.prog circle { transition: stroke-dashoffset 1.2s linear; stroke-dashoffset: 0; }
.lock-overlay .t { font-weight: 600; }
.lock-overlay .s { font-size: 13px; color: #c9c5ff; }

/* ---------- Settings ---------- */
.page-header { padding: calc(var(--safe-top) + 18px) 24px 0; }
.page-header h1 { font-size: 28px; font-weight: 600; }
.page-header p { font-size: 13px; color: var(--text-secondary); }
.settings-section { padding: 18px 24px 0; display: flex; flex-direction: column; gap: 10px; }
.settings-section > .label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-secondary); text-transform: uppercase; }
.segment { display: flex; gap: 4px; padding: 5px; background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.segment button {
  flex: 1; height: 46px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.segment button .icon { width: 18px; height: 18px; }
.segment button.selected { background: var(--bg-hero); color: var(--text-on-hero); font-weight: 600; }
.version { text-align: center; font-size: 12px; color: var(--text-secondary); padding: 24px 0 0; }

/* ---------- Favorites ---------- */
.fav-list { padding: 22px 24px 0; display: flex; flex-direction: column; gap: 12px; }
.fav-row { position: relative; height: 68px; border-radius: var(--radius-2xl); overflow: hidden; box-shadow: var(--shadow-card); }
.fav-remove-action {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 18px;
  background: var(--state-danger); color: #fff; border-radius: var(--radius-2xl);
}
.fav-remove-action span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; width: 56px; }
.fav-remove-action .icon { width: 20px; height: 20px; }
.fav-card {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--bg-surface); border-radius: var(--radius-2xl);
  transition: transform .22s ease; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.fav-card.dragging { transition: none; }
.fav-card .ic { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--bg-surface-alt); color: var(--brand-primary); display: grid; place-items: center; flex-shrink: 0; }
.fav-card .ic .icon { width: 22px; height: 22px; }
.fav-card .txt { flex: 1; min-width: 0; }
.fav-card .t1 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-card .t2 { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-heart { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; color: var(--brand-primary); flex-shrink: 0; }
.fav-heart .icon { width: 22px; height: 22px; }
.fav-play { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-primary); color: #fff; flex-shrink: 0; }
.fav-play .icon { width: 18px; height: 18px; }
.fav-hint { display: flex; align-items: center; gap: 8px; padding: 22px 24px 0; font-size: 12px; color: var(--text-secondary); }
.fav-hint .icon { width: 14px; height: 14px; }
.empty { margin: 40px 24px 0; padding: 32px 24px; text-align: center; background: var(--bg-surface); border-radius: var(--radius-2xl); box-shadow: var(--shadow-card); }
.empty .ic { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; background: var(--bg-surface-alt); color: var(--brand-primary); display: grid; place-items: center; }
.empty .t1 { font-weight: 600; font-size: 16px; }
.empty .t2 { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---------- Modal sheet ---------- */
.modal { position: absolute; inset: 0; z-index: 60; display: none; flex-direction: column; justify-content: flex-end; background: rgba(10, 8, 31, 0.55); }
.modal.show { display: flex; animation: fadeIn .2s ease; }
.modal .sheet { gap: 20px; padding: 32px 24px calc(40px + var(--safe-bottom)); }
.sheet-actions { display: flex; flex-direction: column; gap: 4px; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; z-index: 70; left: 24px; right: 24px; bottom: calc(110px + var(--safe-bottom));
  padding: 14px 16px; border-radius: 16px;
  background: #1e1b4b; color: #fff; font-size: 13px; font-weight: 500; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: all .25s;
}
:root[data-theme="dark"] .toast { background: #fff; color: #1e1b4b; }
.toast.show { opacity: 1; transform: none; }
.toast.has-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.toast.has-action.show { pointer-events: auto; }
.toast-action { font-weight: 600; color: var(--brand-accent); padding: 4px 2px; flex-shrink: 0; }
