:root {
  --bg: #0b0c0f;
  --bg-2: #12141a;
  --line: #23262f;
  --text: #ece8df;
  --muted: #8b8a86;
  --rec: #ff3b4e;
  --ok: #7dffb3;
  --warn: #ffcc66;
  --card: #16181f;
  --focus: #9ad7ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Sora, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a1016 0%, transparent 55%),
    var(--bg);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 22px 80px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 28px;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: -0.04em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.rec {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 0 6px #ff3b4e22;
  animation: pulse 1.8s ease-in-out infinite;
}

.top-note { display: grid; gap: 5px; justify-items: end; }
.note, .storage { color: var(--muted); font-size: 12px; max-width: 250px; text-align: right; margin: 0; }
.storage { font-family: "IBM Plex Mono", monospace; }
.storage.low { color: var(--warn); }
.notice { background: #173026; border: 1px solid #26543e; color: var(--ok); border-radius: 10px; padding: 10px 14px; font-size: 13px; }

.composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

#lookup, #watch-form, form[action="/login"] { display: flex; gap: 10px; }
#url, #channel, #token {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 14px 16px;
  font: 500 14px "IBM Plex Mono", monospace;
}
#url:focus, #channel:focus { outline: 2px solid var(--focus); border-color: transparent; }

button {
  font-family: Sora, sans-serif;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

#lookup-btn, #watch-btn, .go {
  background: var(--text);
  color: #111;
  padding: 0 18px;
}
#lookup-btn:disabled, #watch-btn:disabled, .go:disabled { opacity: 0.5; cursor: wait; }
.watch-box { margin-top: 14px; }
.hint { color: var(--muted); font-size: 12px; margin: 10px 6px 0; }
.watch-box .list { margin-top: 12px; }

.error { color: var(--rec); font-size: 13px; margin: 10px 6px 0; }

.info {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.info img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 124px;
  background: #000;
}

.meta { padding: 18px 18px 18px 0; display: flex; flex-direction: column; gap: 8px; }
.meta h3 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.meta .byline { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: auto; flex-wrap: wrap; }

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: 500 13px "IBM Plex Mono", monospace;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--rec);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rec);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-head h2 { margin: 0; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.count { font: 500 12px "IBM Plex Mono", monospace; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 10px; }
.empty-list { color: var(--muted); font-size: 13px; padding: 18px 0; }

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

.card .title { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.card .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.bar {
  height: 4px;
  background: #2a2d36;
  border-radius: 99px;
  margin: 10px 0 8px;
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--ok); width: 0; transition: width 0.3s ease; }
.bar.live > span { width: 35% !important; animation: indeterminate 1.2s ease-in-out infinite; background: var(--rec); }

.status { font: 500 11px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.04em; }
.status.downloading, .status.queued { color: var(--warn); }
.status.completed { color: var(--ok); }
.status.failed, .status.cancelled { color: var(--rec); }

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 12px;
}
.ghost.danger { color: var(--rec); }

.links { display: flex; gap: 8px; }

.now { margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.now-card {
  background: linear-gradient(180deg, #24141a 0%, var(--card) 70%);
  border: 1px solid #3a2228;
  border-radius: 16px;
  padding: 20px;
}
.now-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.now-card h2 { margin: 0; font-size: 26px; letter-spacing: -0.04em; }
.now-card p { margin: 6px 0 16px; color: var(--muted); }
.now-stats { display: grid; grid-template-columns: 140px 140px 1fr; gap: 12px; margin-bottom: 16px; }
.now-stats b { display: block; font: 500 18px "IBM Plex Mono", monospace; }
.now-stats span { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.now-stats .file b { font-size: 12px; word-break: break-all; }
.mono { font: 500 13px "IBM Plex Mono", monospace; color: var(--muted); }
.one-shot {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--card);
}
.one-shot summary { cursor: pointer; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.one-shot form { margin-top: 12px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@media (max-width: 800px) {
  .top, .info, .grid, .now-stats { display: block; }
  .top-note { justify-items: start; margin-top: 12px; }
  .note, .storage { text-align: left; max-width: none; }
  .info img { max-height: 180px; }
  .meta { padding: 16px; }
  #lookup, #watch-form { flex-direction: column; }
  #lookup-btn, #watch-btn { height: 44px; }
  .now-stats > div { margin-bottom: 10px; }
}
