:root {
  --brand:      #084af3;
  --brand-dark: #0639c4;
  --brand-light:#e8efff;
  --brand-tint: #f4f7ff;
  --ink:        #0a0e1a;
  --ink-2:      #2b3142;
  --ink-3:      #5b6172;
  --ink-4:      #8a8f9d;
  --line:       #e6e8ef;
  --line-2:     #eef0f5;
  --bg:         #f7f8fb;
  --card:       #ffffff;
  --good:       #1f9d55;
  --warn:       #d97706;
  --bad:        #dc2626;
  --stage:      #14161c;
  --stage-2:    #1c1f27;
  --shadow-sm:  0 1px 2px rgba(10,14,26,.04), 0 1px 3px rgba(10,14,26,.05);
  --shadow-md:  0 4px 12px rgba(10,14,26,.06), 0 2px 4px rgba(10,14,26,.04);
  --shadow-lg:  0 20px 40px rgba(10,14,26,.12), 0 4px 8px rgba(10,14,26,.06);
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }

/* ── Zentrierte Einstiegs-Seiten (Landing + Lobby) ─────────────────── */

.hw-shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 20px;
}

.hw-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: var(--ink);
  margin-bottom: 28px;
}
.hw-logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  box-shadow: 0 0 0 5px var(--brand-light);
}

.hw-card {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 32px;
}
.hw-card h1 { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.hw-card .hw-sub { font-size: 13.5px; color: var(--ink-3); margin-bottom: 22px; line-height: 1.5; }

.hw-field { display: block; margin-bottom: 16px; }
.hw-field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.hw-field input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); font-size: 14px; outline: none; transition: border-color .15s, background .15s;
}
.hw-field input:focus { border-color: var(--brand); background: var(--card); }

.hw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 18px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; transition: opacity .15s, background .15s;
}
.hw-btn:hover:not(:disabled) { opacity: .9; }
.hw-btn:disabled { opacity: .45; cursor: not-allowed; }
.hw-btn-primary { background: var(--brand); color: #fff; }
.hw-btn-ghost   { background: var(--line-2); color: var(--ink-2); }

.hw-alert {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px;
  background: #fff0f0; border: 1px solid #fca5a5; color: #b91c1c;
}

.hw-footer {
  margin-top: 26px; text-align: center; font-size: 11.5px; color: var(--ink-4);
}
.hw-footer a { color: var(--ink-4); text-decoration: none; }
.hw-footer a:hover { color: var(--brand); }

/* ── Lobby: Kameravorschau ───────────────────────────────────────── */

.hw-preview {
  position: relative; width: 100%; aspect-ratio: 4/3; border-radius: var(--radius);
  background: var(--stage); overflow: hidden; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center;
}
.hw-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.hw-preview-off {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #8a8f9d; font-size: 13px; font-weight: 500;
}
.hw-preview-controls {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px;
}
.hw-round-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(6px);
  transition: background .15s;
}
.hw-round-btn:hover { background: rgba(255,255,255,.24); }
.hw-round-btn.off { background: var(--bad); color: #fff; }

.hw-room-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  background: var(--line-2); padding: 5px 10px; border-radius: 99px; margin-bottom: 18px;
}

/* ── Call-Buehne ─────────────────────────────────────────────────── */

.hw-stage {
  height: 100vh; background: var(--stage);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.hw-stage-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; color: #fff;
}
.hw-stage-top .hw-logo { margin: 0; color: #fff; }
.hw-stage-room {
  font-size: 12.5px; color: #c7cad4; display: flex; align-items: center; gap: 8px;
}
.hw-copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #fff;
  padding: 6px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.hw-copy-btn:hover { background: rgba(255,255,255,.16); }

.hw-grid {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 12px; padding: 8px 20px;
}

.hw-tile {
  position: relative; background: var(--stage-2); border-radius: var(--radius);
  overflow: hidden; flex: 0 0 auto; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.hw-grid[data-count="1"] .hw-tile { width: min(62vh, 78vw, 620px); }
.hw-grid[data-count="2"] .hw-tile { width: min(62vh, 46vw, 460px); }
.hw-grid[data-count="3"] .hw-tile,
.hw-grid[data-count="4"] .hw-tile { width: min(38vh, 42vw, 360px); }
.hw-tile video { width: 100%; height: 100%; object-fit: cover; }
.hw-tile.mirrored video { transform: scaleX(-1); }
.hw-tile .hw-avatar {
  width: 74px; height: 74px; border-radius: 50%; background: var(--brand);
  color: #fff; font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.hw-tile-name {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.45); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 99px; backdrop-filter: blur(4px);
}
.hw-tile-name svg { width: 13px; height: 13px; }
.hw-tile-name.muted { color: #fca5a5; }

.hw-spotlight-main, .hw-spotlight-thumbs { display: none; }

.hw-grid.spotlight {
  flex-direction: column; flex-wrap: nowrap;
}
.hw-grid.spotlight .hw-spotlight-main {
  display: flex; align-items: center; justify-content: center;
  flex: 1 1 auto; min-height: 0; width: 100%;
}
.hw-grid.spotlight .hw-spotlight-thumbs {
  display: flex; flex-direction: row; flex-wrap: wrap;
  align-items: center; justify-content: center;
  flex: 0 0 auto; gap: 10px; width: 100%;
}
.hw-grid.spotlight .hw-spotlight-main .hw-tile {
  width: auto; height: auto; max-width: 100%; max-height: 100%;
  aspect-ratio: 16 / 9;
}
.hw-grid.spotlight .hw-spotlight-thumbs .hw-tile {
  width: min(16vh, 130px); aspect-ratio: 1; flex: 0 0 auto;
}

.hw-controls {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 20px 26px;
}
.hw-ctrl-btn {
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.10); color: #fff; transition: background .15s, opacity .15s;
}
.hw-ctrl-btn:hover { background: rgba(255,255,255,.20); }
.hw-ctrl-btn.active { background: var(--brand); }
.hw-ctrl-btn.off { background: var(--bad); }
.hw-ctrl-btn.leave { background: var(--bad); width: 56px; }
.hw-ctrl-btn.leave:hover { opacity: .88; }

.hw-toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 99px; box-shadow: var(--shadow-lg);
  z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.hw-toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }

.hw-full-note {
  color: #fff; text-align: center; max-width: 360px; margin: 0 auto; padding: 60px 20px;
}
.hw-full-note h1 { font-size: 18px; margin-bottom: 8px; }
.hw-full-note p { color: #aeb2bf; font-size: 13.5px; line-height: 1.6; }

@media (max-width: 640px) {
  .hw-grid[data-count="1"] .hw-tile { width: min(48vh, 88vw, 620px); }
  .hw-grid[data-count="2"] .hw-tile { width: min(48vh, 88vw, 460px); }
  .hw-grid[data-count="3"] .hw-tile,
  .hw-grid[data-count="4"] .hw-tile { width: min(30vh, 42vw, 360px); }
}
