* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #232427;
    color: #fff;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.game-container {
    max-width: 950px;
    width: 100%;
    text-align: center;
}

header {
    margin-bottom: 25px;
}

/* Base Structural Container Map Matrix */
.map-grid-container {
    position: relative;
    width: 100%;
    background-color: #3b5e23; /* Dark grass exterior background buffer zone */
    padding: 15px;
    border-radius: 14px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
}

/* ASYMMETRIC FLOOR PLAN BLUEPRINT ENGINE */
.base-floorplan {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 140px);
    gap: 12px;
    width: 100%;
}

/* Custom Room Archetypes matching structural layout dimensions */
.room {
    position: relative;
    border: 6px solid #5c4033; /* Thick brown walls mimicking your layout template borders */
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, brightness 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.room:hover {
    transform: scale(1.015);
    filter: brightness(1.15);
}

/* Top-Left Isolated Room Assignment */
.watchtower-room {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    background-color: #7a5435;
}

/* Massive Central Grass Courtyard Allocation Space */
.farms-courtyard {
    grid-column: 1 / 4;
    grid-row: 2 / 3;
    background-color: #55823b; /* Grass green interior biome setting */
    background-image: radial-gradient(#619443 20%, transparent 20%),
                      radial-gradient(#4b7534 20%, transparent 20%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

/* SPECIALIZED TILED CHECKERBOARD ARCHITECTURE WING */
.blacksmith-checkerboard {
    grid-column: 2 / 3;
    grid-row: 3 / 4;
    background-color: #ffffff;
    background-image: linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%, #111),
                      linear-gradient(45deg, #111 25%, #fff 25%, #fff 75%, #111 75%, #111);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
}

.blacksmith-checkerboard .room-label h3,
.blacksmith-checkerboard .room-label span {
    background-color: rgba(0, 0, 0, 0.85);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Right Wing Room Sequence Distributions */
.right-room {
    grid-column: 4 / 5;
    background-color: #8b7355; /* Clay / Packed dirt base look */
}

.top-right { grid-row: 1 / 2; }
.mid-right { grid-row: 2 / 3; }
.bot-right { grid-row: 3 / 4; }

/* Text Content Labels */
.room-label {
    text-align: center;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

.room-label h3 {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.room-label span {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ffd699;
}

/* --- Flashing Mobile Target Beacon Particles --- */
.flash-beacon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 14px;
    height: 14px;
    background-color: #ffeb3b;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.7);
    animation: pulse-glow 1.4s infinite;
}

@keyframes pulse-glow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.8); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 235, 59, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 235, 59, 0); }
}

/* --- Dynamic Moving Character Token Apparition --- */
.player-token {
    position: absolute;
    width: 44px;
    height: 44px;
    background-color: #fff;
    border: 3px solid #3d260f;
    border-radius: 50%;
    font-size: 1.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    pointer-events: none;
    box-shadow: 0 6px 12px rgba(0,0,0,0.5);
    transition: left 0.8s cubic-bezier(0.25, 1, 0.5, 1), top 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.player-token.walking {
    animation: character-bob 0.2s infinite alternate;
}

@keyframes character-bob {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

/* --- Avatar Selection Overlay Layout --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 21, 23, 0.96);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.overlay-content {
    background-color: #232427;
    border: 4px solid #55823b;
    border-radius: 12px;
    padding: 40px;
    max-width: 700px;
    width: 90%;
    text-align: center;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #ffd699;
}

.overlay-content p {
    color: #aaa;
    margin-bottom: 30px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.avatar-card {
    background-color: #2e3033;
    border: 3px solid #444;
    border-radius: 8px;
    padding: 20px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.avatar-card:hover {
    transform: translateY(-5px);
    border-color: #ffd699;
    background-color: #35383c;
}

.avatar-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    background-color: #1e2022;
    width: 80px;
    height: 80px;
    line-height: 80px;
    margin: 0 auto 10px auto;
    border-radius: 50%;
    border: 2px solid #555;
}

/* --- Game Chat Modal Overlay Window --- */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}

.chat-content {
    background-color: #232427;
    border: 4px solid #d7a15c;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    padding: 20px;
    position: relative;
    text-align: left;
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.chat-box {
    background-color: #1a1b1d;
    height: 130px;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 12px;
    border: 1px solid #444;
    overflow-y: auto;
}

/* --- Comic Game Speech Bubble Styles --- */
.speech-bubble {
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.4;
    position: relative;
    max-width: 100%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.elder-bubble {
    background-color: #fceddb;
    color: #3d260f;
    border: 3px solid #d7a15c;
    align-self: flex-start;
}

.user-bubble {
    background-color: #e3f2fd;
    color: #0d47a1;
    border: 3px solid #4a90e2;
    align-self: flex-end;
}

.game-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.primary-game-btn {
    background-color: #d7a15c;
    color: #3d260f;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 10px 40px;
    border: 3px solid #a0723a;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
}

.primary-game-btn:disabled {
    background-color: #555;
    color: #888;
    border-color: #333;
    cursor: not-allowed;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #444;
    background-color: #2e3033;
    color: #fff;
}

.chat-input-area button {
    padding: 10px 20px;
    background-color: #4a752c;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.chat-input-area button:disabled {
    background-color: #333;
    color: #666;
    cursor: not-allowed;
}

/* 🌟 PRACTICE ARENA COMPILER EDITOR STYLING CONFIGURATIONS 🌟 */
textarea {
    box-sizing: border-box;
}

.quiz-option {
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .base-floorplan {
        display: flex;
        flex-direction: column;
    }
    .room {
        height: 110px;
    }
    .avatar-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}