:root{
  --bg:#07070b;
  --panel:#0f111a;
  --card:#141826;
  --stroke:rgba(255,255,255,.10);
  --muted:rgba(255,255,255,.65);
  --text:rgba(255,255,255,.92);
  --accent:#ff3b3b;
  --accent2:#ff7777;

  --shadow: 0 16px 60px rgba(0,0,0,.45);
  --r: 20px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(1000px 600px at 20% -10%, rgba(255,59,59,.18), transparent 55%),
    radial-gradient(800px 500px at 90% 0%, rgba(120,160,255,.10), transparent 55%),
    var(--bg);
  color:var(--text);
}

.skip{
  position:absolute; left:-9999px; top:auto;
  width:1px; height:1px; overflow:hidden;
}
.skip:focus{
  left:12px; top:12px; width:auto; height:auto;
  padding:10px 12px;
  background:#000;
  border:1px solid var(--stroke);
  border-radius:12px;
  z-index:9999;
}

.wrap{max-width:1200px; margin:0 auto; padding:0 18px}

.topbar{
  position:sticky; top:0; z-index:50;
  background:rgba(7,7,11,.55);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--stroke);
}
.topbar__inner{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; padding:14px 0;
}
.brand{display:flex; align-items:center; gap:10px}
.brand__mark{
  width:34px; height:34px; border-radius:12px;
  background: linear-gradient(180deg, rgba(255,59,59,.95), rgba(255,119,119,.65));
  box-shadow: 0 10px 30px rgba(255,59,59,.25);
}
.brand__title{font-weight:800; letter-spacing:.2px}
.brand__sub{font-size:12px; color:var(--muted)}

.nav{display:none; gap:14px; font-size:13px}
.nav a{color:var(--muted); text-decoration:none}
.nav a:hover{color:#fff}

.topbar__actions{display:flex; gap:10px}

@media (min-width: 920px){
  .nav{display:flex}
}

.btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color:#fff;
  border-radius:14px;
  padding:10px 12px;
  font-size:13px;
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,.10)}
.btn--ghost{background:transparent}
.btn--pill{border-radius:999px; padding:9px 12px}

.hero{
  margin-top:18px;
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}
@media(min-width: 920px){
  .hero{grid-template-columns: 1.35fr .65fr; align-items:stretch}
}
.hero__content{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  border-radius: var(--r);
  padding:26px;
  box-shadow: var(--shadow);
}
.kicker{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.16em;
  color:var(--muted);
}
h1{margin:10px 0 8px; font-size:34px; line-height:1.08}
.accent{color:var(--accent2)}
.lede{margin:0; color:var(--muted); line-height:1.55}
.meta{display:flex; flex-wrap:wrap; gap:10px; margin-top:16px}
.pill{
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  border-radius:999px;
  padding:8px 12px;
  font-size:13px;
  color:var(--muted);
}

.hero__cards{
  display:grid;
  gap:12px;
}
.card{
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  border-radius: var(--r);
  padding:18px;
}
.card__label{font-size:12px; color:var(--muted)}
.card__value{margin-top:8px; font-size:18px; font-weight:800; color: #fff}
.card__hint{margin-top:6px; font-size:12px; color:var(--muted)}

.section{margin:34px 0}
.section__head{display:flex; flex-direction:column; gap:6px; margin-bottom:12px}
h2{margin:0; font-size:22px}
h3{margin:0 0 10px; font-size:16px}
.muted{color:var(--muted)}
.small{font-size:12px}

.grid2{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}
@media(min-width: 920px){
  .grid2{grid-template-columns: 1fr 1fr}
}

.panel{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  border-radius: var(--r);
  padding:18px;
  box-shadow: var(--shadow);
}

.bullets{margin:0; padding-left:18px; color:var(--muted)}
.bullets li{margin:6px 0}

.callout{
  margin-top:12px;
  border:1px solid rgba(255,59,59,.22);
  background: rgba(255,59,59,.08);
  padding:12px;
  border-radius: 16px;
  color: rgba(255,255,255,.88);
  font-size:13px;
}

.formula{
  margin:12px 0;
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  padding:12px;
  border-radius:16px;
  overflow-x:auto;
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.tableWrap{
  overflow:auto;
  border-radius:16px;
  border:1px solid var(--stroke);
}
table{width:100%; border-collapse:collapse; min-width: 820px}
th,td{
  padding:12px 10px;
  border-bottom:1px solid rgba(255,255,255,.06);
  text-align:left;
  font-size:13px;
}
th{
  position:sticky; top:0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  cursor:pointer;
  user-select:none;
  color:rgba(255,255,255,.86);
}
td{color:rgba(255,255,255,.82)}
.num{text-align:right}
tbody tr:hover{background: rgba(255,255,255,.06)}
tbody tr.selected{
  outline:2px solid rgba(255,59,59,.55);
  outline-offset:-2px;
  background: rgba(255,59,59,.08);
}
tbody tr.best{background: rgba(120,160,255,.10)}

.legend{
  display:flex; align-items:center; gap:10px;
  margin-top:10px;
  color:var(--muted);
  font-size:12px;
}
.spacer{flex:1}
.dot{width:10px; height:10px; border-radius:50%}
.dot--best{background: rgba(120,160,255,.75)}
.dot--selected{background: rgba(255,59,59,.85)}

.chartHead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
}
.chartBox{
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  border-radius: 16px;
  padding: 12px;
  height: 320px;
}

.formGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
label{
  display:flex; flex-direction:column; gap:6px;
  font-size:13px;
  color:rgba(255,255,255,.86);
}
input{
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.30);
  color:#fff;
  border-radius:14px;
  padding:10px 12px;
  outline:none;
}
input:focus{border-color: rgba(255,59,59,.55)}

.results{
  margin-top:14px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.result{
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  border-radius: 16px;
  padding: 12px;
}
.result__label{font-size:12px; color:var(--muted)}
.result__value{margin-top:6px; font-size:16px; font-weight:800}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}

.contextHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 12px;
}
.contextGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.miniCard{
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  border-radius: 16px;
  padding: 12px;
}
.miniLabel{font-size:12px; color:var(--muted)}
.miniValue{margin-top:6px; font-size:20px; font-weight:800}
.miniHint{margin-top:4px; font-size:12px; color:var(--muted)}

.inlineLink{color: var(--accent2); text-decoration:none}
.inlineLink:hover{text-decoration:underline}

.prose{color:rgba(255,255,255,.88)}
.prose ul{color:var(--muted)}
.prose p{color:var(--muted); line-height:1.6}

.footer{
  margin: 40px 0 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 18px;
}
.footer__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
}
.footer__title{font-weight:800}
.footer__sub{font-size:12px; color:var(--muted)}
.footer a{color:var(--muted); text-decoration:none}
.footer a:hover{color:#fff}

.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}
.modal[aria-hidden="false"]{ display:block; }
.modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}
.modal__card{
  position: relative;
  max-width: 920px;
  margin: 6vh auto;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(15,17,26,.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.modal__body{ padding: 14px 16px 18px; }
.modal__body img{
  width:100%;
  height:auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
}

@media(max-width: 720px){
  h1{font-size:30px}
  table{min-width: 760px}
  .results{grid-template-columns: 1fr}
  .formGrid{grid-template-columns: 1fr}
  .contextGrid{grid-template-columns: 1fr}
}

@media print{
  .topbar, .nav, #printBtn { display:none !important; }
  body{background:#fff; color:#000}
  .panel, .hero__content, .card{box-shadow:none}
}
