#tour-open {
    background: #e5f0df;
    border-color: #8ca380;
    color: #1d4838;
    font-weight: 700;
}

#temas-tour {
    --tour-ink: #163b30;
    --tour-paper: #faf7ef;
    --tour-line: #c8d2c5;
    --tour-edge: clamp(14px, 2.6vw, 60px);
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #102c24;
    color: var(--tour-ink);
    overflow: auto;
    overscroll-behavior: contain;
    text-align: start;
}
#temas-tour::backdrop { background: #102c24; }
#temas-tour [hidden] { display: none !important; }

#temas-tour .tour-shell {
    display: grid;
    grid-template-rows: auto minmax(130px, 1fr) auto;
    height: 100%;
    min-height: min-content;
}
#temas-tour .tour-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: max(8px, env(safe-area-inset-top)) var(--tour-edge) 8px;
    background: #153f34;
    color: #fff7df;
}
#temas-tour .tour-header h2 {
    margin: 0;
    color: inherit;
    font: 650 clamp(18px, 2.8vmin, 42px)/1.15 Georgia, serif;
    overflow-wrap: anywhere;
}
#temas-tour .tour-header small {
    display: block;
    margin-block-start: 3px;
    color: #d5e5d5;
    font: 500 clamp(11px, 1.4vmin, 20px)/1.3 system-ui, sans-serif;
}
#temas-tour button {
    appearance: none;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--tour-line);
    border-radius: 8px;
    background: #fffdf7;
    color: var(--tour-ink);
    font: 650 clamp(13px, 1.5vmin, 22px)/1.25 system-ui, sans-serif;
    cursor: pointer;
    white-space: normal;
}
#temas-tour button:focus-visible, #tour-open:focus-visible {
    outline: 3px solid #ecaf37;
    outline-offset: 2px;
}
#temas-tour button:disabled { opacity: .45; cursor: default; }
#temas-tour .tour-header button,
#temas-tour .tour-look button {
    border-color: #b4c8b7;
    background: #183d32f5;
    color: #fff7df;
}
#temas-tour .tour-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #193a30;
}
#temas-tour .tour-stage canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
}
#temas-tour .tour-stage canvas:active { cursor: grabbing; }
#temas-tour .tour-stage canvas:focus-visible {
    outline: 3px solid #f3c065;
    outline-offset: -3px;
}
#temas-tour #tour-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: contain;
    color: #fff7df;
    text-align: center;
}
#temas-tour #tour-fallback canvas { cursor: default; }
#temas-tour #tour-status {
    position: absolute;
    inset-block-start: 10px;
    inset-inline-start: var(--tour-edge);
    max-width: min(48ch, calc(100% - 2 * var(--tour-edge) - 77px));
    box-sizing: border-box;
    padding: 8px 13px;
    border: 1px solid #b7c6b5;
    border-radius: 8px;
    background: #163a30f5;
    color: #fff9e8;
    font: 600 clamp(12px, 1.5vmin, 20px)/1.35 system-ui, sans-serif;
    pointer-events: none;
}
#temas-tour .tour-look {
    position: absolute;
    bottom: clamp(8px, 1.7vmin, 22px);
    left: max(var(--tour-edge), env(safe-area-inset-left));
    right: max(var(--tour-edge), env(safe-area-inset-right));
    display: flex;
    align-items: end;
    gap: 8px;
    direction: ltr;
    pointer-events: none;
}
#temas-tour #tour-compass {
    position: absolute;
    inset-block-start: 10px;
    inset-inline-end: var(--tour-edge);
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    background: #183d32f5;
    border: 1px solid #b4c8b7;
    border-radius: 8px;
    color: #fff8df;
    font: 600 13px/1.2 system-ui, sans-serif;
    pointer-events: none;
}
#tour-compass .tour-needle { color: #f6ca76; font-size: 16px; line-height: 1; }
#tour-compass small, #tour-compass strong { display: block; }
#tour-compass small { color: #d4dfd5; font-size: 10px; }
#temas-tour .tour-look button {
    min-width: 44px;
    pointer-events: auto;
    box-shadow: 0 2px 7px #0c251e55;
}
#temas-tour #tour-pad {
    display: grid;
    grid-template-areas: ". forward ." "left back right" "hint hint hint";
    grid-template-columns: repeat(3, 44px);
    gap: 4px;
    justify-items: stretch;
}
#temas-tour #tour-forward { grid-area: forward; }
#temas-tour #tour-left { grid-area: left; }
#temas-tour #tour-back { grid-area: back; }
#temas-tour #tour-right { grid-area: right; }
#temas-tour #tour-pad button {
    height: 44px;
    padding: 0;
    font: 600 24px/1 system-ui, sans-serif;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
#temas-tour #tour-pad button:is(:active, [data-active="true"]) {
    background: #ffdfa1;
    border-color: #fff2cc;
    color: #193e32;
}
#temas-tour #tour-pad small {
    grid-area: hint;
    justify-self: center;
    margin: 0;
    padding: 3px 7px;
    border-radius: 4px;
    background: #183d32ee;
    color: #fff7df;
    font: 550 11px/1.3 system-ui, sans-serif;
    text-align: center;
}
#temas-tour .tour-camera {
    display: flex;
    align-items: end;
    gap: 5px;
    margin-left: auto;
}
#temas-tour .tour-guide {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 24px;
    padding: 12px var(--tour-edge) max(14px, env(safe-area-inset-bottom));
    border-top: 3px solid #c4a263;
    background: var(--tour-paper);
}
#temas-tour .tour-routes {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
#temas-tour .tour-routes button {
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 30px;
}
#temas-tour .tour-routes :is([aria-pressed="true"], [aria-current="true"]) {
    border-color: #2a5848;
    background: #245341;
    color: #fff9e8;
}
#temas-tour #tour-step {
    display: block;
    margin: 0 0 3px;
    color: #596d5c;
    font: 700 clamp(11px, 1.3vmin, 19px)/1.3 system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}
#temas-tour #tour-title {
    margin: 0;
    color: var(--tour-ink);
    font: 700 clamp(20px, 3.4vmin, 50px)/1.13 Georgia, serif;
    overflow-wrap: anywhere;
}
#temas-tour #tour-description {
    max-width: 90ch;
    margin: 4px 0 0;
    color: #3a5046;
    font: 450 clamp(13px, 1.65vmin, 24px)/1.42 system-ui, sans-serif;
}
#temas-tour .tour-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#temas-tour .tour-actions button:last-child { border-color: #244c3c; background: #244c3c; color: #fffbea; }
@media (hover: hover) {
    #temas-tour button:not(:disabled):hover { filter: brightness(.94); }
}
@media (max-width: 640px) {
    #temas-tour .tour-guide { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    #temas-tour .tour-routes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
    #temas-tour .tour-routes button { padding: 4px 7px; }
    #temas-tour .tour-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 500px) {
    #temas-tour .tour-camera { flex-direction: column; }
    #temas-tour .tour-camera button { padding-inline: 9px; }
}
@media (max-height: 480px) and (orientation: landscape) {
    #temas-tour .tour-routes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
    #temas-tour .tour-header { padding-block: 3px; }
    #temas-tour .tour-guide { padding-block: 5px; gap: 5px 12px; }
    #temas-tour .tour-routes button { min-height: 32px; }
    #temas-tour #tour-title { font-size: 18px; }
    #temas-tour #tour-description { margin-block-start: 2px; font-size: 12px; }
}
#temas-tour #tour-map-label {
    position: absolute;
    transform: translate(-50%, calc(-100% - 12px));
    max-width: 85%;
    padding: 4px 10px;
    border-radius: 5px;
    background: #173f34;
    color: #fff8e5;
    font: 650 clamp(12px, 1.6vmin, 18px)/1.3 system-ui, sans-serif;
    pointer-events: none;
}
#temas-tour .tour-stage canvas.is-map { cursor: pointer; }
#temas-tour .tour-map-places {
    display: none;
    position: absolute;
    inset: 0;
    pointer-events: none;
}
#tour-view.is-map ~ .tour-map-places,
#temas-tour #tour-fallback:not([hidden]) ~ .tour-map-places { display: block; }
#temas-tour .tour-map-places span {
    position: absolute;
    padding: 3px 7px;
    border: 1px solid #827958;
    border-radius: 4px;
    background: #fff4d4;
    color: #2f4638;
    font: 650 clamp(11px, 1.4vmin, 16px)/1.2 system-ui, sans-serif;
    white-space: nowrap;
}
