/* Layout: settings as stacked rows on top, a three-band verdict strip, then one zoomable map left and
   the date-sorted list right; one column on phones. Colour means drive time; who a class is for has
   its own symbol and colour (men, women, mixed). */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("/fonts/barlow-condensed-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("/fonts/barlow-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("/fonts/barlow-condensed-700.woff2") format("woff2"); }

:root {
  --bg: #eef2f3;
  --surface: #ffffff;
  --ink: #13212b;
  --muted: #586973;
  --line: #d3dbdf;
  --sea: #dbe7ed;
  --land: #fbfaf5;
  --land-edge: #8fa3ad;
  --neighbor: #e9eeec;
  --halo: rgba(251, 250, 245, .88);
  --accent: #1c4fc0;      /* home and selection */
  --near: #0d7f55;        /* under 45 minutes */
  --mid: #a86a00;         /* day trip */
  --far: #c03a27;         /* long trip */
  --men: #0b6f9e;
  --women: #b02a7c;
  --mix: #6a48c2;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d151b;
    --surface: #162129;
    --ink: #e7eef1;
    --muted: #93a5af;
    --line: #2a3a44;
    --sea: #0f1d27;
    --land: #25343e;
    --land-edge: #5a7180;
    --neighbor: #17242c;
    --halo: rgba(15, 29, 39, .88);
    --accent: #82acff;
    --near: #43c795;
    --mid: #f1b750;
    --far: #ff8672;
    --men: #6cc5f2;
    --women: #f49ad0;
    --mix: #b9a3ff;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg.defs { position: absolute; }
.page { margin: 0 auto; padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 480px) { .page { padding: 20px 14px 32px; } }

header { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: baseline; }
header h1 { flex-basis: 100%; }
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.02;
  letter-spacing: .005em;
  margin: 0;
  text-wrap: balance;
}
.sub { margin: 0; color: var(--muted); }
.sync { margin: 0; color: var(--muted); font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.sync.bad #sync-txt { color: var(--far); }
button.link { font: inherit; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
button.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
button.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* settings: one row each */
.controls { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2px 16px; }
.ctl { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 6px 16px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ctl:last-child { border-bottom: 0; }
@media (max-width: 640px) { .ctl { grid-template-columns: 1fr; } .ctl > .lbl { padding-top: 0; } }
.lbl { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ctl > .lbl { padding-top: 9px; }
/* a setting with its note beside it where there is room */
.body { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; min-width: 0; }
.note { color: var(--muted); font-size: 13.5px; margin: 0; max-width: 78ch; }
.combo { position: relative; width: 300px; max-width: 100%; }
.combo input {
  width: 100%; font: 500 16px/1.2 var(--font-body); color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 6px; padding: 8px 12px;
}
.combo input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.combo ul {
  position: absolute; z-index: 5; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; max-height: 300px; overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.combo li { padding: 9px 10px; border-radius: 4px; cursor: pointer; font-variant-numeric: tabular-nums; }
.combo li[aria-selected="true"], .combo li:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  font: 500 14px/1 var(--font-body);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.seg button:hover { border-color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg button:disabled { cursor: default; opacity: .75; }
.seg button .cnt { opacity: .65; margin-left: 5px; }
.checks button { padding: 9px 13px 9px 10px; display: inline-flex; align-items: center; gap: 7px; }
.checks button::before {
  content: ""; width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid currentColor; flex: none;
  background: transparent;
}
.checks button[aria-pressed="true"]::before {
  background: var(--surface);
  clip-path: polygon(12% 52%, 0 66%, 40% 100%, 100% 22%, 86% 10%, 38% 70%);
  border: 0;
}
.sym { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.who-H { color: var(--men); } .who-D { color: var(--women); } .who-M { color: var(--mix); } .who-X { color: var(--muted); }
#who button[aria-pressed="true"] .sym { color: var(--surface); }

/* the level guide */
/* Closed it is a link beside the level buttons. Open it takes a line of its own below them, so the
   buttons stay where they were. */
.guide summary { cursor: pointer; padding: 7px 0; font-weight: 500; color: var(--accent); }
.guide[open] { flex: 0 0 100%; }
.guide[open] .guide-body { border: 1px solid var(--line); border-radius: 6px; padding: 12px; max-width: 800px; margin-top: 2px; }
.guide summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-body { display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; }
.guide-body p { margin: 0; max-width: 72ch; }
.guide-body .small { color: var(--muted); font-size: 13.5px; }
.tablewrap { overflow-x: auto; }
.guide table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.guide th, .guide td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.guide th { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.guide tr:last-child td { border-bottom: 0; }
.guide td .was { color: var(--muted); font-size: 13px; display: block; }
.guide td.se { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.guide td input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; display: block; }
.guide td label { font-weight: 600; cursor: pointer; }

/* verdict strip */
.bands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .bands { grid-template-columns: 1fr; gap: 8px; } }
.band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--c);
  border-radius: 6px;
  padding: 8px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
@media (min-width: 761px) { .band p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
.band.near { --c: var(--near); } .band.mid { --c: var(--mid); } .band.far { --c: var(--far); }
.band h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.1;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.band h2 .n { color: var(--c); font-weight: 700; font-size: 28px; font-variant-numeric: tabular-nums; }
.band p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* Wide screens: the map keeps its place while the list scrolls. The map column is as wide as a map that
   fits the window's height (the map is 690 x 730), and the list gets the rest. */
.main { display: grid; grid-template-columns: clamp(360px, min(38vw, calc((100vh - 170px) * 0.945)), 900px) minmax(0, 1fr); gap: 16px; align-items: start; }
/* "Større kort": the map takes what the window's height allows, up to two thirds of the width */
.main.bigmap { grid-template-columns: clamp(360px, min(66vw, calc((100vh - 120px) * 0.945)), 1600px) minmax(0, 1fr); }
@media (max-width: 1000px) { .main, .main.bigmap { grid-template-columns: 1fr; } .mapsize { display: none; } }
.mapsize { margin-left: auto; }
.range { width: 300px; max-width: 100%; margin: 0; height: 36px; accent-color: var(--ink); }
.datefield { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.datefield input { font: 500 15px/1.2 var(--font-body); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 6px; padding: 6px 8px; min-height: 36px; }
.datefield input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.prof { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.prof[hidden] { display: none; }
.prof .note { flex-basis: 100%; }
.prof input { width: 12em; }
.prof input.pin { width: 7em; -webkit-text-security: disc; letter-spacing: .12em; }
.rangeval { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 14ch; }

.mapcard, .listcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.mapcard { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 1001px) { .mapcard { position: sticky; top: 10px; } }
.maptools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 2px 4px 0; }
.mapwrap { position: relative; }
svg.map { display: block; width: 100%; height: auto; border-radius: 4px; background: var(--sea); touch-action: pan-y; cursor: grab; -webkit-user-select: none; user-select: none; }
svg.map.zoomed { touch-action: none; }
svg.map.dragging { cursor: grabbing; }
.zoom { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.zoom button {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center; cursor: pointer;
  font: 600 24px/1 var(--font-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .16);
}
.zoom button:hover { border-color: var(--muted); }
.zoom button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zoom button:disabled { opacity: .45; cursor: default; }
.zoom svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hint { margin: 0; padding: 0 6px; color: var(--muted); font-size: 13px; }
.sea { fill: var(--sea); }
.nb { fill: var(--neighbor); stroke: color-mix(in srgb, var(--land-edge) 45%, transparent); stroke-width: .7; stroke-linejoin: round; }
#world path { vector-effect: non-scaling-stroke; }
.dk { fill: var(--land); stroke: var(--land-edge); stroke-width: .9; stroke-linejoin: round; }
.geo { font-family: var(--font-display); font-weight: 500; letter-spacing: .14em; fill: var(--muted); opacity: .6; font-size: 13px; }
.geo.sm { font-size: 11px; letter-spacing: .06em; font-style: italic; }
svg.map text { paint-order: stroke; stroke: var(--halo); stroke-width: 4px; stroke-linejoin: round; }
.lab-city { font-family: var(--font-display); font-weight: 600; fill: var(--ink); }
.lab-time { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.near-f { fill: var(--near); } .mid-f { fill: var(--mid); } .far-f { fill: var(--far); }
.lab-sym { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.lab-sym.who-H { stroke: var(--men); } .lab-sym.who-D { stroke: var(--women); } .lab-sym.who-M { stroke: var(--mix); } .lab-sym.who-X { stroke: var(--muted); }
.lab-symbg { fill: var(--halo); }
.lab-cls { font-family: var(--font-display); font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.mk { cursor: pointer; }
.mk.near { --c: var(--near); } .mk.mid { --c: var(--mid); } .mk.far { --c: var(--far); } .mk.na { --c: var(--muted); }
.mk .dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.mk .ring { fill: none; stroke: var(--c); stroke-width: 2.5; }
.mk .hit { fill: transparent; stroke: none; }
.mk .halo { fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0; }
.mk.hot .halo { opacity: 1; }
.mk .sq { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0; }
.mk.picked .sq { opacity: 1; }
.mk .badge { fill: var(--c); stroke: var(--surface); stroke-width: 1.5; }
.mk .badge.se { fill: var(--surface); stroke: var(--c); stroke-width: 2.2; }
.mk .badge.top { stroke: var(--ink); stroke-width: 2.2; }
svg.map .mk text.num { font-family: var(--font-display); font-weight: 700; fill: var(--surface); stroke: none; letter-spacing: .01em; }
svg.map .mk text.num.se { fill: var(--c); }
.mk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.faint { opacity: .42; }
.home rect { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.home text { font-family: var(--font-display); font-weight: 700; fill: var(--accent); letter-spacing: .02em; }

.key { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 2px 6px; color: var(--muted); font-size: 13.5px; }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.key svg { width: 24px; height: 24px; flex: none; }
.key svg.wide { width: 38px; }
.key .k { fill: var(--muted); stroke: var(--surface); stroke-width: 2; }
.key .kr { fill: none; stroke: var(--muted); stroke-width: 2.5; }
.key .ko { fill: var(--surface); stroke: var(--muted); stroke-width: 2.2; }
.key .kh { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.key .ks { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.key text { font-family: var(--font-display); font-weight: 700; font-size: 12px; fill: var(--surface); }
.key text.o { fill: var(--muted); }
.key .sym { width: 16px; height: 16px; }

.listcard { padding: 10px 12px 4px; container-type: inline-size; }
.tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.focus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.focus b { font-weight: 600; }

.sel { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.sel-txt { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; min-width: 0; flex: 1 1 230px; }
.sel-txt strong { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.15; }
.sel-txt span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.sel-note { margin: 0; flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.sel textarea { flex-basis: 100%; width: 100%; min-height: 120px; font: 14px/1.4 var(--font-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; resize: vertical; }

ol.rows { list-style: none; margin: 0; padding: 0; }
/* One thin line per tournament: pick, date, where, who may play, name and deadline, drive time.
   In a narrow list (a phone) the same parts stack in three short lines. */
.month {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 10px 6px 4px; border-bottom: 1px solid var(--line);
}
ol.rows { display: grid; grid-template-columns: 22px max-content minmax(150px, 1.5fr) max-content minmax(0, 1fr) max-content; column-gap: 12px; }
ol.rows li { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
ol.rows li.month, ol.rows li.empty { display: block; }
.row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  grid-template-areas: "p d v c i t";
  row-gap: 2px;
  align-items: center;
  min-height: 36px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
ol.rows li:last-child .row { border-bottom: 0; }
.row.hot { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.row.picked { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pick {
  grid-area: p;
  width: 22px; height: 22px; border-radius: 50%; padding: 0;
  border: 2px solid var(--muted); background: transparent; color: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.pick svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.row:hover .pick { border-color: var(--ink); }
.pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty { padding: 18px 6px; color: var(--muted); }
.d { grid-area: d; font-family: var(--font-display); line-height: 1; display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.d .wd { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.d .dm { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.d .yr { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.v { grid-area: v; min-width: 0; display: flex; gap: 7px; align-items: center; }
.chip {
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .04em; line-height: 1;
  padding: 3px 6px 2px; border-radius: 3px; border: 1.5px solid var(--ink); white-space: nowrap; flex: none;
}
.chip.r0 { background: var(--ink); color: var(--surface); }
.chip.r2 { border-color: var(--muted); }
.chip.low { border-color: var(--line); color: var(--muted); border-width: 1.5px; }
.chip.cse { border-style: dotted; border-width: 2px; }
.chip.plan { border-style: dashed; border-color: var(--muted); color: var(--muted); font-weight: 500; }
.v .venue-name { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.v .city { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
/* who may play: one group per symbol with the levels you asked for; the rest is a muted "+3" */
.cls { grid-area: c; min-width: 0; display: flex; gap: 2px 12px; align-items: center; white-space: nowrap; overflow: hidden; }
.cls .grp { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-size: 16px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cls .grp .sym { width: 17px; height: 17px; }
.cls .lv { color: var(--muted); font-weight: 500; }
.cls .lv.on { color: var(--ink); font-weight: 700; }
.cls .lvs { display: inline-flex; gap: 0 5px; align-items: baseline; }
.i { grid-area: i; min-width: 0; display: flex; gap: 10px; align-items: baseline; color: var(--muted); font-size: 13.5px; }
.i .nm { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.i a { color: inherit; text-decoration: none; }
.i a:hover, .i a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.i .dl { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.i .dl.late { color: var(--far); }
.t { grid-area: t; text-align: right; }
.t .big { font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--c); white-space: nowrap; }
.row.near { --c: var(--near); } .row.mid { --c: var(--mid); } .row.far { --c: var(--far); } .row.na { --c: var(--muted); }
@container (min-width: 761px) and (max-width: 1040px) { .v .city { display: none; } }
@container (max-width: 760px) {
  ol.rows, ol.rows li { display: block; }
  .row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, auto) 58px; grid-template-areas: "p d d t" "p v v v" "p c c c" "p i i i"; padding: 7px 4px; gap: 3px 10px; }
  .cls { flex-wrap: wrap; white-space: normal; }
}
@media (max-width: 480px) { .listcard { padding: 10px 8px 4px; } }

footer { color: var(--muted); font-size: 14px; max-width: 86ch; display: flex; flex-direction: column; gap: 6px; }
footer p { margin: 0; }
footer a { color: var(--accent); }
