/* MBB – gamer × billard. Designtokens først. */
:root {
  --bg: #07130E;
  --surface: #0F2A1F;
  --surface-2: #143826;
  --line: #1f4a35;
  --accent: #00E5A0;
  --gold: #FFC83D;
  --silver: #C9D6D0;
  --bronze: #D98C4A;
  --danger: #FF4D6D;
  --text: #EAF7F0;
  --muted: #8FB5A3;
  --surface-input: #0a1f16;
  --line-soft: rgba(143, 181, 163, .16);
  --radius: 16px;
  --glow: 0 0 0 1px var(--accent), 0 0 18px rgba(0, 229, 160, .35);
  --shadow-card: 0 14px 32px rgba(0, 0, 0, .28);
  --ease-ui: cubic-bezier(.2, .75, .25, 1);
  --font-display: "Rajdhani", "Orbitron", "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --tab-h: 64px;
  --top-h: 56px;  
}

* { box-sizing: border-box; }
html { color-scheme: dark; scrollbar-color: #286247 #0a1f16; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #0a1f16; border-radius: 999px; }
*::-webkit-scrollbar-thumb { background: #286247; border: 2px solid #0a1f16; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #36825d; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(18, 64, 44, .7), transparent 68%),
    radial-gradient(760px 480px at 100% 34%, rgba(0, 95, 62, .12), transparent 68%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
body::after { /* vignette */
  content: ""; position: fixed; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 160px rgba(0,0,0,.55);
}
h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.55rem, 3vw, 2rem); } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Layout ---------- */
.shell { position: relative; z-index: 1; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  background: rgba(7, 19, 14, .82); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft);
}
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; font-size: 1rem; white-space: nowrap; min-width: 0; }
.brand-short { display: none; }
.logo .ball { width: 28px; height: 28px; font-size: 12px; }
.logo-img { height: 52px; width: auto; display: block; }
.topbar .spacer { display: none; } 
.topbar .logo { grid-row: 1; grid-column: 1; justify-self: start; }
.topbar .team-select { grid-row: 1; grid-column: 2; justify-self: center; text-align: center; text-align-last: center; }
.topbar .icon-btn { grid-row: 1; grid-column: 3; justify-self: end; }
main > * { max-width: 860px; margin-left: auto; margin-right: auto; }
.team-select {
  width: min(860px, calc(100vw - 28px)); max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; min-height: 40px; font-weight: 600; transition: border-color .2s, box-shadow .2s, background .2s;
}
.team-select:hover { border-color: rgba(0, 229, 160, .55); background: var(--surface-2); }
@media (max-width: 899px) {
  .topbar { height: calc(108px + env(safe-area-inset-top)); grid-template-columns: 1fr auto; grid-template-rows: 48px 40px; gap: 10px 12px; align-content: center; padding: calc(env(safe-area-inset-top) + 4px) 16px 6px; }
  .topbar .logo { grid-row: 1; grid-column: 1; }
  .logo-img { height: 46px; }
  .topbar .icon-btn { grid-row: 1; grid-column: 2; }
  .topbar .team-select { grid-row: 2; grid-column: 1 / -1; justify-self: center; width: min(860px, calc(100vw - 28px)); }
}
main { padding: 24px 18px calc(var(--tab-h) + 32px + env(safe-area-inset-bottom)); max-width: 1040px; margin: 0 auto; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; background: rgba(7, 19, 14, .9);
  backdrop-filter: blur(16px); border-top: 1px solid var(--line-soft);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .72rem; letter-spacing: .04em;
  text-transform: uppercase; font-family: var(--font-display); font-weight: 700; min-height: 44px;
  transition: color .2s, background .2s, transform .2s var(--ease-ui);
}
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--text); }
@media (max-width: 480px) { .tab { font-size: .6rem; letter-spacing: 0; min-width: 0; } }
.more-link { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; min-height: 56px; transition: border-color .2s, background .2s, transform .2s var(--ease-ui); }
.more-link:hover { border-color: rgba(0, 229, 160, .55); background: var(--surface-2); }
.more-link:active { transform: scale(.985); }
.more-icon { font-size: 1.6rem; width: 36px; text-align: center; flex: none; }
.more-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.more-text .muted { font-size: .85rem; }
.more-arrow { color: var(--accent); font-size: 1.4rem; flex: none; }
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-list.scroll { max-height: 420px; overflow-y: auto; padding-right: 4px; scrollbar-color: #286247 #0a1f16; scrollbar-width: thin; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-soft); background: linear-gradient(145deg, rgba(10,31,22,.9), rgba(7,19,14,.86)); }
.notif.unread { border-color: rgba(0, 229, 160, .55); box-shadow: inset 3px 0 var(--accent), 0 0 14px rgba(0, 229, 160, .12); }
.notif-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: rgba(0, 229, 160, .1); border: 1px solid var(--line); }
.notif-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-head strong { font-family: var(--font-display); letter-spacing: .02em; overflow-wrap: anywhere; }
.notif-head .chip { padding: 2px 9px; font-size: .68rem; flex: none; }
.notif-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .95rem; line-height: 1; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.notif-del:hover, .notif-del:focus-visible { color: #ff5d73; background: rgba(255, 93, 115, .12); }
.notif-sub { font-size: .85rem; color: var(--accent); }
.notif-time { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.notif-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: .92rem; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.notif-result { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.notif-congrats { width: 100%; padding: 10px 12px; border-radius: 12px; background: linear-gradient(120deg, rgba(245,196,0,.16), rgba(245,196,0,.04)); border: 1px solid rgba(245,196,0,.35); }
.forum-scope { margin-top: 12px; }
.forum-intro { margin: 0 2px 16px; }
.forum-compose { margin-bottom: 18px; }
.forum-compose-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.forum-compose-heading h2 { margin: 0; }
.forum-team-label { color: var(--text); font-size: .95rem; }
.forum-list, .forum-replies { display: flex; flex-direction: column; gap: 10px; }
.forum-thread { width: 100%; color: var(--text); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 9px; transition: border-color .2s, background .2s; }
.forum-thread:hover { border-color: rgba(0,229,160,.55); background: var(--surface-2); }
.forum-thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.forum-thread-head strong { font-family: var(--font-display); font-size: 1.15rem; overflow-wrap: anywhere; }
.forum-reply-count { flex: none; color: var(--accent); font-size: .78rem; }
.forum-preview { color: var(--muted); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.forum-meta { color: var(--muted); font-size: .78rem; }
.forum-post { margin: 14px 0; }
.forum-post h1 { overflow-wrap: anywhere; }
.forum-edit-button { margin-top: 12px; }
.forum-edit-form { width: 100%; }
.forum-content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin-bottom: 0; }
.forum-reply-section { margin-bottom: 18px; }
.forum-reply { padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(0,0,0,.16); }
.forum-reply-author { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .84rem; }
.forum-reply-author time { color: var(--muted); font-size: .75rem; margin-left: auto; }
.notif-congrats-title { font-weight: 700; color: #ffd84d; }
.notif-congrats-sub { font-size: .88rem; color: var(--muted); margin-top: 2px; font-style: italic; }
.notif-board-title { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.notif-board { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.notif-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); }
.notif-row.first { background: linear-gradient(120deg, rgba(0,229,160,.18), rgba(0,229,160,.04)); box-shadow: inset 3px 0 var(--accent); }
.notif-row.off { opacity: .55; }
.notif-rank { text-align: center; font-weight: 700; font-size: 1.15rem; }
.notif-name { font-weight: 700; overflow-wrap: anywhere; }
.notif-name small, .notif-pts small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.notif-pts { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: var(--accent); white-space: nowrap; }
.tab[aria-current="page"] { color: var(--accent); text-shadow: 0 0 12px rgba(0,229,160,.45); }
@media (min-width: 900px) {
  .topbar .team-select {
    position: absolute;
    left: 110px;
    transform: translateX(-50%);
    width: min(860px, calc(100vw - 248px));
    max-width: none;
    min-height: 46px;
    padding: 10px 22px;
    font-size: 1.05rem;
  }
  main { margin-left: 220px; max-width: none; padding: 30px clamp(24px, 4vw, 64px) 48px; }
  .tabbar { top: calc(var(--top-h) + env(safe-area-inset-top)); bottom: 0; right: auto; width: 200px; height: auto;
    flex-direction: column; justify-content: flex-start; gap: 6px; padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line-soft); }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; }
  .tab[aria-current="page"] { background: linear-gradient(110deg, rgba(0,229,160,.13), rgba(0,229,160,.035)); box-shadow: inset 3px 0 var(--accent); text-shadow: none; }
}
@media (min-width: 1400px) { .topbar .team-select { min-height: 50px; padding: 12px 26px; font-size: 1.15rem; } }

/* ---------- Komponenter ---------- */
.card {
  background: linear-gradient(145deg, rgba(20, 56, 38, .96), rgba(12, 35, 25, .98) 72%);
  border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-card);
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 1rem;
  transition: transform .18s var(--ease-ui), box-shadow .2s, background .2s, border-color .2s; text-decoration: none; color: var(--text);
}
.btn:hover { box-shadow: 0 6px 20px rgba(0,229,160,.16); border-color: rgba(0,229,160,.55); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #19f0b0, #00c98a); color: #04281b; border-color: transparent; box-shadow: var(--glow); }
.btn.gold { background: linear-gradient(180deg, #ffd966, #f0b100); color: #3a2a00; border-color: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .85rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }

label.field { display: block; }
label.field > span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-input);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { padding: 12px 14px; min-height: 110px; resize: vertical; display: block; box-sizing: border-box; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--glow); outline: none; }
.err { color: var(--danger); font-size: .9rem; min-height: 1.2em; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line); background: var(--surface); }
.chip.open { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px rgba(0,229,160,.3); }
.chip.closed { color: var(--gold); border-color: var(--gold); }
.chip.admin { color: var(--gold); border-color: var(--gold); }
.chip.online-chip { color: var(--accent); border-color: var(--accent); }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.avatar-wrap.online::after { content: ''; position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #0a1f16; box-shadow: 0 0 8px rgba(0,229,160,.7); }
.chip.banned { color: var(--danger); border-color: var(--danger); }

/* Billardkugle-avatar */
.ball {
  --c: #d62828; width: 40px; height: 40px; border-radius: 50%; flex: none; position: relative; overflow: hidden; display: inline-block;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), transparent 35%), var(--c);
  box-shadow: inset -4px -6px 10px rgba(0,0,0,.45), 0 3px 8px rgba(0,0,0,.5);
}
.ball.stripe { background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), transparent 35%), linear-gradient(180deg, #f4f4f4 0 24%, var(--c) 24% 76%, #f4f4f4 76%); }
.ball i {
  position: absolute; left: 50%; top: 50%; width: 52%; height: 52%; transform: translate(-50%, -50%); border-radius: 50%;
  background: #fff; color: #111; font-style: normal; font-weight: 800; display: grid; place-items: center; font-size: .62em; font-family: var(--font-display);
}
.ball.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.avatar.lg { width: 56px; height: 56px; }
.avatar.xl { width: 96px; height: 96px; }
.ball.sm { width: 28px; height: 28px; font-size: 12px; }

/* Spillerkort i sessionen */
.player {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px;
  border-radius: 14px; background: rgba(0,0,0,.22); border: 1px solid var(--line);
}
.player.off { opacity: .55; filter: grayscale(.6); }
.player .name { font-weight: 700; }
.player .sub { font-size: .8rem; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.4rem; cursor: pointer; }
.stepper input { width: 64px; text-align: center; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; padding: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .8rem; color: var(--muted); min-height: 44px; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 999px; background: #20382e; position: relative; cursor: pointer; transition: background .2s; border: 1px solid var(--line); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }

/* Tabeller */
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--line-soft); background: rgba(5, 18, 12, .28); scrollbar-color: #286247 #0a1f16; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { position: sticky; top: 0; background: #0b2218; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; color: var(--muted); text-align: left; white-space: nowrap; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); }
td.n, th.n { text-align: right; font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; }
tbody tr { transition: background .15s; }
tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
tbody tr.drill { cursor: pointer; }
tbody tr.drill:hover, tbody tr:focus-within { background: rgba(0,229,160,.08); }
tbody tr:last-child td { border-bottom: 0; }
td.best { color: var(--gold); text-shadow: 0 0 10px rgba(255,200,61,.5); }
td.first-col, th.first-col { position: sticky; left: 0; background: #0c241a; z-index: 1; }
.go { color: var(--accent); font-size: 1.2rem; }
.hint { font-size: .8rem; color: var(--muted); margin: 6px 2px 0; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; }
.crumbs button { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-transform: inherit; padding: 8px 4px; min-height: 40px; }
.crumbs span { color: var(--muted); }

.seg { display: flex; gap: 4px; padding: 4px; background: rgba(10,31,22,.86); border: 1px solid var(--line-soft); border-radius: 999px; margin-bottom: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.16); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; font-family: var(--font-display); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.seg button { transition: color .18s, background .18s, box-shadow .18s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: linear-gradient(180deg, #19f0b0, #00c98a); color: #04281b; box-shadow: 0 4px 14px rgba(0,229,160,.2); }

/* Podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 8px 0 16px; min-height: 190px; }
.podium .slot { flex: 1; max-width: 170px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium .block {
  width: 100%; border-radius: 12px 12px 0 0; display: grid; place-items: start center; padding-top: 8px; font-size: 1.9rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-bottom: 0;
  transform-origin: bottom; animation: rise .7s cubic-bezier(.2,.9,.3,1.2) both;
}
.slot.p1 .block { height: 110px; border-color: var(--gold); box-shadow: 0 0 24px rgba(255,200,61,.35); color: var(--gold); }
.slot.p2 .block { height: 80px; color: var(--silver); }
.slot.p3 .block { height: 60px; color: var(--bronze); }
.slot .pname { font-weight: 700; font-size: .9rem; overflow-wrap: anywhere; }
.slot.p1 .ball { box-shadow: 0 0 22px rgba(255,200,61,.8), inset -4px -6px 10px rgba(0,0,0,.45); animation: pulse 2s infinite; }
.crown { font-size: 1.3rem; }
@keyframes rise { from { transform: scaleY(.1); opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 34px rgba(255,200,61,1), inset -4px -6px 10px rgba(0,0,0,.45); } }

/* Turnering */
.match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 12px; border-radius: 14px; background: rgba(0,0,0,.2); border: 1px solid var(--line-soft); transition: border-color .2s, background .2s; }
.match .side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.match .side.right { flex-direction: row-reverse; text-align: right; }
.match .pn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.match .score { display: flex; align-items: center; gap: 4px; }
.match .score input { width: 54px; text-align: center; padding: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.starter { font-size: .7rem; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; display: block; }
.match.done { border-color: rgba(0,229,160,.42); background: linear-gradient(110deg, rgba(0,229,160,.055), rgba(0,0,0,.18)); }

/* Tomme tilstande, skeleton */
.empty { text-align: center; padding: 36px 16px; }
.empty .ball { width: 84px; height: 84px; font-size: 32px; margin-bottom: 12px; }
.skel { height: 64px; border-radius: 14px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; z-index: 1; }
.auth .card { width: 100%; max-width: 420px; }
.auth .brand { text-align: center; margin-bottom: 14px; }
.auth-logo { width: 100%; max-width: 280px; height: auto; display: block; margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auth .brand .ball { width: 84px; height: 84px; font-size: 32px; margin-bottom: 8px; animation: roll 1.2s cubic-bezier(.2,.8,.2,1) both; }
@keyframes roll { from { transform: translateX(-120px) rotate(-540deg); opacity: 0; } }

/* Dialog + toast */
dialog { border: 1px solid var(--accent); border-radius: 20px; background: var(--surface); color: var(--text); max-width: min(92vw, 440px); width: 100%; padding: 20px; box-shadow: var(--glow); }
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
dialog.danger { border-color: var(--danger); box-shadow: 0 0 20px rgba(255,77,109,.35); }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: #0b2218; border: 1px solid var(--accent); border-radius: 12px; padding: 10px 16px; box-shadow: var(--glow); animation: toast .25s ease-out; max-width: 90vw; }
.toast.error { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 16px rgba(255,77,109,.35); }
@keyframes toast { from { transform: translateY(12px); opacity: 0; } }

.offline-bar { background: #3a2a00; color: var(--gold); text-align: center; padding: 6px; font-size: .85rem; position: relative; z-index: 21; }
.confetti { position: fixed; top: -12px; width: 8px; height: 14px; z-index: 60; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }
canvas.chart { width: 100%; height: 240px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: .8rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .confetti { display: none; }
}

/* Indsigt */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: #0a1f16; color: var(--muted); cursor: pointer; font-weight: 700; }
.chip-btn.on { border-color: var(--accent); color: var(--text); box-shadow: var(--glow); }
.profile-grid { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 16px; align-items: center; }
@media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }
.radar { width: 100%; max-width: 300px; display: block; margin: 0 auto; overflow: visible; }
.radar-poly { transform-origin: 130px 130px; animation: radarIn .9s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes radarIn { from { transform: scale(.05); opacity: 0; } }
.spark { width: 100%; height: 90px; display: block; overflow: visible; }
.spark-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawLine 1.4s ease-out .2s forwards; }
.spark-dot { animation: pulse 2s infinite; opacity: 0; animation: fadeDot .3s 1.5s forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes fadeDot { to { opacity: 1; } }
.trend { font-weight: 700; margin-top: 4px; }
.trend.up { color: var(--accent); } .trend.down { color: var(--danger); } .trend.flat { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: linear-gradient(145deg, rgba(10,31,22,.9), rgba(7,19,14,.86)); border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px; }
.kpi .big, .rivals .big { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.k-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.k-sub { font-size: .78rem; color: var(--muted); }
.hls, .facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.hl, .fact { background: linear-gradient(160deg, var(--surface-2), #0a1f16); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.fact { flex-direction: row; align-items: flex-start; gap: 10px; }
.hl-ic { font-size: 1.6rem; line-height: 1; }
.heat { font-weight: 700; min-width: 40px; }
.rivals { text-align: center; border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px; background: linear-gradient(145deg, rgba(10,31,22,.9), rgba(7,19,14,.86)); }
.race { position: relative; }
.race-row { position: absolute; left: 0; right: 0; height: 36px; display: grid; grid-template-columns: 28px 84px 1fr 44px; align-items: center; gap: 8px; transition: transform .7s cubic-bezier(.3,.8,.3,1); }
.race-name { font-weight: 700; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-track { height: 18px; border-radius: 999px; background: #0a1f16; border: 1px solid var(--line); overflow: hidden; }
.race-fill { height: 100%; width: 0; border-radius: 999px; transition: width .7s cubic-bezier(.3,.8,.3,1); box-shadow: 0 0 12px currentColor; }
.race-val { text-align: right; font-weight: 700; }
.race-date { color: var(--gold); font-weight: 700; }
input[type=range] { flex: 1; accent-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .radar-poly, .spark-line, .spark-dot, .race-row, .race-fill { animation: none; transition: none; } .spark-line { stroke-dashoffset: 0; } .spark-dot { opacity: 1; } }

@media (hover: hover) {
  .card { transition: border-color .2s, box-shadow .2s, transform .2s var(--ease-ui); }
  .card:hover { border-color: rgba(143,181,163,.28); box-shadow: 0 18px 38px rgba(0,0,0,.32); }
  .player:hover, .match:hover { border-color: rgba(0,229,160,.34); }
}

@media (max-width: 560px) {
  main { padding: 18px 12px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
  .card { padding: 15px; border-radius: 14px; }
  .seg { gap: 2px; padding: 3px; }
  .seg button { min-height: 42px; padding: 0 5px; font-size: .78rem; letter-spacing: .03em; }
  th, td { padding: 11px 10px; }
  .table-wrap { border-radius: 12px; }
}

@media (min-width: 900px) {
  .topbar { border-bottom-color: var(--line-soft); }
}