* {
    box-sizing: border-box;
}

:root {
    /* escala e medidas */
    --ui-scale: 1;
    --icon-btn: 65px;
    --tt-img: 55px;
    --char-btn-w: 80px;
    --char-btn-h: 65px;
    --contract-btn-w: 150px;
    --contract-btn-h: 25px;
    --objetive-btn-w: 130px;
    --objetive-btn-h: 65px;
    --spec-btn-w: 200px;
    --spec-btn-h: 65px;
    --radius: 10px;
    --pad-small: 3px;
    /* ===== Paleta Madeira + Metal escuro ===== */
    --wood-00: #1c1713; /* fundo geral (madeira bem escura) */
    --wood-01: #221b16; /* painéis */
    --wood-02: #2a221b; /* áreas internas */
    --grain-00: #3a2f26; /* linhas/bordas discretas */
    --metal-ink: #e6dccf; /* texto “marfim” visível no escuro */
    --metal-ink-dim: #c9bead;
    --brass-00: #b79a63; /* latão/brass base */
    --brass-10: rgba(183,154,99,.22);
    --brass-20: rgba(183,154,99,.36);
    --brass-30: #a4864f; /* active */
    --steel-00: #6a6b6e; /* aço frio p/ detalhes */
    --steel-10: rgba(106,107,110,.25);
    --muted-pane: rgba(255,255,255,.05);
    --muted-line: rgba(230,220,207,.08);
    --disabled-bg: rgba(255,255,255,.08);
    --disabled-fg: rgba(106,107,110,.25);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--wood-00);
    color: var(--metal-ink);
}

.game-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.game-grid {
    display: grid;
    transform: scale(var(--ui-scale));
    transform-origin: top left;
    width: calc(100% / var(--ui-scale));
    height: calc(100dvh / var(--ui-scale));
    gap: 4px;
}

.game-area {
    border: 1px solid var(--grain-00);
    border-radius: 10px;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: var(--wood-02);
    box-shadow: inset 0 0 0 1px var(--muted-line);
}

.menu-root {
    display: grid;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.menu-section {
    display: grid;
}

.menu-panel {
    border: 1px solid var(--steel-10);
    background: linear-gradient(180deg, var(--wood-01), var(--wood-02));
    overflow: auto;
    height: 100%;
    box-shadow: inset 0 1px 0 var(--muted-line);
    align-content: space-around;
    display: grid;
    grid-template-rows: auto 1fr;
}

    .menu-panel.is-hidden {
        visibility: hidden;
        pointer-events: none;
    }

    .menu-panel .title {
        text-align: center;
        font-weight: 300;
        margin: 0 0 10px;
        color: var(--metal-ink);
        font-size: 15px;
        white-space: nowrap;
    }

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    padding: 1px;
    justify-items: center;
    justify-content: space-evenly;
    align-items: center;
    align-content: space-evenly;
    height: 100%;
    overflow-x: hidden;
}

.icon-button,
.character-button,
.contract-button {
    border: 1px solid var(--steel-10);
    background: var(--brass-10);
    color: var(--metal-ink);
    transition: transform .06s ease, background .12s ease, opacity .12s ease, box-shadow .12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
    cursor: default;
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--muted-line);
}

.icon-button {
    width: calc(var(--icon-btn) * var(--ui-scale));
    height: calc(var(--icon-btn) * var(--ui-scale));
    min-width: calc(var(--icon-btn) * var(--ui-scale));
    min-height: calc(var(--icon-btn) * var(--ui-scale));
    max-width: calc(var(--icon-btn) * var(--ui-scale));
    max-height: calc(var(--icon-btn) * var(--ui-scale));
    padding: calc(var(--pad-small) * var(--ui-scale));
}

    .icon-button .icon-img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
        pointer-events: none;
    }

.character-button {
    width: calc(var(--char-btn-w) * var(--ui-scale));
    height: calc(var(--char-btn-h) * var(--ui-scale));
    min-width: calc(var(--char-btn-w) * var(--ui-scale));
    min-height: calc(var(--char-btn-h) * var(--ui-scale));
    max-width: calc(var(--char-btn-w) * var(--ui-scale));
    max-height: calc(var(--char-btn-h) * var(--ui-scale));
    padding: calc(2px * var(--ui-scale));
}

    .character-button .icon-img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
        pointer-events: none;
    }

.contract-button {
    width: calc(var(--contract-btn-w) * var(--ui-scale));
    height: calc(var(--contract-btn-h) * var(--ui-scale));
    min-width: calc(var(--contract-btn-w) * var(--ui-scale));
    min-height: calc(var(--contract-btn-h) * var(--ui-scale));
    max-width: calc(var(--contract-btn-w) * var(--ui-scale));
    max-height: calc(var(--contract-btn-h) * var(--ui-scale));
    padding: calc(2px * var(--ui-scale));
}

    .icon-button:hover,
    .character-button:hover,
    .contract-button:hover {
        background: var(--brass-20);
    }

    .icon-button:active,
    .character-button:active,
    .contract-button:active {
        background: var(--brass-30);
        transform: translateY(1px) scale(.98);
        box-shadow: 0 0 0 1px var(--brass-00), inset 0 0 0 1px var(--muted-line);
    }

    .icon-button:disabled,
    .character-button:disabled,
    .contract-button:disabled {
        background: var(--disabled-bg);
        color: var(--disabled-fg);
        opacity: .3;
        transform: none;
        box-shadow: none;
    }

.objetive-button {
    width: calc(var(--objetive-btn-w) * var(--ui-scale));
    height: calc(var(--objetive-btn-h) * var(--ui-scale));
    min-width: calc(var(--objetive-btn-w) * var(--ui-scale));
    min-height: calc(var(--objetive-btn-h) * var(--ui-scale));
    max-width: calc(var(--objetive-btn-w) * var(--ui-scale));
    max-height: calc(var(--objetive-btn-h) * var(--ui-scale));
    border: 1px solid var(--steel-10);
    padding: calc(10px * var(--ui-scale)) calc(14px * var(--ui-scale));
    font-size: calc(1rem * var(--ui-scale));
    background: var(--brass-10);
    color: var(--metal-ink);
    font-weight: 600;
    letter-spacing: .2px;
    cursor: pointer;
    transition: transform .06s ease, background .12s ease, opacity .12s ease, box-shadow .12s ease;
    box-shadow: inset 0 0 0 1px var(--muted-line);
}

    .objetive-button:hover, .spec-button:hover {
        background: var(--brass-20);
    }

    .objetive-button:active, .spec-button:active {
        background: var(--brass-30);
        transform: translateY(1px) scale(.98);
        box-shadow: 0 0 0 1px var(--brass-00), inset 0 0 0 1px var(--muted-line);
    }

    .objetive-button:disabled, .spec-button:disabled {
        background: var(--disabled-bg);
        color: var(--disabled-fg);
        opacity: .6;
        transform: none;
        box-shadow: none;
        cursor: default;
    }

.spec-button {
    width: calc(var(--spec-btn-w) * var(--ui-scale));
    height: calc(var(--spec-btn-h) * var(--ui-scale));
    min-width: calc(var(--spec-btn-w) * var(--ui-scale));
    min-height: calc(var(--spec-btn-h) * var(--ui-scale));
    max-width: calc(var(--spec-btn-w) * var(--ui-scale));
    max-height: calc(var(--spec-btn-h) * var(--ui-scale));
    border: 1px solid var(--steel-10);
    padding: calc(10px * var(--ui-scale)) calc(14px * var(--ui-scale));
    font-size: calc(1rem * var(--ui-scale));
    background: var(--brass-10);
    color: var(--metal-ink);
    font-weight: 600;
    letter-spacing: .2px;
    cursor: pointer;
    transition: transform .06s ease, background .12s ease, opacity .12s ease, box-shadow .12s ease;
    box-shadow: inset 0 0 0 1px var(--muted-line);
    border-radius: calc(12px * var(--ui-scale));
    width: 90%;
    height: 100%;
}

    .spec-button .spec-img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
        pointer-events: none;
    }

.objetive-button{
    width: 100%;
    height: 100%;
    min-width: 100%;
}

    .objetive-button .objetive-img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
        pointer-events: none;
        width: 100%;
    }

.character-button .selected {
    background: rgba(183,154,99,.18);
}

.image-resource {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    max-width: 20px;
    max-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px;
    overflow: hidden;
    white-space: nowrap;
    object-fit: contain;
}

.info-table {
    width: 100%;
    gap: 8px 12px;
    padding-top: 6px;
}

    .info-table thead th {
        text-align: center;
        font-weight: 700;
        font-size: .95rem;
        padding: 4px 6px;
        border-bottom: 1px solid var(--muted-line);
        color: var(--metal-ink);
    }

    .info-table tbody {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

        .info-table tbody td {
            padding: 2px 4px;
            vertical-align: middle;
            color: var(--metal-ink-dim);
        }

.info-row {
    display: grid;
    grid-template-columns: 1fr auto;
    transition: background .15s ease;
}

    .info-row:hover {
        background: var(--muted-pane);
    }

.info-name {
    display: flex;
    text-align: left;
    gap: 4px;
    font-weight: 600;
    color: var(--metal-ink);
}

.info-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--metal-ink);
}

.tt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-items: center;
    align-content: center;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--steel-10);
    box-shadow: inset 0 0 0 1px var(--muted-line);
    background: var(--brass-10);
    width: calc(var(--tt-img) * var(--ui-scale));
    height: calc(var(--tt-img) * var(--ui-scale));
    padding: 2px;
}

    .tt-icon .tt-img {
        width: calc(var(--tt-img-size) * var(--ui-scale));
        height: calc(var(--tt-img-size) * var(--ui-scale));
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
        margin: 0 auto;
        pointer-events: none;
    }

.click-stage-img {
    pointer-events: none;
    -webkit-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
}

.click-pop {
    position: absolute;
    left: 50%;
    top: 75%;
    transform: translate(-50%, 0);
    pointer-events: none;
    animation: click-pop-move var(--dur, 700ms) ease-out forwards;
    opacity: 0;
    will-change: transform, opacity;
}

.click-pop-inner {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 800;
    font-size: clamp(14px, 1.6vw, 18px);
    color: #ffd45e;
    text-shadow: 0 1px 2px rgba(0,0,0,.6);
    white-space: nowrap;
}

.click-pop-icon {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    object-fit: contain;
}

@keyframes click-pop-move {
    0% {
        transform: translate(-50%, 0) translate(0, 0) scale(.9);
        opacity: 0;
    }

    10% {
        transform: translate(-50%, 0) translate(0, -6px) scale(1);
        opacity: 1;
    }

    70% {
        transform: translate(-50%, 0) translate(var(--dx, 0), calc(var(--dy, -80px) * .7));
        opacity: 1;
    }

    100% {
        transform: translate(-50%, 0) translate(var(--dx, 0), var(--dy, -80px));
        opacity: 0;
    }
}


@media (max-width: 1400px) {
    :root {
        --ui-scale: 0.9;
    }
}

@media (max-width: 1200px) {
    :root {
        --ui-scale: 0.85;
    }
}

@media (max-width: 1000px) {
    :root {
        --ui-scale: 0.80;
    }
}

@media (max-width: 800px) {
    :root {
        --ui-scale: 0.75;
    }
}

@media (max-width: 600px) {
    :root {
        --ui-scale: 0.70;
    }
}
