/**
 * Mini-Games CSS Styles
 * Styles for all 25 educational mini-games
 * Designed to be compact and fit on screen without scrolling
 */

/* =====================================================
   GLOBAL MINI-GAME CONTAINER STYLES
   ===================================================== */

.mini-game {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    border-radius: 12px;
    padding: 12px;
    max-width: 100%;
    position: relative;
}

.mini-game .game-timer {
    position: absolute;
    top: 8px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85em;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.mini-game .game-score {
    position: absolute;
    top: 8px;
    left: 10px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85em;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* =====================================================
   COMPACT ARCADE ZONE STYLES (For smaller games)
   ===================================================== */

.arcade-zone.compact {
    margin: 0.7rem;
    padding: 0.7rem;
    border-radius: 12px;
}

.arcade-zone.compact .arcade-grid {
    padding: 8px;
    min-height: 120px;
    max-height: 180px;
}

.arcade-zone.compact .arcade-header h2 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.arcade-zone.compact .arcade-header p {
    font-size: 0.85rem;
}

.arcade-zone.compact .arcade-status {
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

/* =====================================================
   HORIZONTAL GAME LAYOUT - Side by side structure
   ===================================================== */

.mini-game .game-layout-horizontal {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    flex-wrap: nowrap;
    justify-content: center;
}

.mini-game .game-visual-area {
    flex-shrink: 0;
    min-width: 200px;
}

.mini-game .game-controls-area {
    flex: 1;
    min-width: 300px;
    max-width: 450px;
}

/* Prevent wrapping on larger screens */
@media (min-width: 700px) {
    .mini-game .game-layout-horizontal {
        flex-wrap: nowrap !important;
    }
}

/* =====================================================
   LOOP RACER STYLES
   ===================================================== */

.loop-racer .maze-grid {
    margin: 8px auto;
    max-width: 220px;
    min-width: 180px;
}

.loop-racer .maze-cell {
    aspect-ratio: 1;
    background: #2a2a4a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    min-width: 35px;
    min-height: 35px;
}

.loop-racer .command-panel {
    margin-top: 10px;
}

.loop-racer .command-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.loop-racer .cmd-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    transition: transform 0.2s;
}

.loop-racer .cmd-btn:hover {
    transform: translateY(-2px);
}

.loop-racer .loop-control {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.loop-racer .loop-control input {
    width: 40px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.loop-racer #add-loop {
    padding: 4px 10px;
    background: #764ba2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.loop-racer .command-queue {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 30px;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.loop-racer .cmd-item {
    background: #e8ebff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
}

.loop-racer .run-btn,
.loop-racer .clear-btn {
    padding: 8px 16px;
    margin: 3px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
}

.loop-racer .run-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.loop-racer .clear-btn {
    background: #6c757d;
    color: white;
}

/* =====================================================
   VARIABLE VAULT STYLES
   ===================================================== */

.variable-vault .vault-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 30px;
}

.variable-vault .var-box,
.variable-vault .val-box {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.variable-vault .var-box {
    background: #e8f4fc;
    border: 2px solid #3498db;
}

.variable-vault .val-box {
    background: #fef3e2;
    border: 2px solid #e67e22;
}

.variable-vault .var-box.selected {
    background: #cce5ff;
    transform: scale(1.02);
}

.variable-vault .var-box.matched,
.variable-vault .val-box.matched {
    background: #d4edda !important;
    border-color: #28a745 !important;
}

/* =====================================================
   IF-THEN TOWER STYLES
   ===================================================== */

.if-then-tower .tower-area {
    margin-top: 25px;
}

.if-then-tower .tower {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    min-height: 120px;
    border-bottom: 2px solid #333;
    margin-bottom: 12px;
}

.if-then-tower .condition-panel {
    text-align: center;
}

.if-then-tower .condition-text {
    font-family: monospace;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 8px;
    border-radius: 7px;
    margin-bottom: 10px;
    font-size: 0.85em;
}

.if-then-tower .block-choices {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.if-then-tower .block-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: transform 0.2s;
}

.if-then-tower .block-btn:hover {
    transform: translateY(-2px);
}

/* =====================================================
   BUG SQUASHER STYLES
   ===================================================== */

.bug-squasher {
    margin-top: 25px;
}

.bug-squasher .code-display {
    margin: 8px 0;
}

.bug-squasher .code-block {
    background: #1e1e1e;
    padding: 10px;
    border-radius: 9px;
    font-family: monospace;
}

.bug-squasher .code-line {
    padding: 5px 10px;
    margin: 3px 0;
    border-radius: 4px;
    cursor: pointer;
    color: #d4d4d4;
    transition: background 0.2s;
    font-size: 0.85em;
}

.bug-squasher .code-line:hover {
    background: rgba(255, 255, 255, 0.1);
}

.bug-squasher .hint-box {
    background: #fff3cd;
    padding: 8px 12px;
    border-radius: 7px;
    margin-top: 8px;
    font-size: 0.85em;
}

/* =====================================================
   ALGORITHM CHEF STYLES
   ===================================================== */

.algorithm-chef {
    margin-top: 25px;
}

.algorithm-chef .steps-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 8px 0;
}

.algorithm-chef .step-item {
    padding: 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 7px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 0.9em;
}

.algorithm-chef .step-item:active {
    cursor: grabbing;
}

.algorithm-chef .step-num {
    background: #667eea;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
}

/* =====================================================
   ARRAY ASSEMBLER STYLES
   ===================================================== */

.array-assembler {
    margin-top: 25px;
}

.array-assembler .instruction {
    text-align: center;
    font-size: 0.95em;
    margin: 8px 0;
    color: #333;
}

.array-assembler .array-visual {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 12px 0;
}

.array-assembler .array-slot {
    width: 50px;
    height: 58px;
    background: #e8f4fc;
    border: 2px dashed #3498db;
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.array-assembler .array-slot:hover {
    background: #d4e9f7;
}

.array-assembler .index-label {
    font-family: monospace;
    font-size: 0.7em;
    color: #666;
}

.array-assembler .slot-content {
    font-weight: bold;
    font-size: 0.85em;
    margin-top: 3px;
}

.array-assembler .items-panel button {
    padding: 8px 14px;
    background: #fff;
    border: 2px solid #667eea;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.2s;
}

.array-assembler .items-panel button:hover {
    background: #e8ebff;
}

/* =====================================================
   OBJECT DETECTIVE STYLES
   ===================================================== */

.object-detective {
    margin-top: 25px;
}

.object-detective .clue-box {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 9px;
    margin: 8px 0;
    font-size: 0.95em;
}

.object-detective .options-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.object-detective .options-grid button {
    padding: 10px 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: transform 0.2s;
}

.object-detective .options-grid button:hover {
    transform: translateY(-2px);
}

/* =====================================================
   STACK ATTACK STYLES
   ===================================================== */

.stack-attack {
    margin-top: 25px;
}

.stack-attack .stack-container {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.stack-attack .stack,
.stack-attack .removed {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    min-height: 130px;
    width: 65px;
    border: 2px solid #333;
    border-radius: 7px;
    padding: 5px;
}

.stack-attack .removed {
    border-style: dashed;
    border-color: #999;
}

.stack-attack #pop-btn {
    display: block;
    margin: 10px auto;
    padding: 8px 22px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
}

/* =====================================================
   QUEUE QUEST STYLES
   ===================================================== */

.queue-quest {
    margin-top: 25px;
}

.queue-quest .queue-display {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 42px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 9px;
    margin: 8px 0;
}

.queue-quest .controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.queue-quest .controls button {
    padding: 8px 16px;
    color: white;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
}

.queue-quest #status {
    text-align: center;
    margin-top: 8px;
    font-size: 0.85em;
}

/* =====================================================
   NESTED NAVIGATOR STYLES
   ===================================================== */

.nested-navigator {
    margin-top: 25px;
}

.nested-navigator .path-display {
    text-align: center;
    font-family: monospace;
    font-size: 0.95em;
    margin: 6px 0;
    padding: 6px;
    background: #1e1e1e;
    color: #ffd700;
    border-radius: 7px;
}

.nested-navigator .data-display {
    font-family: monospace;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 9px;
    margin: 6px 0;
    font-size: 0.85em;
}

.nested-navigator .data-display pre {
    margin: 0;
    white-space: pre-wrap;
}

.nested-navigator #answer-input {
    width: 100%;
    padding: 8px;
    border: 2px solid #667eea;
    border-radius: 7px;
    font-size: 0.95em;
    margin-top: 6px;
}

.nested-navigator #submit-btn {
    width: 100%;
    margin-top: 6px;
    padding: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
}

/* =====================================================
   NETWORKING GAMES STYLES
   ===================================================== */

.ip-matcher .match-container,
.encryption-match .match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 25px;
}

.ip-matcher .device-box,
.ip-matcher .ip-box {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.dns-speedrun .domain-display,
.packet-pathfinder .packet-display {
    text-align: center;
    font-size: 1.05em;
    margin: 10px 0;
    padding: 10px;
    background: #1e1e1e;
    color: #00ff00;
    border-radius: 9px;
    font-family: monospace;
}

.dns-speedrun .ip-options,
.url-decoder .options-area {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.dns-speedrun .ip-options button,
.url-decoder .options-area button {
    padding: 8px;
    background: #f8f9fa;
    border: 2px solid #667eea;
    border-radius: 7px;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.85em;
    transition: all 0.2s;
}

.packet-pathfinder .network-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-width: 200px;
    margin: 8px auto;
}

.router-rush .packet-display,
.password-smash .password-display {
    text-align: center;
    padding: 12px;
    background: #1e1e1e;
    border-radius: 9px;
    margin: 8px 0;
}

.router-rush .network-buttons,
.firewall-frenzy .firewall-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

/* =====================================================
   CYBERSECURITY GAMES STYLES
   ===================================================== */

.password-smash .strength-buttons,
.caesar-cracker .strength-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.caesar-cracker .cipher-display {
    text-align: center;
    margin: 10px 0;
}

.caesar-cracker .cipher-display code {
    font-size: 1.1em;
    background: #1e1e1e;
    color: #ff6b6b;
    padding: 6px 12px;
    border-radius: 7px;
    display: inline-block;
}

.caesar-cracker .decode-area input {
    width: 75%;
    padding: 8px;
    border: 2px solid #667eea;
    border-radius: 7px;
    font-size: 0.95em;
    text-transform: uppercase;
}

.phishing-detector .email-display {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 9px;
    padding: 10px;
    margin: 8px 0;
    font-size: 0.9em;
}

.phishing-detector .detect-buttons,
.bias-buster .bias-buttons,
.privacy-protector .privacy-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.firewall-frenzy .traffic-display {
    text-align: center;
    padding: 12px;
    background: #1e1e1e;
    border-radius: 9px;
    margin: 8px 0;
}

.encryption-match .message-box,
.encryption-match .key-box {
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    transition: all 0.2s;
}

/* =====================================================
   DATA & ETHICS GAMES STYLES
   ===================================================== */

.bias-buster .scenario-display,
.privacy-protector .permission-display,
.ethical-dash .dilemma-display {
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 9px;
    margin: 8px 0;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
}

.trend-spotter .chart-display {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 9px;
    margin: 8px 0;
    min-height: 80px;
}

.trend-spotter .trend-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.chart-champion .data-type-display {
    text-align: center;
    padding: 10px;
    background: #1e1e1e;
    color: #00ff00;
    border-radius: 9px;
    margin: 8px 0;
    font-size: 0.95em;
}

.chart-champion .chart-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.ethical-dash .dilemma-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

/* =====================================================
   INSTRUCTION BOX STYLES - Compact inline version
   ===================================================== */

.game-instructions {
    background: linear-gradient(135deg, #e8f4fc 0%, #d4edda 100%);
    border-left: 4px solid #28a745;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 0.8em;
    line-height: 1.3;
}

.game-instructions strong {
    color: #155724;
    display: inline;
    margin-right: 5px;
}

.game-instructions p {
    margin: 0 0 4px 0;
    color: #333;
    display: inline;
}

/* Collapsible instructions - starts collapsed */
.game-instructions.collapsible {
    cursor: pointer;
    padding: 6px 12px;
}

.game-instructions.collapsible .instructions-content {
    display: none;
    margin-top: 6px;
}

.game-instructions.collapsible.expanded .instructions-content {
    display: block;
}

.game-instructions .instructions-toggle {
    font-size: 0.9em;
    color: #155724;
    font-weight: bold;
}

/* =====================================================
   GAME HEADER STYLES
   ===================================================== */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.game-header .game-timer {
    position: static;
    background: #1e1e1e;
    color: #ffd700;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
}

.game-header .game-score {
    position: static;
    background: transparent;
    color: #333;
    padding: 0;
    font-weight: bold;
    box-shadow: none;
    font-size: 0.9em;
}

/* =====================================================
   THREE-COLUMN LAYOUT - Game | Controls | Instructions
   ===================================================== */

.game-layout-three-col {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.2fr) minmax(150px, 0.8fr);
    gap: 12px;
    align-items: start;
}

.game-layout-three-col .game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-layout-three-col .controls-area {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
}

.game-layout-three-col .instructions-area {
    background: linear-gradient(135deg, #e8f4fc 0%, #d4edda 100%);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.8em;
    line-height: 1.4;
}

.game-layout-three-col .instructions-area h4 {
    margin: 0 0 6px 0;
    color: #155724;
    font-size: 0.95em;
}

.game-layout-three-col .instructions-area p {
    margin: 0 0 8px 0;
    color: #333;
}

/* =====================================================
   TWO-COLUMN LAYOUT STYLES
   ===================================================== */

.game-layout-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
}

.game-left-column,
.game-right-column {
    min-width: 0;
}

/* =====================================================
   ARCADE GRID CONTAINER - Larger and more spacious
   ===================================================== */

.arcade-grid {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
}

.arcade-grid .mini-game {
    max-height: none;
    overflow: visible;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Arcade zone expanded */
.arcade-zone {
    min-height: 500px;
    width: 100%;
}

.arcade-zone .arcade-grid {
    min-height: 420px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* =====================================================
   MINI-GAME BASE STYLES - Wider and cleaner
   ===================================================== */

.mini-game {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 100%;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
}

/* Make maze grids larger */
.loop-racer .maze-grid {
    min-width: 220px;
    min-height: 220px;
    max-width: 280px;
    margin: 0 auto;
}

.loop-racer .maze-cell {
    min-width: 40px;
    min-height: 40px;
}

/* Ensure game content areas have good width */
.mini-game .game-layout-columns,
.mini-game .game-layout-three-col {
    max-width: 100%;
}

/* Stack layout - simpler vertical flow */
.mini-game .game-content-stack {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 900px) {
    .game-layout-three-col {
        grid-template-columns: 1fr 1fr;
    }

    .game-layout-three-col .instructions-area {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .game-layout-columns,
    .game-layout-three-col {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .game-instructions {
        padding: 6px 10px;
        font-size: 0.75em;
    }

    .arcade-grid {
        max-height: 450px;
    }
}

@media (max-width: 600px) {
    .mini-game {
        padding: 8px;
    }

    .mini-game .game-timer,
    .mini-game .game-score {
        font-size: 0.75em;
        padding: 3px 8px;
    }

    .variable-vault .vault-container,
    .ip-matcher .match-container,
    .encryption-match .match-container {
        grid-template-columns: 1fr;
    }

    .dns-speedrun .ip-options,
    .url-decoder .options-area,
    .chart-champion .chart-options {
        grid-template-columns: 1fr;
    }

    .password-smash .strength-buttons,
    .trend-spotter .trend-buttons {
        grid-template-columns: 1fr;
    }
}
