:root {
  --bg: #12162b;
  --bg2: #1c2142;
  --panel: #232a52;
  --line: #343d70;
  --text: #f4f5fb;
  --muted: #a9afd3;
  --accent: #ffc94d;
  --accent-ink: #2a1d00;
  --pink: #ff5d8f;
  --green: #3ddc97;
  --red: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(circle at 20% -10%, #2c3577 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: 2rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
a { color: var(--accent); }

.logo { text-align: center; margin: 28px 0 24px; }
.logo .icon { font-size: 3.2rem; display: block; }
.logo h1 { margin: 6px 0 4px; font-size: 2.3rem; letter-spacing: .5px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
}

label { display: block; font-weight: 600; margin: 12px 0 6px; }
input, select {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  padding: 14px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg2);
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input.code { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-size: 1.8rem; font-weight: 800; }

button, .btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
}
button:disabled { opacity: .45; cursor: default; }
button.block { width: 100%; margin-top: 16px; font-size: 1.2rem; padding: 16px; }
button.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
button.small { padding: 8px 12px; font-size: .9rem; }
button.danger { background: transparent; color: var(--red); border: 2px solid var(--red); }
button.on { border-color: var(--accent); color: var(--accent); }

.error { color: var(--red); font-weight: 600; margin-top: 10px; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(6px);
}
.topbar .title { font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .tag { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: .9rem; }

#toasts { position: fixed; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: #000c; color: #fff; padding: 12px 18px; border-radius: 12px; max-width: 90vw; font-weight: 600; }

body.offline::before {
  content: "Mistet forbindelsen – kobler til igjen …";
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: var(--red); color: #fff; text-align: center; padding: 6px; font-weight: 700; font-size: .9rem;
}

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 10, 25, .82);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.overlay .box { background: var(--panel); border: 2px solid var(--accent); border-radius: 22px; padding: 28px 22px; text-align: center; max-width: 420px; width: 100%; }
.overlay .big { font-size: 2.6rem; font-weight: 900; color: var(--accent); }

.game-list { display: grid; gap: 12px; }
.game-card { display: flex; gap: 14px; align-items: center; text-align: left; background: var(--bg2); color: var(--text); border: 2px solid var(--line); width: 100%; }
.game-card.selected { border-color: var(--accent); }
.game-card .gi { font-size: 2.2rem; }
.game-card .gd { font-weight: 400; color: var(--muted); font-size: .92rem; }
