/* --- CONFIGURAÇÕES GERAIS --- */
:root {
    --bg: #09090b;
    --card: #141416;
    --card-inner: #1c1c1e;
    --border: #27272a;
    --accent: #3b82f6; /* Azul vibrante */
    --text: #ffffff;
    --text-dim: #a1a1aa;
    --profit: #2ecc71;
    --loss: #e74c3c;
    --focus: #ff9800;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.spacious {
    width: 100%;
    max-width: 1300px;
}

/* --- HEADER SELECTORS (TIER/ENCHANT) --- */
.refining-header {
    display: flex;
    gap: 40px;
    margin-bottom: 25px;
}

.selector-group span {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-row {
    display: flex;
    gap: 6px;
}

.btn-opt {
    background: var(--card-inner);
    border: 1px solid var(--border);
    color: #fff;
    min-width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: 0.2s;
}

.btn-opt.active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: #60a5fa !important;
}

/* --- GRID LAYOUT --- */
.calculator-grid {
    display: grid;
    grid-template-columns: 280px 1fr 380px;
    gap: 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
    letter-spacing: 0.05em;
}

/* --- SIDEBAR (RESOURCES & BUTTONS) --- */
.resource-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.res-btn {
    background: var(--card-inner);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 5px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
}

.res-btn img { width: 35px; height: 35px; }
.res-btn.active { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }

/* Grupos de Botões Estilo Imagem */
.button-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.button-group.double button { flex: 1 1 calc(50% - 8px); }
.button-group.triplets button { flex: 1; font-size: 0.65rem; }

button, .btn-opt {
    background: var(--card-inner);
    border: 1px solid var(--border);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}

button.active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: #60a5fa !important;
}

/* Botão de Foco Horizontal Total */
.btn-focus {
    width: 100%;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #231912;
    border: 1px solid #442a18;
    color: var(--focus);
    padding: 14px;
    border-radius: 8px;
    font-weight: 900;
}

.btn-focus.active {
    background: #e67e22 !important;
    color: #fff !important;
    border-color: #f39c12 !important;
}

/* --- INPUTS (VALORES 900) --- */
.input-block {
    background: var(--card-inner);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.input-block h4 {
    margin: 0 0 5px;
    font-size: 0.65rem;
    color: var(--text-dim);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.calc-input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 2.5rem;
    font-weight: 900; /* Extra Bold nos Zeros */
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.mult-tag {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    font-weight: 900;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
}

/* --- RRR CARD BONITO --- */
.rrr-display-card {
    background: var(--accent);
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.rrr-display-card span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
}

.rrr-display-card strong {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1.5px;
}

/* --- RESULTS (LABELS BONITAS) --- */
.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.stat-line span:first-child {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-line span:last-child {
    font-weight: 800;
    font-size: 1.3rem;
}

.main-profit span:last-child {
    color: var(--profit);
    font-size: 2.5rem;
    font-weight: 900;
}

/* --- STACK LIST --- */
.stack-line-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-inner);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.stack-img-group { display: flex; align-items: center; gap: 8px; }
.stack-img-group img { width: 32px; height: 32px; }

.stack-text { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.stack-text b {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 900;
}

.item-preview-box {
    background: radial-gradient(circle, #27272a 0%, #141416 100%);
    height: 180px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.item-preview-box img { width: 110px; }
.item-tier-tag { position: absolute; top: 10px; left: 10px; background: #000; padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 800; }
/* Cor do placeholder para não sumir totalmente no fundo escuro */
.calc-input::placeholder {
    color: rgba(255, 255, 255, 0.2); /* Um branco bem transparente */
    font-weight: 900;
}
/* --- CONFIGURAÇÕES GERAIS --- */
:root {
    --bg: #09090b;
    --card: #141416;
    --card-inner: #1c1c1e;
    --border: #27272a;
    --accent: #3b82f6;
    --text: #ffffff;
    --text-dim: #a1a1aa;
    --profit: #2ecc71;
    --loss: #e74c3c;
    --focus: #ff9800;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 10px; /* Reduzi para telas menores */
    display: flex;
    justify-content: center;
}

.spacious {
    width: 100%;
    max-width: 1300px;
}

/* --- HEADER (MOBILE FRIENDLY) --- */
.refining-header {
    display: flex;
    flex-direction: column; /* Empilha no mobile por padrão */
    gap: 20px;
    margin-bottom: 25px;
}

.selector-group span {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap; /* Permite quebrar linha se o celular for muito estreito */
}

.btn-opt {
    background: var(--card-inner);
    border: 1px solid var(--border);
    color: #fff;
    flex: 1; /* Botões crescem para ocupar a largura */
    min-width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: 0.2s;
}

.btn-opt.active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: #60a5fa !important;
}

/* --- GRID LAYOUT (O SEGREDO DA RESPONSIVIDADE) --- */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr; /* 1 coluna no mobile */
    gap: 15px;
}

/* Quando a tela for maior que 1024px (PC), volta para 3 colunas */
@media (min-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 280px 1fr 380px;
        gap: 20px;
    }
    .refining-header {
        flex-direction: row; /* Lado a lado no PC */
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
    letter-spacing: 0.05em;
}

/* --- BOTÕES LATERAIS --- */
.resource-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.res-btn {
    background: var(--card-inner);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 5px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
}

.res-btn img { width: 35px; height: 35px; }
.res-btn.active { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }

.button-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.button-group.double button { flex: 1 1 calc(50% - 8px); }
.button-group.triplets button { flex: 1; font-size: 0.65rem; }

button, .btn-opt {
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}

button.active {
    background: var(--accent) !important;
    color: #fff !important;
}

.btn-focus {
    width: 100%;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #231912;
    border: 1px solid #442a18;
    color: var(--focus);
    padding: 14px;
    border-radius: 8px;
    font-weight: 900;
}

.btn-focus.active {
    background: #e67e22 !important;
    color: #fff !important;
    border-color: #f39c12 !important;
}

/* --- INPUTS --- */
.input-block {
    background: var(--card-inner);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.input-block h4 {
    margin: 0 0 5px;
    font-size: 0.65rem;
    color: var(--text-dim);
    font-weight: 700;
    text-transform: uppercase;
}

.calc-input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 2.2rem;
    font-weight: 900;
    width: 100%;
}

/* --- RRR CARD --- */
.rrr-display-card {
    background: var(--accent);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rrr-display-card strong {
    font-size: 2rem;
    font-weight: 900;
}

/* --- RESULTADOS --- */
.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.stat-line span:first-child { font-size: 0.75rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; }
.stat-line span:last-child { font-weight: 800; font-size: 1.2rem; }
.main-profit span:last-child { color: var(--profit); font-size: 2.2rem; font-weight: 900; }

/* --- STACK LIST --- */
.stack-line-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-inner);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.stack-column { display: flex; flex-direction: column; gap: 4px; }
.stack-img-group { display: flex; align-items: center; gap: 8px; }
.stack-img-group img { width: 32px; height: 32px; }
.stack-text { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.stack-text b { color: #fff; font-size: 1.1rem; font-weight: 900; }

.item-preview-box {
    background: radial-gradient(circle, #27272a 0%, #141416 100%);
    height: 150px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 20px;
}
.item-preview-box img { width: 100px; }
.item-tier-tag { position: absolute; top: 10px; left: 10px; background: #000; padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 800; }