* { box-sizing: border-box; }

:root {
    --bg-card: rgba(255, 251, 240, 0.90);
    --bg-card-strong: rgba(255, 255, 255, 0.96);
    --text-main: #2f2417;
    --text-soft: #6f5a34;
    --border: rgba(201, 178, 122, 0.45);
    --shadow: 0 12px 32px rgba(0,0,0,0.10);
    --green: #63be7b;
    --green-dark: #4f9e63;
    --red: #f36d6d;
    --red-dark: #d95a5a;
    --accent: #d39b2d;
    --accent-soft: rgba(211,155,45,0.14);
    --cream: #fffaf2;
}

html, body { min-height: 100%; }

body {
    margin: 0;
    padding: 24px;
    font-family: Arial, sans-serif;
    color: var(--text-main);
    background: #241d17;
    background-size: cover;
    overflow-x: hidden;
}

button { font-family: inherit; color: inherit; }
button:focus-visible { outline: 3px solid rgba(211,155,45,.8); outline-offset: 3px; }

.page-wrap { max-width: 1440px; margin: 0 auto; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.title-block { text-align: left; min-width: 0; }

.page-title {
    margin: 0;
    font-size: 42px;
    line-height: 1.03;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-main);
    text-shadow: 0 2px 0 rgba(255,255,255,0.6);
}

.page-subtitle {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 14px;
    max-width: 980px;
    font-size: 18px;
    line-height: 1.35;
    color: var(--text-soft);
    background: rgba(255,255,255,0.68);
    border-radius: 14px;
    backdrop-filter: blur(4px);
}

.top-actions { display: flex; align-items: center; gap: 12px; }

.progress-badge {
    min-width: 110px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255,251,240,0.92);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

.reset-icon {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,251,240,0.92) url('../img/reset-icon.svg') no-repeat center center;
    background-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background-color .2s ease;
    flex: 0 0 auto;
}

.reset-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
    background-color: rgba(255,255,255,0.98);
}

.progress-line-wrap {
    width: 100%;
    height: 8px;
    margin: 0 0 16px;
    background: rgba(255,251,240,0.72);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(201,178,122,.28);
}

.progress-line {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg,#d39b2d 0%,#f0c76a 100%);
    transition: width .28s ease;
}

.start-screen {
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
}

.start-card {
    width: min(960px, 100%);
    padding: clamp(38px, 6vw, 74px) clamp(24px, 6vw, 70px);
    border-radius: 30px;
    background: rgba(255,251,240,.90);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(7px);
    text-align: center;
}

.start-kicker {
    display: inline-flex;
    margin-bottom: 18px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #7a5718;
    border: 1px solid rgba(211,155,45,.22);
    font-size: 15px;
    font-weight: 800;
}

.start-title {
    margin: 0;
    font-size: clamp(48px, 7vw, 84px);
    line-height: .96;
    font-weight: 900;
    letter-spacing: -.04em;
}

.start-question {
    max-width: 780px;
    margin: 24px auto 30px;
    font-size: clamp(21px, 2.4vw, 31px);
    line-height: 1.28;
    font-weight: 700;
    color: var(--text-soft);
}

.primary-button,
.secondary-button,
.back-button {
    min-height: 56px;
    padding: 14px 22px;
    border-radius: 16px;
    border: 1px solid var(--border);
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
}

.primary-button {
    border: none;
    background: linear-gradient(180deg,#8fd694 0%,var(--green) 100%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(79,158,99,.20);
}

.secondary-button { background: rgba(255,255,255,.94); color: var(--text-main); }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled), .back-button:hover { transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .55; box-shadow: none; }

.start-status { margin-top: 12px; min-height: 20px; font-size: 14px; color: var(--text-soft); }

.hub-stage,
.location-stage {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 145px);
    border-radius: 28px;
    overflow: hidden;
    background: rgba(255,255,255,.55);
    border: 1px solid rgba(201,178,122,.45);
    box-shadow: var(--shadow);
    isolation: isolate;
}

.hub-stage {
    aspect-ratio: 16 / 9;
    min-height: 0;
    max-height: calc(100vh - 145px);
}

.hub-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    user-select: none;
    pointer-events: none;
}

.hub-stage::after,
.location-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.hub-stage::after { background: linear-gradient(to top,rgba(35,28,20,.24),transparent 38%); }

.hub-heading {
    position: absolute;
    z-index: 5;
    top: 18px;
    left: 18px;
    max-width: min(650px, calc(100% - 36px));
    padding: 14px 18px;
    border-radius: 18px;
    background: rgba(255,251,240,.90);
    border: 1px solid var(--border);
    box-shadow: 0 7px 20px rgba(0,0,0,.10);
    backdrop-filter: blur(6px);
    text-align: left;
}

.hub-heading h2 { margin: 0; font-size: clamp(24px, 2.5vw, 38px); line-height: 1.05; }
.hub-heading p { margin: 7px 0 0; font-size: 16px; line-height: 1.4; color: var(--text-soft); }

.hotspot {
    position: absolute;
    z-index: 4;
    left: var(--x);
    top: var(--y);
    width: 17%;
    height: 60%;
    transform: translate(-50%,-50%);
    border: 0;
    border-radius: 16px 16px 8px 8px;
    background: linear-gradient(to top,rgba(47,36,23,.14),transparent 36%);
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 8px 4%;
    transition: filter .18s ease, background .18s ease;
}

.hotspot::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: inherit;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.hotspot:hover::before,
.hotspot:focus-visible::before {
    border-color: rgba(255,255,255,.9);
    box-shadow: inset 0 0 0 3px rgba(211,155,45,.58), 0 10px 24px rgba(0,0,0,.18);
    background: rgba(255,255,255,.05);
}

.hotspot.is-visited::before {
    border-color: rgba(99,190,123,.9);
    box-shadow: inset 0 0 0 2px rgba(79,158,99,.55);
}

.door-label {
    position: relative;
    width: 100%;
    padding: 9px 10px 10px;
    border-radius: 12px;
    background: rgba(255,251,240,.92);
    border: 1px solid rgba(201,178,122,.66);
    box-shadow: 0 5px 14px rgba(0,0,0,.15);
    font-size: clamp(10px, 1vw, 15px);
    line-height: 1.12;
    font-weight: 900;
    text-align: center;
    backdrop-filter: blur(5px);
}

.door-label small {
    display: block;
    margin-bottom: 3px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--green-dark);
}

.visited-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--green-dark);
    color: #fff;
    font-size: 12px;
    vertical-align: -1px;
}

.route-line {
    position: absolute;
    z-index: 3;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
}

.route-line path {
    fill: none;
    stroke: #fff3c6;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    filter: drop-shadow(0 2px 2px rgba(47,36,23,.75));
}
.route-line circle { fill: var(--green-dark); stroke: white; stroke-width: 4; }
.hub-stage.route-visible .route-line { opacity: 1; }
.hub-stage.route-visible .route-line path { animation: drawRoute 1.2s ease forwards; }

.final-panel {
    position: absolute;
    z-index: 7;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(470px, 42%);
    padding: 24px;
    border-radius: 22px;
    background: rgba(255,251,240,.94);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,.16);
    backdrop-filter: blur(8px);
    overflow: auto;
    text-align: left;
}

.final-kicker,
.location-kicker,
.task-label,
.fact-label {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #7a5718;
    border: 1px solid rgba(211,155,45,.22);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.final-panel h2 { margin: 0; font-size: clamp(26px, 2.2vw, 36px); line-height: 1.08; }
.final-summary { margin: 22px 0 0; font-size: 17px; line-height: 1.5; color: var(--text-soft); }
.final-question { margin: 18px 0; padding: 16px; border-radius: 16px; background: rgba(216,238,230,.88); border: 1px solid rgba(79,158,99,.28); font-size: 17px; line-height: 1.4; font-weight: 800; }
.final-actions { display: grid; gap: 10px; }

.location-stage {
    min-height: calc(100vh - 145px);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.location-stage::after {
    background: linear-gradient(90deg,rgba(30,24,18,.06) 0 42%,rgba(30,24,18,.24) 62%,rgba(30,24,18,.58) 100%), linear-gradient(to top,rgba(30,24,18,.18),transparent 42%);
}

.back-button {
    position: absolute;
    z-index: 8;
    top: 18px;
    left: 18px;
    background: rgba(255,251,240,.94);
    box-shadow: 0 6px 16px rgba(0,0,0,.13);
}

.location-name {
    position: absolute;
    z-index: 7;
    left: 22px;
    bottom: 22px;
    max-width: 42%;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255,251,240,.9);
    border: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
    font-size: 20px;
    font-weight: 900;
    backdrop-filter: blur(6px);
}

.location-card {
    position: absolute;
    z-index: 7;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(620px, 48%);
    padding: clamp(20px,2.2vw,30px);
    border-radius: 24px;
    background: rgba(255,251,240,.94);
    border: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(0,0,0,.16);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    text-align: left;
}

.location-card h1 { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: clamp(30px, 3vw, 44px); line-height: 1.04; font-weight: 900; letter-spacing: -.02em; }
.location-lead { margin: 14px 0 18px; font-size: 17px; line-height: 1.45; color: var(--text-soft); font-weight: 600; }

.task-sequence { display: grid; gap: 14px; }
.task-card { padding: 16px; border-radius: 18px; background: rgba(255,255,255,.82); border: 1px solid rgba(201,178,122,.45); box-shadow: 0 5px 14px rgba(0,0,0,.05); }
.task-card.locked { opacity: .66; background: rgba(245,242,235,.86); }
.task-card > p { margin: 0 0 13px; font-size: 18px; line-height: 1.36; font-weight: 800; }
.task-options { display: grid; gap: 9px; }

.task-option {
    width: 100%;
    padding: 11px 13px;
    border-radius: 13px;
    border: 1px solid rgba(201,178,122,.58);
    background: rgba(255,255,255,.96);
    text-align: left;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .2s ease, border-color .2s ease;
}
.task-option:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(0,0,0,.08); }
.task-option:disabled { cursor: default; color: var(--text-main); }
.task-option.correct { background: linear-gradient(180deg,#9ae09e 0%,var(--green) 100%); border-color: var(--green-dark); color: white; }
.task-option.incorrect { background: linear-gradient(180deg,#ffb0b0 0%,var(--red) 100%); border-color: var(--red-dark); color: white; }
.task-option.muted { opacity: .62; }

.feedback { margin-top: 12px; padding: 13px 14px; border-radius: 14px; font-size: 15px; line-height: 1.45; }
.feedback.correct { background: rgba(216,238,230,.92); border: 1px solid rgba(79,158,99,.34); }
.feedback.incorrect { background: rgba(242,213,209,.72); border: 1px solid rgba(217,90,90,.28); }
.feedback strong { display: block; margin-bottom: 4px; font-size: 16px; }
.feedback p { margin: 0; }

.fact-box { margin-top: 10px; padding: 14px; border-radius: 14px; background: rgba(255,247,223,.95); border: 1px solid rgba(211,155,45,.28); }
.fact-box p { margin: 0; font-size: 15px; line-height: 1.45; }
.task-card > .task-hint { margin: 15px 0 13px; font-size: 14px; line-height: 1.4; color: var(--text-soft); }
.location-continue { width: 100%; margin-top: 16px; }

.finish-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(21,17,13,.52);
    backdrop-filter: blur(7px);
}

.finish-card {
    width: min(720px,100%);
    padding: 34px;
    border-radius: 28px;
    background: var(--bg-card-strong);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 24px 54px rgba(0,0,0,.22);
    text-align: center;
}
.finish-card h2 { margin: 0; font-size: clamp(30px,4vw,46px); line-height: 1.06; }
.finish-card p { margin: 18px auto 24px; max-width: 620px; font-size: 18px; line-height: 1.5; color: var(--text-soft); }

to { transform: scale(1.8); opacity: 0; } 
@keyframes drawRoute { to { stroke-dashoffset: 0; } }

@media (max-width: 1100px) {
    .location-card { width: min(650px,56%); }
    .final-panel { width: min(520px,48%); }
}

@media (max-width: 820px) {
    body { padding: 16px; }
    .page-title { font-size: 34px; }
    .page-subtitle { font-size: 16px; }
    .hub-stage { max-height: none; }
    .hub-heading { padding: 10px 12px; top: 10px; left: 10px; }
    .hub-heading p { display: none; }
    .location-stage { min-height: calc(100vh - 125px); }
    .location-stage::after { background: linear-gradient(to top,rgba(30,24,18,.68) 0 55%,rgba(30,24,18,.08) 88%); }
    .location-card {
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-height: 66%;
        padding: 18px;
    }
    .location-name { display: none; }
    .back-button { top: 12px; left: 12px; }
    .final-panel {
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-height: 66%;
    }
}

@media (max-width: 620px) {
    body { padding: 12px; }
    .topbar { align-items: flex-start; }
    .page-title { font-size: 29px; }
    .page-subtitle { font-size: 14px; padding: 7px 10px; }
    .progress-badge { min-width: 86px; padding: 8px 11px; font-size: 15px; }
    .reset-icon { width: 44px; height: 44px; }
    .hub-stage { border-radius: 20px; }
    .hub-heading h2 { font-size: 19px; }
    .hotspot { width: 20%; height: 66%; padding-inline: 2px; padding-bottom: 5%; }
    .door-label { padding: 5px 4px 6px; font-size: 8px; border-radius: 7px; }
    .door-label small { display: none; }
    .visited-check { display: none; }
    .location-stage { border-radius: 20px; min-height: calc(100vh - 118px); }
    .back-button { min-height: 46px; padding: 10px 14px; font-size: 15px; }
    .location-card { max-height: 68%; border-radius: 20px; }
    .location-card h1 { font-size: 27px; }
    .location-lead { font-size: 15px; }
    .task-card > p { font-size: 16px; }
    .task-option { font-size: 14px; }
    .final-panel { padding: 18px; border-radius: 19px; }
}



body.game-mode {
    padding: 0;
    background: #241d17;
    overflow: hidden;
}

.immersive-screen {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #241d17;
}

@supports (height: 100dvh) {
    .immersive-screen { height: 100dvh; }
}

.immersive-screen .hub-stage,
.immersive-screen .location-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}


.hub-canvas {
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 50%;
    width: max(100vw, calc(100vh * 16 / 9));
    aspect-ratio: 16 / 9;
    transform: translate(-50%, -50%);
}

@supports (height: 100dvh) {
    .hub-canvas { width: max(100vw, calc(100dvh * 16 / 9)); }
}

.hub-canvas .hub-image,
.hub-canvas .route-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hub-canvas .hub-image { object-fit: fill; }

.hub-stage::after {
    z-index: 2;
    background: linear-gradient(to top, rgba(35,28,20,.30), transparent 42%), linear-gradient(90deg, rgba(20,16,12,.08), transparent 30%, transparent 72%, rgba(20,16,12,.10));
}

.scene-heading {
    position: absolute;
    z-index: 8;
    top: 24px;
    left: 24px;
    width: min(640px, calc(100vw - 260px));
    padding: 15px 18px;
    border-radius: 18px;
    background: rgba(255,251,240,.88);
    border: 1px solid rgba(201,178,122,.48);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    backdrop-filter: blur(8px);
    text-align: left;
}

.scene-heading .scene-eyebrow {
    margin: 0 0 5px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.scene-heading h1 {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(25px, 2.5vw, 40px);
    line-height: 1.04;
    font-weight: 900;
    letter-spacing: -.02em;
}

.scene-heading p {
    margin: 7px 0 0;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.38;
    font-weight: 600;
}

.scene-actions {
    position: absolute;
    z-index: 12;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scene-actions .progress-badge {
    min-width: 88px;
    background: rgba(255,251,240,.92);
    backdrop-filter: blur(8px);
}

.scene-icon-button {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,251,240,.92);
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
    backdrop-filter: blur(8px);
}

.scene-icon-button:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(0,0,0,.16); }
.scene-icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scene-icon-button.is-muted { opacity: .68; }
.scene-reset { background-image: url('../img/reset-icon.svg'); background-repeat: no-repeat; background-position: center; background-size: 24px; }


.back-button {
    top: 128px;
    left: 24px;
    min-height: 52px;
    padding: 8px 16px 8px 9px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 16px;
}

.nav-arrow {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: rgba(211,155,45,.13);
    border: 1px solid rgba(211,155,45,.25);
}

.nav-arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-arrow.is-right svg { transform: rotate(180deg); }

.location-stage {
    background-position: center;
    background-size: cover;
}

.location-stage::after {
    background: linear-gradient(90deg, rgba(30,24,18,.08) 0 42%, rgba(30,24,18,.25) 63%, rgba(30,24,18,.62) 100%), linear-gradient(to top,rgba(30,24,18,.20),transparent 44%);
}

.location-card {
    top: 96px;
    right: 24px;
    bottom: 24px;
    width: min(620px, 47vw);
    scroll-behavior: auto;
    overscroll-behavior: contain;
}

.location-name { left: 24px; bottom: 24px; }

.location-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}


.answer-reveal {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows .38s ease, opacity .30s ease, margin-top .38s ease;
}

.answer-reveal > .answer-reveal-inner {
    min-height: 0;
    overflow: hidden;
}

.answer-reveal.is-opening {
    grid-template-rows: 0fr;
    opacity: 0;
    margin-top: -6px;
}

.answer-reveal.is-opening.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 0;
}

.answer-reveal .feedback { margin-top: 12px; }

.final-panel {
    top: 94px;
    right: 24px;
    bottom: 24px;
}

@media (max-width: 820px) {
    .scene-heading {
        top: 12px;
        left: 12px;
        width: min(56vw, 430px);
        padding: 10px 12px;
    }
    .scene-heading p { display: none; }
    .scene-heading h1 { font-size: 20px; }
    .scene-heading .scene-eyebrow { font-size: 10px; }
    .scene-actions { top: 12px; right: 12px; gap: 7px; }
    .scene-actions .progress-badge { min-width: 72px; padding: 8px 10px; font-size: 14px; }
    .scene-icon-button { width: 44px; height: 44px; border-radius: 13px; }
    .back-button { top: 72px; left: 12px; min-height: 46px; padding: 6px 12px 6px 7px; font-size: 14px; }
    .nav-arrow { width: 31px; height: 31px; flex-basis: 31px; }
    .location-card { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 66%; }
    .final-panel { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 66%; }
}

@media (max-width: 620px) {
    body.game-mode { padding: 0; }
    .scene-heading { width: calc(100vw - 156px); }
    .scene-heading h1 { font-size: 17px; }
    .scene-actions .progress-badge { display: none; }
    .scene-icon-button { width: 42px; height: 42px; }
    .back-button { top: 66px; }
    .location-card { max-height: 69%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .route-line path { stroke-dashoffset: 0 !important; }
}



.location-card,
.final-panel,
.finish-card {
    scrollbar-width: thin;
    scrollbar-color: rgba(145, 119, 68, 0.58) transparent;
    scrollbar-gutter: stable;
}

.location-card::-webkit-scrollbar,
.final-panel::-webkit-scrollbar,
.finish-card::-webkit-scrollbar {
    width: 12px;
}

.location-card::-webkit-scrollbar-track,
.final-panel::-webkit-scrollbar-track,
.finish-card::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 18px;
}

.location-card::-webkit-scrollbar-thumb,
.final-panel::-webkit-scrollbar-thumb,
.finish-card::-webkit-scrollbar-thumb {
    min-height: 46px;
    border: 4px solid transparent;
    border-radius: 999px;
    background: rgba(145, 119, 68, 0.58);
    background-clip: padding-box;
}

.location-card::-webkit-scrollbar-thumb:hover,
.final-panel::-webkit-scrollbar-thumb:hover,
.finish-card::-webkit-scrollbar-thumb:hover {
    background: rgba(119, 94, 49, 0.72);
    background-clip: padding-box;
}


@media (max-width: 1024px) {
    .scene-heading {
        top: 12px;
        left: 12px;
        width: min(58vw, 470px);
        padding: 10px 12px;
        border-radius: 15px;
    }

    .scene-heading p {
        display: none;
    }

    .scene-heading h1 {
        font-size: clamp(18px, 2.6vw, 23px);
        line-height: 1.06;
    }

    .scene-heading .scene-eyebrow {
        font-size: 10px;
    }

    .scene-actions {
        top: 12px;
        right: 12px;
        gap: 7px;
    }

    .scene-actions .progress-badge {
        min-width: 74px;
        padding: 8px 11px;
        font-size: 14px;
    }

    .scene-icon-button {
        width: 44px;
        height: 44px;
        border-radius: 13px;
    }

    .back-button {
        top: 72px;
        left: 12px;
        min-height: 46px;
        padding: 6px 12px 6px 7px;
        font-size: 14px;
    }

    .nav-arrow {
        width: 31px;
        height: 31px;
        flex-basis: 31px;
    }

    .location-stage::after {
        background:
            linear-gradient(to top, rgba(30,24,18,.72) 0 55%, rgba(30,24,18,.08) 88%),
            linear-gradient(90deg, rgba(30,24,18,.06), rgba(30,24,18,.02));
    }

    .location-card,
    .final-panel {
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-height: min(68dvh, calc(100dvh - 136px));
        border-radius: 22px;
    }
}


@media (min-width: 1025px) and (max-height: 760px) {
    .scene-heading {
        top: 12px;
        left: 12px;
        padding: 10px 14px;
    }

    .scene-heading p {
        display: none;
    }

    .scene-actions {
        top: 12px;
        right: 12px;
    }

    .back-button {
        top: 72px;
        left: 12px;
    }

    .location-card {
        top: 72px;
        right: 12px;
        bottom: 12px;
        padding: 18px;
    }

    .final-panel {
        top: 72px;
        right: 12px;
        bottom: 12px;
    }
}

@media (max-width: 700px) {
    .scene-heading {
        width: calc(100vw - 152px);
        min-width: 0;
    }

    .scene-heading h1 {
        font-size: 17px;
    }

    .scene-actions .progress-badge {
        display: none;
    }

    .scene-icon-button {
        width: 42px;
        height: 42px;
    }

    .back-button {
        top: 66px;
    }

    .location-card,
    .final-panel {
        left: 9px;
        right: 9px;
        bottom: 9px;
        max-height: min(72dvh, calc(100dvh - 124px));
        padding: 16px;
        border-radius: 19px;
    }

    .location-card h1 {
        font-size: clamp(24px, 7vw, 29px);
    }

    .location-lead {
        font-size: 15px;
    }

    .task-card {
        padding: 14px;
    }

    .task-card > p {
        font-size: 16px;
    }

    .task-option {
        font-size: 14px;
        padding: 10px 11px;
    }

    .location-card::-webkit-scrollbar,
    .final-panel::-webkit-scrollbar {
        width: 10px;
    }

    .location-card::-webkit-scrollbar-track,
    .final-panel::-webkit-scrollbar-track {
        margin-block: 14px;
    }

    .location-card::-webkit-scrollbar-thumb,
    .final-panel::-webkit-scrollbar-thumb {
        border-width: 3px;
    }
}

@media (max-width: 430px) {
    .scene-heading {
        width: calc(100vw - 120px);
        padding: 9px 10px;
    }

    .scene-heading .scene-eyebrow {
        display: none;
    }

    .scene-heading h1 {
        font-size: 16px;
    }

    .back-button {
        top: 60px;
        max-width: calc(100vw - 118px);
    }

    .back-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .location-card,
    .final-panel {
        max-height: min(74dvh, calc(100dvh - 114px));
    }
}


.hub-backdrop {
    position: absolute;
    z-index: 0;
    inset: -24px;
    width: calc(100% + 48px);
    height: calc(100% + 48px);
    object-fit: cover;
    object-position: center;
    filter: blur(18px) brightness(.72) saturate(.82);
    transform: scale(1.03);
    opacity: .72;
    pointer-events: none;
    user-select: none;
}

.hub-canvas {
    z-index: 1;
    width: min(100vw, calc(100vh * 16 / 9));
    height: auto;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    box-shadow: 0 0 42px rgba(25, 20, 14, .22);
}

@supports (height: 100dvh) {
    .hub-canvas {
        width: min(100vw, calc(100dvh * 16 / 9));
        max-height: 100dvh;
    }
}

.hub-canvas .hub-image {
    object-fit: fill;
}


@media (max-width: 760px) {
    .hotspot {
        width: 18%;
        height: 62%;
        padding-inline: 2px;
        padding-bottom: 4%;
    }

    .door-label {
        padding: 6px 4px 7px;
        font-size: clamp(8px, 1.8vw, 11px);
        border-radius: 8px;
    }

    .door-label small {
        font-size: 7px;
        letter-spacing: .035em;
    }
}

@media (max-width: 480px) {
    .hotspot {
        width: 20%;
        height: 64%;
    }

    .door-label {
        font-size: 8px;
        line-height: 1.05;
    }

    .door-label small {
        display: none;
    }

    .visited-check {
        display: none;
    }
}


.hub-backdrop {
    inset: -46px;
    width: calc(100% + 92px);
    height: calc(100% + 92px);
    object-fit: cover;
    object-position: center;
    filter: blur(28px) brightness(.92) saturate(.90);
    transform: scale(1.08);
    opacity: .96;
}


.hub-canvas .hub-image {
    -webkit-mask-image: linear-gradient(90deg,
        rgba(0,0,0,.15) 0%,
        #000 2.2%,
        #000 97.8%,
        rgba(0,0,0,.15) 100%);
    mask-image: linear-gradient(90deg,
        rgba(0,0,0,.15) 0%,
        #000 2.2%,
        #000 97.8%,
        rgba(0,0,0,.15) 100%);
}


@media (min-aspect-ratio: 19 / 9) {
    .hub-canvas .hub-image {
        -webkit-mask-image: linear-gradient(90deg,
            transparent 0%,
            #000 3.5%,
            #000 96.5%,
            transparent 100%);
        mask-image: linear-gradient(90deg,
            transparent 0%,
            #000 3.5%,
            #000 96.5%,
            transparent 100%);
    }
}


@media (max-aspect-ratio: 16 / 10) {
    .hub-canvas .hub-image {
        -webkit-mask-image: none;
        mask-image: none;
    }
}

.start-hub-stage::after {
    background:
        linear-gradient(rgba(31, 24, 17, .13), rgba(31, 24, 17, .20)),
        linear-gradient(to top, rgba(35,28,20,.22), transparent 42%);
}

.start-overlay {
    position: absolute;
    z-index: 40;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(31, 24, 17, .22);
    backdrop-filter: blur(2px);
    transition: opacity .32s ease, backdrop-filter .32s ease, background .32s ease;
}

.start-overlay.is-leaving {
    opacity: 0;
    background: rgba(31, 24, 17, 0);
    backdrop-filter: blur(0);
    pointer-events: none;
}

.start-overlay .start-card {
    width: min(820px, calc(100vw - 48px));
    padding: clamp(30px, 5vw, 58px) clamp(24px, 5vw, 56px);
    border-radius: 28px;
    background: rgba(255, 251, 240, .92);
    border: 1px solid rgba(201,178,122,.55);
    box-shadow: 0 18px 44px rgba(0,0,0,.20);
    backdrop-filter: blur(10px);
    transform: translateY(0) scale(1);
    transition: opacity .28s ease, transform .32s ease;
}

.start-overlay.is-leaving .start-card {
    opacity: 0;
    transform: translateY(-8px) scale(.985);
}

.start-overlay .start-kicker {
    margin-bottom: 14px;
}

.start-overlay .start-title {
    font-size: clamp(44px, 6.4vw, 74px);
}

.start-overlay .start-question {
    max-width: 700px;
    margin-top: 20px;
    margin-bottom: 26px;
    font-size: clamp(20px, 2.1vw, 28px);
}

@media (max-width: 700px) {
    .start-overlay {
        padding: 14px;
    }

    .start-overlay .start-card {
        width: min(100%, 560px);
        padding: 26px 20px;
        border-radius: 22px;
    }

    .start-overlay .start-title {
        font-size: clamp(38px, 12vw, 54px);
    }

    .start-overlay .start-question {
        font-size: 18px;
        line-height: 1.35;
    }
}

@media (prefers-reduced-motion: reduce) {
    .start-overlay,
    .start-overlay .start-card {
        transition-duration: .01ms !important;
    }
}


.location-stage .back-button {
    top: var(--back-button-top, 128px);
}


.hub-stage .hub-canvas {
    will-change: left, top, transform;
}

.hub-stage .scene-heading,
.hub-stage .scene-actions,
.hub-stage .final-panel,
.hub-stage .hotspot,
.hub-stage .route-line {
    transition:
        opacity .20s ease,
        filter .20s ease,
        transform .20s ease;
}

.hub-stage .hub-backdrop {
    transition:
        transform .62s cubic-bezier(.18,.76,.22,1),
        filter .62s cubic-bezier(.18,.76,.22,1),
        opacity .30s ease;
}

.hub-stage.is-door-entering {
    pointer-events: none;
}

.hub-stage.is-door-entering .scene-heading,
.hub-stage.is-door-entering .scene-actions,
.hub-stage.is-door-entering .final-panel,
.hub-stage.is-door-entering .route-line {
    opacity: 0;
}

.hub-stage.is-door-entering .hotspot {
    opacity: 0;
}

.hub-stage.is-door-entering .hotspot.is-transition-door {
    opacity: 1;
}

.hub-stage.is-door-entering .hotspot.is-transition-door .door-label {
    opacity: 0;
    transform: translateY(7px) scale(.96);
}

.hub-stage.is-door-entering .hub-backdrop {
    transform: scale(1.16);
    filter: blur(32px) brightness(.82) saturate(.86);
}


.scene-transition-cover {
    position: fixed;
    z-index: 9997;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: opacity .18s ease;
}

.scene-transition-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(30,24,18,.04), rgba(30,24,18,.12)),
        linear-gradient(to top, rgba(30,24,18,.14), transparent 46%);
}

.scene-transition-cover.is-visible {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .scene-transition-cover {
        transition-duration: .01ms !important;
    }
}



.route-line {
    position: absolute;
    z-index: 6;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    overflow: visible;
}

.hub-stage.route-visible .route-line {
    opacity: 1;
}

.route-line .route-shadow,
.route-line .route-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

.route-line .route-shadow {
    stroke: rgba(47, 36, 23, .58);
    stroke-width: 13;
}

.route-line .route-path {
    stroke: #fff3c6;
    stroke-width: 7;
    filter: drop-shadow(0 2px 2px rgba(47,36,23,.35));
}

.hub-stage.route-visible .route-shadow,
.hub-stage.route-visible .route-path {
    animation: routeDrawFinal 1.35s cubic-bezier(.22,.72,.24,1) forwards;
}

.route-point {
    fill: var(--green-dark);
    stroke: #fffaf2;
    stroke-width: 5;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(.35);
    filter: drop-shadow(0 2px 2px rgba(47,36,23,.42));
}

.hub-stage.route-visible .route-point {
    animation: routePointFinal .32s ease-out forwards;
}

.hub-stage.route-visible .point-1 { animation-delay: .04s; }
.hub-stage.route-visible .point-2 { animation-delay: .43s; }
.hub-stage.route-visible .point-3 { animation-delay: .82s; }
.hub-stage.route-visible .point-4 { animation-delay: 1.18s; }

@keyframes routeDrawFinal {
    from { stroke-dashoffset: 1; }
    to   { stroke-dashoffset: 0; }
}

@keyframes routePointFinal {
    0%   { opacity: 0; transform: scale(.35); }
    70%  { opacity: 1; transform: scale(1.18); }
    100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .hub-stage.route-visible .route-shadow,
    .hub-stage.route-visible .route-path {
        animation: none !important;
        stroke-dashoffset: 0 !important;
    }

    .hub-stage.route-visible .route-point {
        animation: none !important;
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}


.hub-stage.route-visible .hub-canvas {
    z-index: 3;
}

.hub-stage.route-visible .route-shadow,
.hub-stage.route-visible .route-path {
    animation: none !important;
}

.hub-stage.route-visible .route-point {
    animation: none !important;
    opacity: 0;
    transform: scale(.35);
    transition: opacity .22s ease, transform .28s ease;
}

.hub-stage.route-visible .route-point.is-visible {
    opacity: 1;
    transform: scale(1);
}


.final-panel.final-panel-horizontal {
    top: clamp(108px, 13vh, 138px);
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(1220px, calc(100vw - 56px));
    max-height: none;
    padding: clamp(18px, 2vw, 26px);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr);
    gap: clamp(20px, 2.5vw, 34px);
    align-items: center;
    overflow: visible;
    border-radius: 24px;
}

.final-panel-horizontal .final-copy,
.final-panel-horizontal .final-side {
    min-width: 0;
}

.final-panel-horizontal .final-kicker {
    margin-bottom: 8px;
}

.final-panel-horizontal h2 {
    margin: 0;
    max-width: 660px;
    font-size: clamp(28px, 2.4vw, 39px);
    line-height: 1.06;
}

.final-panel-horizontal .final-summary {
    margin: 14px 0 0;
    max-width: 700px;
    font-size: clamp(15px, 1.1vw, 17px);
    line-height: 1.42;
}

.final-panel-horizontal .final-side {
    display: grid;
    gap: 12px;
}

.final-panel-horizontal .final-question {
    margin: 0;
    padding: 15px 17px;
    font-size: clamp(15px, 1.05vw, 17px);
    line-height: 1.36;
}

.final-panel-horizontal .final-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.final-panel-horizontal .final-actions button {
    width: 100%;
    min-width: 0;
}


.hub-stage.route-visible .scene-heading {
    width: auto;
    max-width: min(520px, calc(100vw - 250px));
    padding: 10px 16px;
}

.hub-stage.route-visible .scene-heading .scene-eyebrow {
    margin-bottom: 3px;
}

.hub-stage.route-visible .scene-heading h1 {
    font-size: clamp(25px, 2.2vw, 36px);
}


@media (max-width: 1180px) {
    .final-panel.final-panel-horizontal {
        top: 112px;
        width: calc(100vw - 34px);
        grid-template-columns: minmax(0, 1fr) minmax(330px, .9fr);
        gap: 18px;
        padding: 18px;
    }

    .final-panel-horizontal h2 {
        font-size: clamp(25px, 3vw, 34px);
    }

    .final-panel-horizontal .final-summary {
        font-size: 15px;
        line-height: 1.38;
    }

    .final-panel-horizontal .final-question {
        padding: 13px 14px;
        font-size: 15px;
    }
}


@media (max-width: 820px) {
    .final-panel.final-panel-horizontal {
        top: 104px;
        left: 12px;
        right: 12px;
        bottom: auto;
        width: auto;
        transform: none;
        grid-template-columns: 1fr;
        gap: 12px;
        max-height: min(52dvh, 430px);
        overflow-y: auto;
        padding: 16px;
        border-radius: 20px;
    }

    .final-panel-horizontal .final-summary {
        margin-top: 10px;
    }

    .final-panel-horizontal .final-side {
        gap: 10px;
    }
}

@media (max-width: 560px) {
    .final-panel.final-panel-horizontal {
        top: 94px;
        left: 9px;
        right: 9px;
        max-height: min(55dvh, 420px);
        padding: 14px;
    }

    .final-panel-horizontal h2 {
        font-size: 24px;
    }

    .final-panel-horizontal .final-summary,
    .final-panel-horizontal .final-question {
        font-size: 14px;
    }

    .final-panel-horizontal .final-actions {
        grid-template-columns: 1fr;
    }
}


.hub-stage.route-visible .scene-heading {
    display: none;
}


.final-panel.final-panel-horizontal {
    top: clamp(68px, 8vh, 86px);
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
    animation: finalPanelReveal .55s ease .55s forwards;
}

@keyframes finalPanelReveal {
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}


.hub-stage.route-visible .route-point {
    transition: opacity .34s ease, transform .42s ease;
}

@media (max-width: 1180px) {
    .final-panel.final-panel-horizontal {
        top: 72px;
    }
}

@media (max-width: 820px) {
    .final-panel.final-panel-horizontal {
        top: 72px;
        transform: none;
        animation: finalPanelRevealMobile .55s ease .55s forwards;
    }

    @keyframes finalPanelRevealMobile {
        from {
            opacity: 0;
            transform: translateY(-6px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@media (max-width: 560px) {
    .final-panel.final-panel-horizontal {
        top: 66px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .final-panel.final-panel-horizontal {
        opacity: 1;
        animation: none !important;
        transform: translateX(-50%);
    }

    @media (max-width: 820px) {
        .final-panel.final-panel-horizontal {
            transform: none;
        }
    }
}
