:root {
    color-scheme: only light;

    /* Brand */
    --color-primary: #1d4d3a;          /* deep forest, confident active state */
    --color-primary-soft: #2e7355;
    --color-primary-tint: rgba(29, 77, 58, 0.06);

    /* Slots — visual identity of the available-slot and class chips */
    --color-accent: #90ce4a;
    --color-accent-bg: #e2f4cc;
    --color-accent-hover: #d4edb5;
    --color-accent-muted: #cfe6b4;     /* quiet tone for the free-court count badge */
    --color-price: #56695d;            /* chip price: calm, still 4.6:1 on a hovered chip */

    /* Skoutti lime key: picked day, app button, booking CTA, selected class */
    --accent-top: #a8dd5e;
    --accent-bottom: #7cc043;
    --accent-ink: #18360f;
    --accent-glow: rgba(110, 180, 55, 0.55);
    --accent-emboss: 0 1px 0 rgba(255, 255, 255, 0.3);
    --ring: 0 0 0 3px rgba(124, 192, 67, 0.6);

    /* Slate header & glass tracks */
    --slate-top: #4a5563;
    --slate-bottom: #20262e;
    --glass-track: rgba(11, 15, 20, 0.28);
    --glass-text: #c3ccd7;
    --day-muted: #8fa6c9;
    --day-name: #9fb0c8;
    --day-date: #dfe5ee;
    --day-text: #e6edf8;
    --weekend: #e6c675;
    --lit-spill: radial-gradient(ellipse 75% 70% at 50% 100%, rgba(168, 221, 94, 0.2), transparent 75%);
    --lit-name: #cfe9a6;
    --lit-weekend: #f3d88a;
    --link-light: #b8e07f;

    /* Surfaces & borders */
    --page: #fafbfc;
    --color-surface: #fbfbf7;
    --color-surface-tint: #f1f4ec;
    --surface-muted: #eef1f4;
    --surface-off: #f4f6f7;
    --color-line: #e3e6dd;
    --hairline: rgba(32, 38, 46, 0.1);
    --hairline-row: rgba(32, 38, 46, 0.07);
    --border-card: #dfe4e8;
    --border-off: #e6eaed;
    --card-shadow: 0 1px 2px rgba(32, 38, 46, 0.05);

    /* Text & ink */
    --navy-ink: #14213d;
    --color-ink: #1c2620;
    --color-bold: #2a3530;
    --text-body: #3d4a43;
    --text-secondary: #5d6b63;
    --text-subtle: #6b7781;
    --text-disabled: #a7b0aa;
    --section-ink: #304438;
    --color-muted: #6b7d72;
    --color-note: #56695d;             /* small print under the table: 5.6:1 on the page */

    /* Filter pills — neutralized (was cream-yellow, now surface + subtle line) */
    --color-filter-bg: var(--color-surface);
    --color-filter-hl: var(--color-primary-tint);
    --color-filter-border: var(--color-line);

    /* Warm family: predictions, warnings & closing-soon badges */
    --warn-bg: #fff6e2;
    --warn-border: #f2d595;
    --warn-ink: #6f5916;
    --color-link-bg: #ffda95;
    --color-link-border: #dea751;
    --color-link-text: #6f5916;

    /* Predictions: the same warm family, quiet enough to sit between the
       bookable rows. The ink is 6.9:1 on the chip. */
    --color-pred-row: #fffcf5;
    --color-pred-bg: #fff8ea;
    --color-pred-border: #dcbd7e;
    --color-pred-ink: #6f5916;
    --color-pred-meter: #d39a3e;
    --color-pred-track: #efe2c4;

    /* Status semantics */
    --status-ok: #2e7355;
    --status-bad: #c96b5e;

    --radius-pill: 16px;
    --radius-sm: 6px;
}

body {
    background: var(--color-surface);
    color: var(--color-ink);
}

/* Layout */
html {
    overflow-y: scroll;
}

/* clip keeps sideways overflow away without making the box a scroll
   container: overflow-x: hidden turns overflow-y to auto as well, which cut
   off the top row's court tooltip at the table's upper edge and left a sticky
   child nothing to stick to. Safari below 16 knows only hidden and keeps it. */
#container {
    overflow-x: hidden;
    overflow-x: clip;
}

/* Typography */
h1.title, h2.title {
    font-size: 14px;
    font-weight: normal;
    display: inline;
}

/* The H1 names the current view for search engines and screen readers. On screen the filter
   pills directly below already say the same thing ("1h · tennis · Helsinki"), so the heading is
   lifted out of the visual flow instead of repeating it. Clipped rather than display:none or
   visibility:hidden — those two are the forms crawlers discount; clipped text is not. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

h2.medium {
    font-size: 14px;
    margin-top: 30px;
}

.small, .medium, #about-service {
    font-size: 14px;
}

b {
    color: var(--color-bold);
}

/* Content toolbar */
.content-toolbar {
    margin-bottom: 4px;
}

.toolbar-filters {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

/* Filter toggle is mobile-only */
.filter-toggle {
    display: none;
}

/* Venues left out of the results because their data is stale. Amber edge: it is
   a caveat, not news. */
.stale-venues-note {
    margin: 18px 0 0;
    padding: 12px 14px 12px 16px;
    font-size: 13px;
    color: var(--color-bold);
    background: var(--color-surface-tint);
    border: 1px solid var(--color-line);
    border-left: 3px solid var(--color-link-border);
    border-radius: 8px;
}

.filter {
    display: inline-block;
    font-size: 14px;
    padding: 3px 5px;
    border-radius: var(--radius-pill);
    color: #222;
    background-color: var(--color-filter-bg);
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.filter:hover {
    text-decoration: underline;
}

.filter-hl {
    background: var(--color-filter-hl);
    border-color: var(--color-filter-border);
}

/* Segmented filter control — neutral by default, primary fill when active */
.court-toggle {
    display: inline-flex;
    border: 1px solid var(--color-filter-border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--color-surface);
}

.toggle-opt {
    padding: 5px 12px;
    font-size: 13px;
    text-decoration: none;
    color: var(--color-muted);
    background: transparent;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
    font-weight: 500;
}

.toggle-opt:hover {
    background: var(--color-filter-hl);
    color: var(--color-ink);
}

.toggle-active {
    background: var(--color-primary);
    color: #fff;
    text-shadow: 0.3px 0 0 currentColor, -0.3px 0 0 currentColor;
}

.toggle-active:hover {
    background: var(--color-primary);
    color: #fff;
}

.uline {
    text-decoration: underline;
    font-weight: 600;
}

/* Table */
/* Page footer: a column per sport's court pages and one for the site, then the
   credit line. Each column takes its own width and they wrap as they fit, so
   a long heading like SULKAPALLOKENTÄT is never broken mid-word. */
.site-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--color-line);
    font-size: 13px;
}

.footer-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 40px;
}

.footer-title {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--color-muted);
}

/* The columns are <nav>s, which Pico lays out as a flex row with padded
   items and pulls its first list left; here they are plain lists. The
   .site-footer prefix outweighs Pico's nav ul:first-of-type. */
.site-footer .footer-col,
.site-footer .footer-col ul {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer .footer-col li a {
    display: inline;
    margin: 0;
    padding: 0;
}

.site-footer .footer-col li {
    display: block;
    margin: 0;
    padding: 2px 0;
    list-style: none;
}

.site-footer a {
    color: var(--color-bold);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.footer-credit {
    margin: 20px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--color-line);
    font-size: 12px;
    color: var(--color-muted);
}

.site-footer .footer-credit a {
    color: var(--color-muted);
    text-decoration: underline;
}

#clubs-combined {
    overflow-x: hidden;
    overflow-x: clip;
    margin-top: 4px;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0.8rem;
}

.empty-slots-state {
    margin-top: 18px;
    padding: 14px 16px;
    background: var(--color-surface-tint);
    border: 1px solid var(--color-line);
    border-radius: 10px;
}

.empty-slots-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-bold);
}

.empty-slots-hint {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--color-muted);
}

table {
    table-layout: fixed;
    width: 100%;
    margin-bottom: 20px;
}

table td,
table th {
    padding: 4px 0 !important;
    font-size: 14px;
}

/* Breathing room between time column and slot chips */
tbody td:first-child,
thead th:first-child {
    padding-right: 8px !important;
}

thead th:first-child,
tbody td:first-child {
    width: 100px;
}

thead th:last-child,
tbody td:last-child {
    width: auto;
}

/* Club entries */
.clubs-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.club-entry {
    display: inline-block;
    background-color: var(--color-accent-bg);
    padding: 3px 8px;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-primary);
    cursor: pointer;
    transition: background-color 0.15s;
    font-size: 13px;
}

.club-entry:hover {
    background: var(--color-accent-hover);
}

/* Details panel */
.details {
    padding: 6px 0;
    margin-top: 6px;
    border-bottom: 1px dashed #99aa77;
}

.hidden {
    display: none;
}

/* Booking links */
.link-wrapper {
    display: block;
    margin: 5px 0;
    padding: 5px 0;
}

.link {
    padding: 5px 10px;
    background: var(--color-link-bg);
    border: 1px solid var(--color-link-border);
    border-radius: var(--radius-sm);
    color: var(--color-link-text);
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.15s;
}

.link:hover {
    background: #ffe8b8;
}

/* Topbar — taller with a "court line" brand stripe along the bottom */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-primary);
    padding: 10px 20px;
    position: relative;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.2px;
    flex-shrink: 0;
}

.topbar-logo img {
    width: 24px;
    height: 24px;
}

/* Day selector — center section */
.topbar-days {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.topbar-days .day {
    padding: 4px 9px;
    margin: 0;
    font-size: 12px;
    color: var(--color-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
    font-weight: 500;
}

.topbar-days .day:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

.topbar-days .day-active {
    background: var(--color-primary);
    color: #fff;
    text-shadow: 0.3px 0 0 currentColor, -0.3px 0 0 currentColor;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-nav a {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.topbar-nav a:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

/* A freshly freed court: the time it came free, on the chip. */
.slot-hit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 0px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
    color: #8b6a2b;
    background: #faf1d9;
    border: 1px solid #eadab3;
}

/* Predictions, behind the % Ennusteet toggle: a fully booked time range and
   each venue's chance of a court still opening up in it. The warm family of
   the freed-court badge sets them apart from the green, bookable chips, and
   the dashed edge says "not a court yet". A meter along the chip's foot shows
   the same figure as its length, so the likeliest venue, which comes first,
   reads at a glance without traffic-light colours. */
#clubs-combined tbody tr.pred-row td {
    background: var(--color-pred-row);
}
/* A hidden prediction row at the top leaves the first visible row without
   the line above it, as the first row always is. */
#clubs-combined tbody tr.pred-row[hidden]:first-child + tr td {
    border-top: 0;
}
.pred-row td.col-time > b {
    color: var(--color-pred-ink);
    font-weight: 500;
}
.pred-full {
    display: block;
    font-size: 10px;
    line-height: 1.3;
    color: var(--color-muted);
}
/* When to look again: the hours cancellations most often show up in, under
   "täynnä". The same warm ink as the range, so it reads as part of it. */
.pred-look {
    display: block;
    font-size: 10px;
    line-height: 1.3;
    color: var(--color-pred-ink);
    white-space: nowrap;
    cursor: help;
}
/* .clubs-cell in front: Pico gives any [data-tooltip] that is not a button a
   dotted bottom border, which would replace the dashed one. */
.clubs-cell .pred-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 5px;
    border: 1px dashed var(--color-pred-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-pred-bg);
    background-image: linear-gradient(to right, var(--color-pred-meter) var(--p, 0%), var(--color-pred-track) var(--p, 0%));
    background-size: calc(100% - 16px) 2px;
    background-position: 8px calc(100% - 3px);
    background-repeat: no-repeat;
    color: var(--color-pred-ink);
    font-size: 13px;
    line-height: inherit;
    cursor: default;
}
.clubs-cell .pred-chip[data-tooltip] {
    cursor: help;
}
.clubs-cell .pred-chip:focus-visible {
    outline: 2px solid var(--color-pred-meter);
    outline-offset: 1px;
}
.pred-chip-pct {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* The hourly chances, one line each, figures lined up. */
.pred-chip[data-tooltip]::before {
    width: max-content;
    white-space: pre;
    text-align: left;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}
.pred-note a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Weather column (outdoor view only), before the start time so the time sits
   next to the slots. Fixed-width groups keep the values lined up row to row.
   The column folds to a narrow strip; the server renders the folded state from
   a cookie. */
table.has-weather th.col-wx,
table.has-weather td.col-wx {
    width: 225px;
    max-width: none;
    padding-right: 10px !important;
    cursor: pointer;
    white-space: nowrap;
    /* A quick second click must not select text, and a quick second tap must
       not wait for a double-tap zoom. */
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

table.has-weather th.col-time,
table.has-weather td.col-time {
    width: 64px;
}

.start-order-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
}

.start-order-toggle:hover {
    color: var(--primary);
}

.start-order-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.start-order-icon {
    font-size: 0.85em;
}

/* Folded, the column goes away entirely rather than leaving a narrow strip:
   the strip used to hold the ☁ button that opened it again, and that button now
   sits in the filter row, where its pressed state shows whether the column is
   on. */
table.has-weather.weather-collapsed th.col-wx,
table.has-weather.weather-collapsed td.col-wx {
    display: none;
}

.weather-collapsed .weather {
    display: none;
}

/* The gap keeps a two-digit wind ("12 m/s") from running into the rain. */
.weather {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-muted);
    vertical-align: middle;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wx-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.wx-main {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 4.6em;
}

/* Temperature, then wind, then rain. Wind sits next to the temperature because
   the rain group is empty on a dry day, and reserving its width between the two
   left a hole the width of the cell. Rain last means its reserved width trails
   off the end, where nothing has to look across it. */
.wx-wind {
    order: 1;
    min-width: 3.6em;
}

.wx-rain {
    order: 2;
}

/* Under the time on a phone; the weather column itself is gone there. */
.wx-inline {
    display: none;
}

.wx-icon {
    flex: none;
    width: 20px;
    height: 20px;
}

.wx-temp {
    font-weight: 600;
    color: var(--color-ink);
}


.wx-rain-none .wx-rain {
    opacity: 0.55;
}

.wx-rain-low .wx-rain {
    color: #5b87a8;
}

.wx-rain-mid .wx-rain {
    color: #1f68a8;
    font-weight: 500;
}

.wx-rain-high .wx-rain {
    color: #0b4a86;
    font-weight: 700;
}

.wx-wind {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wx-arrow {
    flex: none;
    color: var(--color-bold);
}

/* Small print under the slot table: the weather source, the price note and
   the prediction note. A shade darker than the muted grey: at 11px that read
   too faint. */
.weather-source,
.table-note {
    margin: -8px 0 16px;
    font-size: 11px;
    color: var(--color-note);
}
/* A second note sits tight against the one above it instead of repeating the
   pull-up margin. */
.weather-source + .table-note,
.table-note + .table-note {
    margin-top: -12px;
}

/* Free-court count inside a club chip: a round badge a quiet shade darker than
   the chip, so the number reads at a glance without brackets and without
   drawing the eye from the venue name. Two-digit counts stretch it into a pill.
   The chip's flex gap spaces it, and it also separates the name from the price. */
.club-entry-count {
    display: inline-block;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--color-accent-muted);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 600;
    line-height: 15px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

/* Prices switched off with the price toggle. */
.prices-hidden .club-entry-price,
.prices-hidden .price-note {
    display: none;
}

/* One-option pills (prices, weather) are <button>s among link options, so they
   need Pico's button look reset to match. Scoped to .court-toggle so any future
   single-button filter gets it too. */
.court-toggle button.toggle-opt {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: inherit;
    width: auto;
    height: auto;
    min-height: 0;
    box-shadow: none;
    cursor: pointer;
}
.court-toggle button.toggle-opt:not(.toggle-active) {
    background: transparent;
    color: var(--color-muted);
}
.court-toggle button.toggle-opt:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Hourly price inside a club chip: after the count badge, which already sets it
   apart, in a quieter grey-green and tabular figures so prices line up down the
   column. */
.club-entry-price {
    margin-left: 2px;
    color: var(--color-price);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Footer */
.club-list-item:not(:last-child)::after {
    content: ", ";
}

/* Scout success message */
.scout-ok {
    margin-top: 12px;
}

/* Mobile */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        padding: 6px 10px;
        gap: 6px;
    }

    /* Day picker: own full-width row, horizontal scroll with snap.
       flex: 0 0 100% defeats the desktop `flex: 1` that would otherwise let it shrink
       into whatever space remains in the topbar row. */
    .topbar-days {
        flex: 0 0 100%;
        order: 3;
        width: 100%;
        max-width: 100%;
        margin: 0 -10px;
        padding: 6px 10px 4px;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        border-top: 1px solid #eee;
        justify-content: flex-start;
        box-sizing: border-box;
    }
    .topbar-days::-webkit-scrollbar { display: none; }

    .topbar-days .day {
        flex: 0 0 auto;
        scroll-snap-align: center;
        min-width: 52px;
        padding: 6px 10px;
        font-size: 12px;
        text-align: center;
        border-radius: var(--radius-sm);
        background: var(--color-surface-tint);
        color: var(--color-bold);
        font-weight: 500;
    }

    .topbar-days .day-active {
        background: var(--color-primary);
        color: #fff;
    }

    /* Sticky compact filter bar */
    .content-toolbar {
        position: sticky;
        top: 0;
        z-index: 50;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: saturate(180%) blur(8px);
        -webkit-backdrop-filter: saturate(180%) blur(8px);
        margin-left: -10px;
        margin-right: -10px;
        padding: 8px 10px 6px;
        border-bottom: 1px solid #eee;
    }

    /* Compact filter trigger — collapses the full filter grid behind one button */
    .filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        margin: 0;
        padding: 9px 14px;
        background: var(--color-surface);
        border: 1px solid var(--color-filter-border);
        border-radius: var(--radius-pill);
        color: var(--color-bold);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        text-align: left;
        line-height: 1.2;
        min-height: 0;
        transition: border-color 0.15s, background-color 0.15s;
    }
    .filter-toggle:hover,
    .filter-toggle[aria-expanded="true"] {
        border-color: var(--color-primary);
        background: var(--color-primary-tint);
    }
    .filter-toggle-summary {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--color-ink);
    }
    .filter-toggle-chevron {
        transition: transform 0.2s;
        font-size: 11px;
        color: var(--color-primary);
        opacity: 0.8;
    }
    .filter-toggle[aria-expanded="true"] .filter-toggle-chevron {
        transform: rotate(180deg);
    }

    .toolbar-filters {
        display: none;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        width: 100%;
        margin-top: 6px;
    }
    .toolbar-filters.expanded {
        display: grid;
    }

    /* City pill needs all 4 options + space — full width */
    .toolbar-filters .court-toggle-city {
        grid-column: 1 / -1;
    }

    /* After the city row the toggles that come and go with the view —
       prices, weather, indoor/outdoor, predictions, freshness — fill the grid
       two to a row in their page order, and the last one takes the whole row
       when it would be left alone. Duration, sport and city are always the
       first three children, so an even child starts a row. */
    .toolbar-filters > .court-toggle:last-child:nth-child(even) {
        grid-column: 1 / -1;
    }

    .toolbar-filters .court-toggle {
        width: 100%;
    }

    .toolbar-filters .court-toggle .toggle-opt {
        flex: 1;
        text-align: center;
        padding: 6px 4px;
        font-size: 13px;
    }

    /* Indoor/outdoor: hide text labels, show only icons (smaller footprint) */
    .court-toggle-courtype .toggle-label {
        display: none;
    }
    .court-toggle-courtype .toggle-opt {
        padding: 6px 4px;
        font-size: 16px;
    }

    /* Mobile club chips: comfortable touch targets & readable typography */
    button.club-entry,
    .club-entry {
        margin: 0;
        padding: 4px 8px;
        font-size: 13px;
        line-height: 1.35;
        gap: 4px;
        border-radius: 6px;
    }
    .clubs-cell {
        gap: 5px;
    }

    .slot-hit-badge {
        margin-left: 4px;
        padding: 1px 5px;
    }

    /* The narrow time column has no room for a prediction range on one
       line: its end goes on a second line, as in the app. */
    .pred-range-end {
        display: block;
    }

    .clubs-cell .pred-chip {
        padding: 4px 7px 6px;
        font-size: 12px;
        gap: 4px;
        background-size: calc(100% - 14px) 2px;
        background-position: 7px calc(100% - 3px);
    }

    /* Narrower time column on mobile — wide enough for "Aloitus" / "Start" header on one line */
    thead th:first-child,
    tbody td:first-child {
        width: 52px;
        max-width: 52px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* No weather column on a phone. It took 50px of width, which pushed the
       venue chips onto more lines and made every row 13px taller — four rows
       visible instead of five. What matters for an outdoor court goes under the
       start time instead: the icon, the temperature and, when it is going to
       rain, the chance of it. Wind and millimetres stay in the cell's title. */
    table.has-weather th.col-wx,
    table.has-weather td.col-wx {
        display: none;
    }

    /* Wide enough for icon, temperature and chance of rain on one line
       ("14° 45 %" is 62px); narrower, the chance ran under the venue chips. */
    table.has-weather th.col-time,
    table.has-weather td.col-time {
        width: 64px;
        max-width: 64px;
    }

    /* Two lines under the time: temperature (with the chance of rain when there
       is any), then wind. */
    .wx-inline {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        margin-top: 0;
        font-size: 11px;
        line-height: 1.15;
        color: var(--color-muted);
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }

    .wx-inline-row {
        display: flex;
        align-items: center;
        gap: 2px;
    }

    /* The column's own wind rules reserve width and reorder for that layout;
       here it is simply the second line. */
    .wx-inline .wx-wind {
        order: 0;
        min-width: 0;
        gap: 2px;
    }

    /* "4" next to the arrow is the reading; the unit would not fit and the
       cell's title spells it out. */
    .wx-inline .wx-unit {
        display: none;
    }

    .wx-inline .wx-icon {
        width: 13px;
        height: 13px;
    }

    .wx-inline .wx-pop {
        font-size: 10px;
    }

    .wx-inline.wx-rain-low .wx-pop {
        color: #5b87a8;
    }

    .wx-inline.wx-rain-mid .wx-pop {
        color: #1f68a8;
        font-weight: 500;
    }

    .wx-inline.wx-rain-high .wx-pop {
        color: #0b4a86;
        font-weight: 700;
    }

    /* Folding the weather from the filter row takes the inline reading with it,
       and the time column no longer needs the extra width. */
    .weather-collapsed .wx-inline {
        display: none;
    }

    table.has-weather.weather-collapsed th.col-time,
    table.has-weather.weather-collapsed td.col-time {
        width: 52px;
        max-width: 52px;
    }

    /* --- Vertical budget on a phone ---------------------------------------
       The slot list is what people open the site for, so everything above it
       earns its pixels. Measured at 375x812 the first slot row sat at 331px,
       41% of the screen; the rules below bring it to about 170px, which is
       four more slots without shrinking a single one. */

    /* The column heads read "Aloitus" and "Paikka". A time column and venue
       chips need no labels on a phone, and the weather column is folded from
       the filter row, so nothing in this row is needed. */
    thead {
        display: none;
    }

    /* Language and app links ride along on the logo's row instead of taking
       one of their own. Analytics and Status moved to the footer. */
    .topbar-logo {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-nav {
        margin-left: auto;
    }

    /* One step between topbar, filter bar and table instead of three
       different ones (16px, 18px and 19px before). */
    .content-toolbar {
        margin-top: 0;
    }

    #clubs-combined {
        margin-top: 8px;
    }

    /* The day picker follows the page down. Changing the day is by far the
       most used control — about three day changes per booking click in the
       usage data — and without this it means scrolling back to the top every
       time.

       A sticky child cannot leave its parent's box, so the whole topbar
       sticks and is pulled up by the height of its first row: the logo
       scrolls away and the day picker stops at the top edge. --topbar-row-1
       must therefore match that first row's height, and --topbar-row-2 the
       day picker's, which the already-sticky filter bar stacks beneath. */
    :root {
        --topbar-row-1: 40px;
        --topbar-row-2: 41px;
    }

    .topbar {
        position: sticky;
        top: calc(-1 * var(--topbar-row-1));
        z-index: 60;
    }

    .content-toolbar {
        top: var(--topbar-row-2);
    }
}


/* Capital toggle: the capital-region pill (a region of several cities)
   stands out subtly so users notice it */
.toggle-capital {
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Club entries are buttons (not <span>) for a11y/keyboard. Pico's default button styles add
   margin-bottom and appearance — reset everything that would change the visual from the original. */
button.club-entry {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 3px 8px;
    background-color: var(--color-accent-bg);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    font: inherit;
    font-size: 13px;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    width: auto;
    height: auto;
    min-height: 0;
    /* Name, count and price spaced by the gap alone: the template's line breaks
       between the spans would otherwise add a word space to every margin. */
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
button.club-entry:hover {
    background-color: var(--color-accent-hover);
}
button.club-entry:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}
/* The court list tooltip: Pico keeps a tooltip on one line, so a venue with
   many free courts ran it past the page edge, where it was cut. Here it wraps
   at a readable width instead, centred over the chip as before, only between
   court names (each is unbreakable, see nobreak), and the time the court came
   free goes on a line of its own. */
/* The chip under the pointer or focus is lifted above its neighbours: a
   tooltip that opens downwards (see the placement in home.js) would otherwise
   be painted over by the chips in the rows below. 4 is above the header (3),
   which an upward tooltip may reach over, and under the sticky bar (5). Only
   where there is hover and the header does not stick: a tapped chip on a
   phone keeps :hover and would float over the sticky header. */
@media (hover: hover) and (min-width: 769px) {
    button.club-entry:hover,
    button.club-entry:focus-visible {
        z-index: 4;
    }
}
button.club-entry[data-tooltip]::before {
    width: max-content;
    /* Wide enough that even Tali's seventeen courts take two lines. */
    max-width: min(380px, calc(100vw - 32px));
    white-space: pre-line;
    text-align: center;
    line-height: 1.35;
}
/* Closing the venue card gives focus back to the chip it was opened from.
   Pico shows a tooltip on any focus, so after a mouse click it stayed up
   until the next click elsewhere. The chip's tooltip follows the pointer
   and keyboard focus only. */
button.club-entry[data-tooltip]:focus:not(:focus-visible):not(:hover)::before,
button.club-entry[data-tooltip]:focus:not(:focus-visible):not(:hover)::after {
    opacity: 0;
    animation: none;
}
/* The tighter phone chips from the 768px block above: they must come after the
   base button.club-entry rule, which otherwise wins by coming later. */
@media (max-width: 768px) {
    button.club-entry {
        padding: 4px 8px;
        font-size: 13px;
        line-height: 1.35;
        gap: 4px;
        border-radius: 6px;
    }
    .club-entry-price {
        font-size: 11px;
    }
    .club-entry-count {
        min-width: 16px;
        height: 16px;
        padding: 0 3px;
        font-size: 10px;
        line-height: 16px;
    }
}

/* Hidden clubs section */
#hidden-clubs-panel {
    margin-top: 28px;
    background: var(--color-surface-tint);
    border: 1px solid var(--color-line);
    border-radius: 12px;
    padding: 16px;
    font-size: 13px;
}
.hidden-clubs-header {
    font-weight: 600;
    color: var(--color-bold);
    margin-bottom: 6px;
}
.hidden-clubs-hint {
    font-size: 12px;
    color: var(--color-muted);
    margin: 0 0 12px;
}
.hidden-clubs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hidden-clubs-list li {
    list-style: none;
    margin: 0;
    padding: 0;
}
.hidden-club-chip {
    width: auto;
    text-align: center;
    background: var(--color-accent-bg);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--color-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s;
}
.hidden-club-chip:hover {
    background: var(--color-accent-hover);
}

/* Hidden clubs section spacing on smaller viewports */
@media (max-width: 900px) {
    #hidden-clubs-panel {
        margin-top: 16px;
    }
}

/* Per-club popover */
.club-popover[hidden] { display: none; }
.club-popover {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.club-popover-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}
.club-popover-card {
    position: relative;
    background: #fff;
    border-radius: 10px;
    width: min(420px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    padding: 0;
}
.club-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 8px;
    border-bottom: 1px solid var(--color-line);
}
.club-popover-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
}
.club-popover-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.club-popover-close:hover { color: var(--color-ink); }
.club-popover-body {
    padding: 12px 16px;
    font-size: 13px;
}
.club-popover-courts {
    margin: 0 0 12px;
    color: var(--color-muted);
}
.club-popover-court {
    white-space: nowrap;
}
.club-popover-courts-label {
    color: var(--color-bold);
    font-weight: 600;
}
.club-popover-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.club-popover-links .link {
    display: inline-block;
}
.club-popover-footer {
    display: flex;
    justify-content: flex-end;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--color-line);
    background: var(--color-surface-tint);
    border-radius: 0 0 10px 10px;
}
.club-popover-action {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--color-bold);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.club-popover-action-danger:hover {
    background: #fff0f0;
    border-color: #e0a0a0;
    color: #b04040;
}

/* --- Refresh ------------------------------------------------------------
   More to read at a glance without taking more room: the rows group by the
   hour and the table sits on the page instead of on a white sheet of its
   own. */

/* Pico paints every cell white and draws a line under each one. */
#clubs-combined table,
#clubs-combined th,
#clubs-combined td {
    background: transparent;
    border-bottom: 0;
}

#clubs-combined thead th {
    font-size: 11px !important;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
    border-bottom: 2px solid var(--color-line);
}

#clubs-combined .start-order-toggle {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    line-height: inherit;
}

#clubs-combined .col-place-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

#clubs-combined .table-share-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
    line-height: inherit;
    cursor: pointer;
    transition: color 0.15s ease;
}

#clubs-combined .table-share-hint svg {
    flex: none;
    color: #25d366;
}

#clubs-combined .table-share-hint:hover {
    color: var(--color-ink);
}

#clubs-combined .table-share-hint:focus-visible {
    outline: 2px solid var(--color-primary-soft);
    outline-offset: 2px;
}

/* The predictions toggle in the table head: the dartboard, dim until on.
   A phone has no head row and keeps the toggle in its filter row. */
#clubs-combined .pred-toggle-head {
    margin: 0 0 0 auto;
    padding: 0 4px;
    border: 0;
    background: transparent;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.4;
    filter: grayscale(1);
    transition: opacity 0.15s ease, filter 0.15s ease;
}

#clubs-combined .pred-toggle-head:hover,
#clubs-combined .pred-toggle-head.is-active {
    opacity: 1;
    filter: none;
}

#clubs-combined .pred-toggle-head:focus-visible {
    outline: 2px solid var(--color-primary-soft);
    outline-offset: 2px;
}

.court-toggle-pred {
    display: none;
}

@media (max-width: 768px) {
    .court-toggle-pred {
        display: inline-flex;
    }
}

/* A line above each full hour, none above the half past: the table reads as
   hour blocks instead of an even stack of rows. */
#clubs-combined tbody tr.row-hour td {
    border-top: 1px solid var(--color-line);
}

#clubs-combined tbody tr:first-child td {
    border-top: 0;
}

.row-half td.col-time > b {
    color: var(--color-muted);
    font-weight: 500;
}

td.col-time > b {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* A chip lifts a little under the pointer, which says "open me" better than
   the colour shift alone. */
@media (hover: hover) {
    button.club-entry {
        transition: background-color 0.15s, transform 0.12s, box-shadow 0.12s;
    }
    button.club-entry:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(29, 77, 58, 0.14);
    }
}

@media (max-width: 768px) {
    table td {
        padding: 4px 0 !important;
    }

    /* The sticky filter bar is on the same page surface, not a white band. */
    .content-toolbar {
        background: rgba(251, 251, 247, 0.94);
        border-bottom-color: var(--color-line);
    }
}
