:root {
    --bg-color: #1a1a1a;
    --panel-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --accent-color: #4a9eff;
    --wall-color: #000000;
    --lit-color: #ffffca;
    --bulb-color: #ffcc00;
    --bulb-glow: rgba(255, 230, 0, 0.4);
    --error-color: #ff4d4d;
    --border-color: #444;
    --menu-height: 40px;
    --status-height: 30px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.light-theme {
    --bg-color: #f5f5f5;
    --panel-bg: #ffffff;
    --text-color: #222222;
    --accent-color: #0066cc;
    --wall-color: #333333;
    --lit-color: #fff9c4;
    --border-color: #cccccc;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Menu Bar */
.menu-bar {
    height: var(--menu-height);
    background-color: var(--panel-bg);
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.menu-item {
    position: relative;
    height: 100%;
}

.menu-item > button {
    background: none;
    border: none;
    color: inherit;
    padding: 0 15px;
    height: 100%;
    cursor: pointer;
    font-size: 14px;
}

.menu-item > button:hover,
.menu-item > button:focus {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    list-style: none;
    min-width: 180px;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.menu-item:hover .dropdown,
.menu-item button:focus + .dropdown,
.dropdown:focus-within {
    display: block;
}

.dropdown li button {
    width: 100%;
    text-align: left;
    padding: 8px 15px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.dropdown li button:hover {
    background-color: var(--accent-color);
    color: white;
}

.shortcut {
    opacity: 0.6;
    font-size: 11px;
    margin-left: 10px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

/* Game Container */
#game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
    background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

#canvas-wrapper {
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    background-color: var(--panel-bg);
    border-radius: 4px;
    overflow: hidden;
}

#game-canvas {
    display: block;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

#resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--accent-color) 50%);
}

/* Status Bar */
#status-bar {
    height: var(--status-height);
    background-color: var(--panel-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    font-size: 12px;
}

/* Modals */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

#modal-content {
    background-color: var(--panel-bg);
    padding: 30px;
    border-radius: 8px;
    position: relative;
    min-width: 320px;
    border: 1px solid var(--border-color);
}

.hidden {
    display: none !important;
}

#close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: inherit;
    font-size: 24px;
    cursor: pointer;
}

.dialog-row {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-row select {
    padding: 5px 10px;
    background-color: var(--panel-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.primary-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
}

.primary-btn:hover {
    filter: brightness(1.1);
}

.modal-inner p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.modal-inner ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.modal-inner li {
    margin-bottom: 5px;
}

/* Print Styles */
@media print {
    .menu-bar, #status-bar, #resize-handle {
        display: none !important;
    }
    body {
        background: white;
    }
    #game-container {
        padding: 0;
    }
    #canvas-wrapper {
        box-shadow: none;
        border: 1px solid black;
    }
}
