:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, sans-serif;
  --bg: #F1EEE4;
  --surface: #FBF9F3;
  --surface-alt: #F5F2EA;
  --surface-strong: #EEE9DB;
  --surface-muted: #EAE5D7;
  --ink: #1A1813;
  --ink-soft: #4C4638;
  --muted: #9A9384;
  --hint: #B0A995;
  --border: rgba(26, 24, 19, .08);
  --border-strong: rgba(26, 24, 19, .14);
  --accent: #E5B21C;
  --accent-strong: #C98A12;
  --success-bg: #E7F0E4;
  --success-fg: #3E7A3A;
  --warning-bg: #FBEFD3;
  --warning-fg: #9A6C08;
  --danger: #B23B2E;
  --danger-bg: #FBEEEC;
  --danger-border: rgba(178, 59, 46, .18);
  --dark-bg: #1A1813;
  --dark-surface: #241F17;
  --dark-text: #F1EEE4;
  --dark-muted: #B0A995;
  --dark-faint: #6E6551;
  --radius-card: 16px;
  --radius-pill: 999px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); line-height: 1.5;
  font-family: inherit; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); }
a:hover { color: #A06C08; }

.screen {
  max-width: 440px; margin: 0 auto; box-sizing: border-box;
  padding: calc(env(safe-area-inset-top) + 1.1rem) 1.1rem calc(env(safe-area-inset-bottom) + 1.5rem);
  display: flex; flex-direction: column; gap: 1rem; min-height: 100dvh;
}
h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; margin: .25rem 0; }
h2 { font-size: 1rem; font-weight: 700; margin: 0 0 .5rem; }

form { display: flex; flex-direction: column; gap: 0.75rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
input, select {
  padding: 0.65rem 0.75rem; font-size: 1rem; font-family: inherit; color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface);
}
button {
  padding: 0.65rem 1rem; font-size: .95rem; font-weight: 600; font-family: inherit;
  border: 1.5px solid var(--border-strong); border-radius: 14px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.primary {
  background: var(--ink); color: var(--bg); border-color: transparent;
  padding: 1rem; border-radius: 16px; font-size: 1rem; box-shadow: 0 8px 22px rgba(26, 24, 19, .18);
}
button.primary:disabled { background: #DAD4C5; color: #A69F8D; box-shadow: none; }
button.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
button.link-muted { border: none; background: none; padding: .2rem 0; color: var(--muted); font-weight: 600; text-decoration: underline; }

.muted { color: var(--muted); font-size: 0.85rem; }
.hint { color: var(--hint); font-size: .8rem; line-height: 1.4; }
.banner { padding: 0.7rem 0.85rem; border-radius: 14px; font-size: .85rem; }
.banner--error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.banner--warning { background: var(--warning-bg); color: var(--warning-fg); border: 1px solid rgba(154, 108, 8, .25); }
.spinner { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1rem; }

.app-header {
  display: flex; align-items: center; gap: .7rem;
  padding: calc(env(safe-area-inset-top) + .9rem) 1.1rem .8rem;
  margin: calc(-1 * (env(safe-area-inset-top) + 1.1rem)) -1.1rem 0;
  border-bottom: 1px solid var(--border); background: var(--surface-alt);
}
.app-header > .icon-btn { margin-left: auto; }
.app-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: var(--surface-strong); }
.app-title { display: flex; flex-direction: column; line-height: 1; }
.app-title__main { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.app-title__sub { font-size: .72rem; font-weight: 500; color: var(--muted); margin-top: .25rem; }
.screen-header { display: flex; align-items: center; gap: .7rem; }
.screen-header h1 { margin: 0; }

.field-group { display: flex; flex-direction: column; gap: .6rem; }
.field-label { font-size: .72rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; margin-bottom: .1rem; }

.pill-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill {
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface);
  color: var(--ink-soft); font-family: inherit; font-size: .85rem; font-weight: 500;
  padding: .6rem .9rem; cursor: pointer;
}
.pill--active { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.select-card {
  display: flex; align-items: center; gap: .7rem; padding: .9rem;
  border: 1.5px solid var(--border-strong); border-radius: 14px;
  background: var(--surface); cursor: pointer;
}
.select-card--active { border-color: var(--ink); background: var(--surface-alt); }
.select-card--disabled { opacity: .5; pointer-events: none; }

.episode-pick-item {
  width: 100%; text-align: left; border: none; background: transparent; color: var(--ink);
  margin-bottom: .25rem; display: flex; justify-content: space-between;
}
.episode-pick-item--active { background: var(--ink); color: var(--bg); }

.icon-btn {
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none; font-family: inherit;
}
.icon-btn--light { background: var(--surface-muted); color: var(--ink-soft); }
.icon-btn--dark { background: rgba(241, 238, 228, .1); color: var(--dark-text); }
.icon-btn--invert { background: var(--dark-text); color: var(--dark-bg); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }

.progress-track { height: 6px; border-radius: var(--radius-pill); background: var(--surface-muted); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-pill); }
.progress-fill--building { background: #E5372A; }
.progress-fill--building-indeterminate { background: #E5372A; width: 35%; animation: pirolo-pulse 1.8s ease-in-out infinite; }
.progress-fill--player { background: var(--accent); }

.cta-fixed { margin-top: 2rem; }

.badge { font-size: .72rem; font-weight: 600; letter-spacing: .02em; padding: .3rem .6rem; border-radius: 999px; background: var(--surface-muted); color: var(--ink-soft); white-space: nowrap; }
.badge--ready { background: var(--success-bg); color: var(--success-fg); }
.badge--building { background: var(--warning-bg); color: var(--warning-fg); }
.badge--needs_confirmation { background: var(--warning-bg); color: var(--warning-fg); }
.badge--failed { background: var(--surface-muted); color: var(--muted); }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .65rem; }
.podcast-card { display: flex; flex-direction: column; gap: .6rem; cursor: default; }
.podcast-card--clickable { cursor: pointer; }
.podcast-card__row { display: flex; align-items: flex-start; gap: .7rem; }
.podcast-card__main { flex: 1; min-width: 0; }
.podcast-card__title {
  font-size: .95rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.3;
  background: none; border: none; padding: 0; text-align: left; color: inherit; cursor: pointer; font-family: inherit;
}
.podcast-card__meta { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.podcast-card__actions { display: flex; gap: 1rem; }
.avatar { flex: none; width: 56px; height: 56px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.profile-card { display: flex; align-items: center; gap: .9rem; }
.profile-card__email { font-size: .95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dark-screen {
  position: fixed; inset: 0; max-width: 440px; margin: 0 auto; overflow: hidden;
  display: flex; flex-direction: column; background: var(--dark-bg); color: var(--dark-text);
}
.dark-header { display: flex; align-items: center; gap: .6rem; padding: calc(env(safe-area-inset-top) + 1rem) .9rem .5rem; flex: none; }
.dark-eyebrow { flex: 1; text-align: center; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dark-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .6rem 2rem; min-height: 0; gap: 1.4rem; overflow-y: auto; }
.dark-footer { flex: none; padding: .4rem 1.1rem calc(env(safe-area-inset-bottom) + 1.3rem); display: flex; flex-direction: column; gap: .9rem; }
.dark-art { width: 100%; max-width: 280px; aspect-ratio: 1; border-radius: 22px; background: linear-gradient(160deg, #2A2620, var(--dark-bg)); border: 1px solid rgba(241, 238, 228, .1); display: flex; align-items: center; justify-content: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.dark-art img { width: 44%; height: 44%; object-fit: contain; opacity: .92; }
.dark-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; text-align: center; }
.dark-subtitle { font-size: .8rem; font-weight: 500; color: var(--dark-muted); margin-top: .4rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transport-row { display: flex; align-items: center; justify-content: center; gap: .85rem; }
.transport-time { display: flex; justify-content: space-between; margin-top: .5rem; font-size: .72rem; color: var(--dark-faint); font-variant-numeric: tabular-nums; }
.seek-track { height: 5px; border-radius: 999px; background: rgba(241, 238, 228, .16); overflow: hidden; cursor: pointer; }

.ring-wrap { position: relative; width: 170px; height: 170px; display: flex; align-items: center; justify-content: center; }
.ring-halo { position: absolute; inset: 0; border-radius: 999px; }
.ring-core { position: relative; width: 130px; height: 130px; border-radius: 999px; background: var(--dark-surface); border: 1px solid rgba(241, 238, 228, .12); display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }

.command-row { display: flex; gap: .6rem; }
.command-btn { flex: 1; padding: .8rem .4rem; border: none; border-radius: 13px; font-family: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; background: rgba(241, 238, 228, .08); color: var(--dark-text); }
.conn-pill { display: flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 600; flex: none; }
.conn-dot { width: 7px; height: 7px; border-radius: 999px; }
.wake-hint { margin: .6rem 1rem 0; padding: .6rem .8rem; border-radius: 12px; background: rgba(229, 178, 28, .12); border: 1px solid rgba(229, 178, 28, .28); font-size: .72rem; color: var(--accent); display: flex; align-items: center; gap: .5rem; }

.loading-splash { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem; gap: .25rem; }
.loading-splash__gif { width: 180px; height: 180px; object-fit: contain; }
.loading-splash__title { margin-top: .8rem; font-size: 1.8rem; font-weight: 700; letter-spacing: -.03em; animation: pirolo-rise .6s ease both; }
.loading-splash__label { font-size: .85rem; font-weight: 500; color: var(--muted); text-align: center; animation: pirolo-pulse 1.6s ease-in-out infinite; }
.loading-splash__bar { width: 200px; margin-top: 1.8rem; }
.loading-splash__fill { width: 55%; animation: pirolo-pulse 1.6s ease-in-out infinite; }

@keyframes pirolo-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pirolo-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pirolo-ring-pulse { 0%, 100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.12); opacity: .85; } }
@keyframes pirolo-ring-listen { 0% { transform: scale(.96); opacity: .7; } 50% { transform: scale(1.18); opacity: .25; } 100% { transform: scale(.96); opacity: .7; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
