:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1a2540;
  --line: #24314f;
  --text: #eef2f8;
  --muted: #8a97b1;
  --accent: #b6f000;
  --accent-ink: #0b1220;
  --danger: #ff5d6c;
  --warn: #ffb020;
  --pitch: #0f5132;
  --pitch-line: rgba(255, 255, 255, 0.14);
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overscroll-behavior: none;
}
#app { max-width: 520px; margin: 0 auto; padding: 16px 16px 96px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
input {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; width: 100%; outline: none;
}
input:focus { border-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.block { width: 100%; }
.btn.big { padding: 18px; font-size: 18px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }

/* Home */
.hero { text-align: center; padding: 40px 0 24px; }
.logo { font-size: 40px; font-weight: 900; letter-spacing: -0.04em; }
.logo span { color: var(--accent); }
.tagline { color: var(--muted); margin-top: 6px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 24px; }
.rules div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.rules b { display: block; font-size: 20px; color: var(--accent); }

/* Lobby */
.code { font-size: 40px; font-weight: 900; letter-spacing: 0.2em; text-align: center; font-variant-numeric: tabular-nums; }
.manager { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.manager:last-child { border-bottom: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.badge.live { color: var(--accent); }
.badge.off { color: var(--warn); }

/* Topbar in draft */
.topbar {
  position: sticky; top: 0; z-index: 5; margin: -16px -16px 12px; padding: 12px 16px;
  background: rgba(11, 18, 32, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}
.topbar b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.topbar span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Lot card */
.lot { position: relative; overflow: hidden; }
.card {
  display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center;
}
.rating {
  width: 72px; height: 84px; border-radius: 14px; display: grid; place-items: center; text-align: center;
  background: linear-gradient(160deg, #2a3a60, #151f36); border: 1px solid var(--line);
}
.rating b { font-size: 30px; line-height: 1; }
.rating small { font-size: 11px; font-weight: 700; color: var(--muted); }
.rating.legend { background: linear-gradient(160deg, #6b5310, #2b2208); border-color: #b08a1c; }
.rating.legend small { color: #f5d169; }
.pname { font-size: 22px; font-weight: 800; line-height: 1.15; }
.era { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 800; color: #f5d169; vertical-align: middle; }
.bidline { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; }
.bidamt { font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.leader { font-weight: 700; }
.timer { height: 8px; border-radius: 99px; background: var(--panel-2); margin-top: 14px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--accent); transition: width 0.1s linear; }
.timer.hot i { background: var(--danger); }
.secs { font-variant-numeric: tabular-nums; font-weight: 800; }
.bidbtns { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-top: 14px; }
.reason { margin-top: 10px; font-size: 13px; color: var(--warn); text-align: center; min-height: 18px; }
.flash { animation: flash 0.5s ease-out; }
@keyframes flash { from { background: rgba(182, 240, 0, 0.25); } to { background: var(--panel); } }
.sold { text-align: center; padding: 22px 16px; }
.sold .stamp { font-size: 30px; font-weight: 900; color: var(--accent); letter-spacing: 0.08em; }
.sold .stamp.unsold { color: var(--muted); }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(11, 18, 32, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs button { background: none; padding: 10px 4px; font-size: 13px; font-weight: 700; color: var(--muted); border-radius: 10px; }
.tabs button.on { color: var(--accent); background: var(--panel); }

/* Player list */
.plist { margin-top: 10px; }
.prow { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prow .r { font-weight: 900; font-size: 17px; text-align: center; }
.prow .r.legend { color: #f5d169; }
.prow .nm { font-weight: 600; }
.prow .meta { font-size: 12px; color: var(--muted); }
.prow .btn { padding: 8px 12px; font-size: 13px; }
.nofit { opacity: 0.45; }

/* Teams */
.team { margin-top: 12px; }
.needs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.need { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.need.full { color: var(--accent); }
.srow { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.srow:last-child { border-bottom: 0; }

/* Pitch */
.pitch {
  background: repeating-linear-gradient(0deg, var(--pitch) 0 40px, #11593a 40px 80px);
  border-radius: var(--radius); padding: 18px 8px; position: relative; border: 1px solid #1d6b47;
}
.pitch::before { content: ''; position: absolute; left: 8%; right: 8%; top: 50%; border-top: 2px solid var(--pitch-line); }
.pitch::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px;
  border: 2px solid var(--pitch-line); border-radius: 50%;
}
.line { display: flex; justify-content: space-around; margin: 10px 0; position: relative; z-index: 1; }
.spot { width: 72px; text-align: center; }
.spot .shirt {
  width: 40px; height: 40px; margin: 0 auto 4px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 900; color: var(--accent-ink); font-size: 15px;
}
.spot .shirt.empty { background: rgba(255, 255, 255, 0.08); border: 2px dashed rgba(255, 255, 255, 0.3); color: var(--muted); }
.spot .n { font-size: 11px; font-weight: 700; line-height: 1.15; text-shadow: 0 1px 2px #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spot .p { font-size: 10px; color: rgba(255, 255, 255, 0.75); }
.bench { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; }
.bench .spot { flex: none; }

/* Results */
.champ { text-align: center; padding: 28px 16px; background: linear-gradient(160deg, #283d0c, var(--panel)); }
.champ .trophy { font-size: 52px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
td.team-cell { text-align: left; font-weight: 700; }
.award { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.award:last-child { border-bottom: 0; }
.award .ic { font-size: 26px; }
.match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.match .score { font-weight: 900; font-variant-numeric: tabular-nums; }
.match :last-child { text-align: right; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--danger); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600;
  z-index: 20; max-width: 90vw; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.toast.info { background: var(--panel-2); border: 1px solid var(--line); }
.foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 28px; }

.mute {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; z-index: 10; width: 36px; height: 36px;
  border-radius: 50%; background: var(--panel); border: 1px solid var(--line); font-size: 16px; opacity: 0.8;
}
.topbar { padding-right: 52px; }

/* Positionsmærker — farve efter linje */
.pb { display: inline-block; min-width: 36px; text-align: center; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; letter-spacing: 0.02em; }
.pb.GK { background: #f5b301; color: #1b1400; }
.pb.DEF { background: #2f7cf6; color: #fff; }
.pb.MID { background: #19b36b; color: #fff; }
.pb.FWD { background: #ef4452; color: #fff; }
.prow { grid-template-columns: 44px 1fr auto; }

/* Fakta på auktionskortet */
.facts { margin: 12px 0 0; padding: 10px 12px 10px 28px; background: var(--panel-2); border-radius: 12px; font-size: 13px; line-height: 1.45; }
.facts li + li { margin-top: 3px; }

/* Bane med formationens koordinater */
.pitch2 {
  position: relative; aspect-ratio: 3 / 4; margin-top: 12px; border-radius: var(--radius); border: 1px solid #1d6b47; overflow: hidden;
  background:
    linear-gradient(transparent calc(50% - 1px), var(--pitch-line) calc(50% - 1px), var(--pitch-line) calc(50% + 1px), transparent calc(50% + 1px)),
    repeating-linear-gradient(0deg, var(--pitch) 0 12.5%, #11593a 12.5% 25%);
}
.spot2 {
  position: absolute; transform: translate(-50%, 50%); width: 70px; background: none; padding: 0; text-align: center; color: #fff;
}
.spot2:disabled { opacity: 1; cursor: default; }
.shirt2 {
  position: relative; width: 38px; height: 38px; margin: 0 auto 3px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 900; font-size: 12px; color: var(--accent-ink); box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.shirt2.empty { background: rgba(255,255,255,.08); border: 2px dashed rgba(255,255,255,.35); color: #fff; box-shadow: none; }
.spot2.sel .shirt2 { outline: 3px solid #fff; outline-offset: 2px; }
.spot2 .n { font-size: 11px; font-weight: 700; line-height: 1.1; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot2 .p { font-size: 9px; opacity: .8; }
.fit { position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--pitch); display: inline-block; }
.fit.natural { background: #22c55e; } .fit.good { background: #b6f000; } .fit.ok { background: #f59e0b; } .fit.poor { background: #ef4444; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.legend i { position: static; margin-right: 5px; vertical-align: -1px; border-color: var(--bg); }
.needbox { margin: 12px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.warnline, .need.warn { color: var(--warn); font-weight: 700; }
.benchrow { width: 100%; background: none; color: inherit; text-align: left; padding: 8px 4px; border-radius: 8px; }
.benchrow.sel { background: var(--panel-2); outline: 2px solid var(--accent); }

/* Rival-radar */
.radar { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.radar summary { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.rival { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; }
.rival .muted { margin-left: auto; }
.rival.out { opacity: .45; }
.rival .hot { color: var(--warn); font-weight: 800; }

/* Rating-fradrag uden for position */
.minus { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); background: #ef4444; color: #fff; font-size: 9px; font-weight: 900; padding: 1px 4px; border-radius: 5px; line-height: 1.2; }
.minus.static { position: static; transform: none; margin-right: 4px; }
.shirt2 .was { position: absolute; top: -9px; left: -6px; font-size: 9px; font-weight: 800; background: var(--bg); color: var(--muted); text-decoration: line-through; padding: 0 3px; border-radius: 4px; }

/* Going once / twice */
.going { text-align: center; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--danger); min-height: 20px; margin-top: 8px; font-size: 14px; }

/* Sweep */
.sweephead { background: linear-gradient(160deg, #3a2a05, var(--panel)); border-color: #7a5a0a; }

/* Sæsonshow */
.show { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; justify-content: center; gap: 16px; cursor: pointer; }
.showcard { text-align: center; padding: 28px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
.showcard h1 { font-size: 34px; margin-top: 6px; }
@keyframes pop { from { transform: scale(.85) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.big-emoji { font-size: 72px; line-height: 1.1; }
.roastline { font-size: 19px; font-style: italic; margin: 14px 0 6px; line-height: 1.4; }
.dots { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.skip { align-self: center; padding: 8px 18px; font-size: 14px; }
.rise { opacity: 0; animation: rise .5s forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Pass */
.passbtn { margin-top: 8px; background: transparent; color: var(--muted); border-style: dashed; }
.passed-note { margin-top: 10px; text-align: center; font-size: 13px; color: var(--muted); }

.update-banner { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 30; background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 10px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
