:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #eceef1; --border: #d9dce1;
  --text: #111111; --muted: #4a4f57; --faint: #656a73;
  --accent: #eb0a1e; --accent-ink: #b80816; --ok: #1e7e34;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --radius: 10px;
  --font: "Segoe UI Variable", "Segoe UI", "Noto Sans", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111; --surface: #1b1b1b; --surface-2: #262626; --border: #333333;
    --text: #f5f5f5; --muted: #c2c2c2; --faint: #a3a3a3;
    --accent: #ff2b3d; --accent-ink: #ff6b77; --ok: #3ccf6e; --shadow: none;
  }
}
* { box-sizing: border-box; }
/* Elements with display rules (flex/grid) would otherwise ignore the hidden attribute and cover the page. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 650; font-size: 18px; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 32px; height: 32px; flex: none; display: block; }
.brand .badge { width: 18px; height: 18px; font-size: 11px; }
.badge { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--faint); color: #fff; font-size: 14px; flex: none; }
.badge.ok { background: var(--ok); }
form.address { flex: 1; display: flex; gap: 8px; min-width: 0; }
form.address input, form.address select, dialog input {
  height: 42px; padding: 0 12px; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
}
form.address input { flex: 1; min-width: 0; font-size: 17px; }
form.address input::placeholder { color: var(--faint); }
.account { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who { color: var(--muted); font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { color: var(--accent-ink); border-color: var(--accent); background: transparent; }
.btn.danger { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.link { border: none; background: none; color: var(--accent-ink); padding: 0 6px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }
.icon-btn { border: none; background: none; color: var(--muted); font-size: 20px; cursor: help; padding: 4px; }
.copy-btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border-radius: 8px; }
.copy-btn:hover:not(:disabled) { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.copy-btn:disabled { opacity: .4; cursor: default; }
.arrow { font-size: 20px; line-height: 1; }

.strip { padding: 9px 16px; font-size: 14px; text-align: center; color: #fff; background: var(--faint); }
.strip.ok { background: var(--ok); }
.strip.down { background: var(--accent); }
.hint { min-height: 22px; margin: 10px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.hint.err { color: var(--accent-ink); font-weight: 600; }

/* your address */
.your-address { text-align: center; padding: 18px 0 8px; }
.ya-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 20px; }
.ya-label { font-size: 24px; }
.ya-number { font-size: clamp(40px, 7vw, 64px); font-weight: 600; color: var(--accent); letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.ya-help { max-width: 720px; margin: 8px auto 0; color: var(--muted); }
.host-status { margin-top: 10px; font-size: 14px; color: var(--faint); }
.host-session { display: inline-flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--accent); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* cards and sections */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 26px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 4px; font-size: 19px; }
.kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.card p { margin: 0 0 14px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.small { font-size: 13px; color: var(--faint); margin-top: 10px; }
h2.section { font-size: 22px; margin: 30px 0 12px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.step { display: flex; gap: 12px; }
.num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--accent); }
.step h3 { margin: 4px 0 2px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
footer { margin: 40px 0 0; padding: 18px 0 28px; border-top: 1px solid var(--border); color: var(--faint); font-size: 13px; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }

/* dialogs */
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 6px; font-size: 20px; }
dialog label { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 13px; color: var(--muted); }
dialog input { font-size: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.error { color: var(--accent-ink); min-height: 20px; margin: 6px 0 0; font-weight: 600; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 8px; padding: 8px; margin: 8px auto; width: 196px; }
.qr svg { width: 180px; height: 180px; }

/* session */
.session { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: #000; }
.s-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: #1b1b1b; color: #f5f5f5; border-bottom: 1px solid #333; }
.s-toolbar .btn { background: #262626; border-color: #3a3a3a; color: #f5f5f5; }
.s-toolbar .btn.danger { background: var(--accent); border-color: var(--accent); }
.s-toolbar select { height: 34px; border-radius: 6px; background: #fff; color: #111; border: 1px solid #3a3a3a; padding: 0 8px; font: inherit; font-size: 14px; }
.s-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #c2c2c2; }
.grow { flex: 1; }
.s-stage { position: relative; flex: 1; min-height: 0; }
.s-stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; outline: none; cursor: default; }
.s-stage video:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.s-overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #f5f5f5; background: rgba(17,17,17,.85); padding: 16px; }
.s-overlay h2 { margin: 0 0 6px; }
.s-overlay p { margin: 0; color: #c2c2c2; max-width: 560px; }
.s-status { display: flex; justify-content: space-between; gap: 12px; padding: 4px 12px; font-size: 12px; color: #c2c2c2; background: #1b1b1b; border-top: 1px solid #333; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px; }

@media (max-width: 720px) {
  .bar { flex-wrap: wrap; }
  .brand { flex: 1; }
  form.address { order: 3; flex-basis: 100%; }
  .btn .wide { display: none; }
}
