/* OmniEngine v1 - dark sci-fi neon theme (cyan / violet / gold) */

:root {
  --bg: #050816;
  --bg2: #0a1028;
  --panel: rgba(14, 22, 52, 0.78);
  --panel-solid: #0e1634;
  --line: rgba(56, 232, 255, 0.18);
  --text: #e3f6ff;
  --muted: #8fa6c4;
  --cyan: #38e8ff;
  --violet: #b67cff;
  --gold: #ffd166;
  --pink: #ff7ad9;
  --green: #5cffb0;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.light {
  --bg: #eef3fb;
  --bg2: #e2eaf7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --line: rgba(40, 70, 140, 0.16);
  --text: #12203d;
  --muted: #55657f;
  --cyan: #0a8fb3;
  --violet: #6b3fd1;
  --gold: #b07800;
  --shadow: 0 8px 28px rgba(20, 40, 90, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(56, 232, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, rgba(182, 124, 255, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(56, 232, 255, 0.1); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: rgba(5, 8, 22, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
body.light .topbar { background: rgba(255, 255, 255, 0.85); }

.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 20px; letter-spacing: 0.5px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #050816; font-weight: 800;
  box-shadow: 0 0 18px rgba(56, 232, 255, 0.55);
}
.logo-text b { color: var(--cyan); }
.ver { font-size: 11px; color: var(--gold); border: 1px solid var(--gold); padding: 0 6px; border-radius: 20px; }

.search-wrap { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
#search {
  width: 100%; padding: 10px 14px; border-radius: 30px;
  background: rgba(56, 232, 255, 0.07); border: 1px solid var(--line); color: var(--text);
  font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
#search:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56, 232, 255, 0.18); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; display: none;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px;
}
.search-results.show { display: block; }
.sr { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); }
.sr:hover { background: rgba(56, 232, 255, 0.1); text-decoration: none; }
.sr b { display: block; font-weight: 600; }
.sr span { font-size: 12px; color: var(--muted); }
.sr-empty { padding: 12px; color: var(--muted); }

.icon-btn {
  background: rgba(56, 232, 255, 0.08); border: 1px solid var(--line); color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; font-size: 18px; cursor: pointer; flex: none;
  transition: background 0.2s, transform 0.1s;
}
.icon-btn:hover { background: rgba(56, 232, 255, 0.18); }
.icon-btn:active { transform: scale(0.95); }
#menu-btn { display: none; }

/* ---------- layout ---------- */

.layout { display: flex; min-height: calc(100vh - 61px); }

#sidebar {
  width: 290px; flex: none; position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto;
  border-right: 1px solid var(--line); padding: 14px 10px 40px; background: rgba(5, 8, 22, 0.35);
}
body.light #sidebar { background: rgba(255, 255, 255, 0.5); }

.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin: 18px 10px 6px; }
.nav-title.spec { color: var(--violet); }
.nav-link { display: block; padding: 6px 12px; border-radius: 8px; color: var(--text); font-size: 14px; }
.nav-link:hover { background: rgba(56, 232, 255, 0.08); text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, rgba(56, 232, 255, 0.22), rgba(182, 124, 255, 0.12)); color: var(--cyan); box-shadow: inset 3px 0 0 var(--cyan); }
.nav-link.theory { color: var(--violet); }
.nav-link.home { font-weight: 600; }
.nav-main summary { cursor: pointer; padding: 7px 10px; border-radius: 8px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.nav-main summary::-webkit-details-marker { display: none; }
.nav-main summary:hover { background: rgba(56, 232, 255, 0.08); }
.nav-main summary::after { content: "›"; margin-left: auto; transition: transform 0.2s; color: var(--muted); }
.nav-main[open] summary::after { transform: rotate(90deg); }
.dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.nav-sub { margin: 2px 0 6px 16px; border-left: 1px solid var(--line); padding-left: 6px; }
.nav-sub-title { font-size: 12px; color: var(--gold); padding: 6px 8px 0; font-weight: 600; }
.nav-subsub { font-size: 11px; color: var(--muted); padding: 2px 8px 0; text-transform: uppercase; letter-spacing: 0.8px; }
.nav-link.eq { font-size: 13px; padding: 4px 10px; }

#view { flex: 1; min-width: 0; padding: 26px 32px 80px; max-width: 1400px; }

/* ---------- headings, cards ---------- */

h1 { font-size: 30px; margin: 6px 0 10px; line-height: 1.2; }
h2.section { font-size: 18px; margin: 30px 0 12px; color: var(--gold); letter-spacing: 0.4px; }
h3 { margin: 0 0 12px; font-size: 15px; color: var(--cyan); letter-spacing: 0.3px; }
.lead { color: var(--muted); max-width: 900px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.crumbs { font-size: 13px; color: var(--muted); }
.view-head { margin-bottom: 18px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0;
}
.card.note { border-color: rgba(182, 124, 255, 0.35); background: linear-gradient(135deg, rgba(182, 124, 255, 0.1), var(--panel)); }
.card.how ol { margin: 0; padding-left: 20px; }

.two-col { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.25fr); gap: 18px; align-items: start; }
.two-col.wide-right { grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.6fr); }
.two-col > .card { margin-bottom: 0; }
.two-col + .card { margin-top: 18px; }

.badge { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 20px; letter-spacing: 0.6px; text-transform: uppercase; vertical-align: middle; }
.badge.spec { background: rgba(182, 124, 255, 0.18); color: var(--violet); border: 1px solid rgba(182, 124, 255, 0.5); }

.formula {
  font-family: "Cambria Math", "Times New Roman", Georgia, serif; font-size: 18px; color: var(--gold);
  background: rgba(255, 209, 102, 0.06); border: 1px solid rgba(255, 209, 102, 0.22); border-radius: 10px;
  padding: 8px 14px; display: inline-block; margin: 6px 0;
}
.formula.big { font-size: 26px; padding: 10px 20px; text-shadow: 0 0 18px rgba(255, 209, 102, 0.35); }
.formula.small { font-size: 14px; color: var(--violet); border-color: rgba(182, 124, 255, 0.3); background: rgba(182, 124, 255, 0.06); }

/* ---------- home ---------- */

.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: center;
  background: linear-gradient(135deg, rgba(56, 232, 255, 0.1), rgba(182, 124, 255, 0.1));
  border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow); overflow: hidden;
}
.kicker { color: var(--gold); text-transform: uppercase; letter-spacing: 3px; font-size: 12px; }
.hero h1 { font-size: 42px; margin: 8px 0 12px; }
.hero h1 span { background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 16px; }
.hero-canvas { width: 100%; height: 260px; display: block; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card-grid.small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.topic-card, .eq-card {
  display: block; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s; position: relative; overflow: hidden;
}
.topic-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent, var(--cyan)); box-shadow: 0 0 14px var(--accent, var(--cyan)); }
.topic-card:hover, .eq-card:hover { transform: translateY(-3px); border-color: var(--accent, var(--cyan)); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--accent, var(--cyan)); text-decoration: none; }
.topic-card h3 { color: var(--text); margin: 6px 0 6px; font-size: 17px; }
.topic-card p, .eq-card p { color: var(--muted); font-size: 13px; margin: 0; }
.topic-icon { font-size: 26px; color: var(--accent, var(--cyan)); text-shadow: 0 0 14px var(--accent, var(--cyan)); }
.topic-meta { font-size: 12px; color: var(--accent, var(--cyan)); margin-top: 10px; }
.eq-card h3 { color: var(--text); margin: 2px 0 6px; }
.eq-card .formula { font-size: 15px; margin-bottom: 8px; }
.eq-sub { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- buttons ---------- */

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--cyan); background: rgba(56, 232, 255, 0.12); color: var(--text); font-size: 14px; font-family: inherit;
  transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
}
.btn:hover { background: rgba(56, 232, 255, 0.25); box-shadow: 0 0 16px rgba(56, 232, 255, 0.35); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn.gold { border-color: var(--gold); background: rgba(255, 209, 102, 0.16); }
.btn.gold:hover { background: rgba(255, 209, 102, 0.3); box-shadow: 0 0 16px rgba(255, 209, 102, 0.4); }
.btn.ghost { border-color: var(--line); background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

/* ---------- variables / sliders ---------- */

.var-row { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.var-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.var-head label { font-weight: 600; }
.var-range { font-size: 11px; color: var(--muted); }
.var-ctrl { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.var-ctrl input[type="range"] { flex: 1; min-width: 80px; }
.var-ctrl .num {
  width: 120px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25); color: var(--text); font-family: Consolas, monospace; font-size: 13px;
}
body.light .var-ctrl .num { background: #fff; }
.var-ctrl .unit { font-size: 12px; color: var(--muted); min-width: 40px; }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; background: linear-gradient(90deg, rgba(56, 232, 255, 0.5), rgba(182, 124, 255, 0.5)); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); cursor: pointer; border: 2px solid #fff; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; cursor: pointer; }

.result {
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 232, 255, 0.14), rgba(182, 124, 255, 0.12)); border: 1px solid rgba(56, 232, 255, 0.4);
}
.result-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.result-value { font-size: 30px; font-weight: 700; color: var(--cyan); text-shadow: 0 0 16px rgba(56, 232, 255, 0.45); word-break: break-word; }
.result-value .unit { font-size: 16px; color: var(--text); font-weight: 400; text-shadow: none; }
.result-error { color: var(--pink); font-size: 13px; }

table.more { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
table.more th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 8px 5px 0; width: 45%; }
table.more td { padding: 5px 0; }

/* ---------- canvases ---------- */

canvas.vis { width: 100%; height: 300px; display: block; border-radius: 10px; background: #04060f; border: 1px solid var(--line); }
canvas.vis.tall { height: 420px; }
canvas.vis.short { height: 170px; }
.vis-caption { font-size: 12px; color: var(--muted); margin-top: 8px; }
.vis-card { position: sticky; top: 80px; }

/* ---------- data tables ---------- */

.table-wrap { overflow: auto; max-height: 560px; border-radius: 10px; border: 1px solid var(--line); }
.table-wrap.tall { max-height: 640px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { position: sticky; top: 0; background: var(--panel-solid); color: var(--gold); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); z-index: 1; white-space: nowrap; }
table.data td { padding: 6px 10px; border-bottom: 1px solid rgba(56, 232, 255, 0.07); }
table.data tbody tr:hover { background: rgba(56, 232, 255, 0.06); }
table.data th.sortable { cursor: pointer; }
table.data tr.click, table.data tr[data-z] { cursor: pointer; }
tr.row-gold td { background: rgba(255, 209, 102, 0.16); color: var(--gold); font-weight: 600; }
tr.row-pink td { background: rgba(255, 122, 217, 0.08); }
tr.row-green td { background: rgba(92, 255, 176, 0.14); color: var(--green); font-weight: 600; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; margin-right: 8px; border: 1px solid rgba(255, 255, 255, 0.3); }
.swatch.wide { width: 120px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.stat { background: rgba(56, 232, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-value { font-size: 17px; font-weight: 700; color: var(--cyan); word-break: break-word; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* periodic table */
.pt-tools input { width: 100%; max-width: 460px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); color: var(--text); margin-bottom: 12px; }
.pt-wrap { overflow-x: auto; padding-bottom: 6px; }
.ptable {
  --rh: clamp(38px, 4.3vw, 64px);
  display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 3px; min-width: 600px;
  grid-template-rows: repeat(8, var(--rh)) 12px var(--rh) var(--rh) 20px;
}
.el {
  position: relative; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text); cursor: pointer; padding: 3px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: inherit; overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
}
.el:hover, .el.selected { transform: scale(1.1); z-index: 3; box-shadow: 0 0 16px var(--c); background: color-mix(in srgb, var(--c) 32%, var(--panel-solid)); }
.el .z { position: absolute; top: 2px; left: 4px; font-size: 9px; color: var(--muted); }
.el .sym { font-size: 18px; font-weight: 700; color: var(--c); line-height: 1.1; }
body.light .el .sym { color: #111; }
.el .nm { font-size: 8px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.el .ms { font-size: 8px; color: var(--muted); }
.el.dim { opacity: 0.15; }
.el.placeholder { cursor: default; border-style: dashed; border-color: var(--line); background: transparent; color: var(--muted); font-size: 10px; }
.pt-gap { height: 10px; }
.pt-group { font-size: 10px; color: var(--muted); text-align: center; align-self: start; }
.el .sym { font-size: clamp(12px, 1.25vw, 18px); }
.el.ghost { border: 1px dashed rgba(182, 124, 255, 0.7); background: rgba(182, 124, 255, 0.06); --c: #b67cff; opacity: 0.75; }
.el.ghost .sym { color: #b67cff; }
.el.ghost .ms { color: #b67cff; }
.ghost-key { border: 1px dashed #b67cff; background: rgba(182, 124, 255, 0.15) !important; }
.ghost-big { --c: #b67cff; border-style: dashed; }
.pt-note { font-size: 11px; color: var(--violet); align-self: center; padding-left: 6px; }
.pt-rowlabel { font-size: 11px; color: var(--muted); align-self: center; text-align: right; padding-right: 6px; }
.pt-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pt-count { font-size: 13px; color: var(--green); }
.pt-scroll-hint { display: none; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.layer-link { display: block; color: var(--text); border-color: rgba(182, 124, 255, 0.45); background: linear-gradient(135deg, rgba(182, 124, 255, 0.14), var(--panel)); }
.layer-link:hover { text-decoration: none; box-shadow: 0 0 24px rgba(182, 124, 255, 0.35); }
.layer-link h3 { margin-top: 8px; color: var(--violet); }
@media (max-width: 1250px) { .el .nm { display: none; } }
@media (max-width: 1000px) { .el .ms { display: none; } }
@media (max-width: 820px) { .pt-scroll-hint { display: block; } }
.el-detail { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.el-detail h2 { margin: 0 0 6px; }
.el-big {
  width: 130px; height: 130px; border-radius: 18px; border: 2px solid var(--c); position: relative; flex: none;
  background: color-mix(in srgb, var(--c) 18%, transparent); display: grid; place-items: center; box-shadow: 0 0 30px color-mix(in srgb, var(--c) 50%, transparent);
}
.el-big .sym { font-size: 52px; font-weight: 800; color: var(--c); }
.el-big .z { position: absolute; top: 8px; left: 12px; color: var(--muted); }

/* colour converter */
.colour-in { display: flex; gap: 10px; align-items: center; }
.colour-in input[type="color"] { width: 56px; height: 44px; border: none; background: none; cursor: pointer; }
.colour-in input[type="text"], .rgb-in input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--text); font-family: Consolas, monospace; }
.rgb-in { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.rgb-in input { width: 76px; }
.swatch-big { height: 70px; border-radius: 12px; margin: 10px 0; border: 1px solid var(--line); box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3); }

/* sound */
.rbar { position: relative; height: 10px; background: rgba(255, 255, 255, 0.06); border-radius: 5px; }
.rbar span { position: absolute; top: 0; bottom: 0; border-radius: 5px; box-shadow: 0 0 8px currentColor; }
.rbar em { position: absolute; top: -3px; bottom: -3px; width: 1px; background: rgba(255, 255, 255, 0.45); }

/* light */
.spectrum-strip { height: 40px; border-radius: 10px; box-shadow: 0 0 30px rgba(182, 124, 255, 0.3); }
.spectrum-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Grokox steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: all 0.3s; }
.step b { display: block; color: var(--text); }
.step span { font-size: 13px; color: var(--muted); }
.step.active { border-color: #a8e6ff; box-shadow: 0 0 24px rgba(168, 230, 255, 0.35); background: linear-gradient(135deg, rgba(168, 230, 255, 0.14), rgba(139, 30, 91, 0.18)); }

/* ---------- settings drawer ---------- */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 340px; max-width: 92vw; z-index: 100;
  background: var(--panel-solid); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, 0.5);
  padding: 18px; transform: translateX(105%); transition: transform 0.28s ease; overflow-y: auto;
}
body.settings-open .drawer { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drawer-head h2 { margin: 0; font-size: 20px; }
.toggle { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.track { width: 46px; height: 26px; border-radius: 20px; background: rgba(255, 255, 255, 0.12); position: relative; flex: none; transition: background 0.2s; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle input:checked + .track { background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 12px rgba(56, 232, 255, 0.5); }
.toggle input:checked + .track::after { transform: translateX(20px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--gold); }
.tl small { display: block; color: var(--muted); font-size: 12px; }
.select-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.select-row select { background: rgba(0, 0, 0, 0.25); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
body.light .select-row select { background: #fff; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 40px); opacity: 0; z-index: 200;
  background: var(--panel-solid); border: 1px solid var(--cyan); color: var(--text); padding: 10px 18px; border-radius: 12px;
  box-shadow: 0 0 24px rgba(56, 232, 255, 0.35); transition: all 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.adv-only:empty { display: none; }
.adv-only { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .two-col, .two-col.wide-right { grid-template-columns: 1fr; }
  .vis-card { position: static; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  #menu-btn { display: block; }
  #sidebar {
    position: fixed; top: 61px; left: 0; bottom: 0; z-index: 60; width: 290px; height: auto;
    background: var(--panel-solid); transform: translateX(-105%); transition: transform 0.25s; box-shadow: 20px 0 40px rgba(0, 0, 0, 0.5);
  }
  body.nav-open #sidebar { transform: translateX(0); }
  #view { padding: 18px 14px 60px; }
  .logo-text, .ver { display: none; }
  h1 { font-size: 24px; }
  .hero h1 { font-size: 30px; }
  .formula.big { font-size: 20px; }
  .steps { grid-template-columns: 1fr; }
  canvas.vis.tall { height: 320px; }
  .var-ctrl .num { width: 96px; }
}

/* Fox's Layer Table */
.layer-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 5px; }
.lt-tile {
  border-radius: 8px; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--text); padding: 4px; display: flex; flex-direction: column; align-items: center; position: relative; cursor: pointer; font-family: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
.lt-tile:hover, .lt-tile.selected { transform: scale(1.07); box-shadow: 0 0 16px var(--c); }
.lt-tile .z { position: absolute; top: 2px; left: 5px; font-size: 9px; color: var(--muted); }
.lt-tile .sym { font-size: 17px; font-weight: 700; color: var(--c); margin-top: 6px; }
.lt-tile .ms { font-size: 9px; color: var(--muted); }
tr.row-real td { background: rgba(56, 232, 255, 0.10); color: var(--cyan); font-style: italic; }
.real-tag, .spec-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.6px; padding: 1px 6px; border-radius: 6px; font-style: normal; }
.real-tag { background: rgba(56, 232, 255, 0.18); color: var(--cyan); border: 1px solid rgba(56, 232, 255, 0.5); }
.spec-tag { background: rgba(182, 124, 255, 0.18); color: var(--violet); border: 1px solid rgba(182, 124, 255, 0.5); }

/* Daftlad site bar (56px) sits above OmniEngine's own bar (61px), added 2026-11-17 */
.topbar { top: 56px; }
.layout { min-height: calc(100vh - 117px); }
#sidebar { top: 117px; height: calc(100vh - 117px); }
.vis-card { top: 136px; }
@media (max-width: 820px) {
  #sidebar { top: 117px; height: auto; }
}
