/* One stylesheet, no build step — same as the other two apps.
   Dark by default with a light mode that follows the system. */

:root {
  --bg: #0e1015;
  --surface: #171a22;
  --surface-2: #1f232d;
  --line: #2b303c;
  --text: #e7e9ee;
  --dim: #949aa8;
  --accent: #5cc8a8;
  --warn: #e0a458;
  --danger: #e06c75;
  --radius: 12px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --line: #dce0e7;
    --text: #171a22;
    --dim: #626977;
    --accent: #1d8f70;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; margin: 0; letter-spacing: 0.2px; }

main { padding: 12px 16px 220px; }

/* --- lists --- */

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.episode {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 12px 14px;
  cursor: pointer;
}
.episode:active { background: var(--surface-2); }

.show { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.title { font-weight: 600; margin: 2px 0 6px; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.dim { color: var(--dim); }
.pad { padding: 0 2px; }

.badge {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}
.badge.clean { background: var(--surface-2); color: var(--dim); }
.badge.waiting { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

/* Progress under a partly-played episode. */
.rail { height: 3px; background: var(--surface-2); border-radius: 2px; margin-top: 8px; }
.rail i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.empty { text-align: center; padding: 48px 24px; }
.empty p { margin: 6px 0; }

/* --- forms --- */

.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; width: 100%; }
li.row { padding: 12px 14px; }

.field { display: grid; gap: 6px; margin: 14px 0 4px; }
.field > span { font-weight: 600; font-size: 13px; }
.field.row { display: flex; }

input[type="text"], input[type="url"] {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

button {
  background: var(--accent);
  color: #04120d;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.5; }
button.ghost { background: var(--surface-2); color: var(--text); }
button.ghost.danger { color: var(--danger); }

/* --- player --- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(56px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: grid;
  gap: 8px;
  z-index: 4;
}
.np { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scrub {
  position: relative;
  height: 22px;
  cursor: pointer;
  touch-action: none;
}
/* The bar itself is a thin line; the tall hit area above keeps it tappable. */
.scrub::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 9px;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
}
.scrub .ad {
  position: absolute;
  top: 9px;
  height: 4px;
  background: var(--warn);
  border-radius: 2px;
  opacity: 0.85;
}
.scrub .head {
  position: absolute;
  top: 5px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--accent);
}

.controls { display: flex; gap: 8px; align-items: center; }

/* --- tabs --- */

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 5;
}
.tabs button {
  background: none;
  color: var(--dim);
  border-radius: 0;
  padding: 16px 0;
  font-size: 13px;
}
.tabs button[aria-selected="true"] { color: var(--accent); }

/* --- toast --- */

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(150px + env(safe-area-inset-bottom));
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.toast button { padding: 6px 12px; }
[hidden] { display: none !important; }
