:root {
  --ink: #292120;
  --muted: #64524c;
  --link: #703415;
  --glass: rgba(255, 241, 231, .93);
  --action: linear-gradient(130deg, #ae4508, #943700);
  --rule: #61463830;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: #665453;
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #2322399e 0 28%, transparent 70%, #3d282526), url(kystlys.webp) center/cover;
}
.mast, main { width: min(100%, 1080px); margin: auto; padding-inline: clamp(16px, 5vw, 62px); }
main { padding-bottom: 60px; }
.mast { height: 105px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 2; }
.brand { display: grid; color: white; text-decoration: none; font-size: 25px; line-height: 1.2; text-shadow: 0 1px 7px #39303c; }
.brand-symbol { display: block; width: 112px; height: 40px; overflow: hidden; }
.brand-symbol picture { display: block; }
.brand-symbol img { display: block; width: 116px; height: auto; transform: translate(-3px, -6px); filter: brightness(0) invert(1); }
.menu { position: relative; }
.menu summary {
  display: grid; place-items: center; width: 46px; height: 46px;
  color: white; background: #32293280; border-radius: 50%; font-size: 26px; list-style: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu nav {
  position: absolute; right: 0; top: calc(100% + 5px); display: grid; width: 190px;
  padding: 8px 12px; background: #fff2e9; border-radius: 18px; box-shadow: 0 8px 32px #32232c40;
}
.menu nav a { color: #372722; padding: 10px; text-decoration: none; }
.menu nav a[aria-current] { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
a, summary { color: var(--link); }
a { text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
summary, button, select { cursor: pointer; }
:focus-visible { outline: 3px solid #155d70; outline-offset: 2px; }
.mast :focus-visible, .vista :focus-visible, .heading :focus-visible { outline-color: white; box-shadow: 0 0 0 5px #244852; }
.menu nav :focus-visible { outline-color: #155d70; box-shadow: none; }
h1, h2, h3 { margin: 0; line-height: 1.15; overflow-wrap: anywhere; }
h1 { font-size: clamp(36px, 5vw, 60px); letter-spacing: -.04em; }
h2 { font-size: 26px; }
h3 { font-size: 21px; }
small { font-size: 14px; color: var(--muted); }
.vista, .heading { color: white; text-shadow: 0 1px 8px #372930; }
.vista { min-height: clamp(310px, 54svh, 580px); padding: 35px 0 15px; display: flex; flex-direction: column; align-items: flex-start; }
.vista h1 { font-size: clamp(44px, 6vw, 76px); letter-spacing: -.05em; }
.distance { font-size: clamp(23px, 3vw, 36px); }
.launch { margin-top: auto; padding-top: 28px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 24px; }
button, input, select { font: inherit; }
button, .btn, .launch a, .heading a {
  display: inline-block; padding: 10px 22px; min-height: 44px; border: 1px solid #ffb475;
  border-radius: 999px; background: var(--action); color: white; font-weight: 700; text-decoration: none; text-shadow: none;
}
.launch a { font-size: 20px; text-align: center; }
a[aria-busy=true] { cursor: progress; }
section, dialog {
  padding: 22px; border: 1px solid #ffffffaa; border-radius: 24px; color: var(--ink); background: var(--glass);
  backdrop-filter: blur(15px); box-shadow: 0 8px 26px #38262824;
}
.panel h2, .annual h3 { margin-bottom: 12px; }
.annual { margin: 14px 0; padding: 18px 22px; }
.km-year { display: grid; grid-template-columns: 4ch minmax(25px, 1fr) auto; align-items: center; gap: 10px; font-size: 14px; line-height: 1.65; font-variant-numeric: tabular-nums; }
.km-year svg { display: block; width: 100%; height: 6px; }
.km-year span { text-align: right; }
.annual details summary { font-size: 14px; padding-block: 6px; }
.scroll { max-width: 100%; overflow: auto; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--rule); font-size: 14px; }
th { color: var(--muted); font-size: 13px; }
th:first-child, td:first-child { padding-left: 0; }
.trip-table td:nth-child(2), .history-table td:nth-child(2) { min-width: 7rem; max-width: 23rem; white-space: normal; overflow-wrap: anywhere; }
.history-table :is(th,td):last-child,
.stat-table :is(th,td):not(:first-child) { text-align: right; }
.footnav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-block: 4px 8px; }
.footnav a, .footnav strong { padding-block: 8px; }
.pager:not(:empty) { margin-top: 16px; }
.auth, .entry { max-width: 620px; margin: 5vh auto 24px; padding: clamp(20px, 4vw, 38px); }
.auth { max-width: 460px; margin-top: 12vh; }
.auth h1 { font-size: 39px; }
form { display: grid; gap: 12px; margin-top: 18px; }
form label { display: grid; gap: 4px; font-size: 14px; }
input:not([type=checkbox]), select { width: 100%; min-width: 0; padding: 9px; border: 1px solid #99867c; border-radius: 10px; background: #fffcfa; color: inherit; }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; flex: none; margin: 0; accent-color: #a6440b; }
fieldset { min-width: 0; border: 1px solid #b7a49a; border-radius: 8px; }
fieldset label, .check { display: flex; align-items: center; gap: 8px; min-height: 36px; overflow-wrap: anywhere; }
.row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; padding-block: 4px; }
.row + .row { border-top: 1px solid var(--rule); }
.steps { margin-top: 14px; }
.steps summary { padding-block: 8px; }
.deletion summary { color: #832d28; }
.deletion button { background: #832d28; border-color: #832d28; }
.stats-filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; margin: 0 0 18px; }
.flash, .error { background: #fff3e7; border-radius: 12px; padding: 12px; }
.error { color: #822e22; }
dialog { width: min(500px, 94vw); max-height: 86svh; padding: 18px; overflow: auto; background: #fff1e8; }
dialog::backdrop { background: #302831ae; }
dialog .entry { margin: 0; padding: 14px 0; border: 0; background: none; backdrop-filter: none; box-shadow: none; }
dialog > button { display: block; margin-left: auto; background: #5b453f; border-color: #5b453f; }
dialog h2:focus:not(:focus-visible) { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 650px) {
  body::before { background-image: linear-gradient(180deg, #342c41b6 0 33%, transparent 73%), url(kystlys-mobil.webp); }
  main { padding: 0 9px 36px; }
  .mast { height: 100px; padding-inline: 28px; }
  .brand { font-size: 22px; }
  .vista { min-height: clamp(230px, calc(64svh - 100px), 430px); padding: 22px 20px 15px; }
  .launch, .launch a { width: 100%; }
  section { padding: 16px; }
  .panel { padding: 17px 13px; }
  .heading { align-items: flex-start; flex-direction: column; margin: 22px 0 18px; padding-inline: 12px; }
  .auth, .entry { margin-inline: min(8px, 2%); }
  .stats-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stats-filters :is(select,button), .entry input, .auth input { font-size: 16px; }
}
@media (max-width: 360px) {
  .stats-filters { grid-template-columns: 1fr; }
  .row { gap: 5px; }
}

.meeting { margin-top: 16px; }
.meeting h3 { margin: 1.2rem 0 .5rem; }
.meeting h2 + p, .metric-note { color: var(--muted); }
.meeting-totals { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,150px),1fr)); gap: 16px; }
.meeting-totals div { border-left: 3px solid #196b77; padding-left: 12px; }
.meeting-totals dd { margin: 0; font-size: clamp(22px,3vw,34px); font-variant-numeric: tabular-nums; font-weight: 700; }
.meeting .compare { display: block; margin: 0; color: var(--muted); font-size: 13px; font-weight: 400; }
.meeting tfoot { font-weight: 700; background: #f1dfd1; }
.meeting tfoot th { color: var(--ink); }

[hidden] { display: none !important; }
.route-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 10px; }
.route-fields label { flex: 1 1 8rem; min-width: 0; }
[data-add-route], [data-remove-route] { background: transparent; border-color: var(--link); color: var(--link); }
[data-remove-route] { min-height: 36px; font-size: 13px; padding: 4px 10px; }
.club-person:has(.route-choice:not([hidden])) { grid-template-columns: minmax(0,1fr) minmax(65px,.7fr) auto; }
@media (max-width: 480px) {
  .club-person:has(.route-choice:not([hidden])) { grid-template-columns: minmax(0,1fr) auto; }
  .club-person .route-choice { grid-column: 1; grid-row: 2; }
  .club-person label:last-child { grid-column: 2; grid-row: 1; }
}

.trip-title { display: flex; align-items: center; gap: 12px; }
.trip-title [data-trip-help] { border: 1px solid var(--link); background: transparent; color: var(--link); min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 20px; }
dialog.trip-guide { position: fixed; inset: 0; margin: 0; padding: 0; width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden; background: transparent; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; }
.trip-guide::backdrop { background: transparent; }
.guide-ring { position: absolute; border-radius: 8px; outline: 3px solid #176979; box-shadow: 0 0 0 5px #fff5e9, 0 0 0 200vmax #281e24a8; }
.guide-card { position: absolute; width: min(350px,calc(100% - 16px)); max-height: calc(100% - 16px); overflow: auto; padding: 16px; background: #fff4ea; border-radius: 16px; box-shadow: 0 5px 24px #241c254d; }
.guide-card h3 { margin: 4px 0; }.guide-card p { margin: 8px 0 14px; }
.guide-controls { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.guide-controls button { padding: 8px 12px; }
.guide-controls [data-end], .guide-controls [data-prev] { color: var(--link); border-color: var(--link); background: transparent; }
.guide-controls [data-end] { margin-right: auto; }
.guide-controls :disabled { opacity: .5; cursor: default; }

.club-trips :is(th,td):nth-child(n+3),
.my-trips :is(th,td):nth-child(n+4),
.member-table :is(th,td):nth-last-child(-n+3),
.gender-table :is(th,td):nth-child(n+3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.year-heading { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.year-heading a { font-size:13px; }
.year-key { display:flex; flex-wrap:wrap; gap:4px 16px; font-size:13px; }
.year-key span { display:inline-flex; align-items:center; gap:6px; }
.year-key i, .status-dot { display:inline-block; width:9px; height:9px; border-radius:50%; background:#196b77; }
.year-key span:last-child i { background:#c65312; }
.annual details .km-year { grid-template-columns:1ch 4ch minmax(20px,1fr) auto; }
.annual details .km-year::before { content:'▸'; }
.annual details[open] .km-year::before { content:'▾'; }
.annual details summary::-webkit-details-marker { display:none; }
.status-dot.active { background:#347745; }
.status-dot.inactive { background:#a64840; }
.member-info { white-space:normal; overflow-wrap:anywhere; }
.member-info small { display:block; color:var(--muted); }
.member-table td:first-child { width:16px; vertical-align:middle; }
.mobile-label, .trip-measure svg { display:none; }

@media (max-width:650px) {
  .trip-table, .member-table, .trip-table tbody, .member-table tbody { display:block; }
  .trip-table thead, .member-table thead { position:absolute; clip-path:inset(50%); width:1px; height:1px; overflow:hidden; }
  .trip-table tr, .member-table tr { display:grid; border-bottom:1px solid var(--rule); padding:12px 0; column-gap:10px; row-gap:2px; }
  .trip-table tr { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:'place km' 'day wind' 'kind wave'; align-items:baseline; }
  .trip-table td, .member-table td { padding:0; border:0; font-size:13px; line-height:20px; }
  .trip-table td:nth-child(1) { grid-area:day; }
  .trip-table td:nth-child(2) { grid-area:place; min-width:0; }
  .trip-table td:nth-child(3) { grid-area:kind; text-align:left; }
  .trip-table td:nth-child(4) { grid-area:km; }
  .trip-table td:nth-child(5) { grid-area:wind; }
  .trip-table td:nth-child(6) { grid-area:wave; }
  .trip-table td:is(:nth-child(2),:nth-child(4)) { font-weight:700; font-size:16px; line-height:24px; }
  .trip-measure { display:inline-flex; align-items:baseline; gap:7px; }
  .trip-measure svg { align-self:center; display:block; width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
  .trip-measure span:last-child { min-width:7ch; text-align:right; }
  .mobile-label { display:inline; }
  .member-table tr { grid-template-columns:10px minmax(0,1fr) auto; align-content:center; }
  .member-table td:first-child, .member-table .member-info { grid-row:1 / span 3; align-self:center; }
  .member-table .member-info { grid-column:2; }
  .member-table td:nth-last-child(-n+3) { grid-column:3; display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
  .member-table td:nth-child(3) { font-weight:700; }
  .member-table td:first-child { width:auto; grid-column:1; }
  .year-table :is(th,td) { padding:7px 2px; font-size:12px; }
}

body { display: flex; flex-direction: column; }
.mast, main { margin-block: 0; }
.site-footer {
  margin-top: auto;
  padding: 4px 16px 24px;
  text-align: center;
}
.site-footer a {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 12px;
  background: var(--glass);
  box-shadow: 0 1px 5px #32293236;
}
.site-footer img { display: block; width: 140px; height: auto; }
.site-footer a:focus-visible { outline: 3px solid #196b77; outline-offset: 2px; }
.gender-table .leader-km { white-space: nowrap; font-variant-numeric: tabular-nums; }
.gender-table .leader-km::before { content: " · "; }

@media (max-width: 650px) {
  .gender-table .leader-name { display: block; white-space: normal; overflow-wrap: anywhere; }
  .gender-table .leader-km { display: block; }
  .gender-table .leader-km::before { content: none; }
  .gender-table .leader-km + .compare { margin-top: 4px; }
  .meeting .stat-table td:first-child,
  .meeting .gender-table td:nth-child(2) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .meeting :is(.stat-table,.gender-table) :is(th,td) {
    padding-inline: 4px;
  }
  .meeting .gender-table th:nth-child(2) { white-space: normal; }
}
