.tour-page {
    max-width: 48rem;
    margin: 0 auto;
}

.tour-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.tour-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    color: var(--color-zinc-900, #18181b);
}

.dark .tour-header h1 {
    color: var(--color-gray-100, #f3f4f6);
}

.tour-subtitle {
    color: #71717a;
    font-size: 1.1rem;
}

.dark .tour-subtitle {
    color: #a1a1aa;
}

.tour-master-slider-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.tour-slider-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tour-slider-overlay {
    position: relative;
    height: 2rem;
    pointer-events: none;
}

.tour-max-hint {
    position: absolute;
    right: 0;
    top: 0;
    transform: translateX(50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    user-select: none;
}

.tour-max-hint-head {
    display: block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid #16a34a;
    opacity: 0.7;
}

.tour-max-hint-stem {
    display: block;
    width: 2px;
    height: 0.6rem;
    background: #16a34a;
    opacity: 0.7;
}

.dark .tour-max-hint-head {
    border-bottom-color: #4ade80;
}

.dark .tour-max-hint-stem {
    background: #4ade80;
}

.tour-max-hint--flash {
    opacity: 0.6;
}

.tour-audiobook-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.tour-audiobook-marker::before {
    content: '';
    display: block;
    width: 2px;
    height: 0.6rem;
    background: #16a34a;
    opacity: 0.7;
}

.dark .tour-audiobook-marker::before {
    background: #4ade80;
}

.tour-audiobook-btn {
    margin-top: 0.15rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid #16a34a;
    border-radius: 0.2rem;
    background: transparent;
    color: #16a34a;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.tour-audiobook-btn:hover {
    background: #16a34a;
    color: white;
}

.dark .tour-audiobook-btn {
    border-color: #4ade80;
    color: #4ade80;
}

.dark .tour-audiobook-btn:hover {
    background: #4ade80;
    color: #18181b;
}

.tour-master-slider-label {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: #71717a;
    white-space: nowrap;
    font-weight: 500;
}

.dark .tour-master-slider-label {
    color: #a1a1aa;
}

.tour-master-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 0.5rem;
    border-radius: 9999px;
    background: #e4e4e7;
    outline: none;
    cursor: pointer;
}

.dark .tour-master-slider {
    background: #3f3f46;
}

.tour-master-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #16a34a;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.dark .tour-master-slider::-webkit-slider-thumb {
    background: #4ade80;
    border-color: #18181b;
}

.tour-master-slider::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #16a34a;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.dark .tour-master-slider::-moz-range-thumb {
    background: #4ade80;
    border-color: #18181b;
}

.tour-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.tour-lightning-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.tour-card {
    border: 2px dotted #a1a1aa;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    background: transparent;
    transition: border-color 0.3s;
}

.dark .tour-card {
    border-color: #52525b;
}

.tour-card-title {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.tour-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tour-toggle {
    flex-shrink: 0;
    padding: 0.35rem 1rem;
    border: 2px solid #16a34a;
    border-radius: 0.25rem;
    background: transparent;
    color: #16a34a;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tour-toggle[aria-pressed="true"] {
    background: #16a34a;
    color: white;
}

.dark .tour-toggle {
    border-color: #4ade80;
    color: #4ade80;
}

.dark .tour-toggle[aria-pressed="true"] {
    background: #4ade80;
    color: #18181b;
}

.tour-bar-track {
    flex: 1;
    height: 0.5rem;
    background: #e4e4e7;
    border-radius: 9999px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, filter 0.15s;
}

.dark .tour-bar-track {
    background: #3f3f46;
}

.tour-bar-track--active {
    transform: scaleY(2.5);
    filter: brightness(0.85);
}

.dark .tour-bar-track--active {
    filter: brightness(1.4);
}

.tour-bar-fill {
    height: 100%;
    background: #16a34a;
    border-radius: 9999px;
    width: 0%;
    transition: none;
}

.dark .tour-bar-fill {
    background: #4ade80;
}

.tour-card-words {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: #a1a1aa;
    white-space: nowrap;
}

.dark .tour-card-words {
    color: #52525b;
}

.tour-profile {
    font-size: 0.9rem;
    color: #52525b;
    line-height: 1.6;
    margin: 0;
    transition: opacity 0.3s;
}

.dark .tour-profile {
    color: #a1a1aa;
}

.tour-archetype-section {
    padding-top: 1rem;
    text-align: center;
    margin-bottom: 2rem;
}

.tour-total-bar {
    padding-top: 0.75rem;
    text-align: center;
}

/* Fixed clone — mobile only, fades out when inline bar is visible */
.tour-total-bar-fixed {
    display: none;
}

@media (max-width: 767px) {
    .tour-total-bar-fixed {
        display: flex;
        position: fixed;
        bottom: env(safe-area-inset-bottom, 0);
        left: 0;
        right: 0;
        padding: 0.4rem 1rem;
        background: #ffffff;
        z-index: 20;
        align-items: center;
        gap: 0.75rem;
        transition: opacity 0.3s;
    }

    .dark .tour-total-bar-fixed {
        background: #18181b;
    }

    .tour-total-bar-fixed .tour-total-label {
        margin: 0;
        white-space: nowrap;
    }

    .tour-total-bar-fixed .tour-total-display {
        margin: 0;
    }

    .tour-total-bar-fixed .tour-word-counter {
        font-size: 1.5rem;
    }

    .tour-total-bar-fixed .tour-total-unit {
        font-size: 0.9rem;
    }

    .tour-total-bar-fixed--hidden {
        opacity: 0;
        pointer-events: none;
    }
}

.tour-total-label {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #71717a;
    margin-bottom: 0.5rem;
}

.tour-total-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tour-word-counter {
    display: inline-flex;
    gap: 0;
    font-size: 3.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #18181b;
}

.dark .tour-word-counter {
    color: #f3f4f6;
}

.tour-digit {
    display: inline-block;
    min-width: 0.6em;
    text-align: center;
}

.tour-digit-sep {
    display: inline-block;
    color: #a1a1aa;
}

.tour-digit--broken {
    color: #dc2626;
    transition: color 0.4s;
}

.tour-total-unit {
    font-size: 1.2rem;
    color: #71717a;
    font-weight: 500;
}

.tour-archetype {
    font-size: 1rem;
    color: #3f3f46;
    font-style: italic;
    line-height: 1.7;
    max-width: 36rem;
    margin: 0 auto;
    transition: opacity 0.3s;
    min-height: 3rem;
}

.dark .tour-archetype {
    color: #a1a1aa;
}

/* Sticky sidebar counter — desktop only */
.tour-sidebar-fixed {
    display: none;
}

@media (min-width: 768px) {
    .tour-sidebar-fixed {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.4rem;
        position: fixed;
        right: 0;
        top: 50%;
        transform: translateY(-50%) rotate(-90deg);
        transform-origin: center center;
        z-index: 40;
        pointer-events: none;
        padding: 0.75rem 0.5rem;
    }
}

.tour-word-counter--sidebar {
    font-size: 2rem;
    color: #a1a1aa;
}

.dark .tour-word-counter--sidebar {
    color: #52525b;
}

.tour-sidebar-unit {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a1a1aa;
    font-weight: 500;
}

.dark .tour-sidebar-unit {
    color: #52525b;
}

/* NSW mask */
.tour-card-title-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.tour-card-title-wrapper .tour-card-title {
    margin: 0;
}

.tour-nsw-mask {
    position: absolute;
    inset: -0.2em -0.5em;
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.15em 0.5em;
    background: repeating-linear-gradient(
        45deg,
        #1a1a1a,
        #1a1a1a 6px,
        #f5c518 6px,
        #f5c518 12px
    );
    border: 2px solid #f5c518;
    border-radius: 0.2em;
    cursor: pointer;
    font-family: monospace;
    z-index: 2;
    user-select: none;
    box-shadow: 2px 2px 0 #000;
    transition: opacity 0.2s;
}

.tour-nsw-mask:hover {
    opacity: 0.85;
}

.tour-nsw-badge {
    font-size: 0.9rem;
    font-weight: 900;
    color: #f5c518;
    background: #1a1a1a;
    padding: 0.1em 0.3em;
    border: 1px solid #f5c518;
    letter-spacing: 0.05em;
    white-space: nowrap;
    text-shadow: 0 0 4px #f5c518;
}

.tour-nsw-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1a1a1a;
    background: #f5c518;
    padding: 0.1em 0.35em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
    border-radius: 0.1em;
}

.tour-nsw-label small {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.tour-nsw-mask--hidden {
    display: none !important;
}

.tour-nsw-tile.tour-nsw-mask--hidden {
    display: flex !important;
    visibility: hidden;
    pointer-events: none;
}

.tour-nsw-profile-wrapper {
    position: relative;
}

.tour-nsw-tile-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    z-index: 2;
    border-radius: 0.2em;
    overflow: hidden;
}

.tour-nsw-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(
        45deg,
        rgba(26,26,26,0.92),
        rgba(26,26,26,0.92) 6px,
        rgba(245,197,24,0.85) 6px,
        rgba(245,197,24,0.85) 12px
    );
    border: 1px solid #f5c518;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.tour-nsw-tile:hover {
    opacity: 0.8;
}

.tour-nsw-tile-label {
    font-size: 0.7rem;
    font-weight: 900;
    color: #f5c518;
    background: rgba(26,26,26,0.85);
    padding: 0.1em 0.3em;
    border: 1px solid #f5c518;
    letter-spacing: 0.05em;
    text-align: center;
    white-space: pre-line;
    text-shadow: 0 0 4px #f5c518;
    font-family: monospace;
    line-height: 1.2;
}

.tour-nsw-profile-mask {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(26,26,26,0.92),
        rgba(26,26,26,0.92) 6px,
        rgba(245,197,24,0.85) 6px,
        rgba(245,197,24,0.85) 12px
    );
    border: 1px dashed #f5c518;
    border-radius: 0.2em;
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.2s;
}

.tour-nsw-profile-mask:hover {
    opacity: 0.8;
}

/* ── Commitment flow ─────────────────────────────────────────────────────── */

.tour-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s;
    overflow-y: auto;
}

@media (max-width: 767px) {
    .tour-modal {
        padding: 1.25rem 1.25rem;
    }
}

.tour-modal-overlay--visible {
    opacity: 1;
}

.tour-modal {
    background: #fff;
    border-radius: 0.5rem;
    padding: 2rem 2.5rem;
    max-width: 28rem;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dark .tour-modal {
    background: #27272a;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.tour-modal-heading {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #71717a;
    margin: 0 0 1.25rem;
}

.dark .tour-modal-heading {
    color: #a1a1aa;
}

.tour-modal-countdown {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: #18181b;
    margin-bottom: 1.25rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
}

.dark .tour-modal-countdown {
    color: #f3f4f6;
}

.tour-modal-sub {
    font-size: 0.9rem;
    color: #71717a;
    margin: 0;
    font-style: italic;
}

.dark .tour-modal-sub {
    color: #a1a1aa;
}

/* Confirmation modal */
.tour-modal--confirm {
    text-align: left;
}

.tour-modal-stamp {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #16a34a;
    text-align: center;
    margin: 0 0 0.5rem;
    border-bottom: 2px solid #16a34a;
    padding-bottom: 0.5rem;
}

.dark .tour-modal-stamp {
    color: #4ade80;
    border-color: #4ade80;
}

.tour-modal-clause {
    font-size: 0.85rem;
    color: #71717a;
    text-align: center;
    margin: 0 0 1rem;
}

.dark .tour-modal-clause {
    color: #a1a1aa;
}

.tour-modal-body {
    font-size: 1rem;
    color: #3f3f46;
    line-height: 1.7;
    margin: 0 0 0.85rem;
}

.dark .tour-modal-body {
    color: #d4d4d8;
}

.tour-modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.tour-modal-btn {
    padding: 0.5rem 1.4rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid #16a34a;
    transition: background 0.2s, color 0.2s;
}

.tour-modal-btn--commit {
    background: #16a34a;
    color: #fff;
}

.tour-modal-btn--commit:hover {
    background: #15803d;
    border-color: #15803d;
}

.dark .tour-modal-btn--commit {
    background: #4ade80;
    color: #18181b;
    border-color: #4ade80;
}

.dark .tour-modal-btn--commit:hover {
    background: #86efac;
    border-color: #86efac;
}

.tour-modal-btn--decline {
    background: transparent;
    color: #71717a;
    border-color: #d4d4d8;
}

.tour-modal-btn--decline:hover {
    border-color: #71717a;
    color: #3f3f46;
}

.dark .tour-modal-btn--decline {
    color: #a1a1aa;
    border-color: #52525b;
}

.dark .tour-modal-btn--decline:hover {
    border-color: #a1a1aa;
    color: #d4d4d8;
}

/* Cancel border around countdown modal */
.tour-cancel-border {
    position: relative;
    display: inline-block;
    padding: 1.5rem;
}

.tour-cancel-edge {
    position: absolute;
    background: #dc2626;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    z-index: 1;
}

.tour-cancel-edge--top,
.tour-cancel-edge--bottom {
    top: 0;
    left: 0;
    right: 0;
    height: 1.5rem;
    line-height: 1.5rem;
    padding: 0 0.25rem;
}

.tour-cancel-edge--bottom {
    top: auto;
    bottom: 0;
}

.tour-cancel-edge--left,
.tour-cancel-edge--right {
    top: 0;
    bottom: 0;
    width: 1.5rem;
    writing-mode: vertical-rl;
    line-height: 1.5rem;
    padding: 0.25rem 0;
}

.tour-cancel-edge--left {
    left: 0;
    transform: rotate(180deg);
}

.tour-cancel-edge--right {
    right: 0;
}

/* Committed state */
@keyframes tour-glow-pulse {
    0%, 100% { box-shadow: 0 0 6px 1px rgba(202, 138, 4, 0.4); border-color: #ca8a04; }
    50%       { box-shadow: 0 0 16px 5px rgba(234, 179, 8, 0.6); border-color: #eab308; }
}

@keyframes tour-glow-pulse-dark {
    0%, 100% { box-shadow: 0 0 6px 1px rgba(234, 179, 8, 0.35); border-color: #eab308; }
    50%       { box-shadow: 0 0 18px 6px rgba(250, 204, 21, 0.55); border-color: #facc15; }
}

.tour-card--committed {
    border-style: solid;
    animation: tour-glow-pulse 3s ease-in-out infinite;
}

.dark .tour-card--committed {
    animation: tour-glow-pulse-dark 3s ease-in-out infinite;
}

.tour-toggle--locked {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    cursor: default;
}

.tour-slider--locked {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.tour-committed-badge {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #ca8a04;
    font-weight: 700;
    text-align: center;
    margin-top: 0.1rem;
    opacity: 0;
    animation: tour-fade-in 1s ease forwards 0.3s;
}

.dark .tour-committed-badge {
    color: #eab308;
}

@keyframes tour-fade-in {
    to { opacity: 1; }
}

.tour-archetype--committed {
    color: #ca8a04;
    font-style: normal;
    font-weight: 500;
}

.dark .tour-archetype--committed {
    color: #eab308;
}

.tour-sidebar--committed .tour-word-counter--sidebar {
    color: #ca8a04;
}

.dark .tour-sidebar--committed .tour-word-counter--sidebar {
    color: #eab308;
}

.tour-author-note {
    margin-top: 2rem;
    padding: 1.25rem 1.75rem;
    border-left: 3px solid #ca8a04;
    text-align: left;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
    transition: opacity 0.8s ease;
}

.dark .tour-author-note {
    border-color: #eab308;
}

.tour-author-note-text,
.tour-author-note-sig {
    font-family: 'Courier New', Courier, monospace;
    color: #3f3f46;
    line-height: 1.7;
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.dark .tour-author-note-text,
.dark .tour-author-note-sig {
    color: #d4d4d8;
}

.tour-author-note-sig {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.05em;
}
