/* ---------- Themes ---------- */
:root{
  --topbar: #3e445e;
  --bg: #0b1220;
  --card: rgba(255,255,255,0.08);
  --text: #e7ecf3;
  --muted: #a9b3c0;
  --brand: #5cc8ff;
  --brand-2: #8cffc7;
  --ring: rgba(92,200,255,0.35);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --radius: 18px;
  --border: rgba(255,255,255,0.12);
}

html[data-theme="light"]{
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1a2433;
  --muted: #4f5b6b;
  --brand: #2a7be4;
  --brand-2: #59c1a9;
  --ring: rgba(42,123,228,0.25);
  --shadow: 0 8px 18px rgba(0,0,0,0.08);
  --border: rgba(0,0,0,0.08);
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Accessibility helper */
.visually-hidden{ position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

/* Subtle animated gradient background */
.bg-gradient{
  position: fixed; inset: 0;
  background: radial-gradient(1000px 600px at 10% -10%, #0a6cff33, transparent),
              radial-gradient(900px 500px at 100% 0%, #00ffc833, transparent),
              radial-gradient(1000px 700px at 50% 120%, #5cc8ff22, transparent);
  filter: blur(2px);
  z-index: -1;
  animation: float 18s ease-in-out infinite alternate;
}
@keyframes float{
  from { transform: translateY(0px); }
  to { transform: translateY(-10px); }
}

.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  position: sticky; top: 0;
  backdrop-filter: blur(8px);
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
}
html[data-theme="light"] .topbar{
  background: var(--topbar);
}

.brand{ display:flex; align-items:center; gap:14px; }
.logo{
  width:40px; height:40px; border-radius: 12px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
}
.brand-text h1{ font-size: 1.1rem; margin:0; }
.brand-text p{ font-size: .9rem; margin:0; color: var(--muted); }

.top-actions{ display:flex; align-items:center; gap:10px; }
.lang-picker select{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
}
.theme-btn{
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  cursor:pointer;
}

.container{
  width: min(1100px, 92vw);
  margin: 28px auto 60px;
  display: grid;
  gap: 22px;
}

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

.tabs .tabbar{ display:flex; gap:8px; flex-wrap: wrap; }
.tab{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  cursor:pointer;
}
html[data-theme="light"] .tab{ background: #fff; }
.tab.active{
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #05121b;
  border-color: transparent;
  font-weight: 600;
}

.panel{ display:none; }
.panel.active{ display:block; }

.inputs-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.inputs-grid.two{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px){
  .inputs-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 520px){
  .inputs-grid{ grid-template-columns: 1fr; }
}

.field{ display:flex; flex-direction:column; gap:8px; }
.field span{ color: var(--muted); font-size:.9rem; }
select, input[type="range"]{
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
html[data-theme="light"] select, html[data-theme="light"] input[type="range"]{
  background: #fff;
}
select:focus, input[type="range"]:focus{ box-shadow: 0 0 0 6px var(--ring); }
.fieldset{ border: 1px dashed var(--border); border-radius:12px; padding:12px; }
.fieldset legend{ color: var(--muted); padding:0 6px; }

.range-wrap{ display:flex; align-items:center; gap:12px; }
output{ min-width: 64px; text-align: right; color: var(--text); }

.actions{ display:flex; gap:12px; margin-top: 10px; flex-wrap: wrap; }
.btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
  user-select: none;
}
html[data-theme="light"] .btn{ background: #fff; }
.btn:hover{ background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.25); }
.btn:active{ transform: translateY(1px) scale(.99); }
.btn.primary{
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #011018;
  border-color: transparent;
  font-weight: 600;
}
.btn.ghost{ background: transparent; }
.btn.small{ padding: 8px 12px; font-size: .9rem; }

.results-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-top: 14px;
}
.table-wrap{
  overflow:auto; border-radius: 12px; border:1px solid var(--border);
}
table{
  width:100%; border-collapse: collapse; min-width: 520px;
}
thead th{
  position: sticky; top: 0;
  background: rgba(5,10,18,0.75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
}
html[data-theme="light"] thead th{ background: #f0f3f8; }
tbody td{
  padding: 10px; border-bottom: 1px solid var(--border);
}
tbody tr:hover{ background: rgba(255,255,255,0.05); }
html[data-theme="light"] tbody tr:hover{ background: #f7f9fc; }
td.diff-pos{ color: #0aa84f; }
td.diff-neg{ color: #c2561a; }
.badge{
  display:inline-block; padding:6px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.1); border: 1px solid var(--border);
}
.badge.ok{ background: rgba(140,255,199,0.15); border-color: rgba(140,255,199,0.5); color:#caffdf; }
.badge.no{ background: rgba(255,140,140,0.1); border-color: rgba(255,140,140,0.5); color:#ffd6d6; }

.grid-2{ display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px){
  .grid-2{ grid-template-columns: 1fr; }
}

.muted{ color: var(--muted); }
.footnote{ color: var(--muted); margin-top: 6px; font-size: .9rem; }
.disclaimer h3{ margin-top: 0; }
.footer{ text-align:center; color: var(--muted); padding: 24px 0 40px; }

.diagram{ width:100%; height:auto; }
.diagram .measure{ fill:var(--text); font-weight:700; font-size:22px; }
.diagram .dim{ fill: var(--muted); font-size: 12px; }

.logo-img{height:48px;width:auto;display:block}
.brand-logo{display:block;line-height:0}
