:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --text: #1b2219;
  --muted: #5d665a;
  --border: #d9d6cc;
  --accent: #2f6b3a;
  --accent-text: #ffffff;
  --live: #c62828;
  --ok: #2e7d32;
  --warn: #b26a00;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a12;
    --surface: #18251b;
    --text: #eef2ea;
    --muted: #a7b3a3;
    --border: #2c3d30;
    --accent: #6fbf73;
    --accent-text: #0f1a12;
    --live: #ff5a5a;
    --ok: #7bd67f;
    --warn: #ffb74d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a12;
  --surface: #18251b;
  --text: #eef2ea;
  --muted: #a7b3a3;
  --border: #2c3d30;
  --accent: #6fbf73;
  --accent-text: #0f1a12;
  --live: #ff5a5a;
  --ok: #7bd67f;
  --warn: #ffb74d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 28px 0 10px; }
h3 { font-size: 1.05rem; margin: 18px 0 6px; }
p { margin: 8px 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hidden { display: none !important; }

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

.status {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.15rem; font-weight: 600;
}
.status .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.status.live .dot { background: var(--live); animation: pulse 1.4s infinite; }
.status.ok .dot { background: var(--ok); }
.status.warn .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: .35; } }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; letter-spacing: .02em;
  background: var(--border); color: var(--text);
}
.badge.live { background: var(--live); color: #fff; }
.badge.ok { background: var(--ok); color: #fff; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--live); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.copy {
  display: flex; gap: 8px; align-items: stretch; margin: 8px 0;
}
.copy code {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px dashed var(--border);
  font-size: 1.05rem; overflow-wrap: anywhere; word-break: break-all;
}

ol.steps { padding-left: 0; list-style: none; counter-reset: step; margin: 8px 0; }
ol.steps > li {
  counter-increment: step; position: relative;
  padding: 10px 0 10px 48px; border-bottom: 1px solid var(--border);
}
ol.steps > li:last-child { border-bottom: 0; }
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
}

.video-wrap {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9;
}
.video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.video-wrap .overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-weight: 600; text-align: center; padding: 16px;
  background: rgba(0,0,0,.45);
}
.video-wrap .tag { position: absolute; top: 10px; left: 10px; }

.qr { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 10px; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }

details { margin: 12px 0; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
  min-height: 48px; padding: 8px 12px; width: 100%;
}
label { display: block; font-weight: 600; margin: 10px 0 4px; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; z-index: 10; max-width: calc(100% - 32px); text-align: center;
}
