/* ==================================================
   RETRO ARCADE STYLE SHEET - BOSQUITO 2.0
   ================================================== */

:root {
    --color-yellow: #ffd32a;
    --color-yellow-dark: #ffa801;
    --color-red: #ff4757;
    --color-red-dark: #ff2a3a;
    --color-green: #2ed573;
    --color-green-dark: #26af5f;
    --color-blue: #1e90ff;
    --color-blue-dark: #0f75d8;
    --color-dark: #2f3542;
    --color-bg-dark: #1e272e;
    --font-retro: 'Press Start 2P', monospace;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0f1123;
    color: #ffffff;
    font-family: var(--font-retro);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    image-rendering: pixelated;
}

/* Main Arcade Console Screen Container */
#game-container {
    position: relative;
    width: 1024px;
    height: 576px;
    border: 8px solid #57606f;
    border-radius: 12px;
    box-shadow: 0 20px 0 #2f3542, 0 30px 40px rgba(0,0,0,0.6);
    background-color: #000000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #4a6fa5;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* CRT Screen Effect Overlay */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 99;
    pointer-events: none;
    opacity: 0.8;
}
.crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: radial-gradient(circle, rgba(18,16,16,0) 60%, rgba(0,0,0,0.4) 100%);
    z-index: 100;
    pointer-events: none;
}

/* Floating volume controller */
#btn-mute {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 150;
}

/* Overlay Screen Templates */
.overlay-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    z-index: 110;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-sizing: border-box;
    pointer-events: auto;
}

#lobby-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: linear-gradient(rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.65)), url('lobby_bg.jpg') no-repeat center center / cover;
}

.overlay-view.hidden, .modal-overlay.hidden, .hidden {
    display: none !important;
}

/* Arcade Titles */
.arcade-title {
    text-align: center;
    margin-bottom: 25px;
}
.arcade-title h1 {
    font-size: 2.8rem;
    color: var(--color-yellow);
    text-shadow: 4px 4px 0px var(--color-red);
    margin: 0 0 10px 0;
    animation: title-bounce 1s infinite alternate;
}
.arcade-title h2 {
    font-size: 1.3rem;
    color: #ffffff;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 2px 2px 0px #000000;
}

@keyframes title-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

/* Lobby split panels */
.lobby-panels {
    display: flex;
    width: 100%;
    max-width: 940px;
    gap: 40px;
    justify-content: center;
}

.lobby-panel {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 4px solid #485460;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    min-width: 320px;
}

.lobby-panel h3 {
    font-size: 0.8rem;
    color: var(--color-yellow);
    margin-top: 0;
    margin-bottom: 12px;
    border-bottom: 2px dashed #485460;
    padding-bottom: 8px;
    text-shadow: 1px 1px 0px #000;
}

/* Inputs & Choice Selectors */
input[type="text"] {
    font-family: var(--font-retro);
    font-size: 0.9rem;
    background: #000;
    color: #fff;
    border: 4px solid var(--color-blue);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    outline: none;
    text-transform: uppercase;
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 15px;
    box-shadow: inset 0 0 8px rgba(30, 144, 255, 0.4);
}
input[type="text"]:focus {
    border-color: var(--color-yellow);
}

.selection-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
}

/* Choice Buttons */
.choice-btn {
    flex: 1;
    font-family: var(--font-retro);
    font-size: 0.8rem;
    background: #1e272e;
    color: #808e9b;
    border: 3px solid #485460;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.1s;
}
.choice-btn:hover {
    color: #fff;
    border-color: #808e9b;
}
.choice-btn.selected {
    background: var(--color-blue);
    color: #fff;
    border-color: #bfdbfe;
    box-shadow: 0 4px 0 var(--color-blue-dark);
    transform: translateY(-2px);
}

/* Retro Action Buttons */
.action-btn-large, .hud-btn {
    font-family: var(--font-retro);
    font-size: 1.15rem;
    background: var(--color-green);
    color: #ffffff;
    border: 4px solid #fff;
    border-radius: 12px;
    padding: 15px 30px;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--color-green-dark), 0 10px 20px rgba(0,0,0,0.3);
    margin-top: 15px;
    outline: none;
    text-shadow: 2px 2px 0px #15803d;
    transition: transform 0.1s, box-shadow 0.1s;
}
.action-btn-large:hover, .hud-btn:hover {
    background: var(--color-yellow);
    box-shadow: 0 6px 0 var(--color-yellow-dark), 0 10px 20px rgba(0,0,0,0.3);
    text-shadow: 2px 2px 0px #a16207;
}
.action-btn-large:active, .hud-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 transparent;
}

.hud-btn {
    font-size: 0.8rem;
    padding: 8px 12px;
    margin: 0;
    box-shadow: 0 4px 0 #555;
    border-width: 2px;
}

/* Controls list display */
.controls-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.65rem;
    line-height: 2.2;
    color: #d2dae2;
}

/* Leaderboard Tables */
.leaderboard-table-container {
    background: #000;
    border: 3px solid #485460;
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.65rem;
    line-height: 2;
}
th {
    background-color: #2f3542;
    color: var(--color-yellow);
    padding: 6px;
    position: sticky;
    top: 0;
}
td {
    padding: 6px;
    text-align: center;
    border-bottom: 1px dashed #2f3542;
}
tr:nth-child(even) td {
    background: #0f1123;
}
tr:nth-child(1) td { color: #ffd700; font-weight: bold; } /* Gold */
tr:nth-child(2) td { color: #c0c0c0; } /* Silver */
tr:nth-child(3) td { color: #cd7f32; } /* Bronze */

/* HUD Gameplay bottom overlay (Dock Style) */
.hud-container {
    position: absolute;
    bottom: 12px;
    left: 15px;
    width: calc(100% - 30px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 105;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.9);
    border: 3px solid var(--color-yellow);
    border-radius: 12px;
    padding: 8px 12px;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.hud-item {
    font-size: 0.65rem;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 4px 10px;
    text-shadow: 1.5px 1.5px 0px #000;
    box-shadow: none;
    display: inline-block;
    color: #ffffff;
}

/* Controls top help header bar */
#controls-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    border-bottom: 2px solid #57606f;
    padding: 6px;
    text-align: center;
    font-size: 0.52rem;
    letter-spacing: 1px;
    z-index: 105;
    pointer-events: none;
    box-sizing: border-box;
    color: #a4b0be;
}

/* Modal Overlay Styling */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 120;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: #1e272e;
    border: 6px solid var(--color-yellow);
    border-radius: 16px;
    box-shadow: 0 15px 0 #a16207, 0 25px 30px rgba(0,0,0,0.5);
    padding: 25px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    animation: modal-enter 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-enter {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    font-size: 0.9rem;
    color: var(--color-yellow);
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px #000;
}

.question-text {
    font-size: 0.75rem;
    line-height: 1.8;
    color: #fff;
    margin-bottom: 25px;
    background: #000;
    padding: 15px;
    border-radius: 8px;
    border: 3px solid #485460;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Option Buttons inside Modal */
.option-btn {
    font-family: var(--font-retro);
    font-size: 0.65rem;
    background: #2f3542;
    color: #fff;
    border: 3px solid #57606f;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 4px 0 #57606f;
    transition: all 0.1s;
}
.option-btn:hover {
    background: var(--color-blue);
    border-color: #bfdbfe;
    box-shadow: 0 4px 0 var(--color-blue-dark);
}
.option-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 transparent;
}

.feedback-text {
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 15px;
    padding: 8px;
    border-radius: 6px;
}
.feedback-text.correct {
    color: var(--color-green);
}
.feedback-text.incorrect {
    color: var(--color-red);
}

.lobby-footer {
    position: absolute;
    bottom: 20px;
    font-size: 0.5rem;
    color: #57606f;
}

/* Custom Scrollbar for classification tables */
.leaderboard-table-container::-webkit-scrollbar {
    width: 10px;
}
.leaderboard-table-container::-webkit-scrollbar-track {
    background: #000;
}
.leaderboard-table-container::-webkit-scrollbar-thumb {
    background: #485460;
    border: 2px solid #000;
    border-radius: 4px;
}

/* Responsive resizing rules */
@media (max-width: 1200px) {
    #game-container {
        transform: scale(0.85);
    }
}
@media (max-width: 960px) {
    #game-container {
        transform: scale(0.75);
    }
}
@media (max-width: 820px) {
    #game-container {
        transform: scale(0.65);
    }
}
@media (max-width: 640px) {
    #game-container {
        transform: scale(0.48);
    }
}

/* Fullscreen support rules */
#game-container:fullscreen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}
#game-container:fullscreen canvas {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 16/9;
}

#game-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}
#game-container:-webkit-full-screen canvas {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 16/9;
}

/* Graphical Side Backpack Panel */
.backpack-side-panel {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    background: rgba(30, 39, 46, 0.85);
    border: 4px solid #485460;
    border-radius: 8px;
    padding: 10px 8px;
    box-sizing: border-box;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    pointer-events: auto;
}
.backpack-header {
    font-family: var(--font-retro);
    font-size: 0.45rem;
    color: var(--color-yellow);
    margin-bottom: 8px;
    text-align: center;
    text-shadow: 1px 1px 0px #000;
}
.backpack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 6px;
    width: 100%;
}
.backpack-slot {
    width: 36px;
    height: 36px;
    background-color: #151a21;
    border: 2px solid #57606f;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: all 0.15s;
}
.backpack-slot:hover {
    border-color: var(--color-yellow);
    background-color: #1e272e;
}
.backpack-slot .slot-icon {
    font-size: 1.1rem;
    user-select: none;
}
/* Tooltip styling */
.backpack-slot .slot-tooltip {
    visibility: hidden;
    width: 140px;
    background-color: #000000;
    color: #fff;
    text-align: center;
    border: 2px solid var(--color-yellow);
    border-radius: 6px;
    padding: 6px;
    position: absolute;
    z-index: 120;
    right: 125%; /* Position to the left of the slot */
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-family: var(--font-retro);
    font-size: 0.45rem;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0,0,0,0.8);
    pointer-events: none;
}
.backpack-slot:hover .slot-tooltip {
    visibility: visible;
    opacity: 1;
}

/* ==================================================
   SISTEMA DE MONEDAS DE PREMIO - BOSQUITO 2.0
   ================================================== */
.overlay-view {
    overflow-y: auto;
}

.coin-slot-panel {
    background: rgba(15, 23, 42, 0.92);
    border: 3px solid var(--color-yellow);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 6px;
    margin-bottom: 4px;
    box-shadow: 0 0 18px rgba(255, 211, 42, 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coin-slot-label {
    font-family: var(--font-retro);
    font-size: 0.62rem;
    color: var(--color-yellow);
    text-align: center;
    line-height: 1.4;
}

input.coin-input-field {
    font-family: var(--font-retro);
    font-size: 1.15rem !important;
    letter-spacing: 3px;
    color: var(--color-yellow) !important;
    background: #050811 !important;
    border: 3px solid #38bdf8 !important;
    padding: 10px !important;
    margin-bottom: 0 !important;
}

.coin-status-pill {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.9);
    color: #cbd5e1;
    text-align: center;
    border: 1px solid #475569;
}

.coin-status-pill.error {
    background: rgba(127, 29, 29, 0.92);
    color: #fecaca;
    border-color: #ef4444;
}

.coin-status-pill.success {
    background: rgba(6, 78, 59, 0.92);
    color: #a7f3d0;
    border-color: #10b981;
}

.profe-reward-banner {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.22), rgba(16, 185, 129, 0.22));
    border: 2px dashed var(--color-yellow);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #fef08a;
    text-align: center;
}

.profe-reward-banner strong {
    color: #ffffff;
}


/* ==================================================
   MODAL GENERADOR DE CÓDIGO DE 5 VIDAS (2.º Y 3.º GRADO)
   ================================================== */
.btn-quiz-generator {
    font-family: var(--font-retro);
    font-size: 0.78rem;
    background: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
    color: #ffffff;
    border: 3px solid #c4b5fd;
    border-radius: 10px;
    padding: 11px 16px;
    margin-top: 8px;
    cursor: pointer;
    box-shadow: 0 5px 0 #4c1d95;
    transition: transform 0.1s;
}
.btn-quiz-generator:hover {
    background: #7c3aed;
    transform: translateY(-2px);
}

.bq-subject-pill {
    align-self: center;
    background: #6d28d9;
    color: #fff;
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 14px;
    border-radius: 99px;
    border: 2px solid #c4b5fd;
    margin-bottom: 8px;
}

.bq-question-box {
    background: #1e293b;
    border: 2px solid #38bdf8;
    border-radius: 10px;
    padding: 14px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    line-height: 1.35;
    margin-bottom: 12px;
}

.bq-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bq-opt-btn {
    background: #1e293b;
    border: 2px solid #475569;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #f8fafc;
    cursor: pointer;
    text-align: left;
}
.bq-opt-btn:hover:not(:disabled) {
    background: #312e81;
    border-color: #818cf8;
}
.bq-opt-btn.correct {
    background: #065f46 !important;
    border-color: #34d399 !important;
}
.bq-opt-btn.wrong {
    background: #7f1d1d !important;
    border-color: #f87171 !important;
}

.bq-result-box {
    margin-top: 10px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #ffd32a;
    border-radius: 10px;
    text-align: center;
}

.bq-result-msg {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.98rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.bq-code-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.bq-code-display {
    font-family: var(--font-retro);
    font-size: 1.45rem;
    color: #ffd32a;
    background: #050811;
    border: 2px dashed #34d399;
    padding: 8px 18px;
    border-radius: 8px;
    letter-spacing: 4px;
}
