/* --- VIEWPORT & CENTERING --- */
html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background-color: #000;
    font-family: 'VT323', monospace;
    color: #FFF;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-user-select: none;
    -ms-user-select: none; 
    user-select: none;
}

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

#viewport-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- START SCREEN --- */
#start-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}
#start-screen-menu {
    text-align: center;
    padding: 40px;
    background: #111;
    border: 4px solid #444;
}
#start-screen-menu h1 {
    font-size: 48px;
    color: #00FFFF;
    margin: 0;
}
#start-screen-menu p {
    font-size: 24px;
    color: #999;
}
#start-screen-menu button {
    font-family: 'VT323', monospace;
    font-size: 28px;
    background: #555;
    color: #FFF;
    border: 2px solid #888;
    padding: 15px 30px;
    margin: 10px;
    cursor: pointer;
    width: 300px;
}
#start-screen-menu button:hover { background: #777; }

.hidden {
    display: none !important;
}

/* --- THE GAME WORLD & SCENERY --- */
#game-world {
    position: relative;
    width: 1280px; 
    height: 800px;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1280 / 800; 
    background-color: #111;
    overflow: hidden; 
    outline: 4px solid #333;
    transition: opacity 0.5s linear;
}

#world-layers {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
}

#room-background, #room-hotspots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#room-hotspots {
    cursor: crosshair;
    pointer-events: auto;
}

#room-background {
    pointer-events: none;
}

#exit-game-button {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5000; 
    background-color: #A00;
    color: #FFF;
    padding: 8px 15px;
    text-decoration: none;
    font-size: 20px;
    border: 3px solid #FF5555;
    cursor: pointer;
    box-shadow: 2px 2px 0px #700;
    pointer-events: auto;
}
#exit-game-button:hover { background-color: #C00; }

/* --- THE HOTSPOTS --- */
.hotspot {
    position: absolute;
    cursor: pointer;
    border: 3px solid transparent;
    pointer-events: auto; 
}
.hotspot:hover {
    border: 3px solid #00FFFF; 
}

/* --- THE CHARACTER & ANIMATION --- */
#character, #companion {
    position: absolute;
    bottom: 100px;
    left: 600px;  
    width: 64px; 
    height: 128px; 
    pointer-events: none;
}

#companion {
    left: 540px; 
    pointer-events: auto; 
    cursor: pointer; 
    z-index: 100;
}

#sprite, #companion-sprite {
    width: 100%;
    height: 100%;
    background-image: url('https://placehold.co/256x128/ff00ff/000000?text=Spade+Sprite+Sheet');
    background-repeat: no-repeat;
}

/* Companion Sprite Sheet (Phill) */
#companion-sprite {
    background-image: url('https://placehold.co/256x128/00ff00/000000?text=Phill+Sprite+Sheet');
}

/* Character States */
#character.is-idle #sprite, #companion.is-idle #companion-sprite { 
    animation: idle-anim 1.5s steps(2) infinite; 
}
#character.is-walking #sprite, #companion.is-walking #companion-sprite { 
    animation: walk-anim 0.8s steps(4) infinite; 
}
#character.is-facing-left #sprite, #companion.is-facing-left #companion-sprite { 
    transform: scaleX(-1); 
}

#companion.is-rushing #companion-sprite {
    animation: walk-anim 0.4s steps(4) infinite; 
}

/* Reminder: Make the stumble logic after finishing the sprites */
#companion.is-stumbling #companion-sprite { background-image: url('https://placehold.co/256x128/00ff00/000000?text=Phill+Stumble')
}

@keyframes idle-anim {
    from { background-position: 0px; }
    to   { background-position: -128px; }
}
@keyframes walk-anim {
    from { background-position: -128px; }
    to   { background-position: -384px; }
}

/* --- THE VERB UI --- */
#verb-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #222;
    border-top: 4px solid #444;
    padding: 10px;
    text-align: center;
    z-index: 2000; 
}
.verb-button {
    font-family: 'VT323', monospace;
    font-size: 24px;
    background: #555;
    color: #FFF;
    border: 2px solid #888;
    padding: 10px 20px;
    margin: 0 10px;
    cursor: pointer;
}
.verb-button:hover { background: #777; }
.verb-button.active {
    background: #00FFFF;
    color: #000;
    border-color: #FFF;
}

/* --- THE MODAL --- */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); 
    display: flex;
    justify-content: center;
    align-items: flex-end; 
    z-index: 3000; 
}
#modal-content {
    background: #333;
    border: 4px solid #888;
    padding: 20px;
    width: 80%;
    max-width: 1000px; 
    position: relative;
    box-shadow: 0 0 20px #000;
    display: flex; 
    margin-bottom: 20px;
}

#modal-portrait {
    width: 150px;
    height: 150px;
    background: #111;
    border: 3px solid #666;
    margin-right: 20px;
    flex-shrink: 0;
}
#modal-portrait.hidden {
    display: none;
}

#modal-text-content {
    flex-grow: 1; 
    position: relative;
    padding-right: 40px;
}

#modal-close-btn {
    position: absolute;
    top: -10px;
    right: -10px; 
    font-family: 'VT323', monospace;
    font-size: 20px;
    background: #800;
    color: #FFF;
    border: 2px solid #F00;
    cursor: pointer;
    z-index: 10; 
}
#modal-title { 
    font-size: 32px; 
    margin: 0;
    color: #00FFFF;
}
#modal-body {
    font-size: 22px;
}
#modal-body img { 
    max-width: 100%; 
    pointer-events: auto;
}

/* --- DIALOGUE OPTION STYLES --- */
.dialogue-prompt {
    margin-bottom: 20px;
    font-style: italic;
}
.dialogue-option {
    font-family: 'VT323', monospace;
    font-size: 24px;
    background: #555;
    color: #FFF;
    border: 2px solid #888;
    padding: 10px 15px;
    margin: 5px 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    display: block;
}
.dialogue-option:hover {
    background: #777;
    border-color: #FFF;
}