:root {
    --hackathon-paper: var(--bg-secondary);
    --hackathon-ink: var(--text-primary);
    --hackathon-green: var(--score-high);
}

body.hackathon-preview {
    overflow: hidden;
}

.hackathon-preview #post-scan-arrival,
.hackathon-preview #client-workspace-section,
.hackathon-preview #compare-ledger-section,
.hackathon-preview #site-evaluation-section,
.hackathon-preview #scoped-results-section,
.hackathon-preview #panel-mode-compare,
.hackathon-preview #compare-toggle-button,
.hackathon-preview #compare-open-button,
.hackathon-preview #compare-ledger-open,
.hackathon-preview #panel-lead-compare-button,
.hackathon-preview #brief-export-button,
.hackathon-preview #panel-compare-view,
.hackathon-preview .area-compare-btn,
.hackathon-preview .branch-action-export-branch,
.hackathon-preview #client-map-badge,
.hackathon-preview #invalid-client-overlay,
.hackathon-preview #invalid-handoff-overlay,
.hackathon-preview .version-badge {
    display: none !important;
}

.hackathon-preview #search-input {
    cursor: default;
    color: var(--ink) !important;
    opacity: 1 !important;
    -webkit-text-fill-color: var(--ink);
}

.hackathon-preview #search-suggestions,
.hackathon-preview #search-feedback {
    display: none !important;
}

.hackathon-guide-launcher {
    position: fixed;
    z-index: 75;
    right: 14px;
    bottom: 54px;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--hackathon-ink);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.hackathon-guide-launcher:hover,
.hackathon-guide-launcher:focus-visible {
    border-color: var(--hackathon-ink);
    background: var(--hackathon-ink);
    color: var(--bg-panel);
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 2px;
}

.hackathon-preview-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: 24px;
    overflow-y: auto;
    background: rgba(16, 14, 11, 0.64);
}

.hackathon-preview-overlay.hidden,
.hackathon-tour-shell.hidden {
    display: none;
}

.hackathon-preview-dialog {
    width: 620px;
    max-width: calc(100vw - 48px);
    min-width: 0;
    box-sizing: border-box;
    justify-self: center;
    border: 1px solid rgba(23, 19, 14, 0.78);
    background: var(--hackathon-paper);
    color: var(--hackathon-ink);
    box-shadow: 0 10px 28px rgba(8, 7, 5, 0.24);
}

.hackathon-dialog-leaving {
    animation: hackathon-overlay-out 240ms ease both;
}

.hackathon-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 54px;
    padding: 0 22px;
    border-bottom: 1px solid rgba(23, 19, 14, 0.3);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hackathon-dialog-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
}

.hackathon-dialog-brand img {
    display: block;
    width: 25px;
    height: 22px;
    object-fit: contain;
}

.hackathon-dialog-body {
    padding: 40px 44px 32px;
}

.hackathon-dialog-kicker {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.3;
    text-transform: uppercase;
}

.hackathon-preview-dialog h1 {
    max-width: 100%;
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(38px, 5vw, 54px);
    font-weight: 600;
    letter-spacing: -0.038em;
    line-height: 0.98;
    overflow-wrap: break-word;
    white-space: normal;
}

.hackathon-dialog-lede {
    max-width: 500px;
    margin: 20px 0 0;
    color: #332e27;
    font-size: 17px;
    line-height: 1.5;
}

.hackathon-dialog-detail {
    max-width: 510px;
    margin: 9px 0 0;
    color: #6b6257;
    font-size: 14px;
    line-height: 1.55;
}

.hackathon-dialog-scope {
    margin: 26px 0 0;
    border-top: 1px solid rgba(23, 19, 14, 0.2);
    border-bottom: 1px solid rgba(23, 19, 14, 0.2);
}

.hackathon-dialog-scope > div {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 14px;
    padding: 12px 0;
}

.hackathon-dialog-scope > div + div {
    border-top: 1px solid rgba(23, 19, 14, 0.14);
}

.hackathon-dialog-scope dt,
.hackathon-dialog-scope dd {
    margin: 0;
}

.hackathon-dialog-scope dt {
    color: #7b705f;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hackathon-dialog-scope dd {
    min-width: 0;
    color: #3f3930;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.hackathon-preview-note {
    margin: 16px 0 0;
    color: #6b6257;
    font-size: 11px;
    line-height: 1.5;
}

.hackathon-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 76px;
    padding: 0 22px 0 44px;
    border-top: 1px solid rgba(23, 19, 14, 0.3);
}

.hackathon-dialog-footer > span {
    color: #6b6257;
    font-size: 12px;
}

.hackathon-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--hackathon-ink);
    background: var(--hackathon-ink);
    color: #fffaf0;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.hackathon-primary-action:hover,
.hackathon-primary-action:focus-visible {
    border-color: #332e27;
    background: #332e27;
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 2px;
}

.hackathon-secondary-action {
    min-height: 42px;
    padding: 0 4px;
    border: 0;
    border-bottom: 1px solid var(--text-muted);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.hackathon-secondary-action:hover,
.hackathon-secondary-action:focus-visible {
    border-bottom-color: var(--hackathon-ink);
    color: var(--hackathon-ink);
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 3px;
}

.hackathon-tour-shell {
    position: fixed;
    z-index: 300;
    inset: 0;
    pointer-events: none;
}

.hackathon-tour-card {
    position: fixed;
    width: min(390px, calc(100vw - 32px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 0 22px 20px;
    border: 1px solid rgba(23, 19, 14, 0.74);
    background: var(--hackathon-paper);
    color: var(--hackathon-ink);
    box-shadow: 0 8px 24px rgba(18, 15, 10, 0.18);
    pointer-events: auto;
}

.hackathon-tour-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    margin: 0 -22px;
    padding: 0 16px 0 22px;
    border-bottom: 1px solid rgba(23, 19, 14, 0.22);
}

.hackathon-tour-label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hackathon-tour-close {
    min-height: 38px;
    padding: 0 7px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
}

.hackathon-tour-close:hover,
.hackathon-tour-close:focus-visible {
    color: var(--hackathon-ink);
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 1px;
}

.hackathon-tour-progress {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 15px 0 18px;
}

.hackathon-tour-progress::before {
    position: absolute;
    z-index: 0;
    top: 50%;
    right: 9%;
    left: 9%;
    height: 1px;
    background: rgba(23, 19, 14, 0.24);
    content: '';
}

.hackathon-tour-progress button {
    position: relative;
    z-index: 1;
    display: grid;
    width: 30px;
    height: 25px;
    margin: 0 auto;
    place-items: center;
    border: 0;
    background: var(--hackathon-paper);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 9px;
    cursor: pointer;
}

.hackathon-tour-progress button span {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border: 1px solid #b9b0a1;
    background: var(--hackathon-paper);
}

.hackathon-tour-progress button:hover span,
.hackathon-tour-progress button:focus-visible span {
    border-color: var(--hackathon-ink);
    color: var(--hackathon-ink);
}

.hackathon-tour-progress button:focus-visible {
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 2px;
}

.hackathon-tour-progress button.active span {
    border-color: var(--hackathon-ink);
    background: var(--hackathon-ink);
    color: var(--hackathon-paper);
}

.hackathon-tour-progress button:disabled {
    cursor: wait;
}

.hackathon-tour-card h2 {
    margin: 17px 0 0;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.04;
}

.hackathon-tour-card h2:focus {
    outline: none;
}

.hackathon-tour-body {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.hackathon-tour-note {
    margin: 12px 0 0;
    padding: 9px 0 0 12px;
    border-top: 1px solid rgba(23, 19, 14, 0.17);
    color: #6f6659;
    font-size: 11px;
    line-height: 1.45;
}

.hackathon-tour-view {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    min-height: 42px;
    margin-top: 15px;
    padding: 0 13px;
    border: 1px solid var(--hackathon-ink);
    background: var(--hackathon-ink);
    color: var(--hackathon-paper);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.hackathon-tour-view:hover,
.hackathon-tour-view:focus-visible {
    border-color: #332e27;
    background: #332e27;
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 2px;
}

.hackathon-tour-view:disabled {
    border-color: #b5ac9e;
    background: #d7d0c4;
    color: #70685c;
    cursor: wait;
}

.hackathon-tour-actions {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(23, 19, 14, 0.2);
}

.hackathon-tour-actions button {
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid transparent;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
}

.hackathon-tour-back {
    background: transparent;
    color: var(--text-secondary);
}

.hackathon-tour-next {
    border-color: var(--hackathon-ink) !important;
    background: var(--hackathon-ink);
    color: var(--hackathon-paper);
}

.hackathon-tour-actions button:hover,
.hackathon-tour-actions button:focus-visible {
    border-color: var(--hackathon-ink);
    outline: 2px solid var(--hackathon-ink);
    outline-offset: 1px;
}

.hackathon-tour-actions button:disabled {
    opacity: 0.38;
    cursor: default;
}

.hackathon-tour-actions span {
    justify-self: center;
    color: #6b6257;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hackathon-tour-target {
    position: fixed;
    z-index: -1;
    border: 2px solid var(--hackathon-ink);
    pointer-events: none;
}

.hackathon-tour-connector {
    position: fixed;
    z-index: -2;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: visible;
    pointer-events: none;
}

.hackathon-tour-connector path {
    fill: none;
    stroke: rgba(23, 19, 14, 0.78);
    stroke-width: 1;
}

.hackathon-tour-connector circle {
    fill: var(--hackathon-ink);
    stroke: var(--hackathon-paper);
    stroke-width: 2;
}

.hackathon-tour-visual {
    min-height: 82px;
    border: 1px solid rgba(23, 19, 14, 0.24);
    background-color: #ebe4d6;
}

.tour-tier-demo {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 82px;
}

.tour-tier-demo > span {
    display: grid;
    grid-template-columns: 10px auto;
    grid-template-rows: auto auto;
    align-content: center;
    gap: 0 7px;
    padding: 11px 8px;
    border-right: 1px solid rgba(23, 19, 14, 0.18);
}

.tour-tier-demo > span:last-child {
    border-right: 0;
}

.tour-tier-demo i {
    grid-row: 1 / 3;
    width: 8px;
    height: 36px;
}

.tour-tier-demo [data-tier="prime"] i { background: var(--score-high); }
.tour-tier-demo [data-tier="strong"] i { background: var(--score-mid); }
.tour-tier-demo [data-tier="watch"] i { background: var(--score-low); }
.tour-tier-demo [data-tier="soft"] i { background: #788791; }

.tour-tier-demo b,
.tour-tier-demo small {
    font-family: var(--font-mono);
    font-style: normal;
}

.tour-tier-demo b {
    font-size: 11px;
}

.tour-tier-demo small {
    color: var(--text-secondary);
    font-size: 8px;
    text-transform: uppercase;
}

.tour-hex-specimen svg,
.tour-select-demo svg {
    display: block;
    width: 100%;
    height: 142px;
}

.tour-hex-example {
    fill: #716858;
    font-family: var(--font-mono);
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 1px;
}

.tour-hex-shape {
    fill: rgba(196, 153, 54, 0.7);
    stroke: #5d4818;
    stroke-width: 2;
}

.tour-hex-tier,
.tour-hex-voi,
.tour-hex-caption,
.tour-hex-caption-sub,
.tour-select-label {
    font-family: var(--font-mono);
}

.tour-hex-tier,
.tour-hex-voi {
    fill: #4d3a13;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
}

.tour-hex-score {
    fill: var(--hackathon-ink);
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 600;
}

.tour-hex-rule {
    fill: none;
    stroke: #7f6d50;
    stroke-dasharray: 3 3;
    stroke-width: 1;
}

.tour-hex-pin {
    fill: var(--hackathon-ink);
    stroke: var(--hackathon-paper);
    stroke-width: 1;
}

.tour-hex-caption {
    fill: var(--hackathon-ink);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.tour-hex-caption-sub {
    fill: #706555;
    font-size: 8px;
}

.tour-rival-demo {
    display: grid;
    grid-template-columns: 1fr 35px 1fr;
    align-items: center;
    min-height: 98px;
    padding: 10px 28px;
}

.tour-rival-state {
    display: grid;
    justify-items: center;
    gap: 7px;
}

.tour-rival-state small {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.tour-rival-cluster {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 3px solid #f7f1e5;
    border-radius: 50%;
    background: #2f6f53;
    color: white;
    box-shadow: 0 0 0 1px #275a45;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.tour-rival-arrow {
    color: var(--hackathon-ink);
    font-size: 22px;
    text-align: center;
}

.tour-rival-points {
    position: relative;
    display: block;
    width: 62px;
    height: 38px;
}

.tour-rival-points i {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #f7f1e5;
    border-radius: 50%;
    background: #2f6f53;
    box-shadow: 0 0 0 1px #275a45;
}

.tour-rival-points i:nth-child(1) { left: 3px; top: 5px; }
.tour-rival-points i:nth-child(2) { left: 25px; top: 0; }
.tour-rival-points i:nth-child(3) { right: 3px; top: 8px; }
.tour-rival-points i:nth-child(4) { left: 15px; bottom: 1px; }
.tour-rival-points i:nth-child(5) { right: 13px; bottom: 0; }

.tour-select-demo {
    min-height: 86px;
}

.tour-select-neighbour {
    fill: rgba(212, 164, 74, 0.12);
    stroke: #9b907e;
    stroke-width: 1;
}

.tour-select-hex {
    fill: rgba(45, 122, 95, 0.48);
    stroke: #17130e;
    stroke-width: 3;
}

.tour-select-cursor {
    fill: #17130e;
    stroke: #f3efe3;
    stroke-width: 2;
}

.tour-select-label {
    fill: #173e31;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
}

.tour-stage-demo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: 92px;
    list-style: none;
}

.tour-stage-demo li {
    display: grid;
    align-content: center;
    gap: 2px;
    padding: 10px 12px;
    border-right: 1px solid rgba(23, 19, 14, 0.2);
}

.tour-stage-demo li:last-child {
    border-right: 0;
}

.tour-stage-demo span,
.tour-stage-demo small {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tour-stage-demo strong {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
}

@keyframes hackathon-overlay-out {
    to { opacity: 0; }
}

.hackathon-tour-open .hackathon-guide-launcher {
    visibility: hidden;
}

@media (max-width: 760px) {
    .hackathon-preview-overlay {
        place-items: start center;
        padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
    }

    .hackathon-preview-dialog {
        max-width: calc(100vw - 24px);
        box-shadow: 0 8px 24px rgba(8, 7, 5, 0.24);
    }

    .hackathon-dialog-header {
        min-height: 48px;
        padding: 0 16px;
        font-size: 8px;
    }

    .hackathon-dialog-body {
        padding: 28px 20px 23px;
    }

    .hackathon-preview-dialog h1 {
        font-size: 38px;
    }

    .hackathon-dialog-lede {
        margin-top: 16px;
        font-size: 16px;
    }

    .hackathon-dialog-detail {
        font-size: 13px;
    }

    .hackathon-dialog-scope {
        margin-top: 21px;
    }

    .hackathon-dialog-scope > div {
        grid-template-columns: 58px 1fr;
        gap: 9px;
        padding: 10px 0;
    }

    .hackathon-dialog-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 15px 20px 18px;
    }

    .hackathon-primary-action {
        justify-content: space-between;
        width: 100%;
    }

    .hackathon-secondary-action {
        align-self: center;
        min-height: 36px;
    }

    .hackathon-guide-launcher {
        right: 10px;
        bottom: max(48px, calc(env(safe-area-inset-bottom) + 38px));
    }

    .hackathon-tour-shell {
        inset: 0;
        width: auto;
    }

    .hackathon-tour-card {
        top: auto !important;
        right: 10px;
        bottom: max(48px, calc(env(safe-area-inset-bottom) + 40px));
        left: 10px !important;
        width: auto;
        max-height: min(67dvh, 620px);
        padding: 0 17px 16px;
    }

    .hackathon-tour-card-header {
        margin-right: -17px;
        margin-left: -17px;
        padding-right: 12px;
        padding-left: 17px;
    }

    .hackathon-tour-progress {
        margin: 11px 0 13px;
    }

    .hackathon-tour-visual {
        min-height: 70px;
    }

    .hackathon-tour-card h2 {
        margin-top: 13px;
        font-size: 25px;
    }

    .hackathon-tour-body {
        margin-top: 9px;
        font-size: 13px;
    }

    .hackathon-tour-note {
        margin-top: 9px;
        font-size: 10px;
    }

    .hackathon-tour-view {
        min-height: 44px;
        margin-top: 11px;
    }

    .hackathon-tour-actions {
        margin-top: 11px;
        padding-top: 9px;
    }

    .hackathon-tour-actions button {
        min-height: 44px;
    }

    .hackathon-tour-connector {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hackathon-preview-dialog,
    .hackathon-dialog-leaving,
    .hackathon-tour-card {
        animation: none;
    }

    .hackathon-guide-launcher {
        transition: none;
    }

}
