:root {
  --bg: #10141b;
  --bg2: #161b24;
  --bg3: #202734;
  --line: #2a3241;
  --text: #e8edf4;
  --muted: #93a0b4;
  --accent: #6d9fd8;
  --on-accent: #0d1726;
  --accent2: #a8c8ec;
  --ok: #7cc4a4;
  --bad: #e0ae6a;
  --radius: 12px;
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.error { color: var(--bad); }

/* ---- knapper og felt ---- */
.btn {
  border: 1px solid var(--line); background: var(--bg3); color: var(--text);
  padding: 0.55rem 0.95rem; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none;
  white-space: nowrap; transition: background 0.15s, transform 0.05s;
}
.btn:hover:not(:disabled) { background: #2a3242; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: #85b1e2; }
.home .btn.primary { box-shadow: 0 8px 24px #6d9fd840; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn.big { padding: 0.9rem 1.6rem; font-size: 1.1rem; }
.btn.wide { width: 100%; }
.icon-btn {
  background: none; border: 0; color: var(--text); font-size: 1.15rem; cursor: pointer;
  width: 2.2rem; height: 2.2rem; border-radius: 8px; display: inline-grid; place-items: center;
}
.icon-btn:hover:not(:disabled) { background: var(--bg3); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn.small { width: 1.9rem; height: 1.9rem; font-size: 0.95rem; }
input[type="text"] {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 0.6rem 0.85rem; border-radius: 999px; font: inherit; min-width: 0;
}
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.check { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; user-select: none; }
.badge { font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--bg3); color: var(--muted); white-space: nowrap; }
.badge.host { color: var(--accent2); }
.pill { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-size: 0.7rem; padding: 0 0.4rem; margin-left: 0.2rem; }
.count { color: var(--muted); font-weight: 400; margin-left: 0.15rem; }

.logo { font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; margin: 0; }
.logo span { color: var(--accent); }
.logo.big { font-size: clamp(3rem, 10vw, 5rem); }

/* ---- forside ---- */
.home-page {
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, #6d9fd82e, transparent 55%),
    radial-gradient(ellipse 36% 28% at 92% 8%, #a8c8ec14, transparent 50%),
    var(--bg);
  min-height: 100%;
}
.home { max-width: 760px; margin: 0 auto; padding: max(10vh, calc(env(safe-area-inset-top) + 2.5rem)) 1.25rem max(3rem, env(safe-area-inset-bottom)); text-align: center; }
.tagline { font-size: 1.2rem; color: var(--muted); max-width: 32rem; margin: 0.5rem auto 2rem; line-height: 1.5; }
.home-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.join-code { display: flex; gap: 0.5rem; }
.features { list-style: none; padding: 0; margin: 3.5rem 0 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; text-align: left; }
.features li { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: grid; gap: 0.4rem; transition: transform 0.15s, border-color 0.15s; }
.features li:hover { transform: translateY(-2px); border-color: #3a4a63; }
.features span { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }

/* ---- rom ---- */
.room-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem;
  padding-top: max(0.6rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--bg2); flex-wrap: wrap;
}
button.room-code {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.95rem;
  padding: 0.2rem 0.45rem; border-radius: 999px;
}
button.room-code:hover { background: var(--bg3); color: var(--text); }
.spacer { flex: 1; }
.copy-short, .copy-done { display: none; }
#copy-link[data-copied="1"] .copy-idle { display: none !important; }
#copy-link[data-copied="1"] .copy-done { display: inline; }
.conn { font-size: 0.8rem; color: var(--bad); background: var(--bg); padding: 0.12rem 0.55rem; border-radius: 999px; }
.check.live { color: var(--ok); font-weight: 700; }
.voice-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }
.stage { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
/* contents så videoen fortsatt kan feste seg mens man scroller (sticky begrenses av forelderen). */
.screen { display: contents; }
.screen.fullscreen-ready,
.screen:fullscreen,
.screen.pseudo-full { display: flex; flex-direction: column; min-width: 0; }
.screen:fullscreen {
  background: #000;
  padding: 0.6rem 0.75rem max(0.6rem, env(safe-area-inset-bottom));
  gap: 0.45rem;
}
.screen:fullscreen .player-wrap { flex: 1; max-height: none; }
.screen.pseudo-full {
  position: fixed; inset: 0; z-index: 50; background: #000;
  padding: max(0.5rem, env(safe-area-inset-top)) 0.5rem max(0.5rem, env(safe-area-inset-bottom));
  gap: 0.4rem;
}
.screen.pseudo-full .player-wrap {
  flex: 1; min-height: 0; max-height: none; width: 100%; margin: 0;
  border-radius: 10px; aspect-ratio: auto; position: relative;
}

.player-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; max-height: 72vh; box-shadow: 0 12px 40px #0005; }
.player-wrap iframe, .player-wrap #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Desktop, samme triks som kpop.no: YouTube tegner tittel, logo og sluttkort i
   CSS-piksler oppå videoen. Iframen legges ut enormt bred og skaleres ned, så
   de elementene krymper bort mens bildet fortsatt dekker ruten. På mobil lar vi
   være — YouTube velger kvalitet ut fra layout-størrelsen, og et så stort
   spillerfelt betyr 4K. Med undertekster på (.cc) skaleres ikke iframen, ellers
   ville undertekstene krympet like mye som tittelen og blitt uleselige. */
@supports (container-type: size) {
  @media (min-width: 901px) {
    .player-wrap { container-type: size; }
    .player-wrap:not(.cc) iframe {
      --layout-w: 12000px;
      --overscan: 1.18;
      --cover: max(100cqw, 100cqh * 16 / 9);
      position: absolute;
      width: var(--layout-w) !important;
      height: calc(var(--layout-w) * 9 / 16) !important;
      left: calc((100% - var(--cover) * var(--overscan)) / 2) !important;
      top: calc((100% - var(--cover) * var(--overscan) * 9 / 16) / 2) !important;
      right: auto !important;
      bottom: auto !important;
      transform: scale(calc(var(--cover) / var(--layout-w) * var(--overscan)));
      transform-origin: 0 0;
    }
  }
  /* Nettbrett med bred skjerm bruker desktop-oppsettet, men tåler ikke et
     spillerfelt på 12000 px (YouTube velger da 4K). Der vises iframen vanlig. */
  @media (min-width: 901px) and (pointer: coarse) {
    .player-wrap:not(.cc) iframe {
      width: 100% !important;
      height: 100% !important;
      inset: 0 !important;
      transform: none !important;
    }
  }
}
.player-wrap:fullscreen { max-height: none; border-radius: 0; }
.player-wrap.pseudo-full { position: fixed; inset: 0; z-index: 50; max-height: none; border-radius: 0; aspect-ratio: auto; }
.player-overlay { position: absolute; inset: 0; cursor: pointer; z-index: 1; }
.player-overlay.locked { cursor: default; }
.empty { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; text-align: center; padding: 1rem; background: radial-gradient(circle at 50% 40%, #1c2534, #000); }
.empty p { margin: 0.25rem 0; }
.empty .btn { margin-top: 0.75rem; }
.empty-icon { font-size: 3rem; color: var(--accent); }
.autoplay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; }
.autoplay { border: 0; border-radius: 999px; padding: 1rem 1.5rem; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; box-shadow: 0 8px 30px #0008; }
.ptt-indicator { position: absolute; top: 0.75rem; left: 0.75rem; background: #000a; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.85rem; z-index: 3; color: var(--ok); }


.controls { display: flex; align-items: center; gap: 0.4rem; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.35rem 0.6rem; }
.time { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--muted); min-width: 3.2rem; text-align: center; }
.seek, .volume {
  -webkit-appearance: none; appearance: none; background: transparent; height: 1.4rem;
  cursor: pointer; margin: 0;
}
.seek { flex: 1; min-width: 60px; }
.seek:disabled { cursor: not-allowed; opacity: 0.45; }
.volume { width: 90px; }
.seek::-webkit-slider-runnable-track,
.volume::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), #344055 var(--pct, 0%));
}
.seek::-webkit-slider-thumb,
.volume::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -5px;
  border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px #000a;
}
.seek::-moz-range-track,
.volume::-moz-range-track {
  height: 6px; border-radius: 999px; border: 0;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), #344055 var(--pct, 0%));
}
.seek::-moz-range-thumb,
.volume::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
.now-playing { display: flex; gap: 0.6rem; align-items: center; min-height: 1.5rem; min-width: 0; }
.np-title { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.np-yt { flex-shrink: 0; font-size: 0.82rem; font-weight: 700; text-decoration: none; }
.np-yt:hover { text-decoration: underline; }
.add-form { display: flex; gap: 0.5rem; }
.add-form input { flex: 1; }

.search-results { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem; display: grid; gap: 0.4rem; }
.result, .queue-item { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.35rem; border-radius: 8px; }
.result:hover, .queue-item:hover { background: var(--bg3); }
.result img, .queue-item img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; }
.info { display: grid; gap: 0.15rem; min-width: 0; }
.info b { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.info span { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 0.25rem; align-items: center; }

/* ---- sidepanel ---- */
.side { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 0.75rem 0.5rem; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.panel { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
#panel-chat { overflow: hidden; }
.messages { list-style: none; margin: 0; padding: 0.75rem; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.35rem; overscroll-behavior: contain; }
.msg { line-height: 1.4; word-wrap: break-word; overflow-wrap: anywhere; font-size: 0.93rem; }
.msg time { color: var(--muted); font-size: 0.72rem; margin-right: 0.4rem; font-variant-numeric: tabular-nums; }
.msg b { margin-right: 0.35rem; }
.msg.system { color: var(--muted); font-size: 0.82rem; font-style: italic; display: flex; justify-content: space-between; gap: 0.5rem; }
.msg.system time { margin: 0; }
.chat-form, .add-form { align-items: center; }
.chat-form { display: flex; gap: 0.5rem; padding: 0.6rem; border-top: 1px solid var(--line); padding-bottom: max(0.6rem, env(safe-area-inset-bottom)); }
.chat-form input { flex: 1; }
.chat-jump {
  position: absolute; left: 50%; bottom: 4.3rem; transform: translateX(-50%); z-index: 6;
  border: 1px solid var(--line); background: var(--bg3); color: var(--text); border-radius: 999px;
  padding: 0.35rem 0.8rem; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px #0008; white-space: nowrap;
}
.chat-jump:hover { background: #2a3242; }
.msg.mention { background: color-mix(in srgb, var(--accent2) 16%, transparent); box-shadow: inset 3px 0 0 var(--accent2); margin: 0 -0.35rem; padding: 0.2rem 0.4rem; border-radius: 8px; }
.msg.mine { background: color-mix(in srgb, var(--accent) 14%, transparent); margin: 0 -0.35rem; padding: 0.2rem 0.4rem; border-radius: 8px; }

.queue { list-style: none; margin: 0; padding: 0.5rem; display: grid; gap: 0.25rem; counter-reset: q; }
.queue-item { counter-increment: q; }
.queue-item .info b::before { content: counter(q) ". "; color: var(--muted); font-weight: 650; }
.vote { background: var(--bg3); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 0.2rem 0.55rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.vote.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.host-settings { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; display: grid; gap: 0.5rem; justify-items: start; }
.people { list-style: none; margin: 0; padding: 0.5rem; display: grid; gap: 0.2rem; }
.person { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; border-radius: 8px; flex-wrap: wrap; }
.person .name { font-weight: 600; }
.person .actions { margin-left: auto; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #111; flex-shrink: 0; transition: box-shadow 0.1s; }
.person.speaking .avatar { box-shadow: 0 0 0 3px var(--ok); }

/* ---- 7TV-emotes ---- */
#panel-chat { position: relative; }
.emote-stack { display: inline-grid; vertical-align: middle; margin: -4px 1px; }
.emote-stack > img { grid-area: 1 / 1; justify-self: center; align-self: end; }
.emote { height: 28px; width: auto; max-width: 112px; object-fit: contain; }
.emote-pop {
  position: absolute; left: 0.5rem; right: 0.5rem; bottom: 3.6rem; z-index: 10; max-height: min(360px, 60%);
  display: flex; flex-direction: column; gap: 0.4rem; background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.6rem; box-shadow: 0 10px 30px #0009;
}
.emote-tabs { display: flex; gap: 0.3rem; }
.emote-tabs button { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 0.2rem 0.7rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.emote-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.emote-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 0.2rem; }
.emote-grid button { background: none; border: 0; border-radius: 6px; padding: 0.2rem; cursor: pointer; display: grid; place-items: center; height: 40px; }
.emote-grid button:hover { background: var(--bg2); }
.emote-grid .emote { max-width: 100%; }

/* ---- svar, reaksjoner, lenkekort, skriver… ---- */
.msg { position: relative; border-radius: 8px; }
.msg:not(.system):hover, .msg:not(.system):focus-within { background: color-mix(in srgb, var(--text) 5%, transparent); }
.msg:focus { outline: none; }
.msg-actions {
  position: absolute; top: -0.9rem; right: 0.25rem; display: none; gap: 0.1rem;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 0.1rem; box-shadow: 0 4px 14px #0007;
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
@media (hover: none) { .msg:focus .msg-actions, .msg:focus-within .msg-actions { display: flex; } }
.quote {
  display: flex; gap: 0.25rem; align-items: center; max-width: 100%; margin: 0 0 0.15rem; padding: 0.1rem 0.45rem;
  background: none; border: 0; border-left: 2px solid var(--line); color: var(--muted); font: inherit; font-size: 0.8rem;
  cursor: pointer; text-align: left; overflow: hidden; white-space: nowrap;
}
.quote:hover { color: var(--text); border-left-color: var(--accent); }
.quote-text { overflow: hidden; text-overflow: ellipsis; }
.quote .emote { height: 18px; }
.msg.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent2) 30%, transparent); } }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.05rem 0.45rem; height: 1.75rem;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; color: var(--text); font: inherit; font-size: 0.8rem; cursor: pointer;
}
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--bg3)); }
.chip .emote { height: 20px; }
.chip-emoji { font-size: 1rem; }
.react-pop {
  position: absolute; z-index: 12; display: flex; gap: 0.15rem; align-items: center; padding: 0.3rem;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 8px 24px #0009;
}
.react-choice { background: none; border: 0; font-size: 1.25rem; width: 2.1rem; height: 2.1rem; border-radius: 50%; cursor: pointer; }
.react-choice:hover { background: var(--bg2); transform: scale(1.15); }
.yt-card {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 0.6rem; align-items: center; margin-top: 0.35rem;
  padding: 0.4rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; max-width: 340px;
}
.yt-card img { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; }
.yt-card .actions { margin-top: 0.3rem; flex-wrap: wrap; }
.typing { min-height: 1.3rem; padding: 0 0.85rem; font-size: 0.78rem; color: var(--muted); font-style: italic; }
.reply-bar {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.6rem 0.35rem 0.85rem; border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--muted); background: var(--bg);
}
.reply-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-label b { color: var(--text); }
.reply-label .emote { height: 18px; }
.emote-pop.for-reaction { box-shadow: 0 0 0 2px var(--accent), 0 10px 30px #0009; }

/* ---- hopp over, undertekster ---- */
#skip-vote { flex-shrink: 0; }
#skip-vote.on { color: var(--accent2); border-color: var(--accent2); }
.cc-select {
  background: var(--bg3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 0.8rem;
  padding: 0.25rem 0.3rem; max-width: 7.5rem; cursor: pointer;
}
#notify[aria-pressed="false"] { color: var(--muted); }

/* ---- dialog og toast ---- */
.dialog { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 16px; padding: 1.5rem; width: min(92vw, 380px); }
.dialog::backdrop { background: #000b; backdrop-filter: blur(4px); }
.dialog h2 { margin: 0 0 0.25rem; }
.dialog form { display: grid; gap: 0.75rem; }
.dialog input { width: 100%; }
.join-room-line { margin: 0; text-align: center; }
#join-room { color: var(--text); font-family: ui-monospace, SFMono-Regular, monospace; }
.kicked-screen {
  position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center;
  text-align: center; padding: 1.5rem;
}
.kicked-screen h2 { margin: 0 0 0.4rem; }
.kicked-screen p { margin: 0 0 1rem; color: var(--muted); max-width: 26rem; }
.toast {
  position: fixed; left: 50%; top: max(4.6rem, calc(env(safe-area-inset-top) + 4rem)); transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--line); padding: 0.7rem 1.1rem; border-radius: 999px; z-index: 100;
  box-shadow: 0 10px 30px #0008; max-width: min(92vw, 34rem); text-align: center; animation: toastIn 0.18s ease;
}
@keyframes toastIn {
  from { transform: translateX(-50%) translateY(-8px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---- mobil ---- */
@media (max-width: 900px) {
  .room-page { height: auto; min-height: 100dvh; overflow: visible; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .time { min-width: 2.6rem; font-size: 0.78rem; }
  .stage { overflow: visible; padding: 0.6rem; }
  .player-wrap { position: sticky; top: 0; z-index: 5; border-radius: 0; margin: -0.6rem -0.6rem 0; width: calc(100% + 1.2rem); max-height: none; box-shadow: none; }
  .side { border-left: 0; border-top: 1px solid var(--line); height: 70dvh; }
  .volume { display: none; }
  .cc-select { max-width: 4.6rem; }
  /* Én kompakt rad: logo og romkode til venstre, bare ikoner til høyre. */
  .topbar { flex-wrap: nowrap; gap: 0.3rem; padding: 0.4rem 0.5rem; padding-top: max(0.4rem, env(safe-area-inset-top)); }
  .topbar .logo { font-size: 1.1rem; flex-shrink: 0; }
  .topbar .room-code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; padding: 0.2rem 0.3rem; }
  .topbar .spacer { display: block; flex: 1; }
  .topbar .label, .topbar .copy-idle, .topbar .copy-done { display: none !important; }
  .topbar .btn, .topbar .icon-btn { width: 2.4rem; height: 2.4rem; padding: 0; justify-content: center; border-radius: 50%; flex-shrink: 0; }
  .topbar .btn .icon { width: 19px; height: 19px; }
  .voice-controls { width: auto; flex: none; gap: 0.3rem; flex-wrap: nowrap; }
  #voice-ptt-label { display: none !important; }
  .conn { position: fixed; left: 50%; top: max(3.4rem, calc(env(safe-area-inset-top) + 3rem)); transform: translateX(-50%); z-index: 60; white-space: nowrap; }
  .np-yt { display: none; }
  .add-form { flex-wrap: wrap; }
  .add-form input { flex-basis: 100%; }
  .add-form .btn { flex: 1; }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .player-wrap { position: relative; margin: 0; width: 100%; border-radius: var(--radius); }
  .side { height: auto; border-top: 0; border-left: 1px solid var(--line); }
  .room-page { height: 100dvh; overflow: hidden; }
  .stage { overflow-y: auto; }
}
@media (pointer: coarse) {
  .vote { padding: 0.4rem 0.7rem; }
  .icon-btn.small { width: 2.4rem; height: 2.4rem; }
  #voice-ptt-label { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .features li { animation: none; transition: none; }
}
@media (max-width: 520px) {
  /* Spolelinjen får egen rad, så knappene får plass. */
  .controls { flex-wrap: wrap; row-gap: 0.1rem; }
  .controls .seek { flex-basis: 100%; order: -1; }
  .controls #time-total { margin-right: auto; }
  .controls { gap: 0.2rem; padding: 0.35rem 0.45rem; }
  .controls .icon-btn { width: 2rem; }
  .controls .time { min-width: 2.4rem; }
  .cc-select { max-width: 4.2rem; padding: 0.25rem 0.15rem; }
}

/* ---- ikoner, status, forlat/slett ---- */
.icon { flex-shrink: 0; vertical-align: middle; }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.btn .icon { width: 16px; height: 16px; }
.vote { display: inline-flex; align-items: center; gap: 0.2rem; }
.voice-icon { display: inline-flex; color: var(--ok); }
.voice-icon.muted { color: var(--muted); }
.quote .icon { flex-shrink: 0; }
.empty-icon { color: var(--accent); display: grid; place-items: center; }
.empty-icon .icon { width: 48px; height: 48px; }
.host-danger { margin: 0.5rem 1rem 0; padding-top: 0.75rem; border-top: 1px solid var(--line); display: grid; gap: 0.35rem; justify-items: start; }
.host-danger p { margin: 0; }
.panel-footer { margin: auto 0 0; padding: 1rem; text-align: center; }
.panel-footer a, .dialog a { color: var(--accent2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* ---- FAQ og personvern ---- */
.doc-page { min-height: 100%; }
.doc { max-width: 720px; margin: 0 auto; padding: max(2.5rem, env(safe-area-inset-top)) 1.25rem 4rem; line-height: 1.6; }
.doc h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: 1.5rem 0 0.25rem; letter-spacing: -0.02em; }
.doc h2 { font-size: 1.25rem; margin: 2.2rem 0 0.5rem; }
.doc h3 { font-size: 1rem; margin: 1.4rem 0 0.25rem; color: var(--accent2); }
.doc p, .doc li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.doc ul { padding-left: 1.2rem; }
.doc li { margin: 0.4rem 0; }
.doc a { color: var(--accent2); }
.doc code { background: var(--bg3); padding: 0.1rem 0.35rem; border-radius: 6px; font-size: 0.9em; }
.doc details { border: 1px solid var(--line); background: var(--bg2); border-radius: var(--radius); margin: 0.5rem 0; }
.doc summary { cursor: pointer; padding: 0.8rem 1rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.doc summary::-webkit-details-marker { display: none; }
.doc summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.doc details[open] summary::after { content: "–"; }
.doc details p { margin: 0; padding: 0 1rem 0.9rem; }
.doc-nav { margin-top: 3rem; text-align: center; }
.home footer a { color: var(--accent2); }

/* ---- språkvelger ---- */
.lang-switch { display: inline-flex; gap: 0.15rem; }
.lang-switch button { background: none; border: 0; padding: 0.1rem 0.3rem; border-radius: 6px; color: var(--muted); font: inherit; cursor: pointer; }
.lang-switch button.on { color: var(--text); font-weight: 600; }
.lang-switch button:not(.on):hover { color: var(--accent2); text-decoration: underline; }

/* ---- litt Y2K, lånt med måte fra kpop-no ---- */
:root { --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; }
.window-bar {
  display: flex; align-items: center; gap: 0.6rem; height: 1.9rem; padding: 0 0.75rem;
  background: linear-gradient(180deg, #243047, #1b2434); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -0.75rem; position: relative; z-index: 1;
}
.window-bar .dots { display: inline-flex; gap: 0.35rem; }
.window-bar .dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #344055; }
.window-bar .dots i:first-child { background: var(--accent); }
.window-bar .dots i:nth-child(2) { background: var(--accent2); }
.window-title { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.window-bar + .screen .player-wrap, .window-bar + .screen > .player-wrap { border-top-left-radius: 0; border-top-right-radius: 0; }
.stage > .window-bar + .screen { display: contents; }
.time, .np-next, .np-status, .room-code, .cc-select { font-family: var(--mono); }
.np-status {
  display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.np-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #344055; }
.np-status.live { color: var(--accent2); }
.np-status.live .np-dot { background: var(--accent); box-shadow: 0 0 0 0 #6d9fd8aa; animation: np-pulse 1.8s ease-out infinite; }
@keyframes np-pulse { 0% { box-shadow: 0 0 0 0 #6d9fd8aa; } 80%, 100% { box-shadow: 0 0 0 0.45rem #6d9fd800; } }
.np-next { margin: -0.35rem 0 0; font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Forsiden: falmet ord i bakgrunnen, ett klistremerke og små vinduslinjer på kortene. */
.home-page { position: relative; overflow-x: hidden; }
.bg-word {
  position: absolute; left: 50%; top: 8vh; transform: translateX(-50%); z-index: 0; pointer-events: none; user-select: none;
  font-size: clamp(9rem, 30vw, 26rem); font-weight: 900; letter-spacing: -0.06em; line-height: 1; color: #fff; opacity: 0.022; white-space: nowrap;
}
.home { position: relative; z-index: 1; }
.sticker {
  display: inline-block; margin: 0.35rem 0 0.2rem; padding: 0.3rem 0.9rem; border-radius: 999px; transform: rotate(-4deg);
  background: var(--accent2); color: var(--on-accent); font-family: var(--mono); font-size: 0.85rem; font-weight: 700;
  box-shadow: 0 6px 18px #0006;
}
.features li { padding-top: 0; overflow: hidden; align-content: start; }
.window-bar.small { height: 1.6rem; margin: 0 -1rem 0.5rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0 0.7rem; }
.window-bar.small .dots i { width: 0.5rem; height: 0.5rem; }
@media (max-width: 900px) {
  .stage > .window-bar { display: none; }
  .np-next { margin-top: -0.2rem; }
}
@media (prefers-reduced-motion: reduce) { .np-status.live .np-dot { animation: none; } }

/* Lange varsler: vanlige hjørner i stedet for pille. */
.toast { border-radius: 14px; width: max-content; }
#voice-leave { color: var(--bad); }
