/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117; --surface: #171b26; --surface2: #1e2333;
  --border: #272d3f; --accent: #3b82f6; --accent2: #10b981;
  --text: #e2e8f0; --muted: #94a3b8; --error: #ef4444;
  --radius: 10px; --shadow: 0 4px 24px rgba(0,0,0,.4);
}
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, sans-serif; line-height: 1.6; font-size: 16px; }

/* === SKIP LINK === */
.skip-link { position: absolute; top: -100px; left: 0; background: var(--accent); color: #fff; padding: .5rem 1rem; border-radius: 0 0 8px 0; z-index: 9999; transition: top .2s; }
.skip-link:focus { top: 0; }

/* === LAYOUT === */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }

/* === HEADER === */
header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; gap: 1rem; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.2rem; letter-spacing: -.5px; }
nav a { color: var(--muted); text-decoration: none; font-size: .9rem; margin-left: 1.2rem; transition: color .2s; }
nav a:hover { color: var(--accent); }

/* === HERO === */
.hero { background: linear-gradient(135deg, #1a1f35 0%, #0f1117 100%); padding: 3.5rem 0 2.5rem; text-align: center; border-bottom: 1px solid var(--border); }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -.5px; margin-bottom: .75rem; }
.hero-sub { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.5rem; }
.stats-bar { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; font-size: .9rem; color: var(--accent2); }
.stats-bar span { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2); padding: .3rem .8rem; border-radius: 999px; }

/* === TABS === */
.calc-section { padding: 2.5rem 0; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: .6rem 1.2rem; border-radius: var(--radius); cursor: pointer; font-size: .9rem; font-weight: 500; transition: all .2s; }
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.tab-panel[hidden] { display: none; }
.tab-panel h2 { font-size: 1.4rem; margin-bottom: .4rem; }
.calc-desc { color: var(--muted); font-size: .95rem; margin-bottom: 1.5rem; }

/* === FORM === */
.calc-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.field-group { display: flex; flex-direction: column; gap: .4rem; }
.field-group label { font-size: .88rem; color: var(--muted); font-weight: 500; }
.optional { font-size: .78rem; color: #64748b; font-weight: 400; }
.field-group input, .field-group select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: .65rem .9rem; border-radius: 8px; font-size: .95rem; width: 100%;
  transition: border-color .2s;
}
.field-group input:focus, .field-group select:focus { outline: none; border-color: var(--accent); }
.field-group input::placeholder { color: #475569; }
.field-group input:invalid:not(:placeholder-shown) { border-color: var(--error); }
.btn-calc {
  grid-column: 1 / -1; background: var(--accent); color: #fff; border: none;
  padding: .75rem 2rem; border-radius: var(--radius); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background .2s; max-width: 280px;
}
.btn-calc:hover { background: #2563eb; }
.btn-calc:active { transform: scale(.98); }

/* === RESULT === */
.result-box { background: var(--surface2); border: 1px solid var(--accent); border-radius: var(--radius); padding: 1.5rem; margin-top: .5rem; }
.result-box[hidden] { display: none; }
.result-main { font-size: 2rem; font-weight: 800; color: var(--accent2); margin-bottom: .5rem; }
.result-label { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 1rem; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.result-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; }
.result-item .label { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.result-item .value { font-size: 1.05rem; font-weight: 600; }

/* === BREAKDOWN TABLE === */
.breakdown { margin-top: 1rem; overflow-x: auto; }
.breakdown[hidden] { display: none; }
.breakdown-toggle { background: none; border: 1px solid var(--border); color: var(--muted); padding: .4rem 1rem; border-radius: 8px; cursor: pointer; font-size: .85rem; margin-bottom: .75rem; }
.breakdown-toggle:hover { border-color: var(--accent); color: var(--accent); }
.breakdown table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.breakdown th { background: var(--surface2); color: var(--muted); text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.breakdown td { padding: .4rem .75rem; border-bottom: 1px solid var(--border); }
.breakdown tr:last-child td { border: none; }
.breakdown tr:hover td { background: var(--surface2); }

/* === INFO SECTION === */
.info-section { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3rem 0; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.5rem; }
.info-grid h2 { font-size: 1.05rem; margin-bottom: .5rem; color: var(--accent); }
.info-grid p { font-size: .9rem; color: var(--muted); line-height: 1.7; }

/* === FAQ === */
.faq-section { padding: 3rem 0; }
.faq-section h2 { font-size: 1.6rem; margin-bottom: 1.5rem; }
.faq-list { display: flex; flex-direction: column; gap: .75rem; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
summary { padding: 1rem 1.25rem; cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::after { content: '+'; color: var(--accent); font-size: 1.2rem; }
details[open] summary::after { content: '−'; }
details p { padding: 0 1.25rem 1rem; color: var(--muted); font-size: .9rem; line-height: 1.7; }

/* === FOOTER === */
footer { background: var(--surface); border-top: 1px solid var(--border); padding: 1.5rem 0; text-align: center; color: var(--muted); font-size: .85rem; }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .header-inner { padding: .75rem 1rem; }
  nav { display: none; }
  .hero { padding: 2rem 0 1.5rem; }
  .tab-panel { padding: 1.25rem; }
  .calc-form { grid-template-columns: 1fr; }
  .btn-calc { max-width: 100%; }
  .result-main { font-size: 1.6rem; }
  .info-grid { grid-template-columns: 1fr; }
}

/* === AD SLOTS === */
.ad-slot { text-align: center; margin: 1rem 0; }
.ad-leaderboard { min-height: 60px; }
.ad-rectangle { min-height: 100px; }
.ad-placeholder {
  display: inline-block; background: var(--surface2); border: 1px dashed var(--border);
  color: var(--muted); font-size: .75rem; padding: .5rem 2rem; border-radius: 4px;
  letter-spacing: .5px; text-transform: uppercase;
}