/* ============================================================
   Stroll — A Peaceful City Walk
   Enhanced UI styling with HUD, menus, and effects
   ============================================================ */

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

body {
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'Georgia', 'Times New Roman', serif;
    cursor: crosshair;
}

canvas {
    display: block;
}

/* ── UI Overlay ─────────────────────────────────────────────── */

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#title {
    position: absolute;
    top: 24px;
    left: 32px;
    font-size: 28px;
    font-weight: bold;
    color: rgba(255, 248, 230, 0.85);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 4px;
    text-transform: lowercase;
}

#subtitle {
    position: absolute;
    top: 56px;
    left: 34px;
    font-size: 12px;
    color: rgba(255, 248, 230, 0.5);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
    font-style: italic;
}

#controls-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 248, 230, 0.6);
    font-size: 13px;
    line-height: 1.8;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: opacity 1.5s ease;
}

#controls-hint .key,
.key {
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Thought Bubble ─────────────────────────────────────────── */

#thought-bubble {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 248, 230, 0.75);
    font-size: 16px;
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 2s ease;
    max-width: 400px;
}

#thought-bubble.visible {
    opacity: 1;
}

/* ── Sound Toggle ───────────────────────────────────────────── */

#sound-toggle {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 24px;
    cursor: pointer;
    pointer-events: all;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    user-select: none;
}

#sound-toggle:hover,
#sound-toggle:focus {
    opacity: 1;
    outline: none;
}

/* ── Crosshair ──────────────────────────────────────────────── */

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    background: rgba(255, 248, 230, 0.3);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.playing #crosshair {
    opacity: 1;
}

/* ── HUD ────────────────────────────────────────────────────── */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 24px;
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    transition: opacity 1s ease;
}

body.playing #hud {
    opacity: 1;
}

#hud-left, #hud-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 70px;
}

#hud-center {
    display: flex;
    justify-content: center;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 248, 230, 0.7);
    font-size: 13px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.hud-icon {
    font-size: 14px;
}

/* ── Compass ────────────────────────────────────────────────── */

#compass {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 12px;
}

#compass-ring {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 248, 230, 0.2);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#compass-needle {
    width: 2px;
    height: 16px;
    background: linear-gradient(to bottom, #ff6b6b 50%, rgba(255, 248, 230, 0.4) 50%);
    border-radius: 1px;
    transition: transform 0.15s ease;
}

#compass-n {
    position: absolute;
    top: -8px;
    font-size: 8px;
    color: rgba(255, 248, 230, 0.5);
    font-family: 'Courier New', monospace;
}

#compass-dir {
    font-size: 10px;
    color: rgba(255, 248, 230, 0.5);
    margin-top: 4px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

/* ── Toast Notifications ────────────────────────────────────── */

#toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 18px;
    color: rgba(255, 248, 230, 0.9);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    opacity: 0;
    min-width: 250px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-achievement {
    border-color: rgba(255, 215, 64, 0.3);
    background: rgba(40, 30, 10, 0.85);
}

.toast-discovery {
    border-color: rgba(128, 222, 234, 0.3);
    background: rgba(10, 30, 40, 0.85);
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
}

.toast-message {
    font-size: 11px;
    opacity: 0.7;
    font-style: italic;
    margin-top: 2px;
}

/* ── Photo Mode ─────────────────────────────────────────────── */

#photo-mode-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

#photo-mode-header {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 248, 230, 0.9);
    font-size: 18px;
    letter-spacing: 3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#photo-mode-controls {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 248, 230, 0.6);
    font-size: 12px;
    line-height: 1.8;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

#photo-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
}

/* ── Meditation Mode ────────────────────────────────────────── */

#meditation-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 20;
    pointer-events: none;
    text-align: center;
}

#meditation-header {
    margin-top: 24px;
    color: rgba(255, 248, 230, 0.8);
    font-size: 18px;
    letter-spacing: 3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#meditation-hint {
    margin-top: 8px;
    color: rgba(255, 248, 230, 0.4);
    font-size: 12px;
    font-style: italic;
}

/* ── Breathing Guide ────────────────────────────────────────── */

#breathing-guide {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

#breathing-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(255, 248, 230, 0.3);
    transition: transform 1s ease, opacity 1s ease;
}

#breathing-text {
    margin-top: 12px;
    color: rgba(255, 248, 230, 0.6);
    font-size: 14px;
    font-style: italic;
    letter-spacing: 2px;
}

/* ── Pause Menu ─────────────────────────────────────────────── */

#pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.8);
    backdrop-filter: blur(8px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pause-content {
    text-align: center;
    color: rgba(255, 248, 230, 0.9);
    max-width: 400px;
}

#pause-title {
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 24px;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 248, 230, 0.9);
    padding: 10px 32px;
    border-radius: 8px;
    font-family: 'Georgia', serif;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-bottom: 24px;
}

.pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#pause-controls-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 248, 230, 0.5);
    margin-top: 16px;
}

/* ── Discovery Journal ──────────────────────────────────────── */

#journal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(8px);
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
}

#journal-content {
    background: rgba(30, 25, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    color: rgba(255, 248, 230, 0.9);
}

#journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.journal-btn {
    background: none;
    border: none;
    color: rgba(255, 248, 230, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.journal-btn:hover {
    color: rgba(255, 248, 230, 1);
}

#journal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.journal-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 248, 230, 0.6);
    padding: 6px 16px;
    border-radius: 6px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.journal-tab.active {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 248, 230, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

.journal-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.journal-item.locked {
    opacity: 0.4;
}

.journal-item.unlocked {
    opacity: 1;
}

.journal-empty {
    text-align: center;
    color: rgba(255, 248, 230, 0.4);
    font-style: italic;
    padding: 24px;
}

.ach-icon {
    font-size: 18px;
}

.ach-name {
    font-weight: bold;
    letter-spacing: 1px;
}

.ach-desc {
    font-size: 12px;
    opacity: 0.6;
    font-style: italic;
    margin-left: auto;
}

/* ── Cinematic Overlay ──────────────────────────────────────── */

#cinematic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 1s ease;
}

#cinematic-title {
    font-size: 56px;
    font-weight: bold;
    color: rgba(255, 248, 230, 0.95);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    letter-spacing: 12px;
    text-transform: lowercase;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#cinematic-subtitle {
    font-size: 16px;
    color: rgba(255, 248, 230, 0.6);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: 4px;
    font-style: italic;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#cinematic-skip {
    position: absolute;
    bottom: 32px;
    color: rgba(255, 248, 230, 0.3);
    font-size: 12px;
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite;
}

/* ── Loading Screen ─────────────────────────────────────────── */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 1.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-content {
    text-align: center;
}

#loading-title {
    font-size: 64px;
    margin-bottom: 24px;
}

#loading-text {
    color: rgba(255, 248, 230, 0.7);
    font-size: 18px;
    font-style: italic;
    letter-spacing: 2px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

#loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

#loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #fca311, #ffba49);
    border-radius: 2px;
    transition: width 0.3s ease;
}

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

/* ── Mobile Controls ────────────────────────────────────────── */

#mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 20;
    pointer-events: none;
}

#joystick-area {
    position: absolute;
    bottom: 40px;
    left: 40px;
    pointer-events: all;
}

#joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-thumb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: absolute;
    transition: transform 0.1s ease;
}

/* Mobile detection */
@media (max-width: 768px), (hover: none) {
    #mobile-controls {
        display: block;
    }
    #controls-hint {
        display: none;
    }
    #hud-left, #hud-right {
        margin-top: 50px;
    }
}

/* ── Playing State ──────────────────────────────────────────── */

body.playing {
    cursor: none;
}

/* ── Scrollbar styling for journal ──────────────────────────── */

#journal-content::-webkit-scrollbar {
    width: 4px;
}

#journal-content::-webkit-scrollbar-track {
    background: transparent;
}

#journal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}
