:root {
  --bg: #0f1419;
  --panel: #182028;
  --panel-2: #212c37;
  --text: #eef2f6;
  --muted: #9aa8b6;
  --accent: #c8102e;       /* dansk rød */
  --accent-hover: #e0203f;
  --ok: #3ecf8e;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }

.screen { min-height: 100%; }
#lobby, #left { display: grid; place-items: center; padding: 24px; }

.card {
  width: min(440px, 100%);
  background: var(--panel);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
h1 { margin: 0 0 6px; font-size: 1.7rem; }
.sub { margin: 0 0 24px; color: var(--muted); line-height: 1.4; }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
input[type=text] {
  width: 100%; padding: 12px 14px; font-size: 1rem; color: var(--text);
  background: var(--panel-2); border: 1px solid #2f3d4a; border-radius: 10px; outline: none;
}
input[type=text]:focus { border-color: var(--accent); }
.toggles { display: flex; gap: 20px; margin: 16px 0 22px; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); cursor: pointer; }
.room-info {
  background: var(--panel-2); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; color: var(--muted);
}
.notice, .error { border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; font-size: .92rem; }
.notice { background: #3a2c12; color: #ffd48a; }
.error { background: #3a1517; color: #ffb3b9; margin-top: 14px; }

button { font: inherit; cursor: pointer; border: 0; color: var(--text); }
.primary {
  width: 100%; padding: 13px; border-radius: 10px; font-weight: 600;
  background: var(--accent);
}
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: .6; cursor: wait; }
.ghost { background: var(--panel-2); padding: 8px 14px; border-radius: 10px; }
.ghost:hover { background: #2b3a48; }

/* Møde */
#room { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--panel);
}
.title { font-weight: 600; }
.count { color: var(--muted); font-weight: 400; margin-left: 8px; }

.stage {
  display: grid; gap: 10px; padding: 10px; overflow: auto;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  grid-auto-rows: minmax(180px, 1fr);
}
.stage.has-share {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 140px;
}
.stage.has-share .tile.screen { grid-column: 1 / -1; grid-row: span 4; }

.tile {
  position: relative; background: var(--panel); border-radius: var(--radius);
  overflow: hidden; min-height: 140px; outline: 3px solid transparent;
  transition: outline-color .15s;
}
.tile.speaking { outline-color: var(--ok); }
.tile .avatar {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(1.6rem, 6vw, 3rem); font-weight: 600; color: var(--muted);
}
.tile .media { position: absolute; inset: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.screen video { object-fit: contain; }
.tile.local:not(.screen) video { transform: scaleX(-1); }
.tile:not(.has-video) .media { display: none; }
.tile.has-video .avatar { display: none; }
.tile .label {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, .55); padding: 4px 10px; border-radius: 8px; font-size: .85rem;
}
.tile .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .mic.off::before { content: "🔇"; }

.controls {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
  padding: 12px; background: var(--panel);
}
.ctl { background: var(--panel-2); padding: 11px 18px; border-radius: 12px; min-width: 110px; }
.ctl:hover { background: #2b3a48; }
.ctl[aria-pressed="false"] { background: #4a2227; }
.ctl#btn-share[aria-pressed="true"] { background: #1f4a37; }
.ctl#btn-share[aria-pressed="false"] { background: var(--panel-2); }
.ctl.danger { background: var(--accent); }
.ctl.danger:hover { background: var(--accent-hover); }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: #000c; padding: 10px 16px; border-radius: 10px; font-size: .92rem;
}

@media (max-width: 560px) {
  .ctl { min-width: 0; flex: 1 1 40%; }
  .card { padding: 24px; }
}
