:root {
  --bg: #0b1220;
  --bg2: #111a2c;
  --card: #152036;
  --line: #24324d;
  --text: #e6edf7;
  --muted: #95a3bb;
  --accent: #4ea1ff;
  --accent-ink: #06203f;
  --warn: #ffb454;
  --err: #ff7b72;
  --ok: #56d364;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

/* ── Kepala ─────────────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-size: 18px; line-height: 1.1; }
.brand p { color: var(--muted); font-size: 12.5px; }
.status {
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 6px;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.status .dot.busy { background: var(--accent); }
.status .dot.warn { background: var(--warn); }

/* ── Tata letak ─────────────────────────────────────── */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "stage panel" "recent panel";
  gap: 16px;
  padding: 16px;
  align-items: start;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── Pemutar ────────────────────────────────────────── */
.stage { grid-area: stage; min-width: 0; }
.screen {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--ratio, 1501 / 901);
  max-height: calc(100dvh - 190px);
  margin: 0 auto;
}
.screen video, .screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.screen-note {
  position: absolute;
  left: 10px;
  top: 10px;
  max-width: calc(100% - 20px);
  background: rgba(8, 14, 26, .82);
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
}
.screen-note:empty { display: none; }
.busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 10, 20, .6);
}
.busy-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  width: min(320px, 85%);
}
.busy-box p { font-size: 14px; margin-bottom: 10px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .4s linear;
}

.caption { margin-top: 10px; font-size: 14px; color: var(--muted); }
.caption strong { color: var(--text); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.recent { grid-area: recent; min-width: 0; align-self: start; }
.recent h2 { font-size: 14px; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recent button {
  width: 100%;
  text-align: left;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.recent button:hover { border-color: var(--accent); }
.recent button.on { border-color: var(--accent); background: var(--card); }
.recent small { color: var(--muted); white-space: nowrap; }

/* ── Panel pengaturan ───────────────────────────────── */
.panel {
  grid-area: panel;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 0;
  position: sticky;
  top: 16px;
  /* Tinggi kepala ±60px + jarak: tombol "Buat video" tetap terlihat di laptop berlayar pendek. */
  max-height: calc(100dvh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.group { margin-bottom: 18px; }
.group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.hint:empty { display: none; }
.hint.error { color: var(--err); margin: 8px 0 14px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips + .chips { margin-top: 8px; }
.opt {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.seg .opt { border-radius: 10px; padding: 8px 10px; text-align: center; }
.opt:hover { border-color: #3b5580; }
.opt[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.opt:disabled { opacity: .45; cursor: not-allowed; }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fcard {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
}
.fcard:hover { border-color: #3b5580; }
.fcard[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fcard .thumb {
  display: block;
  width: 100%;
  aspect-ratio: var(--ratio, 1501 / 901);
  object-fit: cover;
  background: #050a14;
}
.fcard .meta { padding: 6px 8px 7px; display: grid; gap: 2px; }
.fcard .name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.fcard .sub { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.badge { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.day { color: var(--warn); border-color: rgba(255, 180, 84, .4); }

.custom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.custom label { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.custom input {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 6px;
  min-width: 0;
  width: 100%;
}
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin-top: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  font: inherit;
  font-size: 14px;
  border-radius: 10px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn.ghost { background: var(--card); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
  padding: 12px;
  position: sticky;
  bottom: 0;
  box-shadow: 0 -12px 12px var(--bg2);
  margin-bottom: 14px;
}
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .opt:focus-visible, .fcard:focus-visible, .recent button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.foot { padding: 14px 16px 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* ── Layar sempit ───────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "stage" "panel" "recent"; padding: 12px; gap: 14px; }
  .panel { position: static; max-height: none; overflow: visible; }
  .screen { max-height: none; }
  .top { padding: 10px 12px; }
  .status { max-width: 50%; }
}
@media (max-width: 420px) {
  .brand p { display: none; }
  .custom { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
}
