/* ========== Home / Landing ========== */

.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    padding: 20px;
}

.landing-content { text-align: center; max-width: 400px; }
.landing-content h1 { font-size: 3rem; font-weight: 700; margin-bottom: 1rem; letter-spacing: -0.02em; }
.landing-content p { font-size: 1.1rem; opacity: 0.8; margin-bottom: 2rem; line-height: 1.6; }

/* Momentary /home redirect placeholder — theme-aware so a light-mode user never sees a dark flash. */
.home-redirect {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text);
    padding: 20px;
}

.home-redirect p { font-size: 1.1rem; color: var(--text-secondary); }

/* Inline save/validation error — visually distinct from muted helper text. Theme-aware. */
.field-error { color: var(--danger-text); font-size: 0.85rem; margin-top: 6px; }

/* ========== OAuth Select ========== */

.oauth-container {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: 0 20px 40px var(--shadow-lg);
    padding: 40px 24px;
    max-width: 420px;
    width: 100%;
    margin: 60px auto;
}

.oauth-container .header { text-align: center; margin-bottom: 32px; }
.oauth-container .header h1 { color: var(--text-heading); font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.oauth-container .header p { color: var(--text-secondary); font-size: 1rem; }
.oauth-container .providers { display: flex; flex-direction: column; gap: 12px; }

.oauth-error {
    background: var(--danger-bg, rgba(198, 40, 40, 0.12));
    color: var(--danger, #c62828);
    border: 1px solid var(--danger, #c62828);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

.provider-button {
    display: flex; align-items: center; padding: 14px 16px;
    border: 2px solid var(--border); border-radius: 10px;
    text-decoration: none; font-size: 1rem; font-weight: 500;
    transition: all 0.2s; background: var(--bg-surface); color: var(--text);
    cursor: pointer;
}
.provider-button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--shadow-lg); }
.github:hover { border-color: #333; background: #333; color: white; }
.microsoft:hover { border-color: #0078d4; background: #0078d4; color: white; }
.google:hover { border-color: #db4437; background: #db4437; color: white; }

.provider-icon { width: 24px; height: 24px; margin-right: 12px; flex-shrink: 0; }
.provider-text { flex: 1; text-align: left; }

.remember-method {
    display: flex; align-items: center; gap: 10px;
    margin-top: 20px; cursor: pointer;
    color: var(--text-secondary); font-size: 0.9rem;
}
.remember-method input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }

.oauth-container .footer { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 0.85rem; }

/* Password sign-in form: "or" divider, labelled inputs and a primary-styled submit, all matching
   the OAuth provider buttons above it. */
.password-login { margin-top: 20px; }
.password-divider {
    display: flex; align-items: center; text-align: center;
    color: var(--text-secondary); font-size: 0.85rem; margin: 0 0 16px;
}
.password-divider::before, .password-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}
.password-divider span { padding: 0 12px; white-space: nowrap; }
.password-login .field-label { color: var(--text); }
.password-login .text-input {
    width: 100%; padding: 12px 14px; font-size: 0.95rem;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-surface); color: var(--text);
    margin-bottom: 14px;
}
.password-login .text-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.password-submit {
    justify-content: center; width: 100%; margin-top: 4px;
    background: var(--accent); border-color: var(--accent); color: white;
}
.password-submit:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }
.password-remember {
    display: flex; align-items: center; gap: 8px; margin: 12px 0 4px;
    font-size: 0.85rem; color: var(--text-secondary); cursor: pointer;
}
.password-remember input { width: auto; margin: 0; flex: none; }

/* OAuth page needs dark background even in light mode */
body:has(.oauth-container) { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }

/* ========== Wall List ========== */

.wall-list { padding: 16px; max-width: 600px; margin: 0 auto; }

.list-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.list-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-heading); }

.btn-create {
    padding: 10px 20px; background: var(--accent); color: white;
    text-decoration: none; border-radius: 8px; font-weight: 600;
    font-size: 0.9rem;
}

.join-section { display: flex; gap: 8px; margin-bottom: 20px; }
.join-input {
    flex: 1; padding: 10px 14px; border: 2px solid var(--border);
    border-radius: 8px; font-size: 0.9rem; outline: none;
    background: var(--input-bg); color: var(--text);
}
.join-input:focus { border-color: var(--secondary); }
.btn-join {
    padding: 10px 20px; background: var(--secondary); color: white;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-join:disabled { opacity: 0.5; cursor: not-allowed; }

.wall-cards { display: flex; flex-direction: column; gap: 12px; }

.wall-card {
    display: flex; gap: 12px; padding: 12px; background: var(--bg-surface);
    border-radius: 12px; box-shadow: 0 2px 8px var(--shadow-md);
    text-decoration: none; color: inherit; transition: transform 0.15s;
}
.wall-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px var(--shadow-lg); }

.wall-card-photo {
    width: 80px; height: 80px; border-radius: 8px; overflow: hidden;
    background: var(--bg-surface-alt); flex-shrink: 0;
}
.wall-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.no-photo {
    width: 100%; height: 100%; display: flex; align-items: center;
    justify-content: center; color: var(--text-secondary); font-size: 0.75rem;
}

.wall-card-info { display: flex; flex-direction: column; justify-content: center; }
.wall-card-info h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin: 0; }
.member-count { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

.empty-state {
    text-align: center; padding: 48px 20px; color: var(--text-secondary);
    background: var(--bg-surface); border-radius: 12px;
}

/* ========== Image Stitcher ========== */

.stitcher-page {
    padding: 12px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h));
    min-height: 500px;
}
.stitcher-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.stitcher-toolbar .stitcher-spacer { flex: 1; }
.stitcher-upload {
    width: auto;
    padding: 10px 16px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.stitcher-upload input[type="file"] { display: none; }
.stitcher-viewport {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    cursor: grab;
}
.stitcher-viewport:active { cursor: grabbing; }
/* The transform itself is written by wwwroot/js/viewport.js (transform model) and
   deliberately not rendered by Blazor, so a late re-render can't stomp a gesture. */
.stitcher-world {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    transform-origin: 0 0;
}
.stitcher-layer {
    pointer-events: auto;
    -webkit-user-drag: none;
    user-select: none;
}
.stitcher-layer.selected { outline: none; }
.stitcher-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.stitcher-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}
.stitcher-zoom .fab-btn {
    width: 36px;
    height: 36px;
    background: rgba(22, 22, 42, 0.85);
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stitcher-zoom .fab-btn:hover { background: rgba(22, 22, 42, 1); }

.stitcher-layer-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.stitcher-layer-controls .stitcher-spacer { flex: 1; }

.opacity-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-surface-alt);
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.opacity-slider input[type="range"] {
    width: 120px;
    accent-color: var(--accent);
}
.opacity-value {
    font-variant-numeric: tabular-nums;
    color: var(--text-heading);
    min-width: 3em;
    text-align: right;
}

/* ========== Wall Detail ========== */

.wall-detail { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ========== Wall page carousel ========== */
.wall-carousel-root {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h));
    min-height: 360px;
}
.wall-carousel {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.wall-carousel::-webkit-scrollbar { display: none; }
/* Hidden until the initial page is positioned (see wall-carousel.js initPage), so the first
   painted frame is already the target page instead of a flash of page 1. */
.wall-carousel.carousel-pending { visibility: hidden; }
.wall-page {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: start;
    overflow-y: auto;
    padding: 12px 16px;
    box-sizing: border-box;
}
.wall-page.no-pad { padding: 0; }

.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 0 6px;
    flex: 0 0 auto;
}
.carousel-dots .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.4;
    transition: width 0.18s, height 0.18s, opacity 0.18s, background 0.18s;
    border: none;
    padding: 0;
    cursor: pointer;
}
.carousel-dots .dot.active {
    width: 10px;
    height: 10px;
    opacity: 1;
    background: var(--accent);
}

/* Collapsible wall-settings cards: the <summary> reads as the card header. */
.settings-card > .settings-card-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.settings-card > .settings-card-summary::-webkit-details-marker { display: none; }
.settings-card > .settings-card-summary h2 { margin-bottom: 0; }
.settings-card > .settings-card-summary::after {
    content: "▾";
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: transform 0.18s;
}
.settings-card[open] > .settings-card-summary::after { transform: rotate(180deg); }
.settings-card > .settings-card-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-card > .settings-card-body { margin-top: 14px; }
/* The API-key panel supplies its own settings-panel chrome; drop the nested inset inside its card. */
.settings-card > .settings-card-body > .wall-apikey-panel {
    margin-top: 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.app-shell:has(.wall-carousel-root.editing) .carousel-dots { display: none; }
.app-shell:has(.wall-carousel-root.editing) .wall-carousel {
    overflow-x: hidden;
    scroll-snap-type: none;
}

.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.detail-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-heading);
}
.header-actions { display: flex; gap: 4px; }

.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; }
.btn-icon:hover { color: var(--text-heading); }
.btn-icon.editing { color: var(--accent); }

.description { color: var(--text-secondary); margin-bottom: 16px; font-size: 0.95rem; }

.wall-photo-container { margin-bottom: 16px; }

/* Grow-with-content, not viewport-locked: `.wall-page` (overflow-y:auto) is the vertical scroller,
   so the column and its card must be free to exceed the viewport slice and let the page scroll
   instead of being height-locked and clipped. `min-height:100%` still fills a short viewport. */
.wall-main { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.wall-main .wall-detail-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 12px;
    gap: 10px;
    box-shadow: 0 1px 2px var(--shadow-sm), 0 8px 32px -18px var(--shadow-md);
}
.wall-main .wall-photo-container { display: flex; flex-direction: column; margin-bottom: 0; }
/* The card no longer supplies a locked flex height for the photo to fill, so bound the photo box to
   a viewport slice directly (fullscreen overrides this with its own aspect cap below). Rounded via
   the container: the base .photo-viewport overflow (auto) clips the width-scaled/scrolled content to
   this radius, so the wall photo has rounded corners without the removed .photo-editor band-aid. */
.wall-main .photo-viewport,
.wall-main .schematic-viewport {
    flex: 0 1 auto;
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - var(--wall-photo-chrome));
    border-radius: 12px;
}

/* When the wall photo is framed to its wall region, size the box to the region aspect (published
   as --fit-aspect by bwViewport.fitBox) instead of stretching to fill the card — this is what
   actually trims the floor/ceiling dead band. Only the read-only view is framed; the editor keeps
   the intrinsic-aspect box. Centred, and capped to a viewport slice so the rest of the page flows
   below and scrolls. */
.wall-main .photo-viewport.bw-framed {
    flex: 0 1 auto;
    aspect-ratio: var(--fit-aspect, 1.4);
    height: auto;
    max-height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - var(--wall-photo-chrome));
    margin-inline: auto;
}

.wall-top-row { display: flex; align-items: center; gap: 8px; }
.wall-top-row .view-toggle { flex: 1; margin-bottom: 0; }
.wall-top-row > .btn-icon { color: var(--text); }

.upload-prompt {
    padding: 40px 20px; text-align: center; background: var(--bg-surface-alt);
    border-radius: 12px; border: 2px dashed var(--border);
}
.upload-prompt p { color: var(--text-secondary); margin-bottom: 12px; }

.stats-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.stat {
    flex: 1; text-align: center;
    padding: 14px 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    box-shadow: 0 1px 2px var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.stat.clickable { cursor: pointer; }
.stat.clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px -4px var(--shadow-md), 0 1px 2px var(--shadow-sm);
    border-color: var(--border);
}
.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    color: var(--text-heading);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.filter-bar { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.filter-input {
    flex: 1; padding: 8px 12px; border: 2px solid var(--border);
    border-radius: 8px; font-size: 0.9rem; outline: none; box-sizing: border-box;
    background: var(--input-bg); color: var(--text);
}
.filter-input:focus { border-color: var(--secondary); }
.filter-select {
    padding: 8px 10px; border: 2px solid var(--border); border-radius: 8px;
    font-size: 0.9rem; background: var(--input-bg); color: var(--text);
}
.sort-row, .grade-range-row { display: flex; align-items: center; gap: 8px; }
.sort-row .filter-select { flex: 1; }
.sort-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-secondary); min-width: 46px;
}
.filter-checks { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.filter-check {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.8rem; color: var(--text-secondary); cursor: pointer;
}
.filter-check input { accent-color: var(--accent); }

.grade-range-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grade-range-picker .grade-select { min-width: 62px; font-size: 0.85rem; font-weight: 600; padding: 6px 8px; }
.range-dash { color: var(--text-secondary); }

.archive-section { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 12px; }
.archive-summary {
    cursor: pointer; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 12px; user-select: none;
}

.boulder-rating { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; }
.boulder-rating .rating-count { font-size: 0.72rem; color: var(--text-secondary); }
.fav-icon { color: #f5b301; }
.card-archive {
    background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 10px; font-size: 0.72rem; font-weight: 600; cursor: pointer;
}
.card-archive:hover { border-color: var(--accent); color: var(--accent); }

.star-rating { display: inline-flex; align-items: center; line-height: 1; }
.star-rating.readonly .star-track {
    position: relative; display: inline-block; font-size: 1.05rem; letter-spacing: 1px;
}
.star-rating.small.readonly .star-track { font-size: 0.85rem; }
.star-back { color: var(--border); }
.star-fill {
    position: absolute; top: 0; left: 0; overflow: hidden; white-space: nowrap; color: #f5b301;
}
.star-rating.interactive { gap: 3px; }
.star-btn {
    background: none; border: none; padding: 0 1px; cursor: pointer;
    font-size: 1.5rem; line-height: 1; color: var(--border); transition: color 0.1s ease;
}
.star-rating.small .star-btn { font-size: 1.05rem; }
.star-btn.on, .star-btn:hover { color: #f5b301; }
/* Offline-wired stars render their lit state AS `bw-opt-on` (see StarRating.razor), so the
   delegated DOM handler can lower a rating as well as raise it with the circuit down. This
   has to beat the generic `.bw-opt-on { color: var(--accent) }` rule in app.css, hence the
   container qualifier. Gold reads correctly against both themes' surfaces. */
.star-rating .star-btn.bw-opt-on { color: #f5b301; opacity: 1; }
/* Thumb-friendly hit area without inflating the glyph. */
.star-rating.interactive .star-btn { min-width: 34px; min-height: 40px; }

.fav-toggle {
    background: none; border: none; cursor: pointer; font-size: 1.5rem;
    line-height: 1; color: var(--text-secondary); padding: 0 4px;
    min-width: 40px; min-height: 40px;
    transition: color 0.12s ease, transform 0.12s ease;
}
.fav-toggle.on { color: #f5b301; }
/* Clear tap/hover affordance on the star, gold like its lit state. */
.fav-toggle:hover, .fav-toggle:focus-visible { color: #f5b301; transform: scale(1.15); }
.fav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Both directions of the favourite are always in the DOM; CSS picks the visible one from
   `bw-opt-on`, which offline-actions.js can add and remove without a circuit. See
   Components/Shared/BoulderFavoriteToggle.razor for why one button cannot work offline. */
.fav-wrap { display: inline-flex; align-items: center; color: inherit; opacity: 1; }
.fav-wrap .fav-add { display: inline-flex; align-items: center; justify-content: center; }
.fav-wrap .fav-remove { display: none; }
.fav-wrap.bw-opt-on .fav-add { display: none; }
.fav-wrap.bw-opt-on .fav-remove {
    display: inline-flex; align-items: center; justify-content: center;
}
.archived-badge {
    font-size: 0.65rem; padding: 1px 6px; background: var(--border-light); color: var(--text-secondary);
    border-radius: 4px; font-weight: 600;
}

.rating-section {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; background: var(--bg-surface-alt); border-radius: 10px; margin: 12px 0;
}
.rating-summary { display: flex; align-items: center; gap: 8px; }
.rating-avg { font-weight: 700; color: var(--text-heading); }
.rating-count, .rating-empty { font-size: 0.8rem; color: var(--text-secondary); }
.rating-mine { display: flex; align-items: center; gap: 8px; }
.rating-mine-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 600; }
.rating-clear {
    background: none; border: none; color: var(--text-secondary);
    text-decoration: underline; font-size: 0.72rem; cursor: pointer;
}
.revision-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-archive {
    background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border);
    border-radius: 7px; padding: 7px 14px; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.btn-archive:hover { border-color: var(--accent); color: var(--accent); }

.boulder-section { margin-bottom: 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h2 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}
.btn-add-boulder {
    padding: 7px 14px;
    background: var(--accent); color: white;
    text-decoration: none;
    border-radius: var(--r-pill);
    font-weight: 600; font-size: 0.85rem;
    letter-spacing: -0.005em;
    box-shadow: 0 2px 8px -3px var(--accent-soft);
    transition: background 0.15s ease, transform 0.08s ease;
}
.btn-add-boulder:hover { background: var(--accent-hover); }
.btn-add-boulder:active { transform: translateY(1px); }

.boulder-card {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-left: 3px solid transparent;
    border-radius: var(--r-lg);
    box-shadow: 0 1px 2px var(--shadow-sm);
    margin-bottom: 8px;
    text-decoration: none; color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.boulder-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -6px var(--shadow-md), 0 1px 2px var(--shadow-sm);
    border-left-color: var(--accent);
}
.boulder-card-left { display: flex; flex-direction: column; gap: 3px; }
.boulder-card-right { display: flex; align-items: center; gap: 10px; }
.boulder-name {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-heading);
    font-size: 1.02rem;
}
.boulder-meta { font-size: 0.78rem; color: var(--text-secondary); letter-spacing: 0.005em; }
.boulder-grade {
    padding: 4px 12px;
    background: var(--accent); color: white;
    border-radius: var(--r-pill);
    font-family: var(--font-display);
    font-weight: 700; font-size: 0.85rem;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 6px -3px var(--accent-soft);
}
.historic-badge {
    font-size: 0.65rem; padding: 1px 6px; background: var(--warning-bg); color: var(--warning-text);
    border-radius: 4px; font-weight: 600; margin-left: 6px; vertical-align: middle;
}
.status-icon { font-size: 1rem; }
.flash-icon { color: #FF5722; }
.send-icon { color: #4CAF50; font-weight: 700; }
.try-icon {
    font-size: 0.75rem; font-weight: 700; color: #FF9800;
    background: var(--warning-bg); padding: 2px 6px; border-radius: 4px;
}
.empty-boulders {
    text-align: center; padding: 24px; color: var(--text-secondary); background: var(--bg-surface);
    border-radius: 10px; font-size: 0.9rem;
}

.settings-panel {
    margin-top: 16px;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    box-shadow: 0 1px 2px var(--shadow-sm);
}
.settings-panel + .settings-panel { margin-top: 12px; }
.settings-panel h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-heading);
    margin-bottom: 14px;
}

.share-link { margin-bottom: 12px; }

.member-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: var(--bg-surface); border-radius: 8px;
    margin-bottom: 6px; box-shadow: 0 1px 3px var(--shadow-sm);
}
.member-name-link {
    font-weight: 600; font-size: 0.9rem; color: var(--secondary);
    text-decoration: underline; padding: 4px 0; min-height: 24px; display: inline-flex; align-items: center; gap: 8px;
}
.member-name-link:hover { text-decoration: underline; }
.member-name-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member-role { font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 4px; }
.member-role.owner { background: var(--success-bg); color: var(--success-text); }
.role-toggle {
    padding: 3px 10px; border: 1px solid var(--border); background: var(--bg-surface); border-radius: 4px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--text);
}
.role-toggle.admin { background: var(--info-bg); color: var(--info-text); border-color: var(--info-text); }
.role-toggle.member { color: var(--text-secondary); }

/* Wall member leaderboard (WallLeaderboardCard) */
.leaderboard-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.leaderboard-table {
    width: 100%; min-width: 340px; border-collapse: collapse; font-size: 0.9rem;
}
.leaderboard-table th, .leaderboard-table td {
    padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-light);
}
.leaderboard-table tbody tr:last-child td { border-bottom: none; }
.leaderboard-table th.sortable { padding: 0; white-space: nowrap; }
.sort-btn {
    display: inline-flex; align-items: center;
    width: 100%; padding: 8px 10px; border: none; background: none;
    cursor: pointer; user-select: none;
    font: inherit; font-weight: 600; color: var(--text-secondary);
    text-align: inherit;
}
.leaderboard-table th.num .sort-btn { justify-content: flex-end; }
.sort-btn:hover { color: var(--text-heading); }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sort-btn.active { color: var(--text-heading); font-weight: 700; }
.leaderboard-table th.num, .leaderboard-table td.num {
    text-align: right; font-variant-numeric: tabular-nums;
}
.leaderboard-table td.num { color: var(--text); }
/* Fixed-width slot so an inactive→active arrow does not nudge the header text. */
.leaderboard-sort-ind {
    display: inline-block; width: 0.9em; margin-left: 4px;
    font-size: 0.75rem; color: var(--accent); text-align: center;
}
.leaderboard-empty { text-align: center; padding: 16px; color: var(--text-secondary); font-size: 0.9rem; }

.activity-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    background: var(--bg-surface); border-radius: 6px; margin-bottom: 4px;
    box-shadow: 0 1px 2px var(--shadow-sm); font-size: 0.85rem;
}
.activity-icon {
    width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface-alt); border-radius: 4px; font-size: 0.7rem; font-weight: 700; color: var(--text-secondary);
}
.activity-text { flex: 1; color: var(--text); }
.activity-time { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; }
.activity-pager { display: flex; gap: 6px; margin-top: 8px; }
.empty-activity { text-align: center; color: var(--text-secondary); font-size: 0.85rem; padding: 12px; }

/* ========== Boulder Detail ========== */

.boulder-detail { padding: 16px; max-width: 600px; margin: 0 auto; }

.page-header { margin-bottom: 12px; }
.title-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.title-row h1 { font-size: 1.4rem; font-weight: 700; color: var(--text-heading); min-width: 0; }
/* Right-aligned action cluster (favourite, meta-edit pencil, Revise) — stays grouped and
   pushes to the right edge, wrapping as a unit on narrow screens. */
.title-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.grade-badge {
    padding: 4px 12px; background: var(--accent); color: white;
    border-radius: 6px; font-weight: 700; font-size: 0.95rem;
}
.meta { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }

.bw-revision-notice {
    padding: 12px 14px; background: var(--warning-bg); border-radius: 8px; margin-bottom: 12px;
}
.bw-revision-notice p { color: var(--warning-text); font-size: 0.9rem; margin-bottom: 8px; }
.btn-revise {
    display: inline-block; padding: 8px 16px; background: #E65100; color: white;
    text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 0.85rem;
}

.bw-grade-proposal-notice {
    padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 0.9rem;
}
.bw-grade-proposal-notice.creator { background: var(--info-bg); color: var(--info-text); }
.bw-grade-proposal-notice.viewer { background: var(--warning-bg); color: var(--warning-text); }
.bw-grade-proposal-notice p { margin: 0 0 8px 0; }
.proposal-actions { display: flex; gap: 8px; }
.proposal-btn {
    padding: 6px 16px; border: none; border-radius: 6px;
    font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.proposal-btn.accept { background: #4CAF50; color: white; }
.proposal-btn.accept:hover { background: #43A047; }
.proposal-btn.accept:disabled { opacity: 0.5; cursor: not-allowed; }
.proposal-btn.reject { background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border); }
.proposal-btn.reject:hover { background: var(--bg-surface-alt); }

.btn-propose-grade {
    display: block; width: 100%; padding: 10px; background: var(--bg-surface);
    border: 2px dashed var(--border); border-radius: 8px; color: var(--text-secondary);
    font-size: 0.85rem; cursor: pointer; margin-bottom: 16px; text-align: center;
}
.btn-propose-grade:hover { border-color: var(--text-secondary); color: var(--text); }

.grade-propose-form {
    padding: 12px 14px; background: var(--bg-surface-alt); border-radius: 8px;
    margin-bottom: 16px;
}
.grade-propose-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Creator inline rename / regrade, shown from the pencil next to the title. */
.boulder-edit-btn { color: var(--text-secondary); }
.boulder-edit-btn:hover { color: var(--accent); }
.boulder-meta-edit {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 12px 14px; background: var(--bg-surface-alt); border-radius: 8px; margin: 8px 0 12px;
}
.boulder-name-input {
    flex: 1 1 200px; min-width: 160px; padding: 8px 10px; font-size: 1rem;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--input-bg); color: var(--text);
}
.meta-edit-actions { display: flex; gap: 8px; }

/* Backdated logging: a collapsed card with a time picker and the three ascent buttons. */
.backdate-card {
    margin-bottom: 16px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-surface); overflow: hidden;
}
.backdate-card > summary {
    cursor: pointer; padding: 12px 14px; font-weight: 600; color: var(--text-heading);
}
.backdate-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.backdate-label { font-size: 0.85rem; color: var(--text-secondary); }
.backdate-input {
    padding: 8px 10px; font-size: 0.95rem; border: 1px solid var(--border);
    border-radius: var(--r-sm); background: var(--input-bg); color: var(--text);
}

.photo-section {
    position: relative; border-radius: 12px; overflow: hidden; margin-bottom: 12px;
}
.photo-section .wall-photo { width: 100%; display: block; }
.photo-section .hold-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

.legend-bar { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.legend-chip {
    padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
}
.legend-chip.start { background: var(--success-bg); color: var(--success-text); }
.legend-chip.normal { background: var(--info-bg); color: var(--info-text); }
.legend-chip.top { background: var(--danger-bg); color: var(--danger-text); }
.legend-chip.usage { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }
.legend-chip.foot { background: var(--foot-hold-soft); color: var(--foot-hold-text); }

/* Informational rule banners above the boulder image (feet-of-a-colour, no-match). */
.boulder-info-banners { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.boulder-info-banner {
    background: var(--info-bg); color: var(--info-text);
    border: 1px solid var(--border-light);
    padding: 10px 14px; border-radius: var(--r-md); font-size: 0.88rem; line-height: 1.35;
}

/* Rule chips under the boulder view. */
.rules-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.rule-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--r-pill); font-size: 0.78rem;
    background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border);
}
.rule-chip.on { color: var(--text); border-color: var(--border); }
.rule-chip.off { opacity: 0.85; }
.rule-chip.foot { background: var(--foot-hold-soft); color: var(--foot-hold-text); border-color: transparent; }
.rule-chip .rule-warn { color: var(--warning-text); }
.view-toggle .toggle-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }

.attempt-section { margin-bottom: 16px; }
.attempt-section h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 10px; }

.attempt-buttons { display: flex; gap: 10px; }
.attempt-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 8px; border: 2px solid var(--border); border-radius: 12px;
    background: var(--bg-surface); cursor: pointer; font-weight: 600; font-size: 0.85rem;
    transition: all 0.15s;
}
.attempt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.attempt-btn.try { color: #FF9800; }
.attempt-btn.try:hover:not(:disabled) { border-color: #FF9800; background: var(--warning-bg); }
.attempt-btn.send { color: #4CAF50; }
.attempt-btn.send:hover:not(:disabled) { border-color: #4CAF50; background: var(--success-bg); }
.attempt-btn.flash { color: #FF5722; }
.attempt-btn.flash:hover:not(:disabled) { border-color: #FF5722; background: #FBE9E7; }

.my-stats {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: var(--bg-surface-alt); border-radius: 8px; font-size: 0.9rem;
    color: var(--text-secondary); margin-bottom: 16px;
}
.chip { padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.flash-chip { background: #FBE9E7; color: #D84315; }
.send-chip { background: var(--success-bg); color: var(--success-text); }

/* ========== Beta videos ========== */
/* Collapsed by default (see BoulderBetaVideos.razor): beta is a spoiler, so the section has to
   be opened deliberately. The strip scrolls horizontally rather than wrapping — one row keeps
   the "+" tile permanently in reach on a phone, however many clips a boulder collects. */
.beta-section {
    margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-surface); overflow: hidden;
}
.beta-summary {
    cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 8px;
    list-style: none;
}
.beta-summary::-webkit-details-marker { display: none; }

/* Own disclosure triangle: the native marker cannot be positioned and disappears under
   `display: flex` in some engines. */
.beta-summary::before {
    content: ''; width: 0; height: 0; flex: none;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent; border-bottom: 4px solid transparent;
    color: var(--text-secondary); transition: transform 0.15s ease;
}
.beta-section[open] > .beta-summary::before { transform: rotate(90deg); }
.beta-title { font-weight: 600; color: var(--text-heading); font-size: 1.1rem; }
.beta-count {
    font-size: 0.75rem; font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill);
    background: var(--accent-soft); color: var(--accent);
}
.beta-body { padding: 0 14px 14px; }
.beta-strip {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.beta-strip::-webkit-scrollbar { display: none; }
.beta-strip { scrollbar-width: none; }

.beta-tile {
    position: relative; flex: none; width: 108px; display: flex; flex-direction: column; gap: 6px;
    padding: 0; border: none; background: none; cursor: pointer; scroll-snap-align: start;
    font: inherit; color: inherit; text-align: center;
}
.beta-thumb {
    position: relative; display: block; width: 108px; height: 144px;
    border-radius: var(--r-md); overflow: hidden; background: var(--bg-surface-alt);
    border: 1px solid var(--border);
}
.beta-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.beta-thumb-fallback {
    display: block; width: 100%; height: 100%;
    background: linear-gradient(150deg, var(--bg-surface-alt), var(--border-light));
}
.beta-play {
    position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0, 0, 0, 0.55); color: #fff;
}
.beta-uploader {
    font-size: 0.78rem; color: var(--text-secondary); line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.beta-add .beta-add-mark {
    display: grid; place-items: center; width: 108px; height: 144px;
    border: 2px dashed var(--border); border-radius: var(--r-md);
    background: var(--bg-surface-alt); color: var(--accent);
    font-size: 2rem; font-weight: 300; line-height: 1;
}
.beta-add:hover .beta-add-mark { border-color: var(--accent); }
.beta-add.busy { pointer-events: none; opacity: 0.6; }

/* The file input is driven by the tile it sits in; only the label is ever visible. */
.beta-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.beta-lightbox {
    position: fixed; inset: 0; z-index: 1000; background: var(--overlay-bg);
    display: grid; place-items: center; padding: 16px;
}
.beta-lightbox-inner {
    width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 8px;
}
.beta-lightbox-bar { display: flex; align-items: center; gap: 10px; color: #fff; }
.beta-lightbox-title { flex: 1; font-weight: 600; font-size: 0.9rem; }
.beta-lightbox-delete {
    background: none; border: none; color: #fff; opacity: 0.8; font-size: 0.85rem;
    cursor: pointer; padding: 4px 6px;
}
.beta-lightbox-close {
    background: none; border: none; color: #fff; font-size: 1.6rem; line-height: 1;
    cursor: pointer; padding: 0 6px;
}
.beta-player {
    width: 100%; max-height: 78vh; border-radius: var(--r-md); background: #000; display: block;
}

.activity-feed { margin-bottom: 20px; }
.activity-feed h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 8px; }

.comments-section { margin-bottom: 20px; }
.comments-section h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 8px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-input {
    flex: 1; padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px;
    font-size: 0.9rem; outline: none; box-sizing: border-box;
    background: var(--input-bg); color: var(--text);
}
.comment-input:focus { border-color: var(--secondary); }
.comment-submit {
    padding: 8px 16px; background: var(--secondary); color: white; border: none;
    border-radius: 8px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.comment-submit:disabled { opacity: 0.5; cursor: not-allowed; }
/* The Post button is never `disabled` — a disabled element is skipped by the delegated
   offline handler, and the flag driving it could not be updated with the circuit down.
   `:placeholder-shown` is true exactly while the (unbound) input is empty, so the
   greyed-out affordance is pure CSS and needs no round-trip. Clicking it while empty is
   already a no-op in offline-actions.js. */
.comment-input:placeholder-shown + .comment-submit { opacity: 0.5; }
.comment-submit { min-height: 40px; }
.comment-row {
    padding: 10px 12px; background: var(--bg-surface); border-radius: 8px; margin-bottom: 6px;
    box-shadow: 0 1px 3px var(--shadow-sm);
}
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-weight: 600; color: var(--text); font-size: 0.85rem; }
.comment-time { font-size: 0.75rem; color: var(--text-secondary); }
.comment-text { font-size: 0.9rem; color: var(--text); margin: 0; }

.history-section { margin-bottom: 20px; }
.history-section h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 8px; }
.attempt-row {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: var(--bg-surface); border-radius: 8px; margin-bottom: 6px;
    box-shadow: 0 1px 3px var(--shadow-sm);
}
.attempt-info { flex: 1; display: flex; align-items: center; gap: 8px; }
.attempt-type {
    padding: 2px 8px; border-radius: 4px; font-size: 0.75rem;
    font-weight: 700; text-transform: uppercase;
}
.attempt-type.attempt { background: var(--warning-bg); color: var(--warning-text); }
.attempt-type.send { background: var(--success-bg); color: var(--success-text); }
.attempt-type.flash { background: var(--danger-bg); color: var(--danger-text); }
.attempt-user { font-size: 0.9rem; color: var(--text); }
.attempt-time { font-size: 0.8rem; color: var(--text-secondary); }

/* ========== Wall Create ========== */

.create-wall { padding: 16px; max-width: 500px; margin: 0 auto; }
.create-wall h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-heading); margin-bottom: 20px; }

.hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

.angle-slider { width: 100%; accent-color: var(--accent); }
.angle-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-secondary); }

.photo-preview { margin-bottom: 16px; border-radius: 12px; overflow: hidden; max-height: 300px; }
.photo-preview img { width: 100%; object-fit: contain; }

.detect-choice { margin-bottom: 16px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: var(--bg-surface); border: 2px solid var(--border); border-radius: 8px;
    cursor: pointer; font-size: 0.95rem;
}
.radio-label:has(input:checked) { border-color: var(--accent); background: #fff5f6; }
.radio-label input[type=radio] { accent-color: var(--accent); }

/* ========== Boulder Create ========== */

.boulder-create { padding: 16px; max-width: 600px; margin: 0 auto; }
.boulder-create .page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--text-heading); margin-top: 4px; }
.boulder-create .form-group > label { font-size: 0.85rem; }

.form-section { margin-bottom: 12px; }

.checkbox-label, .toggle-label {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: var(--bg-surface); border: 2px solid var(--border); border-radius: 8px;
    cursor: pointer; font-size: 0.9rem; font-weight: 500;
}
.checkbox-label:has(input:checked), .toggle-label:has(input:checked) {
    border-color: var(--accent); background: #fff5f6;
}
.checkbox-label input, .toggle-label input { accent-color: var(--accent); }

.submit-row { display: flex; gap: 8px; margin-top: 12px; }
.submit-row > .btn-secondary { flex: 0 1 auto; width: auto; margin-bottom: 0; }
.submit-row > .btn-submit { flex: 1; margin-top: 0; }
.boulder-create .hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; text-align: center; }

/* ========== Boulder Revise ========== */

.revision-hint { color: var(--warning-text); font-size: 0.9rem; background: var(--warning-bg); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.reference-panel { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-surface); }
.reference-panel > summary { padding: 10px 14px; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--text-heading); }
.reference-photo { position: relative; }
.reference-photo img { width: 100%; display: block; }
.reference-photo .hold-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.reference-panel .hint { padding: 8px 14px; font-size: 0.78rem; color: var(--text-muted); margin: 0; }

/* Press-and-hold original reference (BoulderRevise). */
.reference-hold { margin-bottom: 12px; }
.btn-reference { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-surface); color: var(--text-heading); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; }
.btn-reference:active { background: var(--bg-surface-alt); border-color: var(--top-hold); }
.reference-hold .hint { margin-top: 6px; }
.reference-overlay { position: fixed; inset: 0; z-index: 1000; background: var(--overlay-bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 16px; overflow: auto; }
.reference-overlay .reference-photo { max-width: 100%; max-height: 88vh; }
.reference-overlay .reference-photo img { width: auto; max-width: 100%; max-height: 88vh; }
.reference-note { margin-top: 10px; font-size: 0.78rem; color: #fff; opacity: 0.85; text-align: center; }

/* ========== Draft & staleness badges ========== */

.draft-badge { background: var(--warning-bg); color: var(--warning-text); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 5px; }
.bw-draft-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; background: var(--warning-bg); color: var(--warning-text); padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 0.88rem; }
.bw-draft-notice .draft-actions { display: flex; gap: 8px; }
.btn-publish { background: var(--accent); color: #fff; border: none; border-radius: 7px; padding: 7px 14px; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.btn-publish:disabled { opacity: 0.5; cursor: not-allowed; }
.card-publish { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 4px 10px; font-size: 0.72rem; font-weight: 600; cursor: pointer; }

/* ========== Join ========== */

.join-page { padding: 48px 20px; text-align: center; max-width: 400px; margin: 0 auto; }
.error-state h2 { color: var(--text-heading); margin-bottom: 8px; }
.error-state p { color: var(--text-secondary); margin-bottom: 20px; }

/* ========== Activity ========== */

.activity-page { padding: 16px; max-width: 600px; margin: 0 auto; }

.activity-page .section { margin-bottom: 24px; }
.activity-page .section h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 10px; }
.profile-page .section h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 10px; }
.activity-page .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.activity-page .section-header h2 { margin-bottom: 0; }

.training-menu { position: relative; }
.btn-add-training {
    width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: white;
    border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.btn-add-training:hover { background: var(--accent-hover); }
.training-dropdown {
    position: absolute; right: 0; top: 42px; background: var(--bg-surface); border-radius: 8px;
    box-shadow: 0 4px 16px var(--shadow-lg); overflow: hidden; z-index: 10; min-width: 140px;
}
.dropdown-item {
    display: block; width: 100%; text-align: left; padding: 10px 16px; color: var(--text);
    text-decoration: none; font-size: 0.9rem; font-weight: 500;
    background: none; border: none; cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-surface-alt); }
.dropdown-item.danger { color: var(--danger-text); }

/* Simple centred modal (session wall picker). */
.bw-modal-backdrop {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.45); padding: 20px;
}
.bw-modal {
    width: 100%; max-width: 360px; background: var(--bg-surface); border-radius: 14px;
    padding: 18px; box-shadow: 0 10px 40px var(--shadow-lg); display: flex; flex-direction: column; gap: 12px;
}
.bw-modal h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-heading); }
.wall-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.wall-pick-item {
    text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-surface); color: var(--text); font-weight: 600; font-size: 0.95rem; cursor: pointer;
}
.wall-pick-item:hover { border-color: var(--accent); background: var(--accent-soft); }

/* GitHub-style contribution graph: fixed-metric cells that can be wider than the viewport, with the
   grid area scrolling horizontally (swipe / trackpad / overflow) so the page body never scrolls sideways.
   A vertical year selector sits to its left; it is omitted entirely when only one year has data. */
.contribution-section { display: flex; align-items: flex-start; gap: 10px; }
.year-selector { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.year-btn {
    padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--input-bg); color: var(--text-secondary);
    font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: center;
}
.year-btn:hover { border-color: var(--accent); }
.year-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.contribution-scroll { flex: 1; min-width: 0; overflow-x: auto; }
.contribution-inner { display: inline-block; }
.contribution-grid { display: flex; gap: 3px; }
.grid-column { display: flex; flex-direction: column; gap: 3px; }
.grid-cell { width: 11px; height: 11px; border-radius: 2px; cursor: pointer; }
.grid-cell.intensity-0 { background: #ebedf0; }
.grid-cell.intensity-1 { background: #9be9a8; }
.grid-cell.intensity-2 { background: #40c463; }
.grid-cell.intensity-3 { background: #30a14e; }
.grid-cell.intensity-4 { background: #216e39; }

[data-theme="dark"] .grid-cell.intensity-0 { background: #2d2d3a; }

.month-labels { position: relative; width: 100%; height: 18px; margin-top: 4px; }
.month-label { position: absolute; font-size: 0.65rem; color: var(--text-secondary); transform: translateX(-50%); }

.grid-legend { display: flex; align-items: center; gap: 3px; margin-top: 2px; justify-content: flex-end; }
.legend-text { font-size: 0.7rem; color: var(--text-secondary); }
.legend-cell { width: 10px; height: 10px; cursor: default; }

.day-summary {
    padding: 16px; background: var(--bg-surface); border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-md); margin-bottom: 16px;
}
.summary-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.summary-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-heading); flex: 1; margin: 0; }
.duration-badge {
    padding: 2px 8px; background: var(--info-bg); color: var(--info-text);
    border-radius: 4px; font-size: 0.75rem; font-weight: 600;
}
.close-btn { background: none; border: none; color: var(--text-secondary); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }
.day-summary h4 { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin: 10px 0 6px; }
.summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 8px; background: var(--bg-surface-alt); border-radius: 6px; margin-bottom: 4px;
}
.summary-name { font-size: 0.85rem; color: var(--text); font-weight: 500; }
.summary-meta { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; }
.mini-grade { padding: 1px 6px; background: var(--accent); color: white; border-radius: 3px; font-weight: 700; }
.result-badge { padding: 1px 6px; border-radius: 3px; font-weight: 600; text-transform: uppercase; font-size: 0.65rem; }
.result-badge.flash { background: #FBE9E7; color: #D84315; }
.result-badge.send { background: var(--success-bg); color: var(--success-text); }
.result-badge.attempt { background: var(--warning-bg); color: var(--warning-text); }
.attempt-count { color: var(--text-secondary); }
.empty-day { text-align: center; color: var(--text-secondary); font-size: 0.85rem; padding: 12px; }

.progression-header { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progression-header h2 { margin-bottom: 0; }
.window-select {
    padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.8rem; background: var(--input-bg); color: var(--text);
}

.score-cards { display: flex; gap: 12px; margin-bottom: 16px; }
.score-card {
    flex: 1; padding: 16px; background: var(--bg-surface); border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-md); text-align: center;
}
.score-label { display: block; font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; }
.score-value { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text-heading); margin: 4px 0; }
.score-grade { display: block; font-size: 0.85rem; color: var(--accent); font-weight: 600; }

.chart-section { margin-bottom: 12px; }
.chart-section h4 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; }
.mini-chart {
    height: 60px; background: var(--bg-surface); border-radius: 8px;
    box-shadow: 0 1px 4px var(--shadow-sm); padding: 8px;
}
.chart-svg { width: 100%; height: 100%; }

.day-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: var(--bg-surface); border-radius: 8px;
    margin-bottom: 6px; box-shadow: 0 1px 3px var(--shadow-sm);
    cursor: pointer;
}
.day-row:hover { box-shadow: 0 2px 8px var(--shadow-md); }
.day-date { font-size: 0.9rem; color: var(--text); font-weight: 500; }
.day-dots { display: flex; gap: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.intensity-1 { background: #9be9a8; }
.dot.intensity-2 { background: #40c463; }
.dot.intensity-3 { background: #30a14e; }
.dot.intensity-4 { background: #216e39; }

/* Activity page inside a carousel: let .wall-carousel-root own width/height. */
.activity-page { padding: 0; max-width: none; }
.window-control { display: flex; gap: 8px; }

/* The "N activities" score card doubles as a button that swipes to the list page. */
.score-card-action { border: none; cursor: pointer; font: inherit; }
.score-card-action:hover { box-shadow: 0 3px 12px var(--shadow-md); }

/* ---- Progression line charts (ProgressionChart.razor) ---- */
.prog-chart { margin-bottom: 16px; }
.prog-chart-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.prog-chart-title { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }
.prog-chart-caption { font-size: 0.7rem; color: var(--text-secondary); opacity: 0.75; }
.prog-chart-empty {
    height: 72px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface); border-radius: 8px; color: var(--text-secondary); font-size: 0.8rem;
    box-shadow: 0 1px 4px var(--shadow-sm);
}
.prog-chart-body {
    position: relative; height: 128px; background: var(--bg-surface); border-radius: 8px;
    box-shadow: 0 1px 4px var(--shadow-sm); padding: 10px 10px 10px 36px;
    touch-action: pan-y; cursor: crosshair;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.prog-chart-svg { width: 100%; height: 100%; display: block; }
.prog-grid { stroke: var(--border); opacity: 0.45; }
.prog-trend { stroke-width: 1.5; stroke-dasharray: 4 3; opacity: 0.65; }
.prog-chart-yaxis { position: absolute; left: 6px; top: 10px; bottom: 10px; width: 30px; pointer-events: none; }
.prog-ytick { position: absolute; left: 0; transform: translateY(-50%); font-size: 0.6rem; color: var(--text-secondary); white-space: nowrap; }
.prog-chart-xaxis { position: relative; height: 14px; margin: 2px 10px 0 36px; }
.prog-xtick { position: absolute; transform: translateX(-50%); font-size: 0.6rem; color: var(--text-secondary); white-space: nowrap; }
.prog-chart-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-secondary); opacity: 0.5; display: none; pointer-events: none; }
.prog-chart-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%); display: none; pointer-events: none; box-shadow: 0 0 0 2px var(--bg-surface); }
.prog-chart-tip {
    position: absolute; top: 6px; background: var(--text-heading); color: var(--bg-surface);
    font-size: 0.7rem; font-weight: 600; padding: 3px 7px; border-radius: 6px; white-space: nowrap;
    display: none; pointer-events: none; z-index: 3;
}

/* ---- Activity rows (recent + full list) ---- */
.activity-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 12px; background: var(--bg-surface); border-radius: 8px; margin-bottom: 6px;
    box-shadow: 0 1px 3px var(--shadow-sm); text-decoration: none; color: inherit;
}
.activity-row:hover { box-shadow: 0 2px 8px var(--shadow-md); }
.activity-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-date { font-size: 0.9rem; font-weight: 600; color: var(--text-heading); }
.activity-meta { font-size: 0.75rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-duration { font-size: 0.9rem; font-weight: 600; color: var(--accent); flex: 0 0 auto; }
.list-hint { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 10px; }

/* ---- Activity detail page ---- */
.activity-detail { padding: 16px; max-width: 600px; margin: 0 auto; }
.activity-detail .page-header { margin: 8px 0 16px; }
.activity-detail .page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--text-heading); }
.detail-sub { font-size: 0.85rem; color: var(--text-secondary); }
.duration-editor {
    background: var(--bg-surface); border-radius: 12px; padding: 14px 16px; margin-bottom: 20px;
    box-shadow: 0 1px 4px var(--shadow-sm);
}
.duration-label { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; }
.duration-row { display: flex; align-items: center; gap: 8px; }
.duration-input {
    width: 90px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--input-bg); color: var(--text); font-size: 1rem;
}
.duration-unit { font-size: 0.85rem; color: var(--text-secondary); }
.duration-saved { font-size: 0.8rem; color: var(--success-text, #2e9e6b); font-weight: 600; }
.duration-hint { display: block; margin-top: 8px; font-size: 0.72rem; color: var(--text-secondary); }

/* ========== Profile ========== */

.profile-page { padding: 16px; max-width: 500px; margin: 0 auto; }

.profile-card {
    text-align: center; padding: 32px 20px; background: var(--bg-surface);
    border-radius: 16px; box-shadow: 0 2px 12px var(--shadow-md);
    margin-bottom: 20px;
}
.avatar {
    width: 64px; height: 64px; border-radius: 50%; background: var(--secondary);
    color: white; font-size: 1.8rem; font-weight: 700; display: flex;
    align-items: center; justify-content: center; margin: 0 auto 12px;
    text-transform: uppercase;
}
img.avatar { object-fit: cover; }
/* Compact avatar for inline author/member rows next to a name. */
.avatar-sm {
    width: 26px; height: 26px; font-size: 0.8rem; margin: 0;
    display: inline-flex; vertical-align: middle; flex-shrink: 0;
}
.profile-card h1 { font-size: 1.3rem; font-weight: 700; color: var(--text-heading); margin-bottom: 6px; }
.role-badge {
    display: inline-block; padding: 4px 12px; background: var(--info-bg);
    color: var(--secondary); border-radius: 12px; font-size: 0.8rem; font-weight: 600;
}
.member-since { color: var(--text-secondary); font-size: 0.85rem; margin-top: 8px; }

/* Profile edit fields (display name + avatar) */
.field-group { margin-bottom: 18px; }
.field-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-heading); margin-bottom: 6px; }
.field-group .text-input {
    width: 100%; padding: 10px 12px; font-size: 0.95rem;
    border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--bg-surface); color: var(--text);
}
.field-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.field-actions .btn-primary { padding: 10px 20px; font-size: 0.95rem; }
.field-actions .btn-secondary { width: auto; margin-bottom: 0; padding: 10px 16px; font-size: 0.95rem; }
.field-actions .btn-primary[disabled],
.field-actions .btn-secondary[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Consistent vertical rhythm for every profile section, matching the collapsible cards' gap. */
.profile-page .section { margin-bottom: 16px; }

/* Non-collapsible section cards (Home wall, TopLogger import) — same surface/border/radius as
   the .profile-collapsible cards so the whole page reads as one consistent stack. */
.profile-section-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: 0 1px 2px var(--shadow-sm);
    padding: 16px;
}

/* Home wall dropdown left-aligned like a normal form control (was right-aligned in a flex header). */
.home-wall-select { display: block; margin-bottom: 4px; }

.profile-page .chart-section h2 { font-size: 1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 8px; }
.chart-box {
    height: 80px; background: var(--bg-surface); border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-md); padding: 12px;
}
.chart-empty { text-align: center; color: var(--text-secondary); font-size: 0.85rem; margin: 0; line-height: 56px; }

.activity-hint { text-align: center; color: var(--text-secondary); font-size: 0.85rem; margin-top: 8px; }
.activity-hint a { color: var(--secondary); font-weight: 600; text-decoration: underline; }

/* ========== Privacy / About ========== */

.legal-page { padding: 24px 16px; max-width: 600px; margin: 0 auto; }
.legal-page h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-heading); margin-bottom: 16px; }
.legal-page h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-heading); margin: 20px 0 8px; }
.legal-page p { color: var(--text); font-size: 0.95rem; line-height: 1.6; margin-bottom: 12px; }
.legal-page ul { padding-left: 20px; margin-bottom: 12px; }
.legal-page li { color: var(--text); font-size: 0.95rem; line-height: 1.6; margin-bottom: 4px; }

/* ========== Fullscreen mode (app-wide full-width toggle) ========== */

html.bw-fullscreen .wall-carousel-root,
html.bw-fullscreen .wall-detail,
html.bw-fullscreen .wall-list,
html.bw-fullscreen .boulder-detail,
html.bw-fullscreen .boulder-create,
html.bw-fullscreen .create-wall,
html.bw-fullscreen .activity-page,
html.bw-fullscreen .activity-detail,
html.bw-fullscreen .profile-page,
html.bw-fullscreen .legal-page,
html.bw-fullscreen .wall-main {
    max-width: none;
}

/* Contain the photo/overlay views within the window on desktop/wide (fullscreen) mode.
 *
 * Fullscreen removes the 600px width cap above, so on a wide window the photo box would grow
 * full-width and — because its height follows the image aspect ratio — become far taller than
 * the window, forcing a scroll. We instead cap the box WIDTH at `availableHeight * aspect` (the
 * image aspect published as `--fit-aspect` by bwViewport.fitBox). `width: auto` then settles at
 * `min(container width, availableHeight * aspect)`, so the box uses as much width as it can while
 * its height stays within the window. Purely CSS + `100dvh`, so it re-fits on resize on its own.
 * Mobile/narrow (no .bw-fullscreen) is untouched. */
/* Scale the boulder image so the header + view + tags + Attempt/Send/Flash buttons all fit one
 * screen (mobile/normal, non-fullscreen). bwViewport.fitBox pins this box's aspect-ratio inline
 * and publishes it as --fit-aspect, so capping the HEIGHT (and the matching WIDTH via that aspect)
 * shrinks the image to make room for the rows below instead of pushing the buttons off-screen —
 * the same trick the wall photo uses. --boulder-photo-chrome (app.css) budgets everything else in
 * the slice; --bottomnav-h collapses when the tab bar hides, reclaiming that space automatically.
 * --fit-h floors the box so a very short window shrinks it gracefully instead of to nothing; the
 * description/lower sections then become the scrollable overflow. Scoped to .boulder-detail so no
 * other page is touched; fullscreen/desktop re-caps just below. */
.boulder-detail .photo-viewport.photo-section {
    --avail-h: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - var(--boulder-photo-chrome));
    --fit-h: max(180px, var(--avail-h));
    width: auto;
    height: auto;
    max-height: var(--fit-h);
    max-width: min(100%, calc(var(--fit-h) * var(--fit-aspect, 1)));
    margin-inline: auto;
}

html.bw-fullscreen .boulder-detail .photo-viewport.photo-section {
    --avail-h: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - var(--boulder-photo-chrome));
    width: auto;
    max-height: var(--avail-h);
    max-width: min(100%, calc(var(--avail-h) * var(--fit-aspect, 1)));
    margin-inline: auto;
}

html.bw-fullscreen .wall-main .photo-viewport {
    --avail-h: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - var(--wall-photo-chrome));
    flex: 0 1 auto;                       /* size to the contained photo, don't stretch the column */
    aspect-ratio: var(--fit-aspect, 1.4); /* opt the wall box into aspect sizing only here */
    height: auto;
    width: auto;
    max-height: var(--avail-h);           /* hard safety cap: never exceed the card height */
    max-width: min(100%, calc(var(--avail-h) * var(--fit-aspect, 1.4)));
    margin-inline: auto;                  /* centre horizontally within the full-width card */
}

/* ========== Personal API Keys ========== */

.apikey-page { padding: 16px; max-width: 640px; margin: 0 auto; }
.apikey-page h1 { font-size: 1.4rem; color: var(--text-heading); margin-bottom: 10px; }
.apikey-page h2 { font-size: 1rem; color: var(--text-heading); margin-bottom: 10px; }
.apikey-blurb { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 18px; }
.apikey-blurb code { font-size: 0.8rem; background: var(--bg-muted, rgba(127, 127, 127, 0.12)); border-radius: 4px; padding: 1px 4px; }

.apikey-create, .apikey-list { margin-top: 22px; }

.apikey-reveal {
    background: var(--bg-surface);
    border: 2px solid var(--accent, #e94560);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: 0 6px 18px var(--shadow-lg, rgba(0, 0, 0, 0.18));
}

.apikey-reveal-warning { font-size: 0.8rem; font-weight: 600; color: var(--accent, #e94560); line-height: 1.5; margin-bottom: 10px; }

.apikey-token {
    display: block;
    word-break: break-all;
    user-select: all;
    font-size: 0.85rem;
    background: var(--bg-muted, rgba(127, 127, 127, 0.12));
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.apikey-reveal-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.apikey-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.apikey-row.revoked, .apikey-row.expired { opacity: 0.6; }
.apikey-row.revoked { border-style: dashed; }
.apikey-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.apikey-name { font-size: 0.92rem; font-weight: 600; color: var(--text-heading); }
.apikey-row.revoked .apikey-name, .apikey-row.expired .apikey-name { text-decoration: line-through; }
.apikey-prefix { font-size: 0.78rem; color: var(--text-secondary); }
.apikey-meta { font-size: 0.72rem; color: var(--text-secondary); }
.apikey-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.apikey-confirm-text { font-size: 0.78rem; font-weight: 600; color: var(--text-heading); }

/* Scope badge next to a key's name; only kiosk keys carry one today. */
.apikey-scope {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle;
}
.apikey-scope.kiosk { background: var(--info-bg); color: var(--info-text); }

/* Kiosk consent, shown under the current user's own row in the members list. */
.kiosk-consent-line {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin: -2px 0 8px; padding: 0 12px 0 12px;
}
.kiosk-consent-state { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.kiosk-consent-confirm { font-size: 0.78rem; font-weight: 600; color: var(--text-heading); }
.kiosk-consent-btn {
    padding: 4px 10px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text);
    border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; min-height: 30px;
}
.kiosk-consent-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.kiosk-consent-btn:disabled { opacity: 0.55; cursor: default; }
.kiosk-consent-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.kiosk-consent-btn.danger { color: var(--danger-text); border-color: var(--danger-text); }

.kiosk-modal-text { font-size: 0.85rem; line-height: 1.6; color: var(--text-secondary); }
.kiosk-modal-warning {
    font-size: 0.82rem; line-height: 1.55; color: var(--warning-text, var(--text-heading));
    background: var(--warning-bg, var(--bg-surface-alt)); border-radius: 8px; padding: 10px 12px;
}
.kiosk-pin-toggle {
    display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600;
    color: var(--text); cursor: pointer;
}
.kiosk-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.apikey-state {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
}

.apikey-btn {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-heading);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.apikey-btn:disabled { opacity: 0.5; cursor: default; }
.apikey-btn.primary { background: var(--accent, #e94560); border-color: var(--accent, #e94560); color: #fff; }
.apikey-btn.danger { background: var(--danger, #c62828); border-color: var(--danger, #c62828); color: #fff; }
.apikey-empty { font-size: 0.85rem; color: var(--text-secondary); }

.apikey-docs-toggle { margin-bottom: 8px; }
.apikey-docs {
    margin-bottom: 18px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.apidocs-surface { margin-top: 20px; }
.apidocs-surface:first-of-type { margin-top: 12px; }
.apidocs-surface-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.apidocs-surface-title { font-size: 1rem; color: var(--text-heading); margin: 0; }
.apidocs-scope {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent, #e94560);
    border: 1px solid var(--accent, #e94560);
    border-radius: 999px;
    padding: 1px 8px;
}
.apidocs-surface-desc { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.6; margin: 6px 0 4px; }

.apidocs-endpoint {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 10px;
    background: var(--bg-muted, rgba(127, 127, 127, 0.06));
}
.apidocs-endpoint-soon { border-style: dashed; }
.apidocs-endpoint-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.apidocs-method {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--text-secondary);
    border-radius: 6px;
    padding: 2px 7px;
    min-width: 3.2em;
    text-align: center;
}
.apidocs-method.get { background: #2e7d32; }
.apidocs-method.post { background: #1565c0; }
.apidocs-method.delete { background: var(--danger, #c62828); }
.apidocs-method.soon { background: var(--text-secondary); }
.apidocs-path { font-size: 0.82rem; word-break: break-all; color: var(--text-heading); }
.apidocs-summary { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.55; margin: 6px 0 0; }

.apidocs-params { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.apidocs-params li { font-size: 0.76rem; color: var(--text-secondary); line-height: 1.5; }
.apidocs-params code { font-size: 0.76rem; background: var(--bg-muted, rgba(127, 127, 127, 0.12)); border-radius: 4px; padding: 1px 4px; }
.apidocs-param-loc {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 6px;
    margin: 0 4px;
}

.apidocs-block-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin: 10px 0 4px;
}
.apidocs-pre {
    font-size: 0.76rem;
    line-height: 1.5;
    background: var(--bg-muted, rgba(127, 127, 127, 0.12));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0;
    overflow-x: auto;
    white-space: pre;
}
.apidocs-note { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.5; margin: 8px 0 0; font-style: italic; }

.profile-links { text-align: center; margin-top: 12px; margin-bottom: 24px; font-size: 0.85rem; }

/* ========== Wall details page (temperature, gallery, wall API keys) ========== */

.wall-panel-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.wall-panel-head h2 { margin-bottom: 0; }
.wall-panel-hint { font-size: 0.78rem; color: var(--text-secondary); }

.wall-range-row { display: flex; gap: 4px; }
.wall-range-btn {
    font-size: 0.75rem; font-weight: 600; padding: 4px 9px; cursor: pointer;
    color: var(--text-secondary); background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: 999px;
}
.wall-range-btn.active { background: var(--accent, #e94560); border-color: var(--accent, #e94560); color: #fff; }
.wall-range-btn:disabled { opacity: 0.5; cursor: default; }

.wall-temp-latest { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.wall-temp-value {
    font-family: var(--font-display); font-size: 2rem; font-weight: 700;
    letter-spacing: -0.03em; color: var(--text-heading);
}
.wall-temp-when { font-size: 0.8rem; color: var(--text-secondary); }
.wall-temp-empty { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }
.wall-temp-empty code {
    font-size: 0.78rem; border-radius: 4px; padding: 1px 4px;
    background: var(--bg-muted, rgba(127, 127, 127, 0.12));
}

.wall-gallery-grid {
    display: grid; gap: 6px; margin-bottom: 10px;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
.wall-gallery-thumb {
    position: relative; padding: 0; border: none; cursor: pointer; overflow: hidden;
    aspect-ratio: 1 / 1; border-radius: 8px; background: var(--bg-muted, rgba(127, 127, 127, 0.12));
}
.wall-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-gallery-badge {
    position: absolute; top: 4px; left: 4px; font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px;
    color: #fff; background: rgba(0, 0, 0, 0.55);
}
.wall-gallery-badge.uploaded { background: rgba(46, 158, 107, 0.85); }
.wall-gallery-badge.current { background: rgba(233, 69, 96, 0.85); }
.wall-gallery-badge.historic { background: rgba(15, 52, 96, 0.85); }
.wall-gallery-when {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 3px 5px;
    font-size: 0.65rem; color: #fff; background: rgba(0, 0, 0, 0.45); text-align: right;
}
.wall-gallery-more { display: block; margin: 0 auto; }
.wall-gallery-empty { font-size: 0.85rem; color: var(--text-secondary); }

.wall-lightbox {
    position: fixed; inset: 0; z-index: 60; outline: none;
    display: flex; flex-direction: column; background: rgba(0, 0, 0, 0.92);
}
.wall-lightbox-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 12px 16px; color: #fff;
}
.wall-lightbox-title { font-size: 0.9rem; font-weight: 600; }
.wall-lightbox-close {
    font-size: 1.6rem; line-height: 1; color: #fff; background: none;
    border: none; cursor: pointer; padding: 0 4px;
}
.wall-lightbox-stage {
    flex: 1 1 auto; min-height: 0; display: flex; align-items: center;
    justify-content: center; gap: 6px; padding: 0 6px;
}
.wall-lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wall-lightbox-nav {
    flex: 0 0 auto; font-size: 2rem; line-height: 1; color: #fff; cursor: pointer;
    background: rgba(255, 255, 255, 0.12); border: none; border-radius: 999px; padding: 6px 14px;
}
.wall-lightbox-nav:disabled { opacity: 0.25; cursor: default; }
.wall-lightbox-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; padding: 12px 16px; color: rgba(255, 255, 255, 0.85);
}
.wall-lightbox-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; }
.wall-lightbox-meta .wall-gallery-badge { position: static; }
.wall-lightbox-actions { display: flex; align-items: center; gap: 8px; }
.wall-lightbox-actions .apikey-confirm-text { color: #fff; font-size: 0.78rem; }

.wall-apikey-panel .apikey-blurb { margin-bottom: 14px; }
.wall-apikey-list { margin-top: 16px; }

/* ── Big-wall multi-image panel grid + overlap confirmation ───────────────── */
.multi-image-toggle { margin-bottom: 10px; font-weight: 600; }

.panel-grid {
    display: grid;
    gap: 6px;
    justify-content: center;
    margin: 8px 0 4px;
}
.panel-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--r-md);
    overflow: hidden;
    min-width: 64px;
}
.panel-thumb {
    border: 1px solid var(--border);
    background: var(--bg-surface-alt);
}
.panel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.panel-add-card {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.panel-add-card:hover { border-color: var(--accent); color: var(--accent); }
.panel-add-plus { font-size: 1.8rem; font-weight: 300; line-height: 1; }
.panel-add-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.panel-staged-card {
    border: 2px solid var(--accent);
    background: var(--bg-surface-alt);
}
.panel-staged-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.35;
}
.panel-staged-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    background: var(--accent);
}
.panel-staged-actions {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px;
}
.panel-staged-actions button {
    min-width: 84px;
}

/* Multi-image read-only viewer: one live panel at a time, with directional step arrows
   overlaid at the edges. The arrows sit OUTSIDE the scrolling .photo-viewport so they stay
   pinned on screen while the panel image pans/zooms inside it. */
.panel-viewer { position: relative; }
/* Read-only multi-image wall view: usage toggle (magnifier). When active every hold is drawn
   green with a small boulder-count badge, mirroring WallPhotoEditor's usage tool. Floats over
   the panel, top-right, outside the scrolling image. Only shown to non-anonymous viewers. */
.panel-usage-toggle {
    position: absolute;
    z-index: 3;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: var(--r-pill);
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.panel-usage-toggle:hover { background: rgba(0, 0, 0, 0.65); }
.panel-usage-toggle.active { background: #4CAF50; }
.panel-arrow {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: var(--r-pill);
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.panel-arrow:hover { background: var(--accent); }
.panel-arrow:active { transform: scale(0.92); }
.panel-arrow.left { left: 8px; top: 50%; transform: translateY(-50%); }
.panel-arrow.right { right: 8px; top: 50%; transform: translateY(-50%); }
.panel-arrow.up { top: 8px; left: 50%; transform: translateX(-50%); }
.panel-arrow.down { bottom: 8px; left: 50%; transform: translateX(-50%); }
.panel-arrow.left:active { transform: translateY(-50%) scale(0.92); }
.panel-arrow.right:active { transform: translateY(-50%) scale(0.92); }
.panel-arrow.up:active { transform: translateX(-50%) scale(0.92); }
.panel-arrow.down:active { transform: translateX(-50%) scale(0.92); }

/* Overlap confirmation */
.panel-overlap { margin: 8px 0; }
.panel-overlap-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.panel-overlap-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}
.panel-cmp {
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    padding: 10px;
    margin-bottom: 12px;
    background: var(--bg-surface-alt);
}
.panel-cmp-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.panel-cmp-img { margin: 0; }
.panel-cmp-img figcaption {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.panel-cmp-frame {
    position: relative;
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}
.panel-cmp-frame img { width: 100%; display: block; }
.panel-cmp-frame .hold-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.panel-hold-badge {
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: var(--r-pill);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    box-shadow: 0 0 0 1.5px #fff;
    pointer-events: none;
}

.panel-proposal-list { list-style: none; margin: 10px 0 0; padding: 0; }
.panel-proposal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 4px;
    border-top: 1px solid var(--border-light);
}
.panel-proposal-row.accepted { background: var(--success-bg); border-radius: var(--r-sm); }
.panel-proposal-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: var(--r-pill);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.panel-proposal-accept { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.panel-proposal-accept input { accent-color: var(--accent); }
.panel-proposal-band { font-weight: 600; }
.panel-proposal-band.high { color: var(--success-text); }
.panel-proposal-band.mid { color: var(--warning-text); }
.panel-proposal-band.low { color: var(--text-secondary); }
.panel-proposal-conf { font-size: 0.78rem; color: var(--text-secondary); }
.panel-proposal-moved {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}
.panel-proposal-moved input { accent-color: var(--accent); }

/* ---- Big-wall overlap stepper (one hold-match at a time) ---- */
.panel-stepper { margin: 8px 0; outline: none; }
.panel-stepper-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.panel-stepper-head .btn-secondary { width: auto; margin-bottom: 0; }
.panel-stepper-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.panel-stepper-progress {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
}
.panel-stepper-band { font-weight: 600; font-size: 0.85rem; }
.panel-stepper-band.high { color: var(--success-text); }
.panel-stepper-band.mid { color: var(--warning-text); }
.panel-stepper-band.low { color: var(--text-secondary); }
.panel-stepper-decided { font-size: 0.8rem; color: var(--success-text); font-weight: 600; }

.maintenance-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    max-width: 520px;
    margin: 12vh auto;
    padding: 32px 24px;
    border: 1px solid var(--border);
    border-radius: var(--r-md, 12px);
    background: var(--surface-2, rgba(120,190,255,0.08));
    color: var(--text-secondary);
}
.maintenance-notice h2 { margin: 0; color: var(--text-primary); }
.maintenance-notice p { margin: 0; }
.maintenance-icon { font-size: 2.4rem; line-height: 1; }

/* Prev/next selector shown above the per-panel hold editor on a big wall. */
.panel-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}
.panel-selector-label {
    min-width: 84px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.panel-stepper-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.panel-step-view { margin: 0; }
.panel-step-cap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* Per-image overlay show/hide. Not uppercase — it is a control, not the caption label. */
.panel-step-toggle {
    flex: none;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface-2, rgba(120,190,255,0.12));
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.panel-step-toggle:hover { color: var(--text-primary); border-color: var(--accent, #4aa8ff); }
.panel-step-toggle.off { background: transparent; color: var(--text-tertiary, var(--text-secondary)); }
/* A scroll-model viewport (see viewport.js): the .photo-editor child is widened by --zoom
   and scrolls inside this fixed box. touch-action mirrors the other viewports. */
.panel-step-viewport {
    position: relative;
    height: 44vh;
    max-height: 460px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: #000;
}
/* HTML number badge pinned to the highlighted hold; lives inside the zoomed .photo-editor
   so it tracks the image on pan/zoom, but keeps a constant pixel size (no SVG stretch). */
.panel-step-badge {
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--r-pill);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
    z-index: 2;
}

.panel-stepper-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.panel-stepper-actions .btn-primary,
.panel-stepper-actions .btn-secondary,
.panel-stepper-actions .btn-danger-soft {
    width: auto;
    margin-bottom: 0;
    flex: 1 1 auto;
    padding: 12px 18px;
    text-align: center;
}
.panel-stepper-actions .btn-secondary[disabled] { opacity: 0.45; cursor: not-allowed; }
.panel-stepper-actions .btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-danger-soft {
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--r-md);
    background: var(--bg-surface);
    color: var(--warning-text, #b3541e);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.btn-danger-soft:hover { background: var(--warning-bg, #fbeee4); border-color: var(--warning-text, #b3541e); }
.panel-stepper-hint { flex: 1 1 100%; font-size: 0.82rem; color: var(--text-secondary); }

.panel-stepper-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.panel-stepper-legend { font-size: 0.76rem; color: var(--text-muted); }
.panel-stepper-legend kbd {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-surface-alt);
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.btn-link {
    background: none;
    border: none;
    padding: 4px 2px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}
.btn-link:hover { color: var(--accent-hover); }

@media (max-width: 560px) {
    .panel-stepper-pair { grid-template-columns: 1fr; }
    .panel-step-viewport { height: 38vh; }
}

/* ── Big-wall update flow (upload → carryover → overlaps → apply) ──────────── */
.bigupdate-entry { width: auto; margin-top: 10px; }

.bigupdate { margin: 8px 0; }
.bigupdate-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.bigupdate-head h2 { margin: 0; }
.bigupdate-step-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Uploader: one centre slot + four direction slots */
.bigupdate-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 10px 0;
}
.bigupdate-slot {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-surface-alt);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 92px;
}
.bigupdate-slot.required { border-color: var(--accent); }
.bigupdate-slot.filled { border-style: solid; border-color: var(--success-text, #2f8f4e); }
.bigupdate-slot-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}
.bigupdate-slot-label { font-weight: 600; color: var(--text-heading); }
.bigupdate-slot-req {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}
.bigupdate-slot-file {
    font-size: 0.78rem;
    color: var(--text-secondary);
    word-break: break-all;
}
.bigupdate-slot-pick {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 40px;
    border: 2px dashed var(--border);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.bigupdate-slot-pick:hover { border-color: var(--accent); color: var(--accent); }

/* Phase overview: summary chips + colour legend */
.bigupdate-phase { margin: 4px 0; }
.bigupdate-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 10px;
}
.bigupdate-chip {
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border-light);
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
}
.bigupdate-chip.carry { color: var(--success-text, #2f8f4e); }
.bigupdate-chip.moved { color: var(--warning-text, #b3541e); }
.bigupdate-chip.remove { color: var(--danger-text, #c0392b); }
.bigupdate-chip.new { color: var(--accent); }
.bigupdate-chip.link { color: var(--text-secondary); }

.bigupdate-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 10px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.bigupdate-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bigupdate-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.bigupdate-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}
.bigupdate-review-actions .btn-secondary { width: auto; margin-bottom: 0; flex: 1 1 auto; }

/* TopLogger import section */
.tl-card .tl-meta { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.tl-reauth {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--input-bg);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.tl-token { font-family: var(--font-mono, monospace); font-size: 0.8rem; resize: vertical; }
.tl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tl-actions .btn-primary, .tl-actions .btn-secondary { width: auto; margin-bottom: 0; }
.tl-confirm { margin-top: 12px; }
.tl-check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-secondary); }
.tl-check input { width: auto; }

/* Two-phase busy indicator: a small rotating circle beside the "Connecting…" / "Syncing…" text. */
.tl-busy {
    display: flex; align-items: center; gap: 8px; margin-top: 12px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.tl-spinner {
    width: 16px; height: 16px; flex: none; border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    animation: tl-spin 0.7s linear infinite;
}
@keyframes tl-spin {
    to { transform: rotate(360deg); }
}

/* Collapsed "Update tokens" disclosure shown once connected, so the token inputs stop cluttering
   the connected view. The summary reads as a small clickable link row. */
.tl-token-edit { margin-top: 14px; }
.tl-token-edit summary {
    cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; font-weight: 600; color: var(--accent); padding: 2px 0;
}
.tl-token-edit summary::-webkit-details-marker { display: none; }
.tl-token-edit summary::before {
    content: ''; width: 0; height: 0; flex: none;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent; border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
}
.tl-token-edit[open] > summary::before { transform: rotate(90deg); }

/* Gym points→grade calibration disclosure: matches the "Update tokens" summary, with a scrollable
   grade→points table and compact numeric inputs. */
.tl-calibration { margin-top: 14px; }
.tl-calibration > summary {
    cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; font-weight: 600; color: var(--accent); padding: 2px 0;
}
.tl-calibration > summary::-webkit-details-marker { display: none; }
.tl-calibration > summary::before {
    content: ''; width: 0; height: 0; flex: none;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent; border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
}
.tl-calibration[open] > summary::before { transform: rotate(90deg); }
.tl-calib-grid { max-height: 260px; overflow-y: auto; margin: 8px 0; }
.tl-calib-table { width: 100%; border-collapse: collapse; }
.tl-calib-table th, .tl-calib-table td { text-align: left; padding: 3px 8px 3px 0; }
.tl-calib-table th { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; }
.tl-calib-input { width: 100px; margin-bottom: 0; }

/* ---- Header avatar with overlaid edit/remove icon controls (self view). Centered inside the
   text-align:center profile card; the 12px gap below matches the avatar's normal bottom margin. ---- */
.avatar-edit { position: relative; display: inline-block; width: 64px; margin: 0 auto 12px; }
.avatar-edit .avatar { margin: 0; }
.avatar-file-input { display: none; }
.avatar-icon-btn {
    position: absolute; bottom: -2px;
    width: 26px; height: 26px; border-radius: 50%; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-surface); color: var(--text-heading);
    border: 1px solid var(--border); box-shadow: 0 1px 2px var(--shadow-sm);
    cursor: pointer;
}
.avatar-icon-btn:hover { background: var(--bg-surface-alt); border-color: var(--text-secondary); }
.avatar-edit-btn { right: -6px; }
.avatar-delete-btn { left: -6px; color: var(--danger-text); }
.avatar-icon-btn.is-disabled { opacity: 0.5; pointer-events: none; }
.avatar-icon-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Collapsible profile cards (password sign-in, 2FA, linked accounts). Collapsed by default;
   the summary is the whole clickable header row, mirroring the tl-token-edit disclosure. ---- */
.profile-collapsible {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: 0 1px 2px var(--shadow-sm);
    padding: 0 16px; margin-bottom: 16px;
}
.profile-collapsible > summary {
    cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
    font-size: 1.05rem; font-weight: 600; color: var(--text-heading); padding: 16px 0;
}
.profile-collapsible > summary::-webkit-details-marker { display: none; }
.profile-collapsible > summary::before {
    content: ''; width: 0; height: 0; flex: none;
    border-left: 6px solid currentColor;
    border-top: 5px solid transparent; border-bottom: 5px solid transparent;
    transition: transform 0.15s ease;
}
.profile-collapsible[open] > summary::before { transform: rotate(90deg); }
.profile-collapsible[open] > summary { padding-bottom: 8px; }

/* API keys link styled to match the app's secondary buttons instead of a bare underlined link. */
.profile-links a.btn-secondary {
    display: inline-block; width: auto; margin-bottom: 0;
    padding: 10px 16px; font-size: 0.95rem; text-decoration: none;
}

/* ============================================================================
   Kiosk mode (Phase 3 UI)
   Everything here is sized for a wall-mounted tablet read at arm's length and
   tapped with a chalky finger: 64px rows, 1.15rem names, no dense list.
   ============================================================================ */

/* Avatar standing in for the tab icon while somebody is acting as a member. Matches the 22px svg
   the other tabs use so the bar's height never shifts between anonymous and acting-as. */
.nav-item .nav-avatar {
    width: 24px; height: 24px; font-size: 0.75rem; margin: 0; flex: none;
}

.kiosk-picker { max-width: 560px; margin: 0 auto; padding: 20px 16px 32px; }
.kiosk-picker-head { text-align: center; margin-bottom: 20px; }
.kiosk-picker-head h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-heading); margin-bottom: 6px; }
.kiosk-picker-head p { color: var(--text-secondary); font-size: 0.95rem; }

.kiosk-user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.kiosk-user-list form { margin: 0; }

/* One row shape for links and submit buttons alike, so a PIN user and a no-PIN user are visually
   identical even though one is an <a> and the other a <button>. */
.kiosk-row {
    display: flex; align-items: center; gap: 14px; width: 100%;
    min-height: 64px; padding: 12px 16px; box-sizing: border-box;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: 0 1px 2px var(--shadow-sm);
    color: var(--text-heading); font-family: inherit; font-size: 1.15rem; font-weight: 600;
    text-align: left; text-decoration: none; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.kiosk-row:hover, .kiosk-row:active { background: var(--bg-surface-alt); border-color: var(--accent); }
.kiosk-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kiosk-row-hint {
    flex: none; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
    color: var(--text-secondary); border: 1px solid var(--border);
    border-radius: 999px; padding: 3px 10px;
}
.kiosk-row-primary { justify-content: center; background: var(--accent); border-color: var(--accent); color: #fff; }
.kiosk-row-primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); }
.kiosk-row-secondary { justify-content: center; margin-top: 12px; color: var(--text-secondary); font-weight: 500; }
.kiosk-row-danger { justify-content: center; color: var(--danger-text); }

.kiosk-avatar { width: 44px; height: 44px; font-size: 1.25rem; margin: 0; flex: none; }

.kiosk-current {
    display: flex; align-items: center; gap: 14px; justify-content: center;
    margin-bottom: 20px; padding: 16px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md);
}
.kiosk-current-name { font-size: 1.25rem; font-weight: 700; color: var(--text-heading); }

.kiosk-pin-form { display: block; margin: 0; }

/* The field that actually posts. Off-screen rather than display:none so it stays a real form control
   and the browser still submits it; readonly + inputmode="none" in the markup are what keep the OS
   keyboard down on a touch-only tablet. */
.kiosk-pin-value {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Masked read-out: one dot per expected digit, filled as they are tapped. The count of entered
   digits is the ONLY thing visible from a couple of metres away. */
.kiosk-pin-display {
    display: flex; justify-content: center; align-items: center; gap: 14px;
    min-height: 28px; margin-bottom: 6px;
}
.kiosk-pin-dot {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--border); background: transparent;
    transition: background-color 0.1s ease, border-color 0.1s ease;
}
.kiosk-pin-dot.is-filled { background: var(--accent); border-color: var(--accent); }
.kiosk-pin-count {
    text-align: center; color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 14px;
}

/* Wall-mounted tablet, used at arm's length with a whole hand: keys are sized for a thumb, not a
   cursor. 72px is the floor; the grid grows the keys on anything roomier. */
.kiosk-numpad {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.kiosk-numpad-key {
    min-height: 72px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--text-heading); background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: var(--r-md);
    cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.kiosk-numpad-key:active { background: var(--accent-soft); border-color: var(--accent); }
.kiosk-numpad-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kiosk-numpad-key:disabled { opacity: 0.5; cursor: default; }
.kiosk-numpad-back { font-size: 1.5rem; color: var(--text-secondary); }
.kiosk-numpad-gap { display: block; }

/* Only rendered for a PIN whose length predates the stored length, so there is nothing to
   auto-submit on. */
.kiosk-pin-submit { margin-top: 14px; }

/* Subordinate on purpose: an escape hatch from a mistap, not a second primary action. */
.kiosk-pin-back {
    display: block; margin-top: 18px; text-align: center;
    color: var(--text-secondary); font-size: 0.9rem; text-decoration: underline;
}

/* The PIN step has to fit without scrolling on a tablet in either orientation, so the header block
   above the pad shrinks before the keys do. */
.kiosk-current-compact { padding: 10px; margin-bottom: 14px; gap: 10px; }
@media (max-height: 700px) {
    .kiosk-picker { padding-top: 10px; padding-bottom: 16px; }
    .kiosk-picker-head { margin-bottom: 10px; }
    .kiosk-current-compact { padding: 6px; margin-bottom: 10px; }
    .kiosk-current-compact .kiosk-avatar { width: 36px; height: 36px; font-size: 1rem; }
    .kiosk-numpad { gap: 10px; }
    .kiosk-numpad-key { min-height: 60px; font-size: 1.5rem; }
}

.kiosk-note { margin-top: 20px; text-align: center; color: var(--text-secondary); font-size: 0.85rem; }
.kiosk-empty { text-align: center; color: var(--text-secondary); font-size: 0.95rem; padding: 24px 8px; }

/* Shared by the picker page and the layout banner that catches ?kiosk_pin_error=1 wherever act-as
   bounced the tablet to. */
.kiosk-banner-error {
    max-width: 560px; margin: 12px auto; padding: 12px 16px;
    background: var(--danger-bg); color: var(--danger-text);
    border: 1px solid var(--danger-border, var(--border)); border-radius: var(--r-md);
    font-size: 0.95rem; text-align: center;
}

/* Register-kiosk disclosure on the sign-in page: deliberately quiet, below the human options. */
.kiosk-register { margin-top: 24px; font-size: 0.9rem; }
.kiosk-register > summary {
    cursor: pointer; list-style: none; color: var(--text-secondary);
    text-align: center; padding: 8px 0;
}
.kiosk-register > summary::-webkit-details-marker { display: none; }
.kiosk-register > summary:hover { color: var(--text-heading); }
.kiosk-register form { margin-top: 12px; }
.kiosk-register .text-input {
    width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 12px 14px;
    background: var(--bg-surface); color: var(--text-heading);
    border: 1px solid var(--border); border-radius: var(--r-md); font-size: 1rem;
}
.kiosk-register .text-input:focus { outline: none; border-color: var(--accent); }
.kiosk-register-submit { justify-content: center; }
.kiosk-register-note { margin-top: 10px; color: var(--text-secondary); font-size: 0.8rem; line-height: 1.5; }

/* ============================================================================
   Kiosk device pairing
   The tablet's /kiosk/pair page is read from a couple of metres away and its QR
   is photographed off a glossy screen, so the code and the QR are both large and
   both deliberately high-contrast rather than themed.
   ============================================================================ */

.kiosk-pair { max-width: 560px; margin: 0 auto; padding: 20px 16px 32px; text-align: center; }

/* The QR keeps its own white ground (the SVG paints one) so it stays scannable in the dark theme;
   the padding and radius stop it looking like an unstyled image dropped on the page. */
.kiosk-pair-qr {
    width: min(320px, 70vw); margin: 20px auto 16px; padding: 12px;
    background: #ffffff; border-radius: var(--r-md);
}
.kiosk-pair-qr .kiosk-pair-qr-svg { display: block; width: 100%; height: auto; }

/* Two groups of three, spaced, tabular so the digits do not shuffle as the page redraws. */
.kiosk-pair-code {
    display: flex; justify-content: center; gap: 18px;
    font-size: clamp(2rem, 12vw, 3rem); font-weight: 700; letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums; color: var(--text-heading);
}

.kiosk-pair-countdown {
    margin-top: 10px; color: var(--text-secondary); font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* Present from the first paint so its antiforgery token is server-rendered, but only visible once
   the approval has landed — at which point it is the manual fallback behind the scripted submit. */
.kiosk-pair-complete-form { display: none; }
.kiosk-pair-complete-form.is-ready { display: block; margin-top: 20px; }

/* The pair-with-a-code link inside the register-kiosk disclosure: the primary of the two paths. */
.kiosk-pair-link { justify-content: center; }

.kiosk-approve { max-width: 560px; margin: 0 auto; padding: 20px 16px 32px; }
.kiosk-approve-blurb { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 16px; }
.kiosk-approve .form-group { margin-bottom: 16px; }

.wall-kiosk-pair-ok {
    padding: 10px 14px; margin-bottom: 12px; border-radius: var(--r-md);
    background: rgba(46, 160, 67, 0.15); color: var(--text);
    border: 1px solid rgba(46, 160, 67, 0.4); font-size: 0.9rem;
}
