@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', monospace;
    background: #000;
    color: #fff;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* Title Screen */
#title-screen {
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    flex-direction: column;
}

.title-content {
    text-align: center;
    padding: 2rem;
}

.title-content h1 {
    font-size: 3rem;
    color: #ffd700;
    text-shadow: 3px 3px 0px #8b4513;
    margin-bottom: 1rem;
    animation: glow 2s ease-in-out infinite alternate;
}

.title-content h2 {
    font-size: 1.2rem;
    color: #87ceeb;
    margin-bottom: 2rem;
}

.subtitle {
    font-size: 0.8rem;
    color: #ddd;
    margin-bottom: 0.5rem;
}

.author {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 3rem;
}

@keyframes glow {
    from { text-shadow: 3px 3px 0px #8b4513, 0 0 10px #ffd700; }
    to { text-shadow: 3px 3px 0px #8b4513, 0 0 20px #ffd700, 0 0 30px #ffd700; }
}

/* Buttons */
.pixel-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    padding: 1rem 2rem;
    margin: 0.5rem;
    background: #4a4a4a;
    color: #fff;
    border: 3px solid #666;
    cursor: pointer;
    transition: all 0.1s;
    text-transform: uppercase;
}

.pixel-button:hover {
    background: #666;
    border-color: #888;
    transform: translateY(-2px);
}

.pixel-button:active {
    transform: translateY(0);
    background: #333;
}

/* Instructions Screen */
#instructions-screen {
    background: #1a1a2e;
    flex-direction: column;
}

.instructions-content {
    max-width: 800px;
    padding: 2rem;
    text-align: center;
}

.instructions-content h2 {
    color: #ffd700;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.instructions-content p {
    font-size: 0.8rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #ddd;
}

.instructions-content ul {
    text-align: left;
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.instructions-content li {
    font-size: 0.7rem;
    margin-bottom: 0.8rem;
    color: #ccc;
}

/* Game Screen */
#game-screen {
    background: #000;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
}

#game-area {
    display: flex;
    width: 100%;
    height: 100%;
}

#scene-container {
    flex: 2;
    position: relative;
    background: #222;
    border: 2px solid #444;
}

#scene-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

#character {
    position: absolute;
    width: 64px;
    height: 64px;
    background-image: url('assets/gwydion_pixel_art.png');
    background-size: contain;
    background-repeat: no-repeat;
    bottom: 20%;
    left: 30%;
    transition: all 0.5s ease;
    image-rendering: pixelated;
}

#interactive-objects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.interactive-object {
    position: absolute;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.interactive-object:hover {
    border-color: #ffd700;
    animation: pulse 1s infinite;
}

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

#ui-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    border-left: 2px solid #444;
}

#text-box {
    flex: 1;
    padding: 1rem;
    background: #2a2a2a;
    border-bottom: 2px solid #444;
    overflow-y: auto;
}

#game-text {
    font-size: 0.7rem;
    line-height: 1.6;
    color: #ddd;
}

#inventory {
    flex: 1;
    padding: 1rem;
    background: #333;
    border-bottom: 2px solid #444;
}

#inventory h3 {
    font-size: 0.8rem;
    color: #ffd700;
    margin-bottom: 1rem;
}

#inventory-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.5rem;
}

.inventory-item {
    width: 50px;
    height: 50px;
    background: #444;
    border: 2px solid #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    transition: all 0.2s;
    image-rendering: pixelated;
}

.inventory-item:hover {
    background: #555;
    border-color: #ffd700;
}

.inventory-item.selected {
    border-color: #ff6b6b;
    background: #4a2a2a;
}

#controls {
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.control-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    padding: 0.8rem;
    background: #4a4a4a;
    color: #fff;
    border: 2px solid #666;
    cursor: pointer;
    transition: all 0.1s;
}

.control-button:hover {
    background: #666;
    border-color: #888;
}

.control-button.active {
    background: #ffd700;
    color: #000;
    border-color: #ffed4e;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2a2a2a;
    border: 3px solid #666;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    color: #ffd700;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.modal-content p {
    font-size: 0.8rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: #ddd;
}

#puzzle-equation {
    font-size: 1.5rem;
    color: #87ceeb;
    margin: 2rem 0;
    padding: 1rem;
    background: #1a1a1a;
    border: 2px solid #444;
    font-family: 'Courier New', monospace;
}

#puzzle-answer {
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    padding: 1rem;
    width: 200px;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #666;
    text-align: center;
    margin-bottom: 2rem;
}

#puzzle-answer:focus {
    outline: none;
    border-color: #ffd700;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title-content h1 {
        font-size: 2rem;
    }
    
    .title-content h2 {
        font-size: 1rem;
    }
    
    #game-area {
        flex-direction: column;
    }
    
    #scene-container {
        flex: 2;
    }
    
    #ui-container {
        flex: 1;
        flex-direction: row;
    }
    
    #text-box, #inventory, #controls {
        flex: 1;
    }
}

