/* ============================================
   Chizhik-Pyzhik Traveller -- WebAR Styles
   Russian train aesthetic, warm tones, mobile-first
   ============================================ */

/* --- Variables --- */
:root {
    --color-bg: #1A2744;
    --color-bg-warm: #2A1F14;
    --color-primary: #E9C46A;
    --color-primary-dim: rgba(233, 196, 106, 0.3);
    --color-accent: #E63946;
    --color-accent-soft: rgba(230, 57, 70, 0.15);
    --color-text: #FFF8ED;
    --color-text-dim: rgba(255, 248, 237, 0.6);
    --color-card-bg: rgba(255, 248, 237, 0.97);
    --color-card-text: #4A3728;
    --color-brown: #8B4513;
    --color-brown-light: #A0522D;
    --color-wood: #5C3A1E;
    --color-wood-light: #8B6914;
    --color-success: #2ECC71;
    --color-glass: rgba(26, 39, 68, 0.75);
    --color-glass-light: rgba(255, 248, 237, 0.08);
    --font-heading: Georgia, 'Times New Roman', serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(233, 196, 106, 0.3);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
}

body {
    font-family: var(--font-body);
    background: #000;
    color: var(--color-text);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* --- AR Container --- */
#ar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #0a0a0a;
}

#ar-container canvas,
#ar-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* --- Overlays --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* --- Splash Screen --- */
.splash-overlay {
    background: linear-gradient(160deg, var(--color-bg) 0%, #1F2F4D 40%, var(--color-bg-warm) 100%);
    flex-direction: column;
    z-index: 1000;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.splash-overlay.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.splash-content {
    text-align: center;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 2;
}

/* Bird SVG in splash */
.splash-bird-container {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.splash-bird {
    animation: birdFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(204, 184, 0, 0.3));
}

@keyframes birdFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(2deg); }
    75% { transform: translateY(-4px) rotate(-1deg); }
}

.splash-sparkles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px;
    height: 140px;
    margin: -70px 0 0 -70px;
    pointer-events: none;
}

.splash-sparkles::before,
.splash-sparkles::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.splash-sparkles::before {
    top: 10%;
    right: 5%;
    animation-delay: 0.3s;
}

.splash-sparkles::after {
    bottom: 15%;
    left: 10%;
    animation-delay: 0.8s;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.5); }
}

.splash-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--color-primary);
    line-height: 1.15;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 12px rgba(233, 196, 106, 0.25);
}

.splash-title span {
    font-size: 0.75em;
    opacity: 0.85;
    display: block;
    margin-top: 0.15em;
}

.splash-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin-bottom: 2.5rem;
    letter-spacing: 0.04em;
}

.splash-hint {
    font-size: 0.8rem;
    color: var(--color-text-dim);
    margin-top: 1.5rem;
    opacity: 0.6;
}

/* Splash train decoration */
.splash-train-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    overflow: hidden;
    z-index: 1;
}

.train-track {
    position: absolute;
    bottom: 15px;
    left: -10%;
    right: -10%;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--color-primary-dim) 0px,
        var(--color-primary-dim) 20px,
        transparent 20px,
        transparent 30px
    );
    opacity: 0.4;
}

.train-track::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-primary-dim);
}

.train-track::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-primary-dim);
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #D4A843 100%);
    color: var(--color-bg);
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-glow {
    box-shadow: var(--shadow-glow);
    animation: btnPulse 2.5s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(233, 196, 106, 0.2); }
    50% { box-shadow: 0 0 30px rgba(233, 196, 106, 0.45); }
}

.btn-secondary {
    background: transparent;
    color: var(--color-brown);
    border: 2px solid var(--color-brown-light);
    padding: 10px 28px;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:active {
    background: rgba(139, 69, 19, 0.1);
    transform: scale(0.97);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-accent) 0%, #C0392B 100%);
    color: white;
    border: none;
    padding: 10px 28px;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-accent:active {
    transform: scale(0.95);
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.82rem;
    opacity: 0.7;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 8px;
    margin-top: 0.5rem;
    transition: opacity var(--transition-fast);
}

.btn-link:active {
    opacity: 1;
}

.btn-icon {
    background: var(--color-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-icon:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.15);
}

.btn-close-sheet {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color var(--transition-fast);
}

.btn-close-sheet:active {
    color: #666;
}

/* --- Top Bar --- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(12px + var(--safe-top)) 12px 10px;
    pointer-events: none;
}

.top-bar > * {
    pointer-events: auto;
}

.top-bar-left,
.top-bar-right {
    flex-shrink: 0;
}

.top-bar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 8px;
}

/* Train mode badge */
.train-mode-badge {
    background: var(--color-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 14px;
    border: 1px solid rgba(233, 196, 106, 0.2);
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.03em;
}

.train-icon {
    font-size: 0.6rem;
    animation: trainPulse 2s ease-in-out infinite;
}

@keyframes trainPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* City counter */
.city-counter {
    background: var(--color-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px 16px;
    min-width: 90px;
    text-align: center;
}

.city-counter #counter-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.05em;
}

.counter-progress {
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    margin-top: 4px;
    overflow: hidden;
}

.counter-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 1px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Scan Hint --- */
.scan-hint {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    text-align: center;
    animation: hintPulse 3s ease-in-out infinite;
    transition: opacity var(--transition-smooth);
}

.scan-hint.fade-out {
    opacity: 0;
    pointer-events: none;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.scan-frame {
    width: 180px;
    height: 180px;
    position: relative;
    margin: 0 auto 14px;
}

.scan-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: var(--color-primary);
    border-style: solid;
}

.scan-corner-tl {
    top: 0; left: 0;
    border-width: 3px 0 0 3px;
    border-radius: 6px 0 0 0;
}

.scan-corner-tr {
    top: 0; right: 0;
    border-width: 3px 3px 0 0;
    border-radius: 0 6px 0 0;
}

.scan-corner-bl {
    bottom: 0; left: 0;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 6px;
}

.scan-corner-br {
    bottom: 0; right: 0;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 6px 0;
}

.scan-line {
    position: absolute;
    top: 10%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    animation: scanMove 2.5s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes scanMove {
    0%, 100% { top: 10%; }
    50% { top: 85%; }
}

.scan-hint p {
    font-size: 0.82rem;
    color: var(--color-text);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
    max-width: 220px;
    line-height: 1.4;
}

/* --- AR Phrase --- */
.ar-phrase {
    position: fixed;
    top: calc(70px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 45;
    background: var(--color-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 10px 20px;
    max-width: 85%;
    text-align: center;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--color-primary);
    transition: opacity var(--transition-smooth), transform var(--transition-smooth);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.ar-phrase.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ar-phrase.hidden {
    display: block !important;
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
    pointer-events: none;
}

/* --- Bottom Sheet (City Info) --- */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    transform: translateY(100%);
    transition: transform var(--transition-spring);
    pointer-events: none;
}

.bottom-sheet.visible {
    transform: translateY(0);
    pointer-events: auto;
}

.bottom-sheet.hidden {
    display: block !important;
    transform: translateY(100%);
    pointer-events: none;
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    margin: 8px auto;
}

.sheet-content {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 4px 20px calc(20px + var(--safe-bottom));
    max-height: 65vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
}

/* Wood texture effect */
.sheet-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--color-wood) 0%,
        var(--color-wood-light) 25%,
        var(--color-wood) 50%,
        var(--color-wood-light) 75%,
        var(--color-wood) 100%
    );
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.sheet-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0 8px;
    position: relative;
}

.sheet-city-badge {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 8px;
    flex-shrink: 0;
    box-shadow: 0 0 8px currentColor;
}

.sheet-city-name {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--color-brown);
    line-height: 1.2;
    flex: 1;
    padding-right: 30px;
}

.sheet-body {
    padding: 4px 0 12px;
}

.sheet-quote {
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #666;
    margin: 0 0 14px;
    padding: 10px 0 10px 14px;
    border-left: 3px solid var(--color-primary);
}

.sheet-description {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--color-card-text);
    margin-bottom: 12px;
}

.sheet-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-details.open {
    max-height: 400px;
}

.sheet-fact {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFF3CD 100%);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.fact-icon {
    color: var(--color-primary);
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.sheet-fact p {
    font-size: 0.82rem;
    line-height: 1.55;
    color: #5D4037;
    margin: 0;
}

.sheet-footer {
    display: flex;
    gap: 10px;
    padding: 8px 0 4px;
    justify-content: center;
}

/* --- Settings Panel --- */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.settings-panel.hidden {
    display: none !important;
}

.settings-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.settings-content {
    position: relative;
    background: var(--color-card-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px 24px calc(24px + var(--safe-bottom));
    animation: sheetSlideUp 0.3s ease-out;
}

@keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-brown);
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.setting-item {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--color-card-text);
    cursor: pointer;
}

.setting-value {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

.setting-hint {
    font-size: 0.78rem;
    color: #999;
    margin-top: 4px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 13px;
    transition: background var(--transition-fast);
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Range slider */
.setting-range {
    width: 100%;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 2px;
    margin: 12px 0 6px;
    outline: none;
}

.setting-range::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #aaa;
}

/* Settings footer */
.settings-footer {
    margin-top: 20px;
    text-align: center;
}

.settings-version {
    font-size: 0.72rem;
    color: #bbb;
}

/* --- Loading Screen --- */
.loading-overlay {
    background: var(--color-bg);
    flex-direction: column;
    z-index: 900;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-bird {
    margin-bottom: 20px;
}

.loading-bird-svg {
    animation: loadingHop 1s ease-in-out infinite;
}

@keyframes loadingHop {
    0%, 100% { transform: translateY(0) scaleY(1); }
    30% { transform: translateY(-12px) scaleY(1.05); }
    50% { transform: translateY(0) scaleY(0.95); }
}

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

.progress-bar {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #D4A843);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-hint {
    font-size: 0.75rem;
    color: var(--color-text-dim);
    margin-top: 12px;
}

/* --- Toast Container --- */
.toast-container {
    position: fixed;
    top: calc(60px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 360px;
}

.toast {
    background: var(--color-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--color-text);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all var(--transition-smooth);
    pointer-events: auto;
    line-height: 1.4;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
}

/* --- Error Overlay --- */
.error-overlay {
    background: var(--color-bg);
    flex-direction: column;
    z-index: 950;
}

.error-content {
    text-align: center;
    padding: 2rem;
}

.error-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: 1.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.error-content h2 {
    font-family: var(--font-heading);
    color: var(--color-text);
    margin-bottom: 8px;
}

.error-content p {
    color: var(--color-text-dim);
    font-size: 0.9rem;
    margin-bottom: 24px;
    max-width: 280px;
    line-height: 1.5;
}

/* --- Demo Mode Panel --- */
.demo-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 0 8px calc(12px + var(--safe-bottom));
    pointer-events: none;
}

.demo-board {
    background: var(--color-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 14px;
    pointer-events: auto;
    max-height: 180px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.demo-board-title {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    text-align: center;
}

.demo-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.demo-city-btn {
    background: var(--color-glass-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    font-size: 0.72rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.demo-city-btn:active {
    transform: scale(0.95);
}

.demo-city-btn.visited {
    background: var(--color-primary-dim);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.demo-city-btn.active {
    background: var(--color-primary);
    color: var(--color-bg);
    border-color: var(--color-primary);
    font-weight: 600;
}

/* --- Confetti Canvas --- */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 300;
    pointer-events: none;
}

/* --- Performance Badge --- */
.perf-badge {
    position: fixed;
    bottom: calc(8px + var(--safe-bottom));
    right: 8px;
    z-index: 55;
    background: rgba(0, 0, 0, 0.6);
    color: #0f0;
    font-size: 0.65rem;
    font-family: monospace;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    display: none;
}

/* --- Landscape Mode Adjustments --- */
@media (orientation: landscape) {
    .splash-title {
        font-size: 1.6rem;
    }

    .splash-bird svg {
        width: 70px;
        height: 70px;
    }

    .splash-subtitle {
        margin-bottom: 1.5rem;
    }

    .btn-primary {
        padding: 12px 36px;
        font-size: 1rem;
    }

    .sheet-content {
        max-height: 55vh;
    }

    .scan-frame {
        width: 140px;
        height: 140px;
    }

    .demo-board {
        max-height: 120px;
    }

    .bottom-sheet.visible .sheet-content {
        max-height: 50vh;
    }
}

/* --- Small Screen Adjustments --- */
@media (max-height: 600px) {
    .splash-bird svg {
        width: 64px;
        height: 64px;
    }

    .splash-title {
        font-size: 1.6rem;
    }

    .splash-subtitle {
        margin-bottom: 1.5rem;
    }

    .splash-hint {
        display: none;
    }
}

/* --- Tablet Adjustments --- */
@media (min-width: 768px) {
    .sheet-content {
        max-width: 480px;
        margin: 0 auto;
    }

    .settings-content {
        max-width: 480px;
    }

    .demo-board {
        max-width: 520px;
        margin: 0 auto;
    }

    .toast-container {
        max-width: 400px;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
