/* --- Basic Setup & Typography --- */
body {
    background-color: #0d1117;
    color: #c9d1d9;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    -webkit-font-smoothing: none;
    font-smooth: never;
}

h1, h2, h3, h4 {
    margin: 0;
    padding: 0;
    color: #58a6ff;
    text-shadow: 2px 2px #0d1117;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-bottom: 20px; }
h3 { margin-bottom: 10px; font-size: 1rem; }
h4 { margin-bottom: 8px; font-size: 0.9rem; }

/* --- Main Layout (Using CSS Grid) --- */
#game-container {
    display: grid;
    grid-template-columns: auto 300px; /* A flexible game column and a fixed info column */
    grid-template-rows: 1fr;
    gap: 20px;
    width: 100%;
    height: 90vh;
    max-width: 1200px;
    max-height: 700px;
}

#play-box-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    min-width: 0; /* Required for grid layout */
    min-height: 0; /* Required for grid layout */
    max-height: 100%;
}

#info-panel {
    display: flex;
    flex-direction: column;
    background-color: #161b22;
    border: 2px solid #30363d;
    padding: 20px;
    position: relative;
}

/* --- Game Canvas --- */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* --- Popups & Overlays --- */
.hidden { display: none !important; }

#popup-container, .powerup-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(13, 17, 23, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

#popup-box {
    max-width: 80%;
    max-height: 90%;
    overflow-y: auto;
}

/* --- UI Elements & Buttons --- */
.button {
    background-color: #238636;
    color: white;
    border: 1px solid #30363d;
    padding: 10px 15px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    margin-top: 20px;
}
.button:hover {
    background-color: #2ea043;
}

#status-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}
#current-rule {
    background-color: #0d1117;
    border: 1px solid #30363d;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.4;
}
#message-container {
    margin-top: auto;
    font-size: 1rem;
    min-height: 60px;
    text-align: center;
}

/* --- Character Selector --- */
.char-display-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}
#char-canvas {
    width: 64px;
    height: 64px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    image-rendering: pixelated;
}
.char-nav-button {
    font-size: 1.5rem;
    background: none;
    border: none;
    color: #c9d1d9;
    cursor: pointer;
}

/* --- Power-up & List Styles --- */
.powerup-screen ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 90%;
    max-height: 70%;
    overflow-y: auto;
}
.powerup-screen li {
    padding: 15px;
    border: 1px solid #30363d;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    background-color: #0d1117;
}
.powerup-screen li:hover,
.powerup-screen li.highlighted {
    background-color: #238636;
    border-color: #c9d1d9;
}
.powerup-screen li.active {
    background-color: #30363d;
    color: #58a6ff;
}
.powerup-screen li.used {
    text-decoration: line-through;
    color: #8b949e;
}
.unpause-text {
    margin-top: 20px;
    font-size: 0.8rem;
    color: #8b949e;
}

/* --- Enemy Info Screen --- */
#enemy-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
}
.enemy-info-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}
.enemy-info-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}
.enemy-info-desc {
    font-size: 0.7rem;
}

/* --- Teacher Mode Styles --- */
#teacher-mode-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background-color: #30363d;
    color: #8b949e;
    border: 1px solid #444c56;
}
#teacher-mode-btn:hover {
    background-color: #444c56;
}
#teacher-mode-container {
    flex-direction: column;
    justify-content: flex-start;
    padding: 15px;
    font-size: 0.8rem;
}
#teacher-rules-form {
    display: flex;
    gap: 20px;
    width: 100%;
    height: calc(100% - 120px);
    overflow-y: auto;
}
.teacher-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}
.teacher-column h4 {
    color: #58a6ff;
    margin: 10px 0 5px 0;
    border-bottom: 1px solid #238636;
    padding-bottom: 5px;
}
#teacher-code-output {
    background-color: #0d1117;
    padding: 10px;
    border: 1px solid #444c56;
    min-height: 50px;
    word-break: break-all;
    font-size: 1rem;
    text-align: center;
}
#generate-code-btn {
    margin-top: auto;
}
#teacher-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.teacher-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Add these rules to the bottom of style.css */
.slider-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.slider-value-label {
    min-width: 2ch;
    text-align: right;
    color: #58a6ff;
}

/* Add this rule to style.css */
.dropdown-group {
    display: inline-block;
    margin-left: 10px;
}