:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --line: #2a2f3a;
  --text: #e9ecf2;
  --muted: #8c94a5;
  --accent: #5b8cff;
  --live: #ff4d5e;
  --ok: #3ccf8e;
  --warn: #ffb547;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #9b6bff);
}

.tag {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  padding: 20px 24px 32px;
  max-width: 1440px;
  margin: 0 auto;
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.placeholder p {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--text);
}

.badge,
.stats {
  position: absolute;
  top: 12px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
}

.badge {
  left: 12px;
  font-weight: 600;
}

.badge.live {
  background: var(--live);
}

.badge.blocked {
  background: var(--warn);
  color: #1b1300;
}

.stats {
  right: 12px;
  color: #cfd5e1;
  font-variant-numeric: tabular-nums;
}

.note {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.card[aria-disabled='true'] {
  opacity: 0.55;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 14px;
}

.num {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 12px;
}

.opt {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
}

textarea {
  resize: vertical;
  font-size: 12px;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

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

button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.live {
  background: var(--live);
  border-color: var(--live);
  color: #fff;
}

.masks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.masks .empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mask {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px 6px;
  font-weight: 500;
  font-size: 12px;
}

.mask img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.mask[aria-pressed='true'] {
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.14);
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  cursor: pointer;
}

.switch input {
  width: auto;
}

.log ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
}

.log li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  color: var(--muted);
}

.log li span:last-child {
  color: var(--text);
  word-break: break-word;
}

.log li.ok span:last-child::before {
  content: '✓ ';
  color: var(--ok);
}

.log li.err span:last-child {
  color: var(--live);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .top {
    padding: 12px 16px;
  }
  .tag {
    display: none;
  }
}
