:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2430;
  --sub: #5b6676;
  --line: #d9dee6;
  --accent: #0b6bcb;
  --accent-text: #ffffff;
  --danger: #c62828;
  --ok: #1b8a4b;
  --warn: #b26a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b212a;
    --text: #e8ecf1;
    --sub: #9aa6b5;
    --line: #2e3744;
    --accent: #4da3ff;
    --accent-text: #08121e;
    --danger: #ff6b6b;
    --ok: #4cd08a;
    --warn: #ffb74d;
  }
}

* { box-sizing: border-box; }
/* スクロールの端でバネのように動かさない（全プロジェクト共通の決まり） */
html, body { overscroll-behavior-y: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.6;
}
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
p { margin: 0 0 8px; }
.sub { color: var(--sub); font-size: 0.9rem; }
[hidden] { display: none !important; }

.wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
.head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ver { color: var(--sub); font-size: 0.8rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], input[type="password"], select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.radio { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 6px 0; }
.radio input { margin-top: 6px; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.big { font-size: 1.1rem; padding: 14px 22px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mt { margin-top: 14px; }

.msg { margin-top: 10px; font-size: 0.95rem; }
.msg.err { color: var(--danger); }

.qr { background: #fff; border-radius: 10px; padding: 8px; line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
.url { font-family: ui-monospace, Consolas, monospace; font-size: 0.9rem; word-break: break-all; }

.status { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sub); flex: none; }
.dot.live { background: var(--danger); }
.dot.ok { background: var(--ok); }
.dot.wait { background: var(--warn); }
.stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 10px; }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.preview { width: 100%; max-height: 260px; background: #000; border-radius: 8px; margin-top: 12px; }
ul.tips { margin: 6px 0 0; padding-left: 1.2em; }
ul.tips li { margin: 4px 0; }
kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
}

/* QR を大きく見せる */
.qr-full {
  position: fixed; inset: 0; z-index: 10;
  background: #fff; color: #111;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; text-align: center; cursor: pointer;
}
.qr-full .qr { width: min(78vh, 90vw); padding: 0; }
.qr-full .url { font-size: 1.2rem; }

/* 印刷は QR と案内だけ */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; }
  .wrap > *:not(.print-only) { display: none !important; }
  .print-only { display: block; text-align: center; padding-top: 30mm; }
  .print-only .qr { width: 90mm; margin: 10mm auto; }
  .print-only h1 { font-size: 22pt; }
  .print-only p { font-size: 13pt; }
}

/* ---- 参加者の画面 ---- */
body.viewer { background: #000; color: #e8ecf1; }
.stage { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.vbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; font-size: 0.85rem;
  background: #14181e; border-bottom: 1px solid #262d38;
}
.vbar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbar button { padding: 5px 10px; font-size: 0.8rem; background: #222a35; color: #e8ecf1; border-color: #36404d; }
.screen { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.screen video { width: 100%; max-height: calc(100dvh - 40px); object-fit: contain; background: #000; display: block; }
.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; padding: 24px; background: #000;
}
.overlay .big { font-size: 1.2rem; font-weight: 600; }
.overlay .sub { color: #9aa6b5; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #36404d; border-top-color: #4da3ff;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
