:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --card: #15181d;
  --line: #262b33;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --waiting: #ff6b5b;
  --working: #f5b942;
  --idle: #4cc38a;
  --ended: #6b7480;
  --accent: #6ea8ff;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.6rem 0 0.6rem; }
h3 { font-size: 1rem; margin: 0.25rem 0; }
h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0.8rem 0 0.2rem; }
p { margin: 0.3rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--waiting); }
.pre { white-space: pre-wrap; word-break: break-word; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

header.top {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
header.top nav { margin-left: auto; display: flex; gap: 1rem; font-size: 0.9rem; }
header.top .back { font-size: 0.95rem; }
.live { color: var(--ended); font-size: 0.7rem; }
.live.on { color: var(--idle); }

main.list, main.narrow { max-width: 760px; margin: 0 auto; padding: 0 1rem 3rem; }
main.narrow { max-width: 480px; padding-top: 1.5rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0.85rem 1rem; margin-bottom: 0.6rem; }
.item { cursor: pointer; border-left: 4px solid var(--ended); }
.item.state-waiting { border-left-color: var(--waiting); }
.item.state-working { border-left-color: var(--working); }
.item.state-idle { border-left-color: var(--idle); }
.item .meta { font-size: 0.8rem; color: var(--muted); }
.item .detail { color: #c4cad1; font-size: 0.92rem; }
.item .more { border-top: 1px solid var(--line); margin-top: 0.6rem; padding-top: 0.2rem; font-size: 0.92rem; }
.badge { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--line); color: var(--text); }
.badge.state-waiting { background: var(--waiting); color: #1a0703; }
.badge.state-working { background: var(--working); color: #1f1402; }
.badge.state-idle { background: var(--idle); color: #04170d; }
.count { color: var(--text); }
.empty { font-size: 0.9rem; }

.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.6rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
input { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem; }
button, .button {
  font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #06101f; border: 0; border-radius: 10px; padding: 0.6rem 1rem; display: inline-block;
}
button.secondary, .button.secondary { background: var(--line); color: var(--text); }
ol { padding-left: 1.2rem; }
ol li { margin: 0.3rem 0; }
