/* Layout: taktiktavla – en kolumn som appskal, planen med magneter är huvudobjektet; flikrad nertill. */
:root {
  --paper: #ECF1EC;
  --surface: #FAFCFA;
  --surface-2: #E1E8E2;
  --ink: #12231A;
  --ink-2: #4D5E53;
  --line: #D0D9D1;
  --accent: #1D4ED8;          /* magnetblå: knappar och våra spelare */
  --accent-ink: #FFFFFF;
  --accent-soft: #DCE4FA;
  --pitch: #2F7848;
  --pitch-2: #2A6E42;
  --chalk: rgba(255, 255, 255, .8);
  --chalk-soft: rgba(255, 255, 255, .16);
  --on-pitch: #FFFFFF;
  --good: #1D7A3B;
  --good-soft: #D6EDDC;
  --warn: #B65309;
  --warn-soft: #FBE6D3;
  --bad: #BE2A31;
  --bad-soft: #F7DADB;
  --scrim: rgba(10, 22, 15, .45);
  --shadow: 0 1px 2px rgba(18, 35, 26, .06), 0 6px 20px rgba(18, 35, 26, .08);
  --shadow-lg: 0 -4px 30px rgba(10, 22, 15, .18);
  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 7px;
  --r-md: 12px;
  --r-lg: 18px;
  --tabbar-h: 62px;
  --topbar-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1611;
    --surface: #15211A;
    --surface-2: #1F2E25;
    --ink: #E4EDE7;
    --ink-2: #9AAEA1;
    --line: #2A3B31;
    --accent: #86A6FF;
    --accent-ink: #0A1533;
    --accent-soft: #1D2B52;
    --pitch: #22593A;
    --pitch-2: #1F5135;
    --chalk: rgba(255, 255, 255, .62);
    --chalk-soft: rgba(255, 255, 255, .1);
    --on-pitch: #F1F6F2;
    --good: #63C783;
    --good-soft: #163322;
    --warn: #F29A55;
    --warn-soft: #3A2516;
    --bad: #F2737A;
    --bad-soft: #3D1B1F;
    --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 -4px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1611;
  --surface: #15211A;
  --surface-2: #1F2E25;
  --ink: #E4EDE7;
  --ink-2: #9AAEA1;
  --line: #2A3B31;
  --accent: #86A6FF;
  --accent-ink: #0A1533;
  --accent-soft: #1D2B52;
  --pitch: #22593A;
  --pitch-2: #1F5135;
  --chalk: rgba(255, 255, 255, .62);
  --chalk-soft: rgba(255, 255, 255, .1);
  --on-pitch: #F1F6F2;
  --good: #63C783;
  --good-soft: #163322;
  --warn: #F29A55;
  --warn-soft: #3A2516;
  --bad: #F2737A;
  --bad-soft: #3D1B1F;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 -4px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
  margin: 0;
  min-height: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .tab-nums { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Toppfält ---------- */
#topbar { position: sticky; top: 0; z-index: 20; }
.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
  max-width: 760px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.brand-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2);
}
.brand-name {
  font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1; letter-spacing: .01em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.coach-stack { display: flex; align-items: center; background: none; border: 0; padding: 4px; border-radius: 999px; }
.coach-stack .av + .av { margin-left: -8px; }
.av {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--paper); object-fit: cover;
  background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex: none;
}
.av.sm { width: 22px; height: 22px; font-size: 10px; border-width: 1.5px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Huvudyta ---------- */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding-block: 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.main.editor-open { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title {
  font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: .95; margin: 0;
  text-transform: uppercase; letter-spacing: .01em; text-wrap: balance;
}
.page-sub { color: var(--ink-2); font-size: 14px; margin: 4px 0 0; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 0;
}
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1; margin: 0; text-transform: uppercase;
  letter-spacing: .02em;
}
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.card-pad { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.empty h3 { margin: 0; font-size: 17px; }
.empty p { margin: 0; color: var(--ink-2); max-width: 52ch; }
.banner {
  border-radius: var(--r-md); padding: 10px 12px; font-size: 14px; display: flex; gap: 8px; align-items: flex-start;
  background: var(--warn-soft); color: var(--ink);
}
.banner.info { background: var(--accent-soft); }

/* ---------- Knappar ---------- */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 15px; line-height: 1.1; text-decoration: none; white-space: nowrap;
  background: var(--surface-2); color: var(--ink);
  transition: background-color .15s, filter .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 10px; }
.btn.line { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Chips och märken ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.code { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .03em; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.hit { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.score {
  font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Segmentväljare ---------- */
.seg {
  display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; min-height: 36px; border: 0; border-radius: 8px; background: transparent; padding: 0 12px;
  font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] {
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

/* ---------- Nästa match ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); color: var(--on-pitch);
  background: repeating-linear-gradient(90deg, var(--pitch) 0 44px, var(--pitch-2) 44px 88px);
  box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; border: 0; text-align: left; width: 100%;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: 50%; width: 170px; height: 170px; margin-top: -85px;
  border: 2px solid var(--chalk); border-radius: 50%; opacity: .45; pointer-events: none;
}
.hero::before {
  content: ""; position: absolute; right: 24px; top: 0; bottom: 0; width: 2px; background: var(--chalk); opacity: .45;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--on-pitch); opacity: .85; }
.hero-date {
  font-family: var(--font-display); font-weight: 800; font-size: 46px; line-height: .9; text-transform: uppercase;
  letter-spacing: .01em;
}
.hero-title { font-size: 19px; font-weight: 600; line-height: 1.25; margin: 0; max-width: 32ch; }
.hero-meta { font-size: 14px; opacity: .9; }
.hero .chip { background: rgba(255, 255, 255, .18); color: var(--on-pitch); }
.hero-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }

/* ---------- Matchlista ---------- */
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--line); }
.mrow {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: transparent; border: 0; width: 100%; text-align: left;
}
.mrow:hover { background: var(--surface-2); }
.list > .mrow:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.list > .mrow:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.datebox { display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 2px; }
.datebox .d { font-family: var(--font-display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.datebox .m { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.mrow-title { display: block; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow-meta { display: block; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.mrow.cancelled .mrow-title { text-decoration: line-through; color: var(--ink-2); }

/* ---------- Matchsida ---------- */
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none;
  color: var(--accent); font-weight: 600; padding: 6px 4px 6px 0; min-height: 40px;
}
.back svg { width: 18px; height: 18px; }
.match-head { display: flex; flex-direction: column; gap: 6px; }
.match-head .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.match-title {
  font-family: var(--font-display); font-weight: 800; font-size: 36px; line-height: .95; margin: 0;
  text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere;
}
.kv { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }

.prop {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.prop.is-final { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.prop-head { display: flex; align-items: center; gap: 10px; }
.prop-who { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-who small { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.prop-comment {
  margin: 0; font-size: 14px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.prop-facts { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Planen ---------- */
.pitch-wrap { display: flex; flex-direction: column; gap: 10px; }
.pitch {
  position: relative; width: 100%; max-width: 520px; margin: 0 auto; aspect-ratio: 68 / 92;
  border-radius: 14px; overflow: hidden;
  background: repeating-linear-gradient(180deg, var(--pitch) 0 9.09%, var(--pitch-2) 9.09% 18.18%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
  user-select: none; -webkit-user-select: none;
}
.pitch.mini { max-width: 150px; border-radius: 8px; }
.pitch > svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pitch > svg.lines * { fill: none; stroke: var(--chalk); stroke-width: .35; vector-effect: non-scaling-stroke; }
.pitch > svg.lines .spot { fill: var(--chalk); stroke: none; }
.pitch .lines-w { stroke-width: 2px; }
.slot {
  position: absolute; transform: translate(-50%, -50%); width: min(20%, 112px);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; padding: 0; color: var(--on-pitch); -webkit-tap-highlight-color: transparent;
}
.slot[disabled] { cursor: default; }
.slot-code {
  font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: .06em; line-height: 1;
  opacity: .9; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.magnet {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1; color: var(--accent-ink);
  background: var(--accent);
  background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--accent) 55%, #fff) 0, var(--accent) 48%, color-mix(in srgb, var(--accent) 78%, #000) 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35), inset 0 -2px 3px rgba(0, 0, 0, .18);
  font-variant-numeric: tabular-nums;
}
.magnet.sm { width: 28px; height: 28px; font-size: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.magnet.xs { width: 24px; height: 24px; font-size: 12px; box-shadow: none; }
.magnet.ghost {
  background: transparent; border: 2px dashed var(--chalk); box-shadow: none; color: var(--on-pitch);
  font-size: 12px; letter-spacing: .04em;
}
.magnet.off { background: var(--surface-2); color: var(--ink-2); box-shadow: none; }
.slot.picking .magnet { outline: 3px solid #FFE15A; outline-offset: 2px; }
.slot-name {
  max-width: 100%; padding: 1px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.35;
  background: rgba(8, 20, 12, .62); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pitch.mini .slot { width: 22%; }
.pitch.mini .magnet { width: 13px; height: 13px; font-size: 0; box-shadow: none; }
.pitch.mini .magnet.ghost { border-width: 1px; }
.pitch-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.bench { display: flex; flex-wrap: wrap; gap: 6px; }
.bench .pl {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}

/* ---------- Spelarrader ---------- */
.prow {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 14px; width: 100%; text-align: left; background: transparent; border: 0;
}
.prow:hover { background: var(--surface-2); }
.list > .prow:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.list > .prow:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.prow-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-sub { font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.prow.off { opacity: .55; }
.prow-right { display: flex; align-items: center; gap: 8px; }
.check {
  width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.check svg { width: 16px; height: 16px; opacity: 0; color: var(--accent-ink); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on svg { opacity: 1; }

/* ---------- Mätare ---------- */
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: visible; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.meter > i.low { background: var(--warn); }
.meter > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); border-radius: 1px; }
.mini-meter { width: 64px; height: 6px; }

/* ---------- Statistik ---------- */
.stat-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 64px; gap: 10px; align-items: center;
  padding: 10px 14px; width: 100%; background: transparent; border: 0; text-align: left;
}
.stat-row:hover { background: var(--surface-2); }
.stat-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.stat-top .prow-name { flex: 1; min-width: 0; }
.stat-val { text-align: right; line-height: 1.1; }
.stat-val strong { font-family: var(--font-display); font-weight: 800; font-size: 22px; display: block; font-variant-numeric: tabular-nums; }
.stat-val span { font-size: 12px; color: var(--ink-2); }
.summary { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.summary b { color: var(--ink); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { padding: 8px 7px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--surface); }
table.grid th:first-child, table.grid td:first-child {
  text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; max-width: 44vw; padding-left: 12px;
  overflow: hidden; text-overflow: ellipsis;
}
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr { cursor: pointer; }
table.grid td.heat { font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-right: 5px; }
.legend i.avg { width: 2px; height: 14px; background: var(--ink-2); }
.legend i.low { background: var(--warn); }
.hist { display: flex; flex-direction: column; }
.hist > * + * { border-top: 1px solid var(--line); }
.hrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; }
.hrow .d { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-line { display: grid; grid-template-columns: 74px minmax(0, 1fr) 36px; gap: 8px; align-items: center; font-size: 14px; }

/* ---------- Formulär ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-2); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--surface-2); font-size: 20px; font-weight: 600; }
.stepper output, .stepper input {
  min-width: 44px; width: 52px; text-align: center; font-weight: 700; font-size: 17px; border: 0; background: transparent;
  font-variant-numeric: tabular-nums; padding: 0;
}
.stepper input::-webkit-inner-spin-button { display: none; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); transition: background .15s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s;
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.poslist { display: flex; flex-direction: column; gap: 8px; }
.posgroup { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.posgroup > span { width: 64px; font-size: 12.5px; color: var(--ink-2); }
.postog {
  min-width: 44px; min-height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .03em;
}
.postog[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Ark (bottom sheet) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 620px; max-height: calc(100% - 24px - env(safe-area-inset-top, 0px));
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
}
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; min-width: 0; }
.sheet-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding-block: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet-foot {
  border-top: 1px solid var(--line); padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.sheet-foot .grow { flex: 1; }
.sheet .list { border: 1px solid var(--line); border-radius: var(--r-md); }
.pick-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%;
  padding: 9px 12px; background: transparent; border: 0; text-align: left;
}
.pick-row:hover { background: var(--surface-2); }
.pick-row.current { background: var(--accent-soft); }
.star { color: #C98A00; font-weight: 700; }
:root[data-theme="dark"] .star { color: #FFD15C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .star { color: #FFD15C; } }
.steps { display: flex; flex-direction: column; gap: 8px; padding-left: 0; margin: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.steps li::before {
  content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}

/* ---------- Redigerare ---------- */
.editor-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.save-state { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.save-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
.save-state.busy i { background: var(--warn); }
.save-state.err i { background: var(--bad); }
.sticky-tabs {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h) + 1px); z-index: 5; background: var(--paper);
  padding-block: 6px; margin-block: -6px;
}
.count-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.count-big { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.count-big small { font-size: 16px; color: var(--ink-2); }

/* ---------- Flikrad ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.tabbar-in { max-width: 760px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: var(--tabbar-h); }
.tab {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; font-weight: 600; color: var(--ink-2); position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  z-index: 80; max-width: calc(100% - 32px); box-shadow: var(--shadow); text-align: center;
  pointer-events: none; /* bara information: tryck går igenom till det som ligger under */
}

/* ---------- Laddning ---------- */
.skel { background: var(--surface-2); border-radius: var(--r-md); min-height: 72px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.center-msg { max-width: 460px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.center-msg h1 { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1; margin: 0; text-transform: uppercase; }
.center-msg p { margin: 0; color: var(--ink-2); }

@media (min-width: 640px) {
  .page-title { font-size: 40px; }
  .hero { padding: 22px; }
  .hero-date { font-size: 56px; }
  .scrim { align-items: center; }
  .sheet { border-radius: var(--r-lg); max-height: 86%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Inloggning ---------- */
.main.auth-main {
  max-width: none; padding-top: 0; padding-bottom: 40px; padding-left: 0; padding-right: 0; gap: 0;
}
.main.auth-main > .center-msg {
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.auth { display: flex; flex-direction: column; }
.auth-hero {
  position: relative; overflow: hidden; color: var(--on-pitch);
  background: repeating-linear-gradient(90deg, var(--pitch) 0 48px, var(--pitch-2) 48px 96px);
  padding-block: calc(36px + env(safe-area-inset-top, 0px)) 60px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.auth-hero-in { position: relative; z-index: 1; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.auth-hero .eyebrow { color: var(--on-pitch); opacity: .85; }
.auth-title {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(50px, 15.5vw, 80px); line-height: .84;
  margin: 0; text-transform: uppercase; letter-spacing: .005em; hyphens: manual;
}
.auth-lead { margin: 0; font-size: 17px; line-height: 1.35; opacity: .95; }
.auth-row { display: grid; grid-template-columns: minmax(0, 1fr) 42%; gap: 14px; align-items: end; }
.auth-board { display: block; width: 100%; height: auto; opacity: .9; pointer-events: none; }
.auth-board .l { fill: none; stroke: var(--chalk); stroke-width: .8; }
.auth-board .m { fill: var(--accent); stroke: rgba(255, 255, 255, .55); stroke-width: .6; }
.auth-board text { font-family: var(--font-display); font-weight: 800; font-size: 6px; fill: var(--accent-ink); }
.auth-board .arrow { fill: none; stroke: #FFE15A; stroke-width: 1; stroke-dasharray: 2.4 1.8; }
.auth-board .arrow-h { fill: none; stroke: #FFE15A; stroke-width: 1; }
.auth-board .pass { fill: none; stroke: var(--chalk); stroke-width: .8; stroke-dasharray: 1 1.6; }
.auth-card {
  position: relative; z-index: 2; width: calc(100% - 32px); max-width: 440px; margin: -40px auto 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.form { display: flex; flex-direction: column; gap: 12px; }
.help summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.help p { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.code-input { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .14em; text-transform: uppercase; }
.code-input::placeholder { font-family: var(--font-body); font-weight: 400; font-size: 15px; letter-spacing: 0; text-transform: none; }
.form-error { margin: 0; color: var(--bad); font-size: 14px; font-weight: 600; }

/* ---------- Diverse ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.input.sm { min-height: 36px; padding: 4px 10px; font-size: 14px; width: auto; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline .input { width: auto; min-width: 120px; }
.warn-text { color: var(--warn); }
.slot-name.empty-name { background: rgba(8, 20, 12, .32); font-weight: 500; }
.prop-grid { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; align-items: start; }
.prop-grid .pitch.mini { max-width: 74px; margin: 0; }
.prop-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hero-avs { display: inline-flex; }
.hero-avs .av { border-color: var(--pitch); }
.hero-avs .av + .av { margin-left: -6px; }
.result-line { display: flex; align-items: center; gap: 10px; }
.score.big { font-size: 40px; }
.prow.sel { grid-template-columns: 30px minmax(0, 1fr) auto; }
.check.on.bad { background: var(--bad); border-color: var(--bad); }
.check.on.bad svg { color: #fff; }
.result-edit { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; }
.res-side { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; min-width: 0; }
.res-side .eyebrow { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-dash { font-family: var(--font-display); font-size: 30px; font-weight: 800; padding-bottom: 4px; }
.pm-row, .pm-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) 92px; gap: 8px; align-items: center; padding: 8px 12px; }
.pm-head { padding-block: 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.pm-head span:nth-child(3) { text-align: center; }
.pm-row .stepper button { width: 30px; height: 36px; }
.pm-row .stepper output { min-width: 24px; width: 24px; font-size: 15px; display: inline-block; }
.stepper output { display: inline-block; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpis > div { background: var(--surface-2); border-radius: 10px; padding: 10px 6px; display: flex; flex-direction: column; gap: 3px; text-align: center; }
.kpis strong { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; }
.kpis span { font-size: 12px; color: var(--ink-2); }
.set-sec { display: flex; flex-direction: column; gap: 10px; }
.set-sec + .set-sec { border-top: 1px solid var(--line); padding-top: 16px; }
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px;
}
.code-val { font-family: var(--font-display); font-weight: 800; font-size: 32px; letter-spacing: .16em; user-select: all; -webkit-user-select: all; }
body.sheet-open { overflow: hidden; }

.cell-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cell-name > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.cell-name .chip { min-height: 18px; padding: 0 5px; font-size: 11px; }

/* ---------- Kommentarer ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; }
.thread-toggle {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: 14px;
}
.thread-toggle svg { width: 18px; height: 18px; flex: none; }
.thread.open { border-top: 1px solid var(--line); padding-top: 10px; }
.thread.open .thread-toggle { color: var(--ink-2); }
.cmt { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; }
.cmt .av { margin-top: 1px; }
.cmt-main { min-width: 0; }
.cmt-head { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.cmt-head span { color: var(--ink-2); }
.cmt-del {
  margin-left: auto; background: none; border: 0; padding: 2px; color: var(--ink-2);
  display: inline-flex; align-items: center; border-radius: 6px;
}
.cmt-del svg { width: 15px; height: 15px; }
.cmt-del:hover { color: var(--bad); }
.cmt-body { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.thread-form textarea { min-height: 44px; resize: vertical; }

/* ---------- Inbjudningskoder och licenser ---------- */
.code-card { display: flex; flex-direction: column; gap: 6px; }
.code-head { display: flex; flex-direction: column; gap: 2px; }
.code-head b { font-size: 15px; }
.prow[disabled] { cursor: default; }
.prow[disabled]:hover { background: transparent; }
.lic-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px;
}
.lic-row.off { opacity: .6; }
.lic-code { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: .12em; }
@media (max-width: 420px) {
  .lic-row { grid-template-columns: minmax(0, 1fr); }
}
.banner a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Kontotyp och läsarplatser ---------- */
.plan-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-line .btn { margin-left: auto; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }

/* ---------- Kontot: länkknapp, listor i ark och integritetstexten ---------- */
.link-btn {
  background: none; border: 0; padding: 6px 0; align-self: flex-start; cursor: pointer;
  color: var(--ink-2); font-family: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent); }
.auth-card .link-btn, .center-msg .link-btn { align-self: center; }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.policy { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }
.policy h4 { margin: 8px 0 0; font-size: 15px; }
.policy p { margin: 0; }
.policy ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.policy a { color: var(--accent); }
.link-btn.inline { padding: 0; font-size: inherit; line-height: inherit; color: var(--accent); align-self: auto; vertical-align: baseline; }
.link-row { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 18px; }

/* ---------- Priser ---------- */
.prices { display: flex; flex-direction: column; gap: 12px; font-size: 14px; line-height: 1.45; }
.prices p, .prices h4 { margin: 0; }
.prices h4 { margin-top: 4px; font-size: 15px; }
.prices a:not(.btn) { color: var(--accent); }
.price-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.price-card.featured { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.price-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.price-name, .price-amount {
  margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1;
  text-transform: uppercase; letter-spacing: .02em;
}
.price-amount { white-space: nowrap; text-transform: none; }
.price-amount small { font-family: var(--font-body); font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-2); margin-left: 2px; }
.price-list, .price-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.price-steps { gap: 6px; }

/* ---------- Ritningar: övningar och taktiktavlan (plus.js) ---------- */
.dw { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.dw .dw-bg, .dw .dw-field { fill: var(--pitch); }
.dw .dw-stripe { fill: var(--pitch-2); }
.dw .dw-mk { fill: none; stroke: var(--chalk); stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.dw .dw-spot { fill: var(--chalk); }
.dw .dw-goal { fill: rgba(255, 255, 255, .22); stroke: #fff; stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.dw-net { fill: rgba(255, 255, 255, .2); stroke: #fff; stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.pl circle { stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.dw .pl text { font-family: var(--font-display); font-weight: 800; text-anchor: middle; fill: #fff; }
.pl-a circle { fill: var(--accent); }
.dw .pl-a text { fill: var(--accent-ink); }
.pl-b circle { fill: #D2343B; }
.pl-n circle { fill: #F2C230; }
.dw .pl-n text { fill: #1B1B1B; }
.pl-w circle { fill: #F4F6F5; stroke: #1B2A21; }
.dw .pl-w text { fill: #12231A; }
.pl-ga circle { fill: #12181F; }
.pl-gb circle { fill: #6E1A1E; }
.ball circle { fill: #fff; stroke: #1B1B1B; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.ball .dw-ball-dot { fill: #1B1B1B; stroke: none; }
.cone path { fill: #FF8A1F; stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.dw-zone { stroke-width: 1.2px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.dw-zone-w { fill: rgba(255, 255, 255, .14); stroke: rgba(255, 255, 255, .65); }
.dw-zone-a { fill: rgba(29, 78, 216, .26); stroke: rgba(170, 195, 255, .9); }
.dw-zone-b { fill: rgba(210, 52, 59, .26); stroke: rgba(255, 175, 178, .9); }
.dw-zone-n { fill: rgba(242, 194, 48, .24); stroke: rgba(255, 226, 120, .95); }
.dw .dw-line { fill: none; stroke: var(--chalk); stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.dw .dw-line.dash { stroke-dasharray: 5 4; }
.dw .txt text { font-family: var(--font-body); font-weight: 700; text-anchor: middle; fill: #fff; paint-order: stroke; stroke: rgba(10, 30, 18, .5); stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
.dw-arr { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dw-hit { fill: none; stroke: transparent; pointer-events: stroke; }
.dw-arr.dw-pass, .dw-arr.dw-drib { stroke: #fff; }
.dw-head.dw-pass, .dw-head.dw-drib { fill: #fff; }
.dw-arr.dw-run { stroke: #FFE15A; }
.dw-head.dw-run { fill: #FFE15A; }
.dw-arr.dw-shot { stroke: #FFB020; }
.dw-head.dw-shot { fill: #FFB020; }
.dw-arr.dw-press { stroke: #FF6B70; }
.dw-head.dw-press { fill: #FF6B70; }
.dw-arr.dw-block { stroke: #FFB3BD; }
.dw .it.sel circle { stroke: #FFE15A; stroke-width: 3px; }
.dw .it.sel .dw-arr, .dw .it.sel .dw-zone, .dw .it.sel .dw-net, .dw .it.sel path { filter: drop-shadow(0 0 2px rgba(255, 225, 90, .95)); }
.dw .dw-handle { fill: #FFE15A; stroke: #12231A; stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.dw.anim .it { transition: transform .8s cubic-bezier(.45, .05, .25, 1); }
.dw .enter { animation: dw-in .45s ease .6s both; }
@keyframes dw-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dw.anim .it { transition: none; } .dw .enter { animation: none; } }
.dw-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.dw-legend span { display: inline-flex; align-items: center; gap: 5px; }
/* Figurer till den skadeförebyggande fysiken: blå spelare med vit kant på planen, medspelaren gul */
.fgr .fg-ground { fill: none; stroke: var(--chalk); stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.fg .fg-halo { fill: none; stroke: #fff; stroke-width: 4.8; stroke-linecap: round; stroke-linejoin: round; }
.fg .fg-limb { fill: none; stroke: var(--accent); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.fg .fg-hhalo { fill: #fff; stroke: #fff; stroke-width: 2; }
.fg .fg-head { fill: var(--accent); }
.fg-n .fg-limb { stroke: #F2C230; }
.fg-n .fg-head { fill: #F2C230; }
.fg-far .fg-limb { stroke-opacity: .55; }
.fg-ghost { opacity: .38; }
.fgr .fg-arr { fill: none; stroke: #FFE15A; stroke-width: 1.4; stroke-linecap: round; }
.fgr .fg-arr.dash { stroke-dasharray: 2.6 2; }
.fgr .fg-arrhead { fill: #FFE15A; }
.fgr .fg-band { fill: none; stroke: #FF6B70; stroke-width: 1.5; stroke-linecap: round; }
.fgr .fg-mk { fill: #FFE15A; }
.fgr .fg-cone { fill: #FF9F1C; }
.tool-ic { width: 22px; height: 22px; border-radius: 6px; background: var(--pitch); flex: none; }
.tool-ic .tool-line { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-ic .tool-txt { fill: #fff; font-weight: 700; text-anchor: middle; font-family: var(--font-body); }

/* ---------- Plus: träning, övningsbanken och taktiktavlan ---------- */
.bank-card { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.bank-card:hover { background: var(--surface-2); }
.bank-art { display: block; width: 64px; }
.bank-art .dw, .ex-thumb .dw, .tac-thumb .dw { border-radius: 7px; }
.chev { color: var(--ink-2); display: inline-flex; }
.chev svg { width: 18px; height: 18px; transform: rotate(180deg); }
.ex-line { display: flex; align-items: center; gap: 4px; padding-right: 10px; }
.ex-line .ex-row { flex: 1; min-width: 0; }
.ex-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.ex-row:hover { background: var(--surface-2); }
.ex-row .chip { margin-top: 4px; }
.ex-thumb { display: block; width: 58px; }
.session-list { margin: 0; padding: 0; list-style: none; }
.session-list .ex-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.ex-num { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.sd-item { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.sd-top { display: flex; align-items: center; gap: 10px; }
.sd-name { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-tools { display: flex; gap: 2px; }
.sd-fields { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.icon-btn.flip svg { transform: rotate(180deg); }
.chips-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip-btn { flex: none; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip-btn small { font-weight: 500; color: var(--ink-2); margin-left: 3px; font-size: 12px; }
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-btn[aria-pressed="true"] small { color: inherit; opacity: .85; }
.filters { display: flex; flex-direction: column; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11.5px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; }
.ex-figure { display: flex; flex-direction: column; gap: 8px; }
.ex-figure .dw, .board .dw { border-radius: var(--r-md); box-shadow: var(--shadow); }
.prewrap { white-space: pre-line; }
.board { width: 100%; max-width: 520px; margin: 0 auto; }
.board-edit { display: flex; flex-direction: column; gap: 8px; }
.board-edit .dw { touch-action: none; cursor: crosshair; }
.tool-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tool-row::-webkit-scrollbar { display: none; }
.tool { flex: none; display: inline-flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; padding: 6px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.tool.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tool .tool-ic { width: 26px; height: 26px; }
.edit-panel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 40px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline .input { width: 84px; min-height: 36px; padding: 6px 10px; }
.zone-sw { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--line); cursor: pointer; }
.zone-sw.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.zone-sw.zone-w { background: #DCE6DE; }
.zone-sw.zone-a { background: #9FB6F2; }
.zone-sw.zone-b { background: #F2A7AA; }
.zone-sw.zone-n { background: #F5D873; }
.tac-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .tac-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tac-card { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0; }
.tac-card:hover { background: var(--surface-2); }
.tac-thumb { display: block; }
.tac-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.tac-sub { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.step-bar { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
.step-dots { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.step-dot { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; }
.step-dot.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step-dot.add { border-style: dashed; color: var(--accent); }
.step-text { display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.step-head { margin: 0; font-weight: 700; font-size: 17px; }
.coach-quote { margin: 0; padding: 12px 14px; border-left: 4px solid #F2C230; background: var(--surface); border-radius: 0 var(--r-md) var(--r-md) 0; font-weight: 700; font-size: 16px; }
.btn-row .grow { flex: 1; }
.ex-row .mrow-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.ex-row .mrow-meta, .bank-card .mrow-meta { white-space: normal; }
.ex-line .btn.sm { padding: 0 10px; }
/* Typer av övningar i ett pass: samma färg i etiketten, stapeln och teckenförklaringen */
.k-uppvarmning { --k: #E39A12; }
.k-knakontroll { --k: #D2343B; }
.k-teknik { --k: #2F63E6; }
.k-spelmoment { --k: #7C3AED; }
.k-spelovning { --k: #1D8A44; }
.k-spel { --k: #0E7F9C; }
.k-nedvarvning { --k: #6B7A90; }
.k-none { --k: #9AA5A0; }
.kind-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.5; padding: 0 7px; border-radius: 6px;
  background: color-mix(in srgb, var(--k) 15%, var(--surface)); color: color-mix(in srgb, var(--k) 70%, var(--ink)); }
.ex-row .kind-tag { margin-bottom: 3px; }
.sd-item .kind-tag { align-self: flex-start; }
.plan-wrap { display: flex; flex-direction: column; gap: 6px; }
.plan-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.plan-bar span { background: var(--k); min-width: 4px; }
.plan-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.plan-legend span { display: inline-flex; align-items: center; gap: 5px; }
.plan-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--k); }
.plan-card { gap: 12px; }
.plan-title { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: .01em; }
.plan-about { margin: 4px 0 0; }
.sd-name.sd-empty { color: var(--accent); }
.ex-row.is-empty { cursor: default; }
.ex-row.is-empty:hover { background: none; }
.ex-row.is-empty .mrow-title { color: var(--ink-2); font-style: italic; }
/* Skadeförebyggande fysik: övningarna med figur */
.kk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.kk-list.text-only { gap: 10px; }
.kk-item { display: grid; gap: 8px; }
.kk-fig .dw { border-radius: var(--r-md); box-shadow: var(--shadow); }
.kk-name { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; line-height: 1.25; }
.kk-code { flex: none; font-family: var(--font-display); font-weight: 800; font-size: 13px; background: var(--surface-2); border-radius: 6px; padding: 1px 7px; }
.kk-text { display: flex; flex-direction: column; gap: 4px; }
.kk-how { margin: 0; font-size: 14px; }
@media (min-width: 560px) { .kk-item { grid-template-columns: 240px minmax(0, 1fr); align-items: start; } .kk-list.text-only .kk-item { grid-template-columns: 1fr; } }
.ext-link { margin: 0; font-size: 14px; }
.ext-link a { color: var(--accent); font-weight: 600; }
.sd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.sd-head .sd-tools { margin-left: auto; }
.sd-item .sd-name { white-space: normal; line-height: 1.3; }
/* Långa ord i rubriker (t.ex. FÖRSVARSSTÄLLNING) bryts hellre än att sidan blir bredare än skärmen */
.page-title { overflow-wrap: anywhere; hyphens: auto; }
/* Rubrik med ett långt ord: krymp så att det längsta ordet (--lw tecken) ryms på en rad i innehållets bredd */
.page-title[style*="--lw"] { font-size: min(34px, calc((min(100vw, 760px) - 32px) / (var(--lw) * .72))); }
@media (min-width: 640px) { .page-title[style*="--lw"] { font-size: min(40px, calc((min(100vw, 760px) - 32px) / (var(--lw) * .72))); } }
.page-head > div { min-width: 0; }
/* Övningens namn i passet går att trycka på som en vanlig knapp */
.sd-item .sd-name { min-height: 34px; padding: 6px 0; }
/* Ta bort en övning ur passet går att ångra; verktygsknapparna lite isär */
.undo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; }
.sd-head .sd-tools { gap: 6px; }
.sd-head .sd-tools [data-act="sd-remove"] { margin-left: 6px; }
/* Långa listor: rader utanför skärmen ritas först när de syns */
.ex-line, .session-list > li { content-visibility: auto; contain-intrinsic-size: auto 84px; }
.fgr .fg-txt { font-family: var(--font-body); font-weight: 700; font-size: 3.6px; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: rgba(10, 30, 18, .55); stroke-width: .8px; }
