/**
 * game.css
 * Mars Retro Sci-Fi Styling for Name Screen, Loading Screen, and Game Viewport.
 */

/* Viewport and Canvas Container */
.game-viewport {
    width: 100vw;
    height: 100vh;
    background-color: var(--space-black, #05050b);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    background-color: #05050b;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.95);
    max-width: 100vw;
    max-height: 100vh;
}

/* Interfaces das cutscenes e decisões de missão: mesma carcaça das HUDs do jogo. */
.ns-pixel-panel {
    box-sizing: border-box;
    background: linear-gradient(160deg, rgba(27, 10, 7, .96), rgba(5, 5, 11, .94) 48%);
    border: 2px solid var(--mars-orange, #d85a22);
    color: var(--text-cream, #f6c885);
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    box-shadow: 0 0 0 1px #6b2c10, 0 0 28px rgba(224, 114, 40, .22), inset 0 0 22px rgba(0, 0, 0, .6);
}

.ns-pixel-button {
    box-sizing: border-box;
    background: rgba(18, 7, 8, .91);
    border: 2px solid var(--mars-orange, #d85a22);
    border-radius: 0;
    color: var(--text-cream, #f6c885);
    font: 9px/1.7 var(--font-pixel, 'Press Start 2P', monospace);
    letter-spacing: .04em;
    text-align: center;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.ns-pixel-button:hover,
.ns-pixel-button:focus-visible {
    background: rgba(107, 38, 18, .85);
    border-color: var(--mars-light, #ed8733);
    color: #fff1d2;
    outline: 2px solid var(--mars-light, #ed8733);
    outline-offset: 2px;
}

.cutscene-caption {
    position: absolute;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%);
    box-sizing: border-box;
    width: min(860px, calc(100% - 32px));
    max-height: calc(100% - 146px);
    padding: 16px 22px;
    overflow: hidden;
    overflow-wrap: anywhere;
    background: linear-gradient(160deg, rgba(23, 9, 7, .91), rgba(5, 5, 11, .91));
    border: 2px solid rgba(224, 114, 40, .85);
    border-left: 4px solid var(--mars-light, #ed8733);
    border-radius: 0;
    color: var(--text-cream, #f6c885);
    font: 10px/1.9 var(--font-pixel, 'Press Start 2P', monospace);
    letter-spacing: .02em;
    text-align: center;
    white-space: pre-line;
    text-shadow: 2px 2px 0 #1a0507;
    box-shadow: 0 6px 30px rgba(0, 0, 0, .7);
    z-index: 9010;
    pointer-events: none;
}

.cutscene-counter {
    position: absolute;
    top: 24px;
    right: 32px;
    max-width: calc(100% - 48px);
    padding: 8px 12px;
    background: rgba(5, 5, 11, .85);
    border: 1px solid rgba(224, 114, 40, .8);
    color: var(--text-cream, #f6c885);
    font: 8px/1.7 var(--font-pixel, 'Press Start 2P', monospace);
    letter-spacing: .06em;
    z-index: 9010;
}

.cutscene-skip {
    position: absolute;
    right: 32px;
    bottom: 28px;
    z-index: 9010;
    min-height: auto;
    padding: 8px 20px;
    background: rgba(18, 7, 8, .91);
    border: 1.5px solid rgba(224, 114, 40, .55);
    border-radius: 6px;
    color: var(--text-cream, #f6c885);
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .08em;
    cursor: pointer;
}

.cutscene-skip:hover,
.cutscene-skip:focus-visible {
    background: rgba(107, 38, 18, .85);
    border-color: var(--mars-light, #ed8733);
    color: #fff1d2;
    outline: none;
}

.ending-terminal {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: min(720px, calc(100% - 32px));
    max-height: calc(100% - 48px);
    padding: 0 24px 28px;
    overflow-y: auto;
    text-align: center;
    border-color: #e07228;
    box-shadow: 0 0 30px rgba(224, 114, 40, .3), inset 0 0 24px rgba(0, 0, 0, .85);
}

.ending-terminal__title {
    align-self: stretch;
    margin: 0 -24px 8px;
    padding: 17px 16px;
    background: rgba(95, 31, 12, .65);
    border-top: 3px solid #e07228;
    border-bottom: 2px solid rgba(237, 135, 51, .35);
    color: var(--text-cream, #f6c885);
    font: 12px/1.7 var(--font-pixel, 'Press Start 2P', monospace);
    overflow-wrap: anywhere;
    text-shadow: 2px 2px 0 #1a0507;
}

.ending-terminal__line {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: var(--text-cream, #f6c885);
    font: 9px/1.9 var(--font-pixel, 'Press Start 2P', monospace);
    letter-spacing: .04em;
}

.ending-terminal__line--closing {
    margin-top: 5px;
    padding-top: 12px;
    border-top: 1px solid rgba(237, 135, 51, .3);
    color: var(--mars-light, #ed8733);
    font-size: 13px;
}

.ending-terminal__button {
    margin-top: 16px;
    min-height: 42px;
    padding: 9px 22px;
    border-color: #e07228;
    box-shadow: none;
}

.ending-terminal__button:hover {
    background: rgba(107, 38, 18, .95);
    border-color: var(--mars-light, #ed8733);
    color: #fff1d2;
    outline: none;
    box-shadow: 0 0 12px rgba(224, 114, 40, .35);
}

.ending-terminal__button:focus-visible {
    background: rgba(18, 7, 8, .91);
    border-color: #e07228;
    color: var(--text-cream, #f6c885);
    outline: none;
    box-shadow: none;
}

.mission-ending-confirm {
    position: absolute;
    inset: 0;
    z-index: 9400;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 20px;
    background: rgba(3, 3, 9, .88);
}

.mission-ending-confirm__panel {
    width: min(560px, 100%);
    max-height: calc(100% - 20px);
    overflow-y: auto;
    text-align: center;
    border-color: #e07228;
    box-shadow: 0 0 32px rgba(224, 114, 40, .3), inset 0 0 20px rgba(0, 0, 0, .85);
}

.mission-ending-confirm__title {
    margin: 0;
    padding: 18px 14px;
    background: rgba(95, 31, 12, .65);
    border-top: 3px solid #e07228;
    border-bottom: 2px solid rgba(237, 135, 51, .35);
    color: var(--text-cream, #f6c885);
    font: 12px/1.7 var(--font-pixel, 'Press Start 2P', monospace);
    text-shadow: 2px 2px 0 #1a0507;
}

.mission-ending-confirm__message {
    margin: 0;
    padding: 22px 24px;
    color: var(--text-cream, #f6c885);
    font: 9px/2 var(--font-pixel, 'Press Start 2P', monospace);
}

.mission-ending-confirm__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 0 24px 26px;
}

.mission-ending-confirm__button {
    min-height: 44px;
    padding: 10px 16px;
    border-color: #e07228;
    box-shadow: none;
}

.mission-ending-confirm__button:hover {
    background: rgba(107, 38, 18, .95);
    border-color: var(--mars-light, #ed8733);
    color: #fff1d2;
    outline: none;
    box-shadow: 0 0 12px rgba(224, 114, 40, .35);
}

.mission-ending-confirm__button:focus-visible {
    background: rgba(18, 7, 8, .91);
    border-color: #e07228;
    color: var(--text-cream, #f6c885);
    outline: 1px dashed rgba(237, 135, 51, .75);
    outline-offset: 3px;
    box-shadow: none;
}

.mission-ending-confirm__button--primary {
    background: rgba(95, 31, 12, .85);
}

.mission-ending-confirm__button--primary:hover {
    background: rgba(135, 45, 17, .95);
}

.mission-ending-confirm__button--primary:focus-visible {
    background: rgba(95, 31, 12, .85);
    outline: 1px dashed rgba(237, 135, 51, .75);
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .cutscene-caption { bottom: 74px; padding: 12px; font-size: 8px; max-height: calc(100% - 120px); }
    .cutscene-counter { top: 12px; right: 12px; font-size: 7px; }
    .cutscene-skip { right: 12px; bottom: 12px; font-size: 10px; }
.ending-terminal { gap: 12px; padding: 0 12px 16px; }
    .ending-terminal__title { margin: 0 -12px 4px; font-size: 10px; }
    .ending-terminal__line { font-size: 8px; }
    .ending-terminal__line--closing { font-size: 11px; }
    .mission-ending-confirm { padding: 12px; }
    .mission-ending-confirm__message { padding: 18px 14px; font-size: 8px; }
    .mission-ending-confirm__actions { padding: 0 12px 18px; gap: 10px; }
    .mission-ending-confirm__button { min-height: 42px; padding: 9px 12px; }
}

/* Background Grid Overlay */
.mars-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(216, 90, 34, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(216, 90, 34, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Name Screen Wrapper */
.name-screen-wrapper,
.loading-screen-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1b0a0e 0%, #05050b 80%);
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    color: var(--text-cream, #f6c885);
    user-select: none;
    overflow: hidden;
}

/* Modal Panel */
.name-modal-panel {
    position: relative;
    width: 90%;
    max-width: 640px;
    background-color: #1a0b0d;
    border: 3px solid #e07228;
    box-shadow: 0 0 30px rgba(224, 114, 40, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.name-panel-header {
    background-color: #2e100f;
    border-bottom: 2px solid #e07228;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.name-panel-header .panel-title {
    font-size: 13px;
    color: #f6c885;
    letter-spacing: 1px;
    text-align: center;
    margin: 0;
}

.name-panel-header .panel-icon {
    color: #e07228;
    font-size: 10px;
}

.name-panel-body {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mission-briefing {
    font-size: 10px;
    line-height: 1.8;
    color: #f6c885;
    text-align: justify;
}

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

.input-label {
    font-size: 9px;
    color: #ed8733;
    letter-spacing: 1px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: #0c0507;
    border: 2px solid #8f3419;
    padding: 8px 14px;
    gap: 10px;
}

.input-wrapper:focus-within {
    border-color: #e07228;
    box-shadow: 0 0 10px rgba(224, 114, 40, 0.4);
}

.input-prefix {
    color: #e07228;
    font-size: 14px;
    font-weight: bold;
}

.retro-text-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: #f6c885;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.name-panel-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
}

/* Retro Buttons */
.btn-retro {
    font-family: inherit;
    font-size: 10px;
    padding: 14px 20px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background-color: #d85a22;
    color: #fff;
    border-color: #f6c885;
    box-shadow: 0 4px 0 #8f3419;
}

.btn-primary:hover {
    background-color: #ed8733;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #8f3419;
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #8f3419;
}

.btn-secondary {
    background-color: #381512;
    color: #c5975b;
    border-color: #582114;
    box-shadow: 0 4px 0 #1c080b;
}

.btn-secondary:hover {
    background-color: #582114;
    color: #f6c885;
    border-color: #8f3419;
}

.btn-secondary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1c080b;
}

.name-panel-footer {
    background-color: #0d0507;
    border-top: 1px solid #4d1d15;
    padding: 10px 16px;
    font-size: 8px;
    color: #8f3419;
    text-align: center;
}

/* Character Select Panel */
.char-select-panel {
    max-width: 880px;
}

.char-select-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
}

.char-card {
    flex: 1 1 220px;
    max-width: 250px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 12px;
    background-color: #0c0507;
    border: 2px solid #582114;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
}

/* Reuses the global mars grid pattern inside every character card.
   Kept at the same opacity as the screen-wide overlay so it stays subtle;
   content is lifted above it to preserve readability. */
.char-card .mars-grid-overlay {
    z-index: 0;
}

.char-card__preview,
.char-card__name,
.char-card__tagline,
.char-card__desc {
    position: relative;
    z-index: 1;
}

.char-card__preview {
    width: 100%;
    height: 132px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    background: radial-gradient(circle at center, rgba(224, 114, 40, 0.10), rgba(8, 4, 6, 0.40) 72%);
}

.char-card__name {
    font-size: 10px;
    color: #f6c885;
    letter-spacing: 1px;
}

.char-card__tagline {
    font-size: 8px;
    color: #ed8733;
    letter-spacing: 0.5px;
    text-align: center;
}

.char-card__desc {
    font-size: 7px;
    line-height: 1.7;
    color: #c5975b;
    text-align: center;
}

.char-card.is-hover {
    border-color: #8f3419;
}

.char-card.is-selected {
    border-color: #e07228;
    box-shadow: 0 0 14px rgba(224, 114, 40, 0.45);
}

.char-card.is-selected .char-card__name {
    color: #ed8733;
}

.char-card:active {
    transform: translateY(2px);
}

@media (max-width: 600px) and (orientation: portrait) {
    .char-select-grid {
        flex-direction: column;
        align-items: center;
    }

    .char-card {
        flex: none;
        width: 90%;
        max-width: 260px;
    }
}

/* Loading Screen Panel */
.loading-panel {
    width: 90%;
    max-width: 580px;
    background-color: #1a0b0d;
    border: 3px solid #e07228;
    box-shadow: 0 0 35px rgba(224, 114, 40, 0.3);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    z-index: 10;
}

.loading-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pulse-beacon {
    width: 12px;
    height: 12px;
    background-color: #e07228;
    border-radius: 50%;
    animation: beacon-blink 1s infinite alternate;
}

@keyframes beacon-blink {
    0% { opacity: 0.3; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 10px #e07228; }
}

.loading-title {
    font-size: 12px;
    color: #f6c885;
    margin: 0;
    letter-spacing: 1px;
}

.loading-status-text {
    font-size: 9px;
    color: #ed8733;
    line-height: 1.6;
    min-height: 28px;
}

.loading-bar-container {
    width: 100%;
    height: 20px;
    background-color: #0a0405;
    border: 2px solid #8f3419;
    padding: 2px;
    box-sizing: border-box;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #d85a22, #ed8733);
    box-shadow: 0 0 8px rgba(237, 135, 51, 0.6);
    transition: width 0.15s ease-out;
}

.loading-footer {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: #c5975b;
}

/* ─── Pause Menu Overlay ─────────────────────────────────── */
.pause-overlay {
    position: absolute;
    inset: 0;
    z-index: 300;
    background: rgba(5, 5, 11, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: pauseOverlayIn 0.2s ease forwards;
}

.pause-overlay[hidden] {
    display: none;
}

@keyframes pauseOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pause-panel {
    position: relative;
    width: 520px;
    max-width: calc(100vw - 32px);
    background: #12030a;
    border: 2px solid #e07228;
    box-shadow:
        0 0 0 1px #6b2c10,
        0 0 30px rgba(224, 114, 40, 0.35),
        0 0 60px rgba(224, 114, 40, 0.12),
        inset 0 0 0 1px rgba(224, 114, 40, 0.08);
    animation: pauseSlideIn 0.25s cubic-bezier(0.22, 0.9, 0.4, 1) forwards;
    clip-path: polygon(
        0px 0px,
        calc(100% - 16px) 0px,
        100% 16px,
        100% 100%,
        0px 100%
    );
    user-select: none;
}

@keyframes pauseSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.pause-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #e07228 50%, transparent 100%);
    opacity: 0.4;
}

/* Header */
.pause-panel__header {
    background: linear-gradient(180deg, #8c2e0e 0%, #5c1c09 100%);
    padding: 10px 20px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e07228;
    position: relative;
}

.pause-panel__header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 16px;
    height: 1px;
    background: #e07228;
    opacity: 0.7;
}

.pause-panel__icon {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 12px;
    color: #e07228;
    letter-spacing: 4px;
}

.pause-panel__title {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 11px;
    color: #f6c885;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 #1a0507;
    margin: 0;
}

/* Body / Buttons */
.pause-panel__stage {
    position: relative;
}

.pause-panel__body {
    padding: 30px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Camada de opções sobreposta aos botões do menu */
.pause-panel--options-open .pause-panel__stage {
    min-height: min(500px, 74vh);
}

.pause-panel__options-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(10, 4, 8, 0.96);
    border-bottom: 1px solid rgba(224, 114, 40, 0.15);
    overflow-y: auto;
    animation: pauseOverlayIn 0.15s ease forwards;
    padding: 18px 10px 12px;
}

.pause-panel--options-open [data-pause-view="main"] {
    opacity: 0.25;
    filter: saturate(0.4);
    transition: opacity 0.15s ease;
}

.pause-panel__options-title {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 11px;
    letter-spacing: 4px;
    color: var(--mars-light, #ed8733);
    text-shadow: 2px 2px 0 #1a0507;
    margin: 0 0 14px;
    text-align: center;
}

/* Botões no mesmo estilo da tela inicial (carcaça transparente, borda laranja) */
.pause-panel__btn {
    position: relative;
    width: 100%;
    height: 54px;
    background: transparent;
    border: 2px solid #A6511F;
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 12px;
    letter-spacing: 2px;
    color: #A6511F;
    cursor: pointer;
    outline: none;
    text-align: left;
    padding-left: 22px;
    text-shadow: 2px 2px 0 #1a0507;
    transition: color 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease, transform 0.05s ease;
    clip-path: polygon(
        0px 0px,
        calc(100% - 8px) 0px,
        100% 8px,
        100% 100%,
        0px 100%
    );
}

/* Detalhe de linha de brilho no topo do botão */
.pause-panel__btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 8px;
    height: 2px;
    background: #c95c2e;
    pointer-events: none;
}

.pause-panel__btn:hover,
.pause-panel__btn:focus-visible {
    background: transparent;
    color: var(--mars-light, #ed8733);
    border-color: var(--mars-light, #ed8733);
    text-shadow: 2px 2px 0 #1a0507, 0 0 4px rgba(237, 135, 51, 0.6);
    box-shadow: 0 0 10px rgba(216, 90, 34, 0.4);
}

.pause-panel__btn:hover::before,
.pause-panel__btn:focus-visible::before {
    background: #ed8733;
}

.pause-panel__btn:active {
    transform: translateY(2px);
    background: transparent;
    box-shadow: 0 1px 0 #150507;
}

.pause-panel__btn:focus-visible {
    outline: 2px dashed var(--mars-light, #ed8733);
    outline-offset: 3px;
}

/* Warning state for armed "voltar ao menu" */
.pause-panel__btn--warning,
.pause-panel__btn--warning:hover,
.pause-panel__btn--warning:focus-visible {
    color: #ff5a4d;
    border-color: #e62424;
    background: transparent;
    text-shadow: 2px 2px 0 #1a0507, 0 0 6px rgba(230, 36, 36, 0.6);
    box-shadow: 0 0 12px rgba(230, 36, 36, 0.4);
}

.pause-panel__btn--warning::before {
    background: #e62424;
}

/* ─── Options view ───────────────────────────────────────── */
.pause-panel__options {
    border-top: 1px solid rgba(224, 114, 40, 0.15);
    max-height: 58vh;
    overflow-y: auto;
}

.opt-item {
    margin-bottom: 16px;
}

.opt-item__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.opt-item__label {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 9px;
    letter-spacing: 1.5px;
    color: var(--text-cream, #f6c885);
    text-shadow: 2px 2px 0 #1a0507;
}

.opt-item__value {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--mars-light, #ed8733);
    min-width: 44px;
    text-align: right;
}

.opt-item__slider {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 34px;
    box-sizing: border-box;
    background:
        linear-gradient(180deg, #c75624 0%, #ed8733 100%) 0 0 / calc(var(--val, 70) * 1%) 100% no-repeat,
        rgba(90, 30, 18, 0.4);
    border: 2px solid #A6511F;
    cursor: pointer;
    outline: none;
    clip-path: polygon(
        0px 0px,
        calc(100% - 8px) 0px,
        100% 8px,
        100% 100%,
        0px 100%
    );
    transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

.opt-item__slider:hover,
.opt-item__slider:focus-visible {
    border-color: var(--mars-light, #ed8733);
    box-shadow: 0 0 10px rgba(216, 90, 34, 0.35);
}

.opt-item__slider:focus-visible {
    outline: 2px dashed var(--mars-light, #ed8733);
    outline-offset: 3px;
}

.opt-item__slider::-webkit-slider-runnable-track {
    background: transparent;
    border: 0;
}

.opt-item__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 30px;
    margin-top: -1px;
    background: linear-gradient(180deg, #ed8733 0%, #a83d18 100%);
    border: 2px solid #1a0507;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.25), 0 0 8px rgba(216, 90, 34, 0.45);
}

.opt-item__slider::-moz-range-track {
    height: 100%;
    background: transparent;
    border: 0;
}

.opt-item__slider::-moz-range-thumb {
    width: 18px;
    height: 28px;
    background: linear-gradient(180deg, #ed8733 0%, #a83d18 100%);
    border: 2px solid #1a0507;
    border-radius: 0;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.25), 0 0 8px rgba(216, 90, 34, 0.45);
}

/* ─── Controles / remap de teclas (tela separada) ────────── */
.controls-overlay {
    position: absolute;
    inset: 0;
    z-index: 340;
    background: rgba(5, 5, 11, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: pauseOverlayIn 0.2s ease forwards;
}

.controls-panel {
    position: relative;
    width: min(960px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #12030a;
    border: 2px solid #e07228;
    box-shadow:
        0 0 0 1px #6b2c10,
        0 0 30px rgba(224, 114, 40, 0.35),
        inset 0 0 0 1px rgba(224, 114, 40, 0.08);
    animation: pauseSlideIn 0.25s cubic-bezier(0.22, 0.9, 0.4, 1) forwards;
    clip-path: polygon(
        0px 0px,
        calc(100% - 16px) 0px,
        100% 16px,
        100% 100%,
        0px 100%
    );
    user-select: none;
}

.controls-panel__body {
    padding: 18px 22px 22px;
    overflow-y: auto;
}

.controls-panel__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(224, 114, 40, 0.25);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 24px;
}

.controls-remap__hint {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 8px;
    letter-spacing: 1px;
    color: rgba(246, 200, 133, 0.65);
    margin: 0 0 14px;
}

.controls-remap__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(21, 8, 7, 0.5);
    border: 1px solid rgba(224, 114, 40, 0.16);
}

.controls-remap__row:hover,
.controls-remap__row:focus-within {
    border-color: rgba(224, 114, 40, 0.5);
}

.controls-remap__label {
    flex: 0 1 auto;
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 8px;
    letter-spacing: 1px;
    color: #b97f4f;
}

.controls-remap__binds {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.controls-remap__key {
    min-width: 44px;
    height: 30px;
    padding: 0 8px;
    background: rgba(18, 7, 8, 0.91);
    color: #ed8733;
    border: 2px solid #e07228;
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 9px;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    box-shadow: 0 0 0 rgba(216, 90, 34, 0);
    transition: color 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.controls-remap__key:hover,
.controls-remap__key:focus-visible {
    color: #fff3d6;
    border-color: #ed8733;
    box-shadow: 0 0 10px rgba(216, 90, 34, 0.45);
    outline: 2px dashed rgba(237, 135, 51, 0.75);
    outline-offset: 2px;
}

.controls-remap__key--listening {
    background: #3b1208;
    color: #ffd440;
    border-color: #ffd440;
    animation: ctrlListenPulse 0.6s ease infinite alternate;
}

@keyframes ctrlListenPulse {
    from { box-shadow: 0 0 6px rgba(255, 212, 64, 0.35); }
    to   { box-shadow: 0 0 14px rgba(255, 212, 64, 0.7); }
}

.controls-remap__reset {
    height: 40px;
    width: 240px;
}

.controls-panel__back {
    height: 40px;
    width: 240px;
}

@media (max-width: 600px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }
    .controls-panel__actions {
        flex-direction: column;
        align-items: center;
    }
    .controls-panel__body {
        padding: 14px 12px;
    }
}

/* ─── Ranking Screen (tela inicial) ──────────────────────── */
.ranking-overlay {
    position: absolute; inset: 0; z-index: 330; display: grid; place-items: center;
    padding: 22px; box-sizing: border-box; background: rgba(5, 5, 11, .94);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.ranking-panel {
    width: min(1180px, 100%); max-height: min(760px, 100%); display: flex; flex-direction: column;
    overflow: hidden; color: var(--text-cream, #f6c885); font-family: var(--font-pixel, 'Press Start 2P', monospace);
    background: linear-gradient(145deg, rgba(24, 9, 7, .96), rgba(5, 5, 11, .94));
    border: 2px solid #e07228; box-shadow: 0 0 28px rgba(216, 90, 34, .2), inset 0 0 24px rgba(0, 0, 0, .65);
}
.ranking-header, .ranking-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 22px; border-bottom: 1px solid rgba(237, 135, 51, .28);
}
.ranking-kicker, .ranking-subtitle, .ranking-footer, .ranking-table, .ranking-podium__stats { font-family: var(--font-pixel, 'Press Start 2P', monospace); }
.ranking-kicker { margin: 0 0 12px; color: #ed8733; font-size: 8px; letter-spacing: 1px; }
.ranking-header h2 { margin: 0; font: 20px var(--font-pixel, 'Press Start 2P', monospace); color: #f6c885; }
.ranking-subtitle { margin: 12px 0 0; color: rgba(246, 200, 133, .68); font-size: 7px; line-height: 1.8; }
.ranking-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px 0; }
.ranking-filter { min-height: 34px; padding: 0 12px; color: rgba(246, 200, 133, .8); background: rgba(18, 7, 8, .91); border: 2px solid #a6511f; border-radius: 0; font: 7px var(--font-pixel, 'Press Start 2P', monospace); cursor: pointer; }
.ranking-filter:hover, .ranking-filter:focus-visible { color: #f6c885; border-color: #ed8733; outline: none; box-shadow: 0 0 10px rgba(216, 90, 34, .3); }
.ranking-filter.is-active { color: #f6c885; border-color: #ed8733; background: rgba(237, 135, 51, .18); }
.ranking-filter:disabled { opacity: .55; cursor: wait; }
.ranking-close { flex: 0 0 auto; width: 38px; height: 38px; color: #ed8733; background: rgba(18, 7, 8, .91); border: 2px solid #e07228; border-radius: 0; font: 13px var(--font-pixel, 'Press Start 2P', monospace); cursor: pointer; }
.ranking-content { min-height: 150px; overflow: auto; padding: 20px 22px; }
.ranking-content, .ranking-table-wrap, .pause-panel__options, .pause-panel__options-layer, .controls-panel__body {
    scrollbar-width: thin;
    scrollbar-color: rgba(237, 135, 51, .7) transparent;
}
.ranking-content::-webkit-scrollbar, .ranking-table-wrap::-webkit-scrollbar,
.pause-panel__options::-webkit-scrollbar, .pause-panel__options-layer::-webkit-scrollbar,
.controls-panel__body::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}
.ranking-content::-webkit-scrollbar-track, .ranking-table-wrap::-webkit-scrollbar-track,
.ranking-content::-webkit-scrollbar-corner, .ranking-table-wrap::-webkit-scrollbar-corner,
.pause-panel__options::-webkit-scrollbar-track, .pause-panel__options-layer::-webkit-scrollbar-track,
.pause-panel__options::-webkit-scrollbar-corner, .pause-panel__options-layer::-webkit-scrollbar-corner,
.controls-panel__body::-webkit-scrollbar-track, .controls-panel__body::-webkit-scrollbar-corner {
    background: transparent;
}
.ranking-content::-webkit-scrollbar-thumb, .ranking-table-wrap::-webkit-scrollbar-thumb,
.pause-panel__options::-webkit-scrollbar-thumb, .pause-panel__options-layer::-webkit-scrollbar-thumb,
.controls-panel__body::-webkit-scrollbar-thumb {
    background: rgba(237, 135, 51, .7);
    border: 2px solid transparent;
    border-radius: 8px;
    background-clip: padding-box;
}
.ranking-content::-webkit-scrollbar-thumb:hover, .ranking-table-wrap::-webkit-scrollbar-thumb:hover,
.pause-panel__options::-webkit-scrollbar-thumb:hover, .pause-panel__options-layer::-webkit-scrollbar-thumb:hover,
.controls-panel__body::-webkit-scrollbar-thumb:hover {
    background-color: #f6c885;
}
.ranking-content::-webkit-scrollbar-button, .ranking-table-wrap::-webkit-scrollbar-button,
.pause-panel__options::-webkit-scrollbar-button, .pause-panel__options-layer::-webkit-scrollbar-button,
.controls-panel__body::-webkit-scrollbar-button {
    display: none;
}
.ranking-loading, .ranking-empty, .ranking-error { margin: 32px auto; text-align: center; font: 9px/2 var(--font-pixel, 'Press Start 2P', monospace); }
.ranking-loading { color: #ed8733; } .ranking-empty { color: #f6c885; } .ranking-error { color: #ef8065; }
.ranking-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 16px; margin: 0 auto 22px; max-width: 900px; }
.ranking-podium__card { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 10px; text-align: center; background: rgba(12, 6, 8, .86); border: 1px solid #a6511f; }
.ranking-podium__card--1 { order: 2; min-height: 130px; border-color: #ed8733; } .ranking-podium__card--2 { order: 1; min-height: 108px; } .ranking-podium__card--3 { order: 3; min-height: 94px; }
.ranking-podium__place { color: #ed8733; font: 10px var(--font-pixel, 'Press Start 2P', monospace); }
.ranking-podium__card--1 .ranking-podium__place { color: #e5b84f; }
.ranking-podium__name { max-width: 100%; overflow-wrap: anywhere; font: 11px var(--font-pixel, 'Press Start 2P', monospace); }
.ranking-podium__character { max-width: 100%; overflow-wrap: anywhere; color: #e5b84f; font: 8px/1.5 var(--font-pixel, 'Press Start 2P', monospace); }
.ranking-podium__time { color: #ed8733; font: 16px var(--font-pixel, 'Press Start 2P', monospace); }
.ranking-podium__stats { color: rgba(246, 200, 133, .7); font-size: 6px; line-height: 1.8; }
.ranking-table-wrap { overflow-x: auto; background: rgba(5, 5, 11, .56); border: 1px solid #a6511f; }
.ranking-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 7px; text-align: left; }
.ranking-table th, .ranking-table td { padding: 12px 10px; white-space: nowrap; border-bottom: 1px solid rgba(237, 135, 51, .14); }
.ranking-table th { color: #ed8733; background: rgba(0, 0, 0, .22); } .ranking-table td { color: rgba(246, 200, 133, .86); }
.ranking-table tbody tr:first-child td { color: #e5b84f; }
.ranking-footer { border-top: 1px solid rgba(237, 135, 51, .28); border-bottom: 0; font-size: 7px; color: rgba(246, 200, 133, .6); }
.ranking-actions { display: flex; gap: 10px; }
.ranking-action { min-height: 38px; padding: 0 14px; color: #f6c885; background: rgba(18, 7, 8, .91); border: 2px solid #e07228; border-radius: 0; font: 8px var(--font-pixel, 'Press Start 2P', monospace); cursor: pointer; }
.ranking-action:hover, .ranking-action:focus-visible, .ranking-close:hover, .ranking-close:focus-visible { color: #f6c885; border-color: #ed8733; outline: none; box-shadow: 0 0 10px rgba(216, 90, 34, .3); }
.ranking-action:disabled { opacity: .55; cursor: wait; }

/* ─── Credits Screen (tela inicial) ──────────────────────── */
.title-screen-wrapper--credits .title-screen__content { visibility: hidden; }
.credits-overlay {
    position: absolute;
    inset: 0;
    z-index: 320;
    background: rgba(5, 5, 11, 0.93);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    overflow: hidden;
    user-select: none;
}

.credits-scroller {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    animation: creditsRise 10s linear forwards;
    will-change: transform;
}

@keyframes creditsRise {
    from { transform: translateY(0); }
    to   { transform: translateY(calc(-1 * var(--rise, 50vh))); }
}

.credits-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
    transform: translateX(4px);
}

.credits-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 52px;
}

.credits-kicker {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 12px;
    letter-spacing: 6px;
    color: var(--mars-light, #ed8733);
    text-shadow: 2px 2px 0 #1a0507;
    margin: 0;
}

.credits-title {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 26px;
    letter-spacing: 4px;
    color: var(--text-cream, #f6c885);
    text-shadow: 3px 3px 0 #1a0507, 0 0 18px rgba(237, 135, 51, 0.45);
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--panel-brown, #4d1d15);
}

.credits-role {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 10px;
    letter-spacing: 4px;
    color: var(--mars-orange, #d85a22);
    text-shadow: 2px 2px 0 #1a0507;
    margin: 0 0 6px;
}

.credits-name {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 16px;
    letter-spacing: 3px;
    color: var(--text-cream, #f6c885);
    text-shadow: 2px 2px 0 #1a0507, 0 0 8px rgba(224, 114, 40, 0.25);
    margin: 0;
}

.credits-name--sm {
    font-size: 12px;
    color: var(--mars-light, #ed8733);
}

.credits-class {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--logo-gold, #e39a3e);
    text-shadow: 2px 2px 0 #1a0507;
    margin: 0;
}

.credits-class--light {
    color: var(--mars-light, #ed8733);
}

.credits-skip {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(calc(-50% + 4px));
    z-index: 2;
    height: 46px;
    padding: 0 22px;
    background: transparent;
    border: 2px solid #A6511F;
    color: #A6511F;
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
    text-shadow: 2px 2px 0 #1a0507;
    clip-path: polygon(
        0px 0px,
        calc(100% - 8px) 0px,
        100% 8px,
        100% 100%,
        0px 100%
    );
    transition: color 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}
.credits-skip[hidden] { display: none; }

.credits-skip:hover,
.credits-skip:focus-visible {
    color: var(--mars-light, #ed8733);
    border-color: var(--mars-light, #ed8733);
    text-shadow: 2px 2px 0 #1a0507, 0 0 4px rgba(237, 135, 51, 0.6);
    box-shadow: 0 0 10px rgba(216, 90, 34, 0.4);
    outline: none;
}

@media (max-width: 600px) {
    .credits-title { font-size: 18px; }
    .credits-name  { font-size: 12px; }
    .credits-class { font-size: 10px; }
}

@media (max-width: 650px) {
    .ranking-overlay { padding: 10px; }
    .ranking-header, .ranking-footer { align-items: flex-start; padding: 14px; }
    .ranking-header h2 { font-size: 16px; }
    .ranking-subtitle { max-width: 280px; }
    .ranking-filters { padding-left: 14px; padding-right: 14px; }
    .ranking-content { padding: 14px; }
    .ranking-footer { flex-direction: column; }
    .ranking-podium { gap: 6px; }
    .ranking-podium__card { padding: 12px 5px; }
    .ranking-podium__name { font-size: 8px; }
    .ranking-podium__character { font-size: 6px; }
    .ranking-podium__time { font-size: 12px; }
    .ranking-podium__stats { font-size: 5px; }
    .ranking-table { font-size: 6px; }
    .ranking-table th, .ranking-table td { padding: 9px 7px; }
}

/* Footer */
.pause-panel__footer {
    background-color: #0d0507;
    border-top: 1px solid #4d1d15;
    padding: 10px 16px;
    font-size: 7px;
    color: #8f3419;
    text-align: center;
    letter-spacing: 0.5px;
}

/* ─── Responsive: Pause Menu ─────────────────────────────── */
@media (max-width: 600px) {
    .pause-panel {
        width: 94%;
    }
    .pause-panel__title {
        font-size: 9px;
    }
    .pause-panel__btn {
        font-size: 10px;
        height: 48px;
        letter-spacing: 1px;
        padding-left: 14px;
    }
    .pause-panel__body {
        gap: 12px;
    }
}

/* ─── Responsive: Game Viewport ──────────────────────────── */
/* Base: Desktop (≥1101px) — game viewport fills viewport, canvas scales via JS */

/* Tablet: narrower viewports (601–1100px) */
@media (min-width: 601px) and (max-width: 1100px) {
    .game-viewport {
        width: 100vw;
        height: 100vh;
    }
}

/* Mobile: small viewports (≤600px) */
@media (max-width: 600px) {
    .game-viewport {
        width: 100vw;
        height: 100vh;
    }
}

/* ─── Cave Choice Overlay ────────────────────────────────── */
/* Tela de escolha de caminho da caverna (aberta pelo [E] na entrada).
   Fundo: cavern_choice.jpeg (cover); fallback retângulo sólido enquanto a
   arte não existir. Hotspots posicionados sobre os buracos da imagem
   (coordenadas em JS, ui/caveChoiceScreen.js -> HOTSPOTS). */
.cave-choice-overlay {
    position: absolute;
    inset: 0;
    z-index: 260;
    background: rgba(5, 5, 11, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: caveChoiceIn 0.2s ease forwards;
    user-select: none;
}

.cave-choice-overlay[hidden] {
    display: none;
}

@keyframes caveChoiceIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Camada do fundo (imagem ou placeholder) preenchendo o overlay */
.cave-choice-bg {
    position: absolute;
    inset: 0;
    /* Fallback sólido (placeholder) enquanto cavern_choice.jpeg não existe.
       A classe .has-bg (aplicada por JS via loadCavernChoiceBackground)
       mantém o background-image definido inline; o fundo escuro abaixo só
       aparece quando a imagem não está disponível. */
    background-color: #14060d;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    box-shadow: inset 0 0 80px rgba(226, 114, 40, 0.18);
}

/* Título no topo */
.cave-choice-header {
    position: absolute;
    top: 28px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    text-align: center;
    padding: 0 24px;
}

.cave-choice-title {
    font-family: var(--font-pixel);
    font-size: 20px;
    color: #f6c885;
    letter-spacing: 3px;
    /* Mesma cor/sombra dos botões (labels) */
    text-shadow: 2px 2px 0 #1c080b, 0 0 10px rgba(224, 114, 40, 0.8);
}

.cave-choice-sub {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: #f6c885;
    letter-spacing: 1.5px;
    /* Mesma cor/sombra dos botões (labels) */
    text-shadow: 2px 2px 0 #1c080b, 0 0 10px rgba(224, 114, 40, 0.8);
}

/* Hotspots clicáveis/selecionáveis sobre os buracos da imagem.
   O botão encolhe ao tamanho do texto (shrink-to-fit) e é centralizado no
   ponto (cx, cy) definido em JS via transform translate(-50%,-50%) — a área
   de clique fica apenas onde está o texto, sem retângulo grande. */
.cave-choice-hotspot {
    position: absolute;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    transform: translate(-50%, -50%);
}

.cave-choice-hotspot:active {
    transform: translate(-50%, calc(-50% + 2px));
}

/* Efeito de hover/foco aplicado só ao botão pequeno (label).
   O destaque vem de :hover (enquanto o mouse está em cima) ou da classe
   .is-selected gerenciada por JS (navegação por teclado) — sem
   :focus-visible para o destaque não "grudar" após interação com o mouse. */
.cave-choice-hotspot:hover .cave-choice-hotspot__label,
.cave-choice-hotspot.is-selected .cave-choice-hotspot__label {
    background: rgba(224, 114, 40, 0.35);
    border-color: #f6c885;
    box-shadow: 0 0 14px rgba(224, 114, 40, 0.5);
}

.cave-choice-hotspot__label {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: #f6c885;
    letter-spacing: 1.5px;
    text-shadow: 2px 2px 0 #1c080b, 0 0 10px rgba(224, 114, 40, 0.8);
    padding: 6px 10px;
    background: rgba(5, 5, 11, 0.45);
    border: 1px solid rgba(224, 114, 40, 0.4);
    line-height: 1.4;
    text-align: center;
}

/* Rodapé com dicas de controle */
.cave-choice-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 38px;
    background: rgba(5, 5, 11, 0.85);
    border-top: 1px solid #4d1d15;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.cave-choice-footer span {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: #f6c885;
    letter-spacing: 1px;
}

@media (max-width: 600px) {
    .cave-choice-title {
        font-size: 14px;
    }
    .cave-choice-sub {
        font-size: 8px;
    }
    .cave-choice-hotspot__label {
        font-size: 7px;
    }
    .cave-choice-footer span {
        font-size: 6px;
    }
}

/* ─── Modal de Loja do Aliado ─── */
.shop-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 11, 0.88);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    user-select: none;
    animation: shopFadeIn 0.2s ease-out;
}

@keyframes shopFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.shop-panel {
    background: linear-gradient(160deg, rgba(22, 9, 7, .96), rgba(5, 5, 11, .94));
    border: 3px solid #e07228;
    box-shadow: 0 0 35px rgba(224, 114, 40, 0.35), inset 0 0 20px rgba(0, 0, 0, 0.9);
    width: 95%;
    max-width: 980px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e07228;
    padding-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.shop-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-header-icon {
    color: #e07228;
    font-size: 12px;
}

.shop-title {
    font-size: 14px;
    color: #f6c885;
    letter-spacing: 2px;
    margin: 0;
}

.shop-wallet {
    background: rgba(5, 5, 11, .82);
    border: 1px solid #e07228;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-wallet-label {
    font-size: 8px;
    color: #c5975b;
}

.shop-wallet-amount {
    font-size: 11px;
    color: #ffd440;
    font-weight: bold;
}

.shop-message-bar {
    padding: 8px 12px;
    font-size: 9px;
    text-align: center;
    letter-spacing: 1px;
}

.shop-message-bar.msg-success {
    background: rgba(40, 160, 60, 0.25);
    border: 1px solid #4ade80;
    color: #86efac;
}

.shop-message-bar.msg-warning,
.shop-message-bar.msg-error {
    background: rgba(180, 40, 40, 0.25);
    border: 1px solid #f87171;
    color: #fca5a5;
}

.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.shop-card {
    position: relative;
    background: linear-gradient(180deg, rgba(23, 9, 7, .88), rgba(5, 5, 11, .86));
    border: 2px solid #a6511f;
    border-radius: 0;
    padding: 16px;
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.shop-card:hover {
    border-color: #e07228;
    background: linear-gradient(180deg, rgba(44, 16, 10, .92), rgba(8, 5, 8, .9));
    box-shadow: 0 4px 16px rgba(224, 114, 40, 0.2);
    transform: translateY(-2px);
}

.shop-card.shop-card-special {
    border-color: #e07228;
    background: linear-gradient(180deg, rgba(27, 12, 9, .91), rgba(5, 5, 11, .9));
    box-shadow: inset 0 0 20px rgba(224, 114, 40, .13);
}

.shop-card.shop-card-special:hover {
    border-color: #ed8733;
    box-shadow: inset 0 0 24px rgba(224, 114, 40, .18), 0 0 22px rgba(224, 114, 40, .18);
    transform: translateY(-2px);
}

.shop-card.is-bought {
    border-color: #444;
    opacity: 0.7;
}

.shop-card-badge {
    font-size: 7px;
    color: #8a5a40;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.shop-card-purchase-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 7px;
    color: #ffd440;
    background: rgba(10, 8, 14, 0.85);
    padding: 2px 6px;
    border: 1px solid #e07228;
    border-radius: 0;
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
}

.shop-card-sprite {
    width: 128px;
    height: 128px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6));
}

.shop-card-sprite img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    transform: scale(1.15);
}

.shop-card-sprite[data-item-id="cura_alienigena"] {
    background: radial-gradient(circle at center, rgba(34, 197, 94, 0.15) 0%, transparent 70%);
    border-radius: 0;
}

.shop-card-sprite[data-item-id="energia_duna"] {
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.15) 0%, transparent 70%);
    border-radius: 0;
}

.shop-card-sprite[data-item-id="cadencia_frenetica"] {
    background: radial-gradient(circle at center, rgba(234, 179, 8, 0.15) 0%, transparent 70%);
    border-radius: 0;
}

.shop-card-sprite[data-item-id="necro_ally_help"] {
    background: radial-gradient(circle at center, rgba(77, 210, 255, 0.15) 0%, transparent 70%);
    border-radius: 0;
}



.shop-card.shop-card-special .shop-card-badge {
    color: #4dd2ff;
}

.shop-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.shop-card-name {
    font-size: 10px;
    color: #f6c885;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.shop-card.shop-card-special .shop-card-name {
    color: #d6f4ff;
}

.shop-card-desc {
    font-size: 7px;
    color: #b08a6e;
    line-height: 1.5;
    flex-grow: 1;
}

.shop-card-stats {
    display: flex;
    gap: 12px;
    padding-top: 6px;
    border-top: 1px dashed #4d1d15;
    margin-top: auto;
}

.shop-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 7px;
    color: #c8a07a;
}

.shop-stat-value {
    color: #ffd440;
    font-weight: bold;
}

.shop-card-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid #3d1a12;
}

.price-tag {
    font-size: 7px;
    color: #8a5a40;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-val {
    font-size: 11px;
    color: #ffd440;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.shop-buy-btn {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 8px;
    padding: 10px 16px;
    background: rgba(70, 23, 12, .84);
    border: 2px solid #e07228;
    color: #fffae6;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shop-buy-btn:hover:not(:disabled) {
    background: rgba(107, 38, 18, .9);
    border-color: #ed8733;
    box-shadow: 0 2px 8px rgba(224, 114, 40, 0.4);
    transform: translateY(-1px);
}

.shop-buy-btn:active:not(:disabled) {
    transform: translateY(0);
}

.shop-buy-btn.bought,
.shop-buy-btn:disabled {
    background: rgba(12, 9, 9, .78);
    border-color: #8f3419;
    color: #888;
    cursor: default;
}

.shop-footer {
    display: flex;
    justify-content: center;
    margin-top: 6px;
}

.shop-close-btn {
    font-family: var(--font-pixel, 'Press Start 2P', monospace);
    font-size: 9px;
    padding: 10px 24px;
    background: rgba(18, 7, 8, .91);
    border: 2px solid #e07228;
    color: #f6c885;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.shop-close-btn:hover {
    background: rgba(224, 114, 40, 0.25);
    border-color: #f6c885;
}

@media (max-width: 680px) {
    .shop-items-grid {
        grid-template-columns: 1fr;
    }
}
