*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

:root {
    --bg:        #e8e3db;
    --surface:   #f2ede7;
    --available: #5c8c63;
    --booked:    #9e5445;
    --past:      #bbb5ae;
    --txt:       #1b1714;
    --txt2:      #6b6058;
    --txt3:      #a09488;
    --bdr:       #cdc7be;
    --acc:       #b07034;
    --acc-lt:    #f0e4d2;
}

body {
    font-family: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--txt);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ── STICKY HEADER ── */
.hdr {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
}

.hdr-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--bdr);
}

/* Date block */
.date-block {
    flex: 1;
    min-width: 0;
    position: relative;
    cursor: pointer;
}

.date-eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--txt3);
    line-height: 1;
    margin-bottom: 2px;
}

.date-name {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--txt);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.date-name::after {
    content: ' ▾';
    font-size: 12px;
    color: var(--txt3);
}

/* Overlay invisible date input on top of date block */
.date-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
    background: transparent;
}

/* Nav buttons */
.nav-btn {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--bdr);
    border-radius: 9px;
    background: var(--surface);
    color: var(--txt);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .12s, border-color .12s;
    -webkit-tap-highlight-color: transparent;
}
.nav-btn:active:not(:disabled) { background: var(--acc-lt); }
.nav-btn:disabled { opacity: .38; cursor: not-allowed; }

/* Logo */
.logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: contain;
    border: 1.5px solid var(--bdr);
    flex-shrink: 0;
}

/* ── LEGEND ── */
.legend {
    display: flex;
    gap: 14px;
    padding: 7px 14px 6px;
    border-bottom: 1px solid var(--bdr);
}

.leg-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--txt2);
}

.leg-pip {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.pip-free   { background: var(--available); }
.pip-booked { background: var(--booked); }
.pip-past   { background: var(--past); }

/* ── COURT HEADERS ── */
.court-hdr-row {
    display: grid;
    padding: 7px 14px 4px;
    background: var(--bg);
}

.court-hdr-cell {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--txt2);
}

/* ── GRID ── */
.grid-wrap {
    padding: 4px 14px 40px;
}

.grid-row {
    display: grid;
    margin-bottom: 2px;
}

/* every-2-hours divider */
.grid-row.two-hour-mark {
    margin-top: 6px;
}

.t-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--txt3);
    height: 28px;
    user-select: none;
}

.t-cell.full-hour {
    color: var(--txt2);
    font-weight: 500;
}

/* slot cells */
.slot {
    margin: 1px;
    border-radius: 3px;
    height: 26px;
}

.slot-free   { background: var(--available); }
.slot-booked { background: var(--booked); }
.slot-past   { background: var(--past); opacity: .5; }

/* ── SPINNER ── */
.spinner-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 220px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--bdr);
    border-top-color: var(--acc);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── FOOTER ── */
.footer {
    text-align: center;
    padding: 16px 16px 36px;
    font-size: 12px;
    color: var(--txt3);
}

.footer a {
    color: var(--txt3);
    text-decoration-color: var(--bdr);
}

/* ── COOKIE ── */
.cookie-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
    padding: 0 14px 28px;
}

.cookie-card {
    background: var(--txt);
    color: var(--surface);
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 16px 48px rgba(0,0,0,.35);
    max-width: 480px;
    width: 100%;
}

.cookie-card span { flex: 1; }

.cookie-ok {
    background: var(--acc);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
