/* Padrão visual compartilhado pelas calculadoras públicas. */
body.calculator-page {
    --calculator-border: #d9d0c6;
    --calculator-panel: #f8f5f0;
    --calculator-muted: #665d56;
    --calculator-orange: #d65728;
    --calculator-dark: #2a1b16;
}

/* Prévia das tabelas exclusivas para visitantes sem Calculadora PRO. */
body.calculator-page .calculator-pro-preview-shell {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: 12px;
    isolation: isolate;
}

body.calculator-page .calculator-pro-preview-surface {
    min-width: 0;
    overflow-x: auto;
}

body.calculator-page .calculator-pro-preview-veil {
    position: absolute;
    z-index: 8;
    inset: 48% 0 0;
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 22px;
    border-top: 1px solid rgba(235, 112, 55, .42);
    background: linear-gradient(180deg, rgba(24, 18, 16, .28), rgba(24, 16, 14, .9) 34%, rgba(17, 13, 12, .97));
    -webkit-backdrop-filter: blur(7px) saturate(.72);
    backdrop-filter: blur(7px) saturate(.72);
    box-shadow: inset 0 18px 38px rgba(64, 27, 14, .12);
    text-align: center;
}

body.calculator-page .calculator-pro-preview-veil::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 25%, rgba(226, 89, 38, .19), transparent 52%);
}

body.calculator-page .calculator-pro-preview-card {
    position: relative;
    z-index: 1;
    width: min(100%, 680px);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    justify-items: start;
    gap: 3px 13px;
    padding: 13px 16px;
    border: 1px solid rgba(244, 131, 75, .42);
    border-radius: 13px;
    color: #fff7f0;
    background: linear-gradient(145deg, rgba(43, 31, 27, .96), rgba(24, 18, 16, .98));
    box-shadow: 0 18px 44px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
    text-align: left;
}

body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-icon {
    grid-column: 1;
    grid-row: 1 / span 3;
}

body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-badge,
body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-card > strong,
body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-copy {
    grid-column: 2;
}

body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-action {
    grid-column: 3;
    grid-row: 1 / span 3;
    margin-top: 0;
}

body.calculator-page .calculator-pro-preview-veil.is-secondary {
    min-height: 110px;
    padding: 12px;
}

body.calculator-page .calculator-pro-preview-veil.is-secondary .calculator-pro-preview-card {
    width: min(100%, 280px);
    grid-template-columns: auto 1fr;
    justify-items: start;
    gap: 3px 10px;
    padding: 11px 14px;
    text-align: left;
}

body.calculator-page .calculator-pro-preview-veil.is-secondary .calculator-pro-preview-icon {
    grid-row: 1 / span 2;
    width: 31px;
    height: 31px;
}

body.calculator-page .calculator-pro-preview-veil.is-secondary .calculator-pro-preview-badge {
    align-self: end;
}

body.calculator-page .calculator-pro-preview-veil.is-secondary .calculator-pro-preview-card > strong {
    align-self: start;
    font-size: 12px;
}

body.calculator-page .calculator-pro-preview-veil.is-progressive {
    inset: var(--calculator-pro-lock-start, 48%) 0 0;
    min-height: 0;
}

body.calculator-page .calculator-pro-preview-veil.is-compact {
    padding: 2px 6px;
}

body.calculator-page .calculator-pro-preview-veil.is-compact .calculator-pro-preview-card {
    width: auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 7px;
    text-align: center;
}

body.calculator-page .calculator-pro-preview-veil.is-compact :is(
    .calculator-pro-preview-icon,
    .calculator-pro-preview-card > strong,
    .calculator-pro-preview-copy,
    .calculator-pro-preview-action
) {
    display: none;
}

body.calculator-page .calculator-pro-preview-veil.is-compact .calculator-pro-preview-badge {
    align-self: center;
    line-height: 1.2;
}

body.calculator-page .calculator-pro-preview-veil.is-mini {
    inset: 0;
    min-height: 0;
    padding: 2px 6px;
}

body.calculator-page .calculator-pro-preview-veil.is-empty {
    display: none;
}

body.calculator-page .calculator-pro-preview-veil.is-mini .calculator-pro-preview-card {
    width: auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 7px;
    text-align: center;
}

body.calculator-page .calculator-pro-preview-veil.is-mini :is(
    .calculator-pro-preview-icon,
    .calculator-pro-preview-card > strong,
    .calculator-pro-preview-copy,
    .calculator-pro-preview-action
) {
    display: none;
}

body.calculator-page .calculator-pro-preview-veil.is-mini .calculator-pro-preview-badge {
    align-self: center;
    line-height: 1.2;
}

body.calculator-page .calculator-pro-preview-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(243, 139, 83, .44);
    border-radius: 50%;
    color: #ff9a62;
    background: rgba(216, 77, 28, .13);
}

body.calculator-page .calculator-pro-preview-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.calculator-page .calculator-pro-preview-badge {
    color: #ff9d65;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .15em;
    text-transform: uppercase;
}

body.calculator-page .calculator-pro-preview-card > strong {
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.2;
}

body.calculator-page .calculator-pro-preview-copy {
    max-width: 380px;
    color: #d7c9c1;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.55;
}

body.calculator-page .calculator-pro-preview-action {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 3px;
    padding: 0 18px;
    border: 1px solid #e15a2c;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, #d84e20, #ee6a36);
    box-shadow: 0 9px 22px rgba(191, 60, 18, .27);
    font-size: 11px;
    font-weight: 900;
    text-decoration: none;
}

body.calculator-page .calculator-pro-preview-action:hover,
body.calculator-page .calculator-pro-preview-action:focus-visible {
    color: #fff;
    background: linear-gradient(135deg, #e65b29, #f47a43);
    outline: 2px solid rgba(255, 166, 112, .62);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    body.calculator-page .calculator-pro-preview-veil {
        inset-block-start: 46%;
        min-height: 210px;
        padding: 13px;
    }

    body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-card {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 6px;
        padding: 15px 14px;
        text-align: center;
    }

    body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) .calculator-pro-preview-icon {
        display: none;
    }

    body.calculator-page .calculator-pro-preview-veil:not(.is-secondary) :is(
        .calculator-pro-preview-icon,
        .calculator-pro-preview-badge,
        .calculator-pro-preview-card > strong,
        .calculator-pro-preview-copy,
        .calculator-pro-preview-action
    ) {
        grid-column: auto;
        grid-row: auto;
    }

    body.calculator-page .calculator-pro-preview-icon {
        width: 32px;
        height: 32px;
    }

    body.calculator-page .calculator-pro-preview-copy {
        font-size: 10px;
    }

    body.calculator-page .calculator-pro-preview-action {
        width: 100%;
    }

    body.calculator-page .calculator-pro-preview-veil.is-mini {
        min-height: 0;
        padding: 2px 5px;
    }

    body.calculator-page .calculator-pro-preview-veil.is-mini .calculator-pro-preview-card {
        display: inline-flex;
        padding: 4px 8px;
    }

    body.calculator-page .calculator-pro-preview-veil.is-progressive {
        inset-block-start: var(--calculator-pro-lock-start, 48%);
        min-height: 0;
    }
}

/* Shared result language: required values are green; shortages are red. */
body.calculator-page .calculator-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
}

body.calculator-page .calculator-summary--needed,
body.calculator-page .calculator-summary--balance:not(.is-missing),
body.calculator-page .calculator-summary--positive {
    border-color: #9fd3b5 !important;
    background: #f3fff8 !important;
}

body.calculator-page .calculator-summary--missing,
body.calculator-page .calculator-summary--balance.is-missing {
    border-color: #ee9a78 !important;
    background: #fff3ed !important;
}

body.calculator-page .calculator-summary--needed > span:last-child,
body.calculator-page .calculator-summary--balance:not(.is-missing) > span:last-child,
body.calculator-page .calculator-summary--positive > span:last-child {
    color: #256b4a !important;
}

body.calculator-page .calculator-summary--missing > span:last-child,
body.calculator-page .calculator-summary--balance.is-missing > span:last-child {
    color: #a43b1d !important;
}

body.calculator-page .calculator-summary--available {
    display: none !important;
}

/* Mantém necessários e faltantes em linhas completas por calculadora. */
body.calculator-page--collection .collection-result-grid.calculator-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

body.calculator-page--armor .calculator-result-grid.calculator-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 850px) {
    body.calculator-page--collection .collection-result-grid.calculator-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 760px) {
    body.calculator-page--armor .calculator-result-grid.calculator-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 620px) {
    body.calculator-page--collection .collection-result-grid.calculator-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

.lab-inventory-field {
    display: grid;
    gap: .45rem;
    max-width: 360px;
    margin: 0 auto 1rem;
    font-weight: 800;
    color: #3f342e;
}

.lab-inventory-field input {
    min-height: 48px;
    border: 1px solid #d8c9bd;
    border-radius: 10px;
    color: var(--calculator-dark);
    background: #fff;
    padding: .7rem .85rem;
    font: inherit;
}

body.calculator-page input:not([type="checkbox"]):not([type="radio"]) {
    color: var(--calculator-dark);
    caret-color: var(--calculator-orange);
    -webkit-text-fill-color: var(--calculator-dark);
}

body.calculator-page input:not([type="checkbox"]):not([type="radio"])::placeholder {
    color: #766b63;
    opacity: 1;
}

.calculator-page--collection .collection-modes,
.calculator-page--collection [data-collection-panel="inventory"] > :not(.collection-fields--inventory) {
    display: none !important;
}

.calculator-page--armor .calculator-modes {
    display: none !important;
}

.calculator-page--forticlad .forticlad-modes {
    display: none !important;
}

.calculator-page--forticlad [data-forticlad-inventory-host] .forticlad-inventory-fields {
    margin: 1rem 0 1.25rem;
}

.calculator-page--tome .calculator-modes {
    display: none !important;
}

.calculator-page--tome [data-tome-inventory-host] .calculator-tome-inputs {
    margin-top: 1rem;
}

body.calculator-page :is(input, select, button) {
    font-family: inherit;
}

body.calculator-page table {
    scroll-margin-top: 155px;
}

body.calculator-page [data-calculator-resource-anchor] {
    scroll-margin-top: 155px;
}

body.calculator-page .calculator-table-shortcut {
    position: fixed;
    z-index: 38;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px 7px 15px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #2a1b16, #59301f);
    box-shadow: 0 12px 34px rgba(48, 25, 16, .34);
    font-size: 10px;
    font-weight: 950;
    letter-spacing: .09em;
    text-transform: uppercase;
    cursor: pointer;
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: box-shadow .2s, background .2s;
}

body.calculator-page .calculator-table-shortcut:hover,
body.calculator-page .calculator-table-shortcut:focus-visible {
    background: linear-gradient(135deg, #b9441d, #e46831);
    box-shadow: 0 14px 38px rgba(192, 65, 25, .4);
    outline: 3px solid rgba(214, 87, 40, .22);
    outline-offset: 2px;
}

body.calculator-page .calculator-table-shortcut-arrow {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--calculator-orange);
    font-size: 20px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform .24s ease, background .2s;
}

body.calculator-page .calculator-table-shortcut.is-after-table .calculator-table-shortcut-arrow {
    transform: rotate(180deg);
}

body.calculator-page table.calculator-table-highlight {
    animation: calculatorTableHighlight 1.35s ease-out;
}

body.calculator-page .calculator-resource-highlight {
    animation: calculatorResourceHighlight 1.35s ease-out;
}

@keyframes calculatorTableHighlight {
    0%, 35% { filter: drop-shadow(0 0 12px rgba(214, 87, 40, .58)); }
    100% { filter: none; }
}

@keyframes calculatorResourceHighlight {
    0%, 35% { filter: drop-shadow(0 0 10px rgba(214, 87, 40, .48)); }
    100% { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    body.calculator-page table { scroll-behavior: auto; }
    body.calculator-page table.calculator-table-highlight { animation: none; }
    body.calculator-page .calculator-resource-highlight { animation: none; }
    body.calculator-page .calculator-table-shortcut-arrow { transition: none; }
}

/* Voltar precisa parecer uma acao clara, principalmente no celular. */
body.calculator-page a[class$="-back"] {
    display: inline-flex;
    min-height: 42px;
    box-sizing: border-box;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 8px;
    border: 1px solid #d8cdc3;
    border-radius: 999px;
    color: #3d322d;
    background: #fff;
    box-shadow: 0 8px 22px rgba(63, 40, 29, .08);
    font-size: 11px;
    line-height: 1;
}

body.calculator-page a[class$="-back"]::before {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    margin-right: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--calculator-orange);
    content: '\2190';
    font-size: 18px;
    line-height: 1;
}

body.calculator-page a[class$="-back"]:hover,
body.calculator-page a[class$="-back"]:focus-visible {
    border-color: var(--calculator-orange);
    color: var(--calculator-orange);
    transform: translateY(-1px);
}

/* Hierarquia mais forte para identificadores, instrucoes e dicas. */
body.calculator-page p[class$="-kicker"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid #f0c5b2;
    border-radius: 999px;
    background: #fff0e8;
}

body.calculator-page p[class$="-kicker"]::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--calculator-orange);
    box-shadow: 0 0 0 4px rgba(214, 87, 40, .12);
    content: '';
}

body.calculator-page :is(
    .arsenal-panel-copy,
    .collection-mode-copy,
    .forticlad-mode-copy,
    .energy-mode-copy,
    .calculator-mode-copy,
    .forticlad-inventory-hint,
    .lab-note
) {
    position: relative;
    padding: 13px 15px 13px 45px;
    border: 1px solid #ead8cd;
    border-left: 4px solid var(--calculator-orange);
    border-radius: 4px;
    color: #51463f;
    background: #fffaf6;
    font-weight: 700;
    text-align: left;
}

body.calculator-page :is(
    .arsenal-panel-copy,
    .collection-mode-copy,
    .forticlad-mode-copy,
    .energy-mode-copy,
    .calculator-mode-copy,
    .forticlad-inventory-hint,
    .lab-note
)::before {
    position: absolute;
    top: 16px;
    left: 17px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--calculator-orange);
    box-shadow: 0 0 0 5px rgba(214, 87, 40, .12);
    content: '';
}

/* As tabelas deixam de disputar espaço lateral com a calculadora. */
body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-layout {
    display: block;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-card,
body.calculator-page--energy .energy-card,
body.calculator-page--laboratory section[aria-labelledby="lab-tree-title"] {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--calculator-border);
    border-radius: 5px;
    background: var(--calculator-panel);
    box-shadow: 0 18px 45px rgba(63, 40, 29, .08);
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-card,
body.calculator-page--energy .energy-card {
    padding: 0;
    text-align: left;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-card > h2,
body.calculator-page--energy .energy-card > h2 {
    padding: 26px 26px 0;
    font-size: 31px;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-card > p,
body.calculator-page--energy .energy-card > p {
    margin: 0;
    padding: 9px 26px 20px;
    border-bottom: 1px solid #ded5cc;
    color: var(--calculator-muted);
    font-size: 13px;
    line-height: 1.55;
}

body:is(.calculator-page--tome, .calculator-page--armor) .calculator-modes,
body.calculator-page--energy .energy-modes {
    gap: 8px;
    margin: 0;
    padding: 12px;
    background: #eee7df;
}

body:is(.calculator-page--tome, .calculator-page--armor) .calculator-mode-button,
body.calculator-page--energy .energy-mode-button {
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #685a52;
    background: transparent;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .04em;
    text-transform: uppercase;
}

body:is(.calculator-page--tome, .calculator-page--armor) .calculator-mode-button:hover,
body:is(.calculator-page--tome, .calculator-page--armor) .calculator-mode-button[aria-selected="true"],
body.calculator-page--energy .energy-mode-button:hover,
body.calculator-page--energy .energy-mode-button[aria-selected="true"] {
    border-color: #d6c9bd;
    color: #fff;
    background: linear-gradient(135deg, var(--calculator-dark), #59301f);
    box-shadow: 0 7px 18px rgba(53, 30, 20, .18);
}

body:is(.calculator-page--tome, .calculator-page--armor) .calculator-mode-panel,
body.calculator-page--energy .energy-mode-panel {
    padding: 26px;
}

body.calculator-page--equipment .calculator-card > .calculator-inputs {
    margin: 26px;
}

body.calculator-page--equipment .calculator-card > .calculator-results {
    margin: 0 26px 26px;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-inputs,
body.calculator-page--energy .energy-fields {
    gap: 16px;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-inputs--one {
    grid-template-columns: minmax(280px, 520px);
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-field input,
body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-field select,
body.calculator-page--energy .energy-field input,
body.calculator-page--forticlad .forticlad-field input,
body.calculator-page--forticlad .forticlad-field select {
    width: 100%;
    min-height: 54px;
    box-sizing: border-box;
    border-radius: 4px;
    border-color: #cfc3b8;
    background-color: #fff;
    font-size: 17px;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-field input:focus,
body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-field select:focus,
body.calculator-page--energy .energy-field input:focus,
body.calculator-page--forticlad .forticlad-field input:focus,
body.calculator-page--forticlad .forticlad-field select:focus {
    border-color: var(--calculator-orange);
    box-shadow: 0 0 0 3px rgba(214, 87, 40, .12);
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-result,
body.calculator-page--energy .energy-result {
    min-height: 112px;
    border-radius: 4px;
    background: #fff;
}

body.calculator-page--armor .calculator-result-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.calculator-page--armor .calculator-result-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-costs {
    width: 100%;
    box-sizing: border-box;
    margin-top: 48px;
    border-radius: 5px;
    box-shadow: 0 18px 45px rgba(63, 40, 29, .06);
}

body:is(.calculator-page--equipment, .calculator-page--tome) .calculator-costs {
    max-height: none;
    overflow: hidden;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-costs > header {
    padding: 26px;
    text-align: center;
}

body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-table th,
body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-table td {
    padding: 12px 16px;
}

/* Energia e Feras usa os mesmos blocos de modo, campos e resultados. */
body.calculator-page--energy .energy-mode-copy {
    text-align: left;
}

body.calculator-page--energy .energy-result-grid {
    margin-top: 22px;
}

body.calculator-page--energy .energy-field input[readonly] {
    background: #eee8e1;
}

/* O laboratório preserva a árvore, mas adota o mesmo contêiner e campos grandes. */
body.calculator-page--laboratory section[aria-labelledby="lab-tree-title"] .lab-section-title {
    margin: 0;
    padding: 26px;
    border-bottom: 1px solid #ded5cc;
}

body.calculator-page--laboratory .lab-presets {
    gap: 8px;
    margin: 0;
    padding: 12px;
    background: #eee7df;
}

body.calculator-page--laboratory .lab-preset {
    min-height: 48px;
    border-color: transparent;
    border-radius: 4px;
    color: #685a52;
    background: transparent;
}

body.calculator-page--laboratory .lab-preset:hover,
body.calculator-page--laboratory .lab-preset.is-active {
    border-color: #d6c9bd;
    color: #fff;
    background: linear-gradient(135deg, var(--calculator-dark), #59301f);
    box-shadow: 0 7px 18px rgba(53, 30, 20, .18);
}

body.calculator-page--laboratory .lab-tree {
    width: auto;
    margin: 26px;
}

body.calculator-page--laboratory .lab-stage-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.calculator-page--laboratory .lab-node select {
    min-height: 54px;
    border-radius: 4px;
    font-size: 14px;
}

body.calculator-page--laboratory .lab-results {
    overflow: hidden;
    margin-top: 48px;
    border: 1px solid var(--calculator-border);
    border-radius: 5px;
    background: var(--calculator-panel);
    box-shadow: 0 18px 45px rgba(63, 40, 29, .06);
}

body.calculator-page--laboratory .lab-results-heading {
    margin: 0;
    padding: 26px;
    border-bottom: 1px solid #ded5cc;
}

body.calculator-page--laboratory .lab-resource-grid {
    padding: 26px 26px 0;
}

body.calculator-page--laboratory .lab-zero {
    margin: 13px 26px 26px;
    text-align: center;
}

body.calculator-page--laboratory .lab-details {
    margin-top: 48px;
}

body.calculator-page--laboratory .lab-details > h2 {
    margin-bottom: 18px;
    text-align: center;
}

@media (min-width: 761px) and (max-width: 1050px) {
    body.calculator-page--laboratory .lab-tree {
        width: 100%;
        max-width: 680px;
        box-sizing: border-box;
    }

    body.calculator-page--laboratory :is(.lab-stage-four, .lab-stage-two, .lab-stage-single) {
        grid-template-columns: minmax(0, 1fr);
    }

    body.calculator-page--laboratory .lab-node {
        width: min(100%, 520px);
        box-sizing: border-box;
        justify-self: center;
    }
}

@media (max-width: 760px) {
    body.calculator-page a[class$="-back"] {
        width: 100%;
        justify-content: center;
        margin-bottom: 24px;
    }

    body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-card > h2,
    body.calculator-page--energy .energy-card > h2,
    body.calculator-page--laboratory section[aria-labelledby="lab-tree-title"] .lab-section-title,
    body.calculator-page--laboratory .lab-results-heading {
        padding-right: 17px;
        padding-left: 17px;
    }

    body:is(.calculator-page--equipment, .calculator-page--tome, .calculator-page--armor) .calculator-card > p,
    body.calculator-page--energy .energy-card > p {
        padding-right: 17px;
        padding-left: 17px;
    }

    body:is(.calculator-page--tome, .calculator-page--armor) .calculator-mode-panel,
    body.calculator-page--energy .energy-mode-panel {
        padding: 21px 17px;
    }

    body.calculator-page--equipment .calculator-card > .calculator-inputs {
        margin: 21px 17px;
    }

    body.calculator-page--equipment .calculator-card > .calculator-results {
        margin: 0 17px 21px;
    }

    body.calculator-page--armor .calculator-result-grid,
    body.calculator-page--armor .calculator-result-grid--three {
        grid-template-columns: 1fr;
    }

    body.calculator-page--laboratory .lab-tree {
        width: calc(100% - 24px);
        max-width: none;
        box-sizing: border-box;
        margin: 12px auto;
        padding: 10px 8px;
    }

    body.calculator-page--laboratory :is(.lab-stage-four, .lab-stage-two, .lab-stage-single) {
        grid-template-columns: minmax(0, 1fr);
    }

    body.calculator-page--laboratory .lab-stage {
        width: 100%;
        min-width: 0;
        gap: 8px;
    }

    body.calculator-page--laboratory .lab-node {
        width: min(100%, 310px);
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        justify-self: center;
        overflow: hidden;
        padding: 10px;
    }

    body.calculator-page--laboratory .lab-node h3 {
        margin-top: 7px;
        font-size: 17px;
    }

    body.calculator-page--laboratory .lab-node-fields {
        grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
        gap: 5px;
        margin-top: 7px;
    }

    body.calculator-page--laboratory .lab-node select {
        min-width: 0;
        min-height: 44px;
        padding-right: 28px;
        padding-left: 8px;
        font-size: 13px;
    }

    body.calculator-page--laboratory .lab-node-arrow {
        padding-bottom: 12px;
        transform: none;
    }

    body.calculator-page--laboratory .lab-resource-grid {
        padding: 21px 17px 0;
    }

    body.calculator-page--laboratory .lab-zero {
        margin: 13px 17px 21px;
    }
}

/*
 * Acoes das calculadoras
 *
 * Os seletores abaixo abrangem os botoes de modo, filtros e selecao de livros
 * usados pelas diferentes calculadoras. O relevo e a borda deixam evidente
 * que os elementos sao interativos, inclusive antes de o usuario passar o
 * mouse sobre eles.
 */
body.calculator-page :is(
    .calculator-mode-button,
    .energy-mode-button,
    .forticlad-mode-button,
    .collection-mode,
    .arsenal-mode,
    .lab-preset,
    .tome-selection-action
) {
    box-sizing: border-box;
    position: relative;
    border: 2px solid #c66b47;
    border-radius: 5px;
    color: #4a3027;
    background: linear-gradient(180deg, #fffdfb 0%, #f8e7df 100%);
    box-shadow: 0 4px 0 #b95631, 0 8px 16px rgba(76, 38, 24, 0.14);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease,
        border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

/* Satélites usa o mesmo padrão de ação das demais calculadoras. */
body.calculator-page .satellite-rarity {
    box-sizing: border-box;
    position: relative;
    border: 2px solid #c66b47;
    border-radius: 5px;
    color: #4a3027;
    background: linear-gradient(180deg, #fffdfb 0%, #f8e7df 100%);
    box-shadow: 0 4px 0 #b95631, 0 8px 16px rgba(76, 38, 24, .14);
}

body.calculator-page .satellite-rarity:not(.is-active):hover,
body.calculator-page .satellite-rarity:not(.is-active):focus-visible {
    border-color: #ad3f1b;
    color: #fff;
    background: linear-gradient(180deg, #e96a38 0%, #cc4e23 100%);
    box-shadow: 0 4px 0 #8f3215, 0 10px 20px rgba(76, 38, 24, .2);
}

body.calculator-page .satellite-rarity.is-active,
body.calculator-page .satellite-rarity[data-satellite-rarity].is-active {
    border-color: #251712;
    color: #fff;
    background: linear-gradient(180deg, #5a372c 0%, #36221b 100%);
    box-shadow: 0 4px 0 #160d0a, 0 9px 18px rgba(37, 23, 18, .25);
}

body.calculator-page :is(
    .calculator-mode-button,
    .energy-mode-button,
    .forticlad-mode-button,
    .collection-mode,
    .arsenal-mode,
    .lab-preset,
    .tome-selection-action
):not([aria-selected="true"]):not(.is-active):hover {
    border-color: #ad3f1b;
    color: #ffffff;
    background: linear-gradient(180deg, #e96a38 0%, #cc4e23 100%);
    box-shadow: 0 4px 0 #8f3215, 0 10px 20px rgba(76, 38, 24, 0.2);
    transform: translateY(-1px);
}

body.calculator-page :is(
    .calculator-mode-button,
    .energy-mode-button,
    .forticlad-mode-button,
    .collection-mode,
    .arsenal-mode,
    .lab-preset,
    .tome-selection-action
)[aria-selected="true"],
body.calculator-page .lab-preset.is-active {
    border-color: #251712;
    color: #ffffff;
    background: linear-gradient(180deg, #5a372c 0%, #36221b 100%);
    box-shadow: 0 4px 0 #160d0a, 0 9px 18px rgba(37, 23, 18, 0.25);
}

body.calculator-page :is(
    .calculator-mode-button,
    .energy-mode-button,
    .forticlad-mode-button,
    .collection-mode,
    .arsenal-mode,
    .lab-preset,
    .tome-selection-action
):focus-visible {
    outline: 3px solid rgba(232, 91, 42, 0.42);
    outline-offset: 4px;
}

body.calculator-page :is(
    .calculator-mode-button,
    .energy-mode-button,
    .forticlad-mode-button,
    .collection-mode,
    .arsenal-mode,
    .lab-preset,
    .tome-selection-action
):active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #8f3215, 0 4px 8px rgba(76, 38, 24, 0.18);
}

body.calculator-page :is(
    .calculator-mode-button,
    .energy-mode-button,
    .forticlad-mode-button,
    .collection-mode,
    .arsenal-mode,
    .lab-preset,
    .tome-selection-action
):disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Cabeçalho visual compartilhado entre as calculadoras. */
body.calculator-page .calculator-hero-banner {
    width: 100%;
    max-width: none;
    min-height: 230px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    align-items: center;
    gap: 34px;
    overflow: hidden;
    margin-bottom: 32px;
    padding: 36px clamp(28px, 5vw, 58px);
    border: 1px solid rgba(44, 82, 145, .2);
    border-radius: 20px;
    background:
        radial-gradient(circle at 86% 18%, rgba(255, 183, 65, .24), transparent 26%),
        linear-gradient(125deg, #fff 0%, #f7f5f7 55%, #e9eef9 100%);
    box-shadow: 0 24px 60px rgba(44, 35, 31, .09);
}

body.calculator-page .calculator-hero-banner__copy {
    position: relative;
    z-index: 2;
    max-width: 720px;
}

body.calculator-page .calculator-hero-banner__copy > p:last-child {
    max-width: 670px;
    margin: 18px 0 0;
    color: #655d58;
    font-size: 16px;
    line-height: 1.65;
}

body.calculator-page .calculator-hero-banner__copy h1 {
    margin: 0;
    font-family: Impact, "Arial Black", sans-serif;
    font-size: clamp(44px, 6.5vw, 76px);
    font-weight: 500;
    line-height: .95;
    letter-spacing: .015em;
    text-transform: uppercase;
}

body.calculator-page .calculator-hero-art {
    position: relative;
    width: 270px;
    height: 180px;
    justify-self: end;
}

body.calculator-page .calculator-hero-art::before {
    position: absolute;
    inset: 18px 10px 10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(247, 177, 73, .24), rgba(63, 91, 144, .08) 45%, transparent 72%);
    content: '';
}

body.calculator-page .calculator-hero-art img {
    position: absolute;
    z-index: 1;
    width: 150px;
    height: 150px;
    display: block;
    object-fit: contain;
    image-rendering: auto;
    backface-visibility: hidden;
}

body.calculator-page .calculator-hero-art img:first-child:not(:only-child) {
    top: 0;
    left: 0;
}

body.calculator-page .calculator-hero-art img:last-child:not(:only-child) {
    right: 0;
    bottom: 0;
}

body.calculator-page .calculator-hero-art img:only-child {
    inset: 0;
    width: 180px;
    height: 180px;
    margin: auto;
}

@media (max-width: 850px) {
    body.calculator-page .calculator-hero-banner {
        grid-template-columns: minmax(0, 1fr) 210px;
    }

    body.calculator-page .calculator-hero-art {
        width: 210px;
    }

    body.calculator-page .calculator-hero-art img {
        width: 132px;
        height: 132px;
    }
}

@media (max-width: 620px) {
    body.calculator-page .calculator-hero-banner {
        min-height: 0;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 18px;
        padding: 26px 21px;
    }

    body.calculator-page .calculator-hero-banner__copy h1 {
        font-size: clamp(42px, 14vw, 58px);
    }

    body.calculator-page .calculator-hero-banner__copy > p:last-child {
        font-size: 14px;
    }

    body.calculator-page .calculator-hero-art {
        width: 190px;
        height: 108px;
        justify-self: center;
    }

    body.calculator-page .calculator-hero-art img {
        width: 108px;
        height: 108px;
    }

    body.calculator-page .calculator-hero-art img:only-child {
        width: 120px;
        height: 120px;
    }
}

body.calculator-page .calculator-illustration-note {
    width: min(760px, calc(100% - 32px));
    box-sizing: border-box;
    margin: 30px auto 0;
    padding: 14px 18px 0;
    border-top: 1px solid rgba(113, 96, 84, .2);
    color: #8a817a;
    font-size: 10px;
    line-height: 1.55;
    text-align: center;
}
