:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --card: #101010;
  --text: #f5f5f5;
  --muted: #8d8d8d;
  --accent: #d4af37;
  --line: #1a1a1a;
  --radius: 10px;
  --font: "Segoe UI", Helvetica, sans-serif;
}
html[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; }
.top, footer { display: flex; align-items: center; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--bg); }
footer { border-bottom: 0; border-top: 1px solid var(--line); color: var(--muted); margin-top: auto; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 650; letter-spacing: .04em; }
.brand img { height: 36px; width: auto; color: var(--text); }
nav { display: flex; gap: 8px; flex: 1; }
nav a, button, .chip { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; text-decoration: none; font: inherit; cursor: pointer; }
nav a.active, button.primary { background: var(--accent); color: #000; border-color: var(--accent); }
main { padding: 28px; max-width: 1100px; }
h1 { font-weight: 560; letter-spacing: -.02em; margin: 0 0 8px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.card, label.field, .row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
label.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
input, textarea, select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; }
textarea { min-height: 120px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
dialog { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--radius); max-width: 640px; }
dialog pre { white-space: pre-wrap; font: inherit; color: var(--muted); }
.err { color: #ffb4b4; }
html[data-theme="light"] .err { color: #8d1d1d; }
.searchbar { display: flex; gap: 8px; margin: 18px 0 8px; }
.searchbar input { flex: 1; }
.row-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0 16px; }
.poster { width: 148px; flex: 0 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.poster img, .poster .ph { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #000; display: block; }
.poster span, .poster small { display: block; padding: 0 10px 10px; }
.poster span { padding-top: 8px; font-size: 13px; }
.poster small { color: var(--muted); font-size: 12px; padding-top: 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; margin: 18px 0; }
.badge { text-align: left; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; }
.badge.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.badge b { font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); margin-right: 6px; }
.dot.ok { background: #3dd68c; }
.dot.wait { background: var(--accent); }
.checkline { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.panel { max-width: 760px; }
.status-line { color: var(--muted); margin-top: 0; }
html, body { overflow-x: hidden; }
main { min-width: 0; overflow-x: hidden; max-width: none; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
button.icon, a.icon { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
button.icon svg, a.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#search-open[hidden], #settings-open[hidden] { display: none; }
.row-scroll { max-width: 100%; scrollbar-width: none; }
.row-scroll::-webkit-scrollbar { display: none; }
.poster { cursor: pointer; text-align: left; padding: 0; }
.poster span { padding: 8px 10px 0; }
#finder, #sheet { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 40; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 20px 20px; }
#finder[hidden], #sheet[hidden], #stage[hidden] { display: none; }
.overlay-card { width: min(760px, 100%); max-height: 76vh; overflow: auto; background: #000; color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
#finder-q { width: 100%; font-size: 18px; }
.hit { display: block; width: 100%; text-align: left; margin-top: 8px; }
#stage { position: fixed; inset: 0; background: #000; z-index: 60; }
#stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#stage-close { position: absolute; top: 16px; left: 16px; z-index: 2; font-size: 22px; }
#stage-title { position: absolute; top: 22px; left: 68px; margin: 0; color: #fff; z-index: 2; }
.guide-tools { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.guide-scroll { max-height: calc(100vh - 230px); overflow-y: auto; overflow-x: hidden; }
.g-head, .g-row { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 8px; align-items: center; }
.g-head { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.times { position: relative; height: 18px; }
.times span { position: absolute; transform: translateX(-50%); }
.chan { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chan b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane { position: relative; height: 58px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.prog { position: absolute; top: 4px; bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 8px; text-align: left; }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
a.tile { display: flex; flex-direction: column; justify-content: space-between; min-height: 148px; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
a.tile:hover, a.tile:focus { border-color: var(--accent); }
a.tile strong { font-size: 18px; }
.settings-search { width: 100%; font-size: 16px; margin: 8px 0 18px; }
.back { margin-bottom: 12px; }
