/* Cargar DESPUÉS de main.css. Puedes borrar de main.css la regla #minigame-canvas. */
.screen { height: 100dvh; }
.btn-nav:disabled { opacity: .35; cursor: not-allowed; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.minigame-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.comic-layout { padding: 8px 10px; }

/* HUD */
.hud { display: flex; gap: 16px; align-items: center; padding: 8px 64px 0 12px; color: #ddd; font-size: .8rem; flex-wrap: wrap; }
.hud-stats { display: flex; gap: 10px; }
.stat { width: 76px; }
.bar { height: 6px; background: #333; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.bar i { display: block; height: 100%; background: #27ae60; transition: width .3s; }
.bar i.low { background: #cc0000; }
.hud-crew { display: flex; gap: 6px; }
.chip { padding: 2px 8px; border-radius: 10px; border: 1px solid #555; }
.chip.healthy { border-color: #27ae60; } .chip.injured { border-color: #f1c40f; }
.chip.critical { border-color: #e67e22; } .chip.dead { border-color: #555; color: #666; text-decoration: line-through; }
.hud-meta { margin-left: auto; color: #aaa; }

.event-banner { margin: 6px 12px 0; padding: 6px 12px; border-left: 4px solid #888; background: #1c1c1c; color: #ddd; font-size: .85rem; }
.event--emergency { border-color: #cc0000; } .event--discovery { border-color: #2980b9; } .event--bonus { border-color: #27ae60; }
.event-banner[hidden] { display: none; }

/* Cartas */
.card-tray { display: flex; align-items: stretch; gap: 10px; padding: 6px 12px 0; }
#plays-left { color: #aaa; font-size: .8rem; align-self: center; }
.card-hand { display: flex; gap: 8px; overflow-x: auto; flex: 1; padding-top: 4px; }
.card { flex: 0 0 170px; display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 8px 10px; background: #1a1a2e; color: #eee; border: 2px solid #444; border-radius: 8px; cursor: pointer; transition: transform .1s, border-color .2s; }
.card:hover:not(:disabled) { transform: translateY(-4px); border-color: #fff; }
.card:disabled { opacity: .4; cursor: not-allowed; }
.card small { color: #aaa; font-size: .72rem; }
.card em { display: flex; flex-wrap: wrap; gap: 4px; font-style: normal; font-size: .68rem; }
.card em span { background: #000; padding: 1px 6px; border-radius: 6px; }
.card--tech { border-color: #2980b9; } .card--supply { border-color: #d68910; } .card--medical { border-color: #27ae60; }
.card--science { border-color: #8e44ad; } .card--risk { border-color: #cc0000; }

.game-footer .hint { color: #aaa; font-size: .8rem; }
.toast { position: fixed; bottom: 70px; left: 50%; transform: translate(-50%, 20px); background: #000c; color: #fff; padding: 8px 18px; border-radius: 20px; opacity: 0; pointer-events: none; transition: .3s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Ending */
.ending-content { text-align: center; color: #ddd; display: flex; flex-direction: column; align-items: center; gap: 12px; }
#ending-stats { list-style: none; display: flex; gap: 20px; color: #aaa; }
#screen-ending[data-result="victory"] #ending-title { color: #27ae60; }
#screen-ending[data-result="defeat"] #ending-title { color: #cc0000; }
/* ===== Cabina: páginas 1-3 ===== */
.comic-pages {
    container-type: size;
    align-items: center;
    justify-content: center;
}

.comic-page[data-page="1"],
.comic-page[data-page="2"],
.comic-page[data-page="3"],
.comic-page[data-page="4"],
.comic-page[data-page="5"] {
    flex: none;
    width: min(100cqw, 177.78cqh);   /* 16:9 */
    height: min(100cqh, 56.25cqw);
    padding: 0;
    gap: 0;
    position: relative;
    background-position: center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.comic-page[data-page="1"] { background-image: url("../assets/img/clean1.png"); }
.comic-page[data-page="2"] { background-image: url("../assets/img/calibrate2.png"); }
.comic-page[data-page="3"] { background-image: url("../assets/img/colors3.png"); }
.comic-page[data-page="4"] { background-image: url("../assets/img/page_4.jpeg"); }
.comic-page[data-page="5"] { background-image: url("../assets/img/page_5.jpeg"); }


.comic-page[data-page="1"] .comic-panel,
.comic-page[data-page="2"] .comic-panel,
.comic-page[data-page="3"] .comic-panel,
.comic-page[data-page="4"] .comic-panel,
.comic-page[data-page="5"] .comic-panel {
    position: absolute;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    grid-row: auto;
    grid-column: auto;
}

/* Página 1: grande + 2 pequeñas */
[data-page="1"] .panel--1 { left: 9.1%;  top: 14.4%; width: 48.4%; height: 60%; }
[data-page="1"] .panel--2 { left: 61.9%; top: 13.6%; width: 29.1%; height: 26.9%; }
[data-page="1"] .panel--3 { left: 61.9%; top: 47.8%; width: 29.1%; height: 26.7%; }

/* Página 2: ancha arriba + 3 abajo */
[data-page="2"] .panel--4 { left: 9.1%;  top: 14.4%; width: 81.6%; height: 25.8%; }
[data-page="2"] .panel--5 { left: 9.1%;  top: 47.8%; width: 25.2%; height: 26.7%; }
[data-page="2"] .panel--6 { left: 37.5%; top: 47.8%; width: 25%;   height: 26.7%; }
[data-page="2"] .panel--7 { left: 65.8%; top: 47.8%; width: 24.8%; height: 26.7%; }

/* Página 3: 2 arriba + ancha abajo */
[data-page="3"] .panel--5 { left: 9.1%;  top: 14.4%; width: 38.6%; height: 25.8%; }
[data-page="3"] .panel--4 { left: 52.3%; top: 14.4%; width: 38.3%; height: 25.8%; }
[data-page="3"] .panel--6 { left: 9.1%;  top: 47.8%; width: 81.6%; height: 27.2%; }

/* Página 4: cuadrícula 2x2 */
[data-page="4"] .panel--8  { left: 9.25%;  top: 14.56%; width: 38.4%;  height: 25.8%; }
[data-page="4"] .panel--9  { left: 52.06%; top: 14.56%; width: 38.4%;  height: 25.8%; }
[data-page="4"] .panel--10 { left: 9.1%;   top: 47.9%;  width: 38.75%; height: 26.9%; }
[data-page="4"] .panel--7  { left: 51.9%;  top: 47.9%;  width: 38.9%;  height: 26.9%; }

/* Página 5: 2 pequeñas a la izquierda + 1 grande a la derecha */
[data-page="5"] .panel--9 { left: 9.25%; top: 14.56%; width: 24.5%; height: 25.8%; }
[data-page="5"] .panel--8 { left: 9.1%;  top: 47.9%;  width: 24.6%; height: 26.9%; }
[data-page="5"] .panel--5 { left: 37.7%; top: 14.56%; width: 52.8%; height: 60.2%; }

/* ===== Selección de nave ===== */
#screen-selection {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0d0d0d;
    overflow-y: auto;
}

.console-panel {
    width: min(1100px, 94%);
    padding: 24px 28px;
    background: #111;
    border: 2px solid #333;
    border-radius: 12px;
    color: #ddd;
}

.console-panel h2 { font-size: 1.3rem; margin-bottom: 18px; }
.column h3 { color: #aaa; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }

.selection-grid .column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.selection-grid .column h3 { grid-column: 1 / -1; margin-bottom: 0; }

.ship-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: #1a1a2e;
    border: 2px solid #444;
    border-radius: 8px;
    transition: border-color .2s, transform .1s;
}
.ship-card:hover { border-color: #fff; transform: translateY(-3px); }
.ship-card.selected { border-color: #cc0000; }

.ship-card h4 { font-size: 1.1rem; color: #fff; }
.ship-card p { font-size: .85rem; line-height: 1.5; color: #bbb; flex: 1; }

.select-btn {
    align-self: flex-start;
    background: #cc0000;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 10px 24px;
    font-size: .85rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color .2s, transform .1s;
}
.select-btn:hover { background: #ff1a1a; }
.select-btn:active { transform: scale(.96); }

.ship-img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 2px solid #000;
    border-radius: 6px;
    image-rendering: pixelated;   /* conserva el aspecto pixel art */
}