* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: #111; font-family: 'Segoe UI', system-ui, sans-serif;
    color: #fff; cursor: default;
}

#game-canvas { position: fixed; inset: 0; }
#game-canvas canvas { display: block; width: 100% !important; height: 100% !important; }

#loading-screen, #start-screen {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.85);
}
#loading-screen.hidden { display: none; }
#start-screen { display: none; }
#start-screen:not(.hidden) { display: flex; }

.start-title { font-size: 2.5rem; font-weight: 700; text-align: center; color: #fff; }
.start-title span { display: block; font-size: 1.2rem; color: #aaa; margin-top: 8px; font-weight: 400; }
.start-subtitle { color: #999; margin: 16px 0 32px; text-align: center; max-width: 480px; padding: 0 20px; }
.btn-engage {
    padding: 14px 40px; background: #fff; color: #111; border: none;
    font-size: 1rem; font-weight: 700; cursor: pointer; border-radius: 4px;
}
.btn-engage:hover { background: #ddd; }
.controls-hint { margin-top: 24px; color: #666; font-size: 0.8rem; }
.controls-hint kbd {
    background: #333; padding: 2px 6px; border-radius: 3px; color: #ccc; margin: 0 2px;
}

.cinematic-bar { display: none; }

body.cinematic::before,
body.cinematic::after {
    content: '';
    position: fixed;
    left: 0; right: 0;
    height: 10vh;
    background: #000;
    z-index: 90;
    pointer-events: none;
}
body.cinematic::before { top: 0; }
body.cinematic::after { bottom: 0; }

.back-link {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    z-index: 50; color: rgba(255,255,255,0.5); text-decoration: none; font-size: 0.75rem;
    opacity: 0; transition: opacity 0.3s;
}
.back-link.visible { opacity: 1; }
.back-link:hover { color: #fff; }

#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s; }
#hud.visible { opacity: 1; }

.hud-panel {
    position: absolute; background: rgba(0,0,0,0.55); padding: 10px 14px;
    font-size: 0.75rem; color: #ddd; border-radius: 4px;
}
.hud-top-left { top: 16px; left: 16px; }
.hud-top-right { top: 16px; right: 16px; text-align: right; }
.hud-bottom-left { bottom: 16px; left: 16px; }
.hud-bottom-right { bottom: 16px; right: 16px; }
.hud-label { color: #888; font-size: 0.65rem; text-transform: uppercase; margin-bottom: 2px; }

#minimap-canvas { border-radius: 4px; display: block; border: 1px solid rgba(255,255,255,0.1); }

.hud-map-panel { min-width: 210px; }

#map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 8px;
    max-width: 200px;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.58rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.legend-item i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

#interact-prompt {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.7); padding: 8px 20px; border-radius: 4px;
    font-size: 0.85rem; opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
#interact-prompt.visible { opacity: 1; }
#interact-prompt kbd { background: #333; padding: 2px 8px; border-radius: 3px; margin-right: 6px; }

#dialogue-box {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    width: min(600px, 90vw); background: rgba(0,0,0,0.8); padding: 20px 24px;
    border-radius: 6px; opacity: 0; visibility: hidden; transition: all 0.3s;
}
#dialogue-box.active { opacity: 1; visibility: visible; }
.dialogue-speaker { color: #8c8; font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; }
.dialogue-text { font-size: 1rem; line-height: 1.5; color: #eee; }
.dialogue-continue { margin-top: 12px; text-align: right; font-size: 0.7rem; color: #666; }

#info-panel {
    position: fixed; top: 50%; right: 24px; transform: translateY(-50%);
    width: min(340px, 85vw); max-height: 60vh; overflow-y: auto;
    background: rgba(0,0,0,0.85); padding: 20px; border-radius: 6px;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
#info-panel.active { opacity: 1; visibility: visible; }
.info-panel-title { font-size: 1.2rem; font-weight: 700; }
.info-panel-subtitle { color: #8c8; font-size: 0.75rem; margin: 4px 0 12px; }
.info-panel-body { font-size: 0.9rem; line-height: 1.6; color: #ccc; }
.info-panel-close {
    position: absolute; top: 10px; right: 10px; background: none; border: none;
    color: #888; font-size: 1rem; cursor: pointer;
}
.info-panel-close:hover { color: #fff; }

.loading-bar-track { width: 200px; height: 3px; background: #333; margin-top: 16px; }
.loading-bar-fill { height: 100%; width: 0; background: #fff; transition: width 0.3s; }
.start-badge { color: #666; font-size: 0.7rem; letter-spacing: 0.15em; margin-bottom: 12px; }

#watercolor-overlay { display: none; }

body.riding::before,
body.riding::after {
    content: '';
    position: fixed;
    left: 0; right: 0;
    height: 8vh;
    background: #000;
    z-index: 60;
    pointer-events: none;
}
body.riding::before { top: 0; }
body.riding::after { bottom: 0; }

#ride-hud {
    position: fixed;
    bottom: 10vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, 92vw);
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 14px 18px;
    z-index: 55;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
}
#ride-hud.visible { opacity: 1; visibility: visible; }

.ride-hud-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8c8;
    margin-bottom: 6px;
}
#ride-line { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.ride-dest-row { font-size: 0.8rem; color: #aaa; margin-bottom: 10px; }
#ride-dest { color: #fff; }

.ride-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
#ride-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #00cc44, #44aacc);
    transition: width 0.15s linear;
}

.ride-hint { font-size: 0.72rem; color: #666; text-align: center; }
.ride-hint kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    color: #ccc;
    margin-right: 4px;
}

#transit-picker {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, 92vw);
    max-height: 75vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 20px;
    z-index: 120;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    pointer-events: auto;
}
#transit-picker.active { opacity: 1; visibility: visible; }

#transit-search {
    width: 100%;
    padding: 10px 12px;
    margin: 12px 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
}
#transit-search::placeholder { color: #666; }

#transit-dest-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 4px;
}

.transit-group { margin-bottom: 14px; }
.transit-group-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8c8;
    margin-bottom: 6px;
}

.transit-dest-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #eee;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.transit-dest-btn:hover {
    background: rgba(0, 204, 68, 0.15);
    border-color: rgba(0, 204, 68, 0.4);
}
.transit-dest-name { display: block; font-weight: 600; font-size: 0.9rem; }
.transit-dest-desc { display: block; font-size: 0.75rem; color: #999; margin-top: 2px; }

.transit-empty { color: #666; font-size: 0.85rem; padding: 12px 0; }
.transit-cancel-btn {
    padding: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}
.transit-cancel-btn:hover { color: #fff; border-color: #fff; }