:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1e2230;
  --line: #2a2f40;
  --text: #e6e8ef;
  --muted: #8b90a3;
  --accent: #ffd257;

  --c-alkali: #ff7a6b;
  --c-alkaline: #ffb35c;
  --c-transition: #6fa8ff;
  --c-post: #7fd1c7;
  --c-metalloid: #b9d86a;
  --c-nonmetal: #5fd38d;
  --c-halogen: #3ec9e0;
  --c-noble: #b28cff;
  --c-lanthanide: #ff8ccf;
  --c-actinide: #e07bff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 20px 48px; }
header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
header h1 { font-size: 20px; margin: 0; letter-spacing: .3px; }
header p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Search ---------- */
header { align-items: center; }
header h1 { margin-bottom: 4px; }
.search { position: relative; flex: 1; max-width: 460px; min-width: 260px; }
.search input { width: 100%; padding: 10px 14px 10px 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b90a3' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l4 4'/%3E%3C/svg%3E") no-repeat 12px center;
  color: var(--text); font: inherit; font-size: 14px; outline: none; }
.search input:focus { border-color: #4a5372; box-shadow: 0 0 0 3px rgba(111, 168, 255, .15); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.45);
  max-height: 420px; overflow-y: auto; }
.res { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 7px; background: none; cursor: pointer; text-align: left; font-size: 14px; }
.res.on, .res:hover { background: var(--panel-2); }
.res .fx { color: var(--muted); font-size: 13px; }
.res .kind { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.res.web { color: #8cb8ff; }
.res-note { padding: 8px 10px; font-size: 13px; color: var(--muted); }

/* ---------- Periodic table ---------- */
.table {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows: repeat(7, auto) 10px repeat(2, auto);
  gap: 4px;
  position: relative;
}
.el {
  --c: var(--muted);
  aspect-ratio: 1 / 1.08;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: color-mix(in srgb, var(--c) 13%, var(--panel));
  border-radius: 6px;
  padding: 3px 4px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; text-align: left; min-width: 0;
  transition: transform .12s, background .12s, box-shadow .12s, opacity .12s, border-color .12s;
  position: relative;
}
.el:hover { background: color-mix(in srgb, var(--c) 26%, var(--panel)); transform: translateY(-1px); }
.el:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.el .z { font-size: clamp(7px, .75vw, 10px); color: var(--muted); line-height: 1; }
.el .s { font-size: clamp(11px, 1.45vw, 20px); font-weight: 700; color: var(--c); line-height: 1; }
.el .n { font-size: clamp(5px, .62vw, 9px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.el.sel {
  background: var(--c); border-color: #fff;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c), 0 6px 22px color-mix(in srgb, var(--c) 55%, transparent);
  transform: translateY(-2px) scale(1.04); z-index: 2;
}
.el.sel .s, .el.sel .z, .el.sel .n { color: #10121a; }
.table.has-sel .el:not(.sel):not(.partner) { opacity: .28; }
.table.has-sel .el:not(.sel):hover { opacity: 1; }
.el.partner {
  background: color-mix(in srgb, var(--c) 24%, var(--panel));
  border-color: color-mix(in srgb, var(--c) 75%, transparent);
  animation: glow 2.6s ease-in-out infinite alternate;
}
@keyframes glow {
  from { box-shadow: 0 0 6px color-mix(in srgb, var(--c) 25%, transparent); }
  to   { box-shadow: 0 0 16px color-mix(in srgb, var(--c) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .el.partner { animation: none; box-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); }
}

.el.alkali { --c: var(--c-alkali); }
.el.alkaline { --c: var(--c-alkaline); }
.el.transition { --c: var(--c-transition); }
.el.post { --c: var(--c-post); }
.el.metalloid { --c: var(--c-metalloid); }
.el.nonmetal { --c: var(--c-nonmetal); }
.el.halogen { --c: var(--c-halogen); }
.el.noble { --c: var(--c-noble); }
.el.lanthanide { --c: var(--c-lanthanide); }
.el.actinide { --c: var(--c-actinide); }

.ph { display: flex; align-items: center; justify-content: center; font-size: clamp(6px, .7vw, 10px);
      color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; aspect-ratio: 1 / 1.08; }

.legend { grid-column: 3 / 13; grid-row: 1 / 4; display: flex; flex-direction: column; justify-content: flex-start;
          gap: 10px; padding: 4px 10px; pointer-events: none; }
.legend .keys { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); }
.legend .keys span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px;
                             background: var(--k); margin-right: 5px; vertical-align: -1px; }
.legend .sel-bar { pointer-events: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 30px; }
.legend .hint { color: var(--muted); font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 9px; border-radius: 999px;
        background: color-mix(in srgb, var(--c) 22%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
        font-size: 13px; font-weight: 600; cursor: pointer; }
.chip .x { opacity: .6; font-weight: 400; padding: 0 3px; }
.chip:hover .x { opacity: 1; }
.clear { pointer-events: auto; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
         padding: 4px 10px; font-size: 12px; cursor: pointer; }
.clear:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Lower area ---------- */
.lower { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.5fr); gap: 16px; margin-top: 22px; }
@media (max-width: 860px) { .lower { grid-template-columns: 1fr; } .legend { grid-column: 3 / 13; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-height: 220px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.empty { color: var(--muted); font-size: 14px; line-height: 1.5; }

.group-title { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.group-title:first-of-type { margin-top: 0; }
.list { display: flex; flex-direction: column; gap: 4px; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
        padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; background: var(--panel-2);
        cursor: pointer; text-align: left; }
.item:hover { border-color: var(--line); background: #242939; }
.item.active { border-color: var(--accent); }
.item .nm { font-size: 14px; }
.item .meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.item .fx { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; padding: 2px 6px; border-radius: 4px;
       background: #2c3245; color: #aab0c4; }
.tag.alloy { background: #3b3220; color: #ffd27a; }
.extra { font-size: 11px; color: var(--muted); }

/* ---------- Detail ---------- */
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head h3 { margin: 0; font-size: 24px; }
.detail-head .formula { font-size: 22px; color: var(--accent); margin-top: 4px; }
.els { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.mini { --c: var(--muted); width: 44px; height: 46px; border-radius: 6px; padding: 3px 4px;
        background: color-mix(in srgb, var(--c) 18%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
        display: flex; flex-direction: column; justify-content: space-between; }
.mini .z { font-size: 9px; color: var(--muted); }
.mini .s { font-size: 17px; font-weight: 700; color: var(--c); }
.mini.big { width: 64px; height: 68px; padding: 5px 7px; }
.mini.big .s { font-size: 28px; }
.mini.add { cursor: pointer; text-align: left; }
.mini.add:hover { background: color-mix(in srgb, var(--c) 32%, var(--panel)); transform: translateY(-1px); }
.detail-body { display: grid; grid-template-columns: 220px 1fr; gap: 18px; margin-top: 16px; }
@media (max-width: 640px) { .detail-body { grid-template-columns: 1fr; } }
.structure { background: #fff; border-radius: 10px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.structure img { width: 100%; height: 100%; object-fit: contain; }
.props { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; align-content: start; }
.props dt { color: var(--muted); }
.props dd { margin: 0; word-break: break-word; }
.desc { font-size: 14px; line-height: 1.55; margin-top: 16px; color: #cfd3df; }
.src { font-size: 12px; color: var(--muted); margin-top: 6px; }
a { color: #8cb8ff; }
.bar-row { display: grid; grid-template-columns: 34px 1fr 56px 72px; gap: 10px; align-items: center; font-size: 13px; margin: 6px 0; }
.bar { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 999px; }
.skeleton { background: linear-gradient(90deg, var(--panel-2), #262b3a, var(--panel-2)); background-size: 200% 100%;
            animation: sh 1.2s infinite; border-radius: 6px; height: 12px; margin: 8px 0; }
@keyframes sh { to { background-position: -200% 0; } }
.err { color: #ff9b8f; font-size: 13px; }

/* ---------- Colour-by control & heatmap ---------- */
.view-pick { pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.view-pick select, .orb-ctl select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.legend .scale { display: inline-flex; align-items: center; gap: 8px; }
.legend .scale::before { display: none; }
.legend .scale i { display: inline-block; width: 160px; height: 10px; border-radius: 3px; }
.legend .scale em { font-style: normal; opacity: .7; }
.legend .keys .scale span::before { display: none; }
.table.heat .el { background: var(--heat); border-color: transparent; --c: var(--heat); }
.table.heat .el .s, .table.heat .el .z, .table.heat .el .n { color: var(--ink); }
.table.heat .el.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #fff, 0 6px 22px rgba(255,255,255,.25); }
.table.heat .el:hover { filter: brightness(1.12); }

/* predicted-only partners: dashed, softer than known partners */
.el.partner-pred { border: 1px dashed color-mix(in srgb, var(--c) 80%, transparent); }
.table.has-sel .el.partner-pred:not(.sel) { opacity: .75; }

/* ---------- Detail extras ---------- */
.section-title { font-size: 13px; font-weight: 600; color: #aab0c4; margin: 18px 0 6px; }
.section-title .muted, .muted { text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12px; }
.bar-row .muted { font-size: 12px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 4px 0 8px; }
.tag.pred { background: transparent; border: 1px dashed #6b7390; color: #c3c8d9; }
.group-title .count { color: #5f6579; margin-left: 4px; }
.more, .btn { margin-top: 8px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.more:hover, .btn:hover { border-color: var(--muted); }
.mini.add.pred { border-style: dashed; background: transparent; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
kbd { font-family: ui-monospace, Consolas, monospace; font-size: 11px; padding: 1px 5px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; color: var(--text); }
.hint.small { font-size: 12px; }
.hint.tiny { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 6px 0 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tabs button { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.tabs button.on { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.structure.dark { background: radial-gradient(circle at 50% 40%, #1b2030, #0b0d13); }
.structure canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.structure canvas:active { cursor: grabbing; }
.structure svg { width: 92%; height: 92%; }
.orb-ctl { display: flex; gap: 6px; margin-top: 8px; }
.orb-ctl select { flex: 1; min-width: 0; }

/* ---------- Mobile ---------- */
.table-scroll { overflow-x: auto; padding: 4px 2px 6px; }
#legendHost .legend { pointer-events: auto; padding: 0 0 12px; gap: 8px; }
@media (max-width: 760px) {
  .wrap { padding: 14px 12px 40px; }
  header { flex-direction: column; align-items: stretch; }
  .search { max-width: none; min-width: 0; }
  .table { min-width: 660px; }
  .el .n { display: none; }
  .el .s { font-size: 14px; }
  .el .z { font-size: 8px; }
  .detail-head h3 { font-size: 20px; }
  .bar-row { grid-template-columns: 30px 1fr 50px 62px; gap: 8px; }
}

/* ---------- GHS hazards ---------- */
.ghs { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.ghs figure { margin: 0; width: 84px; text-align: center; }
.ghs img { display: block; margin: 0 auto 4px; background: #fff; border-radius: 6px; padding: 2px; }
.ghs figcaption { font-size: 11px; color: var(--muted); line-height: 1.3; }
.signal { margin-left: 8px; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.signal.danger { background: #5a1d1d; color: #ffb4a8; }
.signal.warn { background: #4a3a14; color: #ffd27a; }
.hstate { font-size: 13px; margin: 6px 0; }
.hstate summary { cursor: pointer; color: #cfd3df; }
.hstate ul { margin: 6px 0 0; padding-left: 18px; color: #cfd3df; line-height: 1.5; }

/* ---------- Navigation ---------- */
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #111; padding: 6px 10px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.nav button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px;
  font-size: 14px; cursor: pointer; margin-bottom: -1px; }
.nav button:hover { color: var(--text); }
.nav button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #111; font-size: 11px; font-weight: 700; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tool panels ---------- */
.tool h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 14px; }
.eq-form { display: flex; gap: 8px; margin-bottom: 10px; }
.big-input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 16px; font-family: ui-monospace, Consolas, monospace; }
.btn.primary { background: #2a78d6; border-color: #3987e5; color: #fff; font-weight: 600; }
.btn.primary:hover { background: #3987e5; }
.btn.small { padding: 4px 10px; font-size: 12px; margin-top: 0; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.chip-btn { background: var(--panel-2); border: 1px solid var(--line); color: #cfd3df; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; cursor: pointer; font-family: ui-monospace, Consolas, monospace; }
.chip-btn:hover { border-color: var(--muted); }
.eq-result { font-size: 26px; padding: 16px 18px; background: var(--panel-2); border-radius: 10px; margin: 8px 0 10px; line-height: 1.4; }
.eq-result b { color: var(--accent); margin-right: 2px; }
.phase { font-size: .7em; color: var(--muted); margin-left: 1px; }
.atomcheck summary { cursor: pointer; color: #9fe0b5; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; min-width: 100%; }
table.data th, table.data td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.data tr.limiting td { background: rgba(255, 210, 87, .08); }
table.compare td:first-child { white-space: nowrap; }
.amt { display: inline-flex; gap: 4px; }
.amt input { width: 90px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
.amt select, .tool-row select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 13px; }
.eq-dh { font-size: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }
.tag.exo { background: #4a2a14; color: #ffc08a; }
.tag.endo { background: #14324a; color: #9ec5f4; }
.exports { display: flex; gap: 6px; margin: 8px 0; }
.tool-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.tool-row label { display: inline-flex; gap: 8px; align-items: center; }
.tool-row .muted { font-size: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 11px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; pointer-events: none; background: #0b0d13; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; z-index: 5; white-space: nowrap; }
#toolPanel { position: relative; }
.mini-chart { max-width: 420px; }
.x-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.x-btn:hover { color: var(--text); }
.linkbtn { background: none; border: 0; color: #8cb8ff; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 2px; }

/* practice */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.seg button { background: none; border: 0; color: var(--muted); border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.score { color: var(--muted); }
.quiz { max-width: 640px; }
.quiz .q { font-size: 20px; margin: 10px 0; }
.opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0; }
.ok { color: #9fe0b5; }

/* sources */
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.source { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.source h3 { margin: 0 0 6px; font-size: 14px; }
.source p { margin: 4px 0; line-height: 1.45; }
pre { white-space: pre-wrap; font-size: 12px; background: #0b0d13; border-radius: 8px; padding: 10px; overflow-x: auto; color: #cfd3df; }

/* cite dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; width: min(640px, 92vw); padding: 16px 18px; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
dialog textarea { width: 100%; background: #0b0d13; color: #cfd3df; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: 12px ui-monospace, Consolas, monospace; resize: vertical; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h3 { margin: 0; }

/* element extras */
.spectrum { width: 100%; height: auto; display: block; margin: 4px 0; }
.glow-row { display: flex; gap: 12px; align-items: center; margin: 4px 0 8px; }
.glow { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--g); box-shadow: 0 0 18px 4px var(--g); }
.iso-details summary { cursor: pointer; font-size: 13px; color: #cfd3df; margin: 4px 0; }
.lewis { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.lewis-svg { background: #0b0d13; border-radius: 10px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.lewis-svg svg { width: 92%; height: 92%; }
@media (max-width: 640px) { .lewis { grid-template-columns: 1fr; } .lewis-svg { max-width: 240px; } }

/* projector mode: bigger and higher contrast */
body.projector .wrap { zoom: 1.3; max-width: 1100px; }
body.projector { --muted: #b8bdcc; --line: #3a4157; }
body.projector .el .n { color: #c9cddb; }
body.projector .note, body.projector .hint, body.projector .src { color: #c9cddb; }
#projectorBtn[aria-pressed="true"] { background: var(--accent); color: #111; border-color: var(--accent); }

@media (max-width: 760px) {
  .eq-result { font-size: 19px; }
  .opts { grid-template-columns: 1fr; }
  .nav button { padding: 6px 8px; font-size: 13px; }
}
