/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f1923;
    color: #e0e6ed;
    line-height: 1.6;
    min-height: 100vh;
}

/* === Header === */
header {
    background: linear-gradient(135deg, #1a2a3a 0%, #2d1810 100%);
    border-bottom: 3px solid #c4883a;
    padding: 1.5rem 2rem;
    text-align: center;
}
.header-inner h1 {
    font-size: 2.2rem;
    color: #f0c060;
    letter-spacing: 1px;
}
.logo-icon { font-size: 1.8rem; }
.tagline {
    color: #9ab;
    font-size: 1rem;
    margin-top: 0.25rem;
}

/* === Navigation === */
nav#main-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: #162333;
    border-bottom: 1px solid #2a3a4a;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-btn {
    background: transparent;
    border: 1px solid #2a3a4a;
    color: #8899aa;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.nav-btn:hover { background: #1e3044; color: #bcc; border-color: #3a5a7a; }
.nav-btn.active {
    background: #c4883a;
    color: #fff;
    border-color: #c4883a;
    font-weight: 600;
}

/* === Main === */
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

h2 {
    color: #f0c060;
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #2a3a4a;
    padding-bottom: 0.5rem;
}
.section-desc { color: #8899aa; margin-bottom: 1.5rem; }

/* === Two Column Layout === */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* === Probability Table === */
.prob-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.prob-table th {
    background: #1e2e3e;
    color: #c4883a;
    padding: 0.5rem;
    text-align: left;
    border-bottom: 2px solid #c4883a;
}
.prob-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #1e2e3e;
}
.prob-table .highlight-row { background: rgba(196, 136, 58, 0.15); font-weight: 600; }

/* === Insight Box === */
.insight-box {
    background: #1a2a3a;
    border-left: 4px solid #c4883a;
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-top: 1rem;
}
.insight-box h4 { color: #f0c060; margin-bottom: 0.5rem; }
.insight-box ul { padding-left: 1.25rem; }
.insight-box li { margin-bottom: 0.4rem; color: #bcc; }

/* === Resource Inputs === */
.resource-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.resource-input {
    background: #162333;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #2a3a4a;
}
.resource-input label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}
.resource-input input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    color: #e0e6ed;
    font-size: 0.95rem;
}
.resource-input.wood label { color: #6fbf73; }
.resource-input.wheat label { color: #ffd54f; }
.resource-input.brick label { color: #e57373; }
.resource-input.ore label { color: #90a4ae; }
.resource-input.sheep label { color: #81c784; }
.res-icon { font-size: 1.1rem; }

/* === Sim Params === */
.sim-params {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin: 1rem 0;
}
.sim-params label {
    font-size: 0.85rem;
    color: #8899aa;
}
.sim-params input[type="number"] {
    width: 100px;
    padding: 0.4rem 0.5rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    color: #e0e6ed;
    margin-left: 0.35rem;
}

/* === Buttons === */
.btn-primary {
    background: #c4883a;
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #d49a4a; }
.btn-primary:disabled { background: #6a5a3a; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: #c4883a;
    border: 1px solid #c4883a;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(196, 136, 58, 0.15); }

/* === Status Bar === */
.status-bar {
    background: #1a2a3a;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin: 0.75rem 0;
    font-size: 0.9rem;
    color: #8899aa;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}
.stat-card {
    background: #162333;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
}
.stat-card .stat-label { font-size: 0.8rem; color: #8899aa; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: #f0c060; }
.stat-card .stat-sub { font-size: 0.8rem; color: #6a7a8a; }

/* === Chart Cards === */
.chart-card {
    background: #162333;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.chart-card.full-width { width: 100%; }
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.75rem;
}

/* === Comparison === */
.compare-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-content: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.compare-group {
    background: #162333;
    padding: 1.25rem;
    border-radius: 8px;
    border: 2px solid #2a3a4a;
    min-width: 200px;
    text-align: center;
}
.compare-group h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.group-a { border-color: #4fc3f7; }
.group-a h3 { color: #4fc3f7; }
.group-b { border-color: #ff8a65; }
.group-b h3 { color: #ff8a65; }
.compare-group input {
    width: 100%;
    padding: 0.5rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    color: #e0e6ed;
    font-size: 1.1rem;
    text-align: center;
}
.compare-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: #c4883a;
}
.input-hint { font-size: 0.75rem; color: #6a7a8a; margin-top: 0.25rem; }

/* === Build Calculator === */
.build-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.preset-btn {
    background: #162333;
    border: 1px solid #2a3a4a;
    color: #bcc;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.preset-btn:hover { border-color: #c4883a; color: #f0c060; }
.preset-btn.active { background: #c4883a; color: #fff; border-color: #c4883a; }

.basket-target {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.basket-target label {
    font-size: 0.9rem;
    color: #bcc;
}
.basket-target input {
    width: 60px;
    padding: 0.3rem 0.5rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    color: #e0e6ed;
    margin-left: 0.25rem;
}

/* === Placement Advisor === */
#placement-spots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.placement-spot {
    background: #162333;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    padding: 1rem;
}
.placement-spot h3 { color: #f0c060; font-size: 1rem; margin-bottom: 0.5rem; }
.spot-hexes { display: flex; flex-direction: column; gap: 0.5rem; }
.hex-entry {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.hex-entry select, .hex-entry input {
    padding: 0.4rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    color: #e0e6ed;
    font-size: 0.9rem;
}
.hex-entry select { flex: 1; }
.hex-entry input { width: 60px; }

.placement-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#placement-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.placement-card {
    background: #162333;
    border: 2px solid #2a3a4a;
    border-radius: 8px;
    padding: 1rem;
}
.placement-card.best { border-color: #f0c060; }
.placement-card h4 { color: #f0c060; margin-bottom: 0.5rem; }
.placement-card .score { font-size: 2rem; font-weight: 700; }
.placement-card .details { font-size: 0.85rem; color: #8899aa; margin-top: 0.5rem; }
.placement-card .res-breakdown { margin-top: 0.5rem; }
.placement-card .res-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
    font-size: 0.85rem;
}
.placement-card .res-bar-fill {
    height: 8px;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* === Weird Games === */
.weird-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 600px) { .weird-controls { grid-template-columns: 1fr; } }
.weird-scenario {
    background: #162333;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #2a3a4a;
}
.weird-scenario h3 { color: #f0c060; margin-bottom: 0.5rem; font-size: 1rem; }
.weird-pair {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.weird-pair label { font-size: 0.85rem; color: #bcc; }
.weird-pair input {
    width: 60px;
    padding: 0.3rem 0.5rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    color: #e0e6ed;
    margin-left: 0.25rem;
}

/* === Footer === */
footer {
    text-align: center;
    padding: 2rem;
    color: #6a7a8a;
    border-top: 1px solid #1e2e3e;
    margin-top: 3rem;
    font-size: 0.85rem;
}
footer a { color: #c4883a; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* === Responsive === */
@media (max-width: 600px) {
    header { padding: 1rem; }
    .header-inner h1 { font-size: 1.6rem; }
    main { padding: 1rem 0.5rem; }
    .resource-inputs { grid-template-columns: 1fr 1fr; }
    .chart-grid { grid-template-columns: 1fr; }
    .compare-controls { flex-direction: column; }
    .compare-vs { transform: rotate(90deg); }
    nav#main-nav { gap: 0.15rem; padding: 0.5rem; }
    .nav-btn { font-size: 0.75rem; padding: 0.4rem 0.6rem; }
}
