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

:root {
    --bg-dark: #1a1410;
    --bg-medium: #2d2318;
    --bg-light: #3d3020;
    --accent-gold: #d4a847;
    --accent-orange: #c76f30;
    --accent-cream: #e8dcc4;
    --text-primary: #f5ebe0;
    --text-secondary: #c9b99a;
    --border-dark: #1a1410;
}

body {
    font-family: 'VT323', monospace;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-medium) 100%);
    border: 3px solid var(--accent-gold);
    border-radius: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(10px, 2.5vw, 16px);
    color: var(--accent-gold);
    text-shadow: 2px 2px 0 var(--border-dark), -1px -1px 0 var(--accent-orange);
}

.location-name {
    font-size: clamp(14px, 3vw, 20px);
    color: var(--accent-cream);
    background: var(--bg-dark);
    padding: 6px 16px;
    border-radius: 4px;
    border: 2px solid var(--accent-orange);
}

.menu-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 8px 16px;
    background: var(--accent-orange);
    color: var(--text-primary);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: var(--accent-gold);
    transform: scale(1.05);
}

/* Main Game Area */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 3/2;
    max-height: 450px;
    background: var(--bg-dark);
    border: 4px solid var(--accent-gold);
    border-radius: 8px;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.scene-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.player-sprite {
    position: absolute;
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transform: translateX(-50%);
    z-index: 10;
    animation: idle-bounce 1s ease-in-out infinite;
}

@keyframes idle-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-3px); }
}

.npc-sprite {
    position: absolute;
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s;
    transform: translate(-50%, -50%);
}

.npc-sprite:hover {
    filter: brightness(1.2) drop-shadow(0 0 8px var(--accent-gold));
    transform: translate(-50%, -50%) scale(1.1);
}

.hotspot {
    position: absolute;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotspot:hover {
    background: rgba(212, 168, 71, 0.3);
    box-shadow: 0 0 10px var(--accent-gold);
}

.hotspot.travel:hover {
    background: rgba(71, 168, 212, 0.3);
    box-shadow: 0 0 10px #47a8d4;
}

.hotspot.pickup:hover {
    background: rgba(71, 212, 100, 0.4);
    box-shadow: 0 0 10px #47d464;
}

.hotspot.dig:hover {
    background: rgba(212, 168, 71, 0.5);
    box-shadow: 0 0 15px var(--accent-gold);
}

.hotspot-sprite {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    pointer-events: none;
}

/* Message Box */
.message-box {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-medium) 100%);
    border: 3px solid var(--accent-gold);
    border-radius: 8px;
}

.message-portrait {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border: 2px solid var(--accent-orange);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-dark);
}

.message-portrait img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.message-text {
    font-size: clamp(16px, 3vw, 22px);
    line-height: 1.4;
    color: var(--text-primary);
}

/* Dialogue Overlay */
.dialogue-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.dialogue-box {
    width: 100%;
    max-width: 800px;
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-dark) 100%);
    border: 4px solid var(--accent-gold);
    border-radius: 12px;
    padding: 20px;
    animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.dialogue-header {
    margin-bottom: 12px;
}

.dialogue-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--accent-gold);
}

.dialogue-text {
    font-size: clamp(18px, 4vw, 24px);
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 20px;
    min-height: 60px;
}

.dialogue-responses {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dialogue-response {
    font-family: 'VT323', monospace;
    font-size: clamp(16px, 3vw, 20px);
    padding: 12px 20px;
    background: var(--bg-medium);
    color: var(--accent-cream);
    border: 2px solid var(--accent-orange);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.dialogue-response:hover {
    background: var(--accent-orange);
    color: var(--text-primary);
    transform: translateX(10px);
}

/* Inventory Bar */
.inventory-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-dark) 100%);
    border: 3px solid var(--accent-gold);
    border-radius: 8px;
    overflow-x: auto;
}

.inventory-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.inventory-items {
    display: flex;
    gap: 10px;
    flex: 1;
    overflow-x: auto;
    padding: 5px;
}

.inventory-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: var(--bg-light);
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.inventory-item:hover {
    border-color: var(--accent-gold);
    transform: scale(1.1);
}

.inventory-item.selected {
    border-color: var(--accent-gold);
    box-shadow: 0 0 12px var(--accent-gold);
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { box-shadow: 0 0 8px var(--accent-gold); }
    to { box-shadow: 0 0 16px var(--accent-gold); }
}

.inventory-item img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.item-name {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.empty-inventory {
    font-size: 16px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer */
.game-footer {
    text-align: center;
    padding: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.game-footer a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color 0.2s;
}

.game-footer a:hover {
    color: var(--accent-orange);
}

/* Victory Screen */
.victory-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, var(--accent-gold) 0%, var(--bg-dark) 70%);
    padding: 20px;
}

.victory-content {
    text-align: center;
    background: var(--bg-medium);
    border: 4px solid var(--accent-gold);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    animation: victory-pop 0.5s ease-out;
}

@keyframes victory-pop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.victory-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(20px, 5vw, 32px);
    color: var(--accent-gold);
    text-shadow: 3px 3px 0 var(--border-dark);
    margin-bottom: 20px;
    animation: golden-glow 1s ease-in-out infinite alternate;
}

@keyframes golden-glow {
    from { text-shadow: 3px 3px 0 var(--border-dark), 0 0 10px var(--accent-gold); }
    to { text-shadow: 3px 3px 0 var(--border-dark), 0 0 30px var(--accent-gold); }
}

.victory-image {
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 4px solid var(--accent-gold);
    border-radius: 12px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.victory-text {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 15px;
    line-height: 1.5;
}

.victory-subtext {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.restart-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    padding: 15px 30px;
    background: var(--accent-gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.restart-btn:hover {
    background: var(--accent-orange);
    transform: scale(1.1);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .game-header {
        justify-content: center;
    }
    
    .game-canvas {
        aspect-ratio: 4/3;
    }
    
    .player-sprite, .npc-sprite {
        width: 56px;
        height: 56px;
    }
    
    .message-portrait {
        width: 48px;
        height: 48px;
    }
    
    .inventory-item img {
        width: 40px;
        height: 40px;
    }
}