/* ============================================
   THE BLACKWOOD CASE - Game Styles
   ============================================ */

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

body {
    background: #0a0a12;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    font-family: 'VT323', monospace;
}

/* VIEWPORT */
.game-viewport {
    width: 100%;
    max-width: 900px;
    background: #12121f;
    border: 4px solid #2a2a4a;
    box-shadow: 0 0 0 2px #0a0a12, 0 0 40px rgba(100, 80, 150, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    position: relative; /* For context menu positioning */
}

.title-bar {
    background: linear-gradient(90deg, #1a1a2e 0%, #2a2a4a 50%, #1a1a2e 100%);
    padding: 0.4rem 1rem;
    border-bottom: 1px solid #3a3a5a;
    display: flex;
    justify-content: center;
    align-items: center;
}

.title-bar h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: #c9a227;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 0.15em;
}

/* HUD BAR */
.hud-bar {
    background: linear-gradient(180deg, #12121f 0%, #0f0f1a 100%);
    padding: 0.35rem 1rem;
    border-bottom: 2px solid #3a3a5a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-bar .score { color: #8888aa; font-size: 1rem; }
.hud-right { display: flex; align-items: center; gap: 0.5rem; }
.stats-display { color: #8888aa; font-size: 1.1rem; display: flex; gap: 0.75rem; }
.stats-display span { display: flex; align-items: center; gap: 0.2rem; }

.save-btn {
    background: transparent;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: #ccccdd;
    transition: all 0.2s ease;
}
.save-btn:hover { background: #2a2a4a; border-color: #c9a227; color: #c9a227; }

/* SCENE */
.scene-container { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0a0a12; }
.scene-bg { width: 100%; height: 100%; display: block; }
.hotspot-layer { position: absolute; inset: 0; pointer-events: none; }

/* HOTSPOTS */
.hotspot { position: absolute; pointer-events: auto; cursor: pointer; transition: all 0.2s ease; }
.hotspot::after { content: ''; position: absolute; inset: -4px; border: 2px solid transparent; border-radius: 4px; transition: all 0.3s ease; }
.hotspot:hover::after { border-color: rgba(201, 162, 39, 0.6); box-shadow: 0 0 10px rgba(201, 162, 39, 0.3), inset 0 0 10px rgba(201, 162, 39, 0.1); }
.hotspot.item-glow { animation: itemPulse 2s ease-in-out infinite; }
.hotspot.item-glow::before { content: '\2726'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #c9a227; font-size: 1.5rem; text-shadow: 0 0 10px #c9a227, 0 0 20px #c9a227; animation: sparkle 1.5s ease-in-out infinite; pointer-events: none; }

@keyframes sparkle { 0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.8); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); } }
@keyframes itemPulse { 0%, 100% { filter: drop-shadow(0 0 2px rgba(201, 162, 39, 0.3)); } 50% { filter: drop-shadow(0 0 8px rgba(201, 162, 39, 0.6)); } }

/* MESSAGE BAR */
.message-bar { min-height: 3.5rem; padding: 0.75rem 1rem; background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 100%); border-top: 2px solid #2a2a4a; border-bottom: 2px solid #2a2a4a; color: #ccccdd; font-size: 1.1rem; line-height: 1.4; display: flex; align-items: center; }
.message-bar .cursor { display: inline-block; width: 0.6em; height: 1.1em; background: #c9a227; margin-left: 0.2em; animation: blink 0.8s step-end infinite; }
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* VERB BAR - Hidden by default, contextual menu used instead */
.verb-bar { display: none; }

/* CONTEXTUAL MENU */
.context-menu {
    position: absolute;
    background: linear-gradient(180deg, #1a1a2e 0%, #12121f 100%);
    border: 2px solid #3a3a5a;
    border-radius: 6px;
    padding: 0.25rem;
    z-index: 150;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    min-width: 80px;
    animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu button {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #aaaacc;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.1s ease;
}

.context-menu button:hover {
    background: linear-gradient(180deg, #2a2a46 0%, #1e1e36 100%);
    color: #c9a227;
}

.context-menu button:active {
    background: #3a3a5a;
}

/* USE WITH mode indicator */
.context-menu.use-with-mode {
    border-color: #c9a227;
}

.context-menu .use-with-label {
    padding: 0.3rem 0.75rem;
    color: #c9a227;
    font-size: 0.8rem;
    border-bottom: 1px solid #3a3a5a;
    margin-bottom: 0.25rem;
}

/* HOVER TOOLTIP */
.hover-tooltip {
    position: absolute;
    background: rgba(10, 10, 18, 0.9);
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    color: #ccccdd;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 140;
    white-space: nowrap;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hotspot hover effect enhancement */
.hotspot:hover {
    cursor: pointer;
}

/* Selected inventory item indicator */
.inv-item.use-with-selected {
    border-color: #c9a227;
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.5);
    animation: pulseSelected 1.5s ease-in-out infinite;
}

@keyframes pulseSelected {
    0%, 100% { box-shadow: 0 0 10px rgba(201, 162, 39, 0.4); }
    50% { box-shadow: 0 0 20px rgba(201, 162, 39, 0.7); }
}

/* INVENTORY */
.inventory-bar { display: flex; gap: 0.5rem; padding: 0.6rem; min-height: 70px; background: linear-gradient(180deg, #0f0f1a 0%, #12121f 100%); border-top: 2px solid #2a2a4a; flex-wrap: wrap; position: relative; padding-top: 1.5rem; }
.inventory-bar::before { content: 'INVENTORY'; position: absolute; top: 0.3rem; left: 0.6rem; font-size: 0.7rem; color: #4a4a6a; letter-spacing: 0.1em; }
.inv-item { width: 52px; height: 52px; background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%); border: 2px solid #3a3a5a; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; padding: 4px; }
.inv-item:hover { border-color: #6a6a8a; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }
.inv-item.selected { border-color: #c9a227; box-shadow: 0 0 15px rgba(201, 162, 39, 0.4); }
.inv-item svg { width: 100%; height: 100%; }

/* DIALOGUE */
.dialogue-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); display: none; flex-direction: column; justify-content: center; align-items: center; padding: 1rem; z-index: 100; overflow-y: auto; }
.dialogue-overlay.active { display: flex; }
.dialogue-box { background: linear-gradient(180deg, #1a1a2e 0%, #12121f 100%); border: 3px solid #3a3a5a; border-radius: 8px; padding: 1.5rem; max-width: 90%; width: 500px; max-height: 90%; overflow-y: auto; box-shadow: 0 0 30px rgba(0, 0, 0, 0.8); }
.dialogue-speaker { font-family: 'Cinzel', serif; color: #c9a227; font-size: 1rem; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.dialogue-text { color: #ccccdd; font-size: 1.1rem; line-height: 1.5; margin-bottom: 1.25rem; }
.dialogue-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.dialogue-choice { background: linear-gradient(180deg, #1e1e36 0%, #14142a 100%); border: 2px solid #3a3a5a; border-radius: 4px; padding: 0.75rem 1rem; color: #aaaacc; cursor: pointer; font-family: 'VT323', monospace; font-size: 1rem; text-align: left; transition: all 0.15s ease; min-height: 44px; /* Touch target */ }
.dialogue-choice:hover { background: linear-gradient(180deg, #2a2a46 0%, #1e1e36 100%); border-color: #c9a227; color: #c9a227; }
.dialogue-continue { background: linear-gradient(180deg, #2a3a2a 0%, #1a2a1a 100%); border: 2px solid #4a6a4a; color: #88aa88; }
.dialogue-continue:hover { border-color: #6a8a6a; color: #aaccaa; }

/* NOTIFICATIONS */
.notification { position: fixed; top: 1rem; right: 1rem; background: #2a2a4a; border: 2px solid #c9a227; border-radius: 4px; padding: 0.75rem 1.25rem; color: #c9a227; font-family: 'VT323', monospace; font-size: 1rem; z-index: 200; animation: fadeInOut 2s ease forwards; }
@keyframes fadeInOut { 0% { opacity: 0; transform: translateY(-10px); } 15% { opacity: 1; transform: translateY(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }

/* TRANSITIONS */
.scene-container.transitioning .scene-bg { animation: fadeScene 0.5s ease; }
@keyframes fadeScene { 0%, 40% { opacity: 0; filter: brightness(0); } 100% { opacity: 1; filter: brightness(1); } }

/* LOADING */
.loading-screen { position: fixed; inset: 0; background: #0a0a12; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 1000; color: #c9a227; font-family: 'Cinzel', serif; }
.loading-screen h1 { font-size: 2rem; margin-bottom: 1rem; letter-spacing: 0.2em; }
.loading-screen .spinner { width: 40px; height: 40px; border: 3px solid #2a2a4a; border-top-color: #c9a227; border-radius: 50%; animation: spin 1s linear infinite; }
.loading-screen .status { margin-top: 1rem; font-family: 'VT323', monospace; color: #8888aa; }
.loading-screen .act-title { margin-top: 2rem; font-size: 1.4rem; color: #ccccdd; letter-spacing: 0.15em; }
.loading-screen .loading-footer { position: absolute; bottom: 2rem; font-family: 'VT323', monospace; font-size: 0.95rem; color: #6666aa; }
.loading-screen .loading-footer a { color: #8888cc; text-decoration: none; transition: color 0.2s ease; }
.loading-screen .loading-footer a:hover { color: #c9a227; }
@keyframes spin { to { transform: rotate(360deg); } }

/* MOBILE */
@media (max-width: 600px) {
    .verb-bar button { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
    .message-bar { font-size: 0.95rem; }
}

/* PORTRAIT MODE - taller viewport for dialogue */
@media (orientation: portrait), (max-aspect-ratio: 3/4) {
    body {
        padding: 0.5rem;
        align-items: flex-start;
    }
    
    .game-viewport {
        max-width: 100%;
    }
    
    /* Taller viewport that clips the scene, scrollable to see edges */
    .scene-container {
        aspect-ratio: 4 / 5;
        overflow-x: scroll;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* SVG and hotspot layer need to be wider than container */
    /* They sit inside a wrapper that can scroll */
    .scene-bg {
        width: auto;
        height: 100%;
        aspect-ratio: 16 / 10;
        display: block;
    }
    
    /* Hotspot layer matches the SVG dimensions */
    .hotspot-layer {
        position: absolute;
        top: 0;
        left: 0;
        width: auto;
        height: 100%;
        aspect-ratio: 16 / 10;
    }
    
    /* Dialogue adjustments for portrait - fixed to viewport, not scene */
    .dialogue-overlay {
        position: fixed;
        inset: 0;
        padding: 0.75rem;
        background: rgba(0, 0, 0, 0.9);
    }
    
    .dialogue-box {
        width: 95%;
        max-width: 500px;
        max-height: 85%;
        padding: 1rem;
    }
    
    .dialogue-text {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .dialogue-choice {
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
        min-height: 48px; /* Larger touch target on mobile */
    }
    
    /* Context menu adjustments for portrait */
    .context-menu {
        min-width: 100px;
    }
    
    .context-menu button {
        padding: 0.6rem 1rem;
        font-size: 1.05rem;
        min-height: 44px;
    }
    
    /* Smaller title on portrait */
    .title-bar h1 {
        font-size: 0.95rem;
    }
    
    /* HUD adjustments */
    .hud-bar {
        padding: 0.25rem 0.5rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .stats-display {
        font-size: 0.9rem;
    }
    
    .hud-bar .score {
        font-size: 0.9rem;
    }
    
    .save-btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.9rem;
    }
    
    /* Message bar */
    .message-bar {
        min-height: 3rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Inventory - smaller items */
    .inventory-bar {
        padding: 0.4rem;
        padding-top: 1.2rem;
        min-height: 60px;
        gap: 0.35rem;
    }
    
    .inventory-bar::before {
        font-size: 0.6rem;
        top: 0.2rem;
        left: 0.4rem;
    }
    
    .inv-item {
        width: 44px;
        height: 44px;
    }
}

/* Extra small portrait screens */
@media (orientation: portrait) and (max-width: 400px) {
    .scene-container {
        aspect-ratio: 3 / 4;
    }
    
    .context-menu button {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
    
    .dialogue-choice {
        font-size: 0.9rem;
    }
}

/* Settings Modal */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.settings-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.settings-modal {
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    border: 2px solid #c9a227;
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 280px;
    max-width: 90%;
    box-shadow: 0 0 30px rgba(201, 162, 39, 0.3);
}

.settings-modal h2 {
    font-family: 'Cinzel', serif;
    color: #c9a227;
    font-size: 1.3rem;
    margin: 0 0 1.25rem 0;
    text-align: center;
    letter-spacing: 0.1em;
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #2a2a4a;
}

.settings-option:last-of-type {
    border-bottom: none;
}

.settings-option label {
    color: #ccccdd;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background: #2a2a4a;
    border: 2px solid #3a3a5a;
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-toggle.active {
    background: #3a5a4a;
    border-color: #c9a227;
}

.settings-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #8888aa;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.settings-toggle.active::after {
    left: 26px;
    background: #c9a227;
}

.settings-close {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.75rem;
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a3a 100%);
    border: 2px solid #3a3a5a;
    border-radius: 4px;
    color: #ccccdd;
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-close:hover {
    background: linear-gradient(180deg, #3a3a5a 0%, #2a2a4a 100%);
    border-color: #c9a227;
    color: #c9a227;
}
