/* ============================================================
   Virtual Simulations 共享样式：/sim/ 目录下所有模块页共用
   （原创布局/配色，沿用全站 design token，不照抄任何第三方产品的
   视觉设计）
   ============================================================ */

.sim-subnav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.sim-subnav-alllink {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.sim-subnav-alllink::before { content: '\2190\0020'; } /* ← */
.sim-subnav-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sim-pill {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.sim-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* -------------------- /sim/ 首页目录 -------------------- */
.sim-category-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 20px 0 8px;
}
.sim-category-title:first-child { margin-top: 0; }
.sim-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.sim-card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sim-card:hover, .sim-card:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
}
.sim-card-title { font-weight: 700; font-size: 15px; color: var(--color-text); margin-bottom: 4px; }
.sim-card-desc { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; }
.sim-card.soon { opacity: 0.55; cursor: default; pointer-events: none; }
.sim-card-badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
.sim-card-badge.soon { background: #F1F3F5; color: #4A5568; } /* was var(--color-text-muted) #667085 -- 4.47:1, just under the 4.5:1 threshold on this background */
.sim-card-badge.student { background: #EDE9FE; color: #6D28D9; }

/* -------------------- 锁定/发现态（家长门户看学生专属模块） -------------------- */
.sim-locked-panel {
  padding: 24px 16px;
  text-align: center;
  color: #555;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
}
.sim-locked-panel .btn { margin-top: 10px; }

/* -------------------- Build an Atom -------------------- */
.atom-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
@media (max-width: 720px) { .atom-layout { grid-template-columns: 1fr; } }

.atom-visual-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  margin: 0 auto;
}
.atom-shell-ring {
  position: absolute;
  top: 50%; left: 50%;
  border: 1.5px dashed #C7D2DA;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.atom-particle {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.atom-particle.proton { background: #FF8A5C; box-shadow: inset -2px -2px 3px rgba(0,0,0,0.2); }
.atom-particle.neutron { background: #8FA3B0; box-shadow: inset -2px -2px 3px rgba(0,0,0,0.2); }
.atom-particle.electron { background: #fff; border: 2px solid var(--color-primary); }
.atom-nucleus-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 11px; font-weight: 700; color: rgba(27,36,48,0.35); pointer-events: none;
}

.atom-controls-group { margin-bottom: 16px; }
.atom-controls-group .label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.atom-controls-group .label-row .name { font-weight: 600; font-size: 14px; }
.atom-controls-group .label-row .count { font-size: 20px; font-weight: 700; }
.atom-btn-row { display: flex; gap: 8px; }
.atom-btn-row button {
  flex: 1; padding: 8px 0; font-size: 18px; font-weight: 700; border-radius: 8px;
  border: 1px solid var(--color-border); background: #fff; cursor: pointer;
}
.atom-btn-row button:active { transform: scale(0.96); }
.atom-btn-row button:disabled { opacity: 0.35; cursor: default; }
.atom-btn-row button.proton-btn { color: #C2410C; }
.atom-btn-row button.neutron-btn { color: #475569; }
.atom-btn-row button.electron-btn { color: var(--color-primary); }

.atom-info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.atom-info-table td { padding: 5px 0; border-bottom: 1px solid var(--color-border); }
.atom-info-table td:first-child { color: var(--color-text-muted); }
.atom-info-table td:last-child { text-align: right; font-weight: 600; }
.atom-identity {
  text-align: center; margin-bottom: 14px; padding: 12px; background: var(--color-bg);
  border-radius: 10px;
}
.atom-identity .sym { font-size: 34px; font-weight: 800; color: var(--color-primary); line-height: 1; }
.atom-identity .name { font-size: 14px; color: var(--color-text-muted); margin-top: 2px; }
.atom-identity .charge-tag {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px;
}
.atom-identity .charge-tag.neutral { background: #E6F7EC; color: #1D8A3F; }
.atom-identity .charge-tag.cation { background: #E3F2FD; color: #1565C0; }
.atom-identity .charge-tag.anion { background: #FBEAEA; color: var(--color-danger); }

/* -------------------- Electron Shell Explorer -------------------- */
.shell-explorer-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
@media (max-width: 720px) { .shell-explorer-layout { grid-template-columns: 1fr; } }
.shell-element-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.shell-element-picker button {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--color-border);
  background: #fff; font-weight: 700; cursor: pointer;
}
.shell-element-picker button.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.shell-note {
  font-size: 12.5px; color: var(--color-text-muted); background: var(--color-bg);
  border-radius: 8px; padding: 10px 12px; margin-top: 12px;
}
.shell-nav-btns { display: flex; justify-content: space-between; margin-top: 12px; }

/* -------------------- Periodic Table 详情面板 -------------------- */
.ptable-wrap { overflow-x: auto; padding-bottom: 8px; }
.ptable { display: grid; grid-template-columns: repeat(18, minmax(46px, 1fr)); gap: 3px; min-width: 900px; }
.ptable-cell {
  position: relative; aspect-ratio: 1/1; border-radius: 5px; padding: 3px 4px;
  font-size: 10px; line-height: 1.15; color: #1a1a1a; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.ptable-cell:hover, .ptable-cell:focus-visible, .ptable-cell.active {
  transform: scale(1.08); box-shadow: 0 2px 8px rgba(0,0,0,0.3); z-index: 1; outline: none;
}
.ptable-cell.active { outline: 2px solid #0F5C97; }
/* opacity dropped (accessibility audit, Portal/Focus/Reference
   consolidation) -- the category background colors are light enough
   that full-opacity dark text is needed to clear WCAG contrast at
   this font size; a full per-category color audit is a separate,
   larger piece of work (see Final Report known issues). */
.ptable-cell .z { position: absolute; top: 2px; left: 3px; font-size: 8px; color: #1B2430; }
.ptable-cell .sym { font-size: 16px; font-weight: 700; text-align: center; }
.ptable-cell .name { font-size: 7px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptable-cell .mass { font-size: 7px; text-align: center; color: #1B2430; }
.ptable-cell.ptable-gap { background: transparent; cursor: default; }

.cat-alkali { background: #FFAB91; }
.cat-alkaline { background: #FFE082; }
.cat-transition { background: #80CBC4; }
.cat-post { background: #B0BEC5; }
.cat-metalloid { background: #C5E1A5; }
.cat-nonmetal { background: #81D4FA; }
.cat-halogen { background: #FFF59D; }
.cat-noble { background: #CE93D8; }
.cat-lanthanide { background: #F48FB1; }
.cat-actinide { background: #EF9A9A; }
.cat-unknown { background: #E0E0E0; }

.ptable-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; }
.ptable-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ptable-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.ptable-detail {
  margin-top: 14px; padding: 14px; background: var(--color-bg); border-radius: 10px;
  display: none;
}
.ptable-detail.show { display: block; }
.ptable-detail .hd { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.ptable-detail .hd .sym { font-size: 26px; font-weight: 800; color: var(--color-primary); }
.ptable-detail .hd .name { font-size: 14px; color: var(--color-text-muted); }
.ptable-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; font-size: 13px; }
.ptable-detail-grid .k { color: var(--color-text-muted); font-size: 11px; }
.ptable-detail-grid .v { font-weight: 700; }
.ptable-detail-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Focus Reference: classroom/widescreen presentation of the same
   Periodic Table Reference data (Portal/Focus/Reference consolidation).
   Applied via body.ref-focus-mode, set only when the page is opened
   with ?mode=focus (e.g. from a Topic's Focus Mode). Widens the layout
   and enlarges text/touch targets for a projector/interactive display;
   does not change any scientific data or interaction. */
body.ref-focus-mode .container { max-width: 1400px; }
body.ref-focus-mode .ptable-cell .sym { font-size: 20px; }
body.ref-focus-mode .ptable-cell .name { font-size: 8.5px; }
body.ref-focus-mode .ptable-cell .mass { font-size: 8.5px; }
@media (min-width: 1000px) {
  body.ref-focus-mode #periodicCard { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
  body.ref-focus-mode #periodicCard h2,
  body.ref-focus-mode #periodicCard > p { grid-column: 1 / -1; }
  body.ref-focus-mode .ptable-detail { position: sticky; top: 12px; }
}
body.ref-focus-mode .ptable-detail .hd .sym { font-size: 34px; }
body.ref-focus-mode .ptable-detail .hd .name { font-size: 18px; }
body.ref-focus-mode .ptable-detail-grid { font-size: 16px; }
body.ref-focus-mode .ptable-detail-grid .k { font-size: 13px; }
body.ref-focus-mode .ptable-detail-actions .btn { min-height: 44px; padding: 10px 18px; font-size: 14px; }

/* -------------------- Molecule Explorer -------------------- */
.molecule-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
@media (max-width: 700px) { .molecule-layout { grid-template-columns: 1fr; } }
.molecule-list { list-style: none; margin: 0; padding: 0; }
.molecule-list li { margin-bottom: 4px; }
.molecule-list button {
  width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--color-border);
  border-radius: 6px; background: #fff; cursor: pointer;
}
.molecule-list button.active { background: #eef4fa; border-color: var(--color-primary); font-weight: 600; }
.molecule-list button.locked { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #777; }
.molecule-list button.locked .lock-icon { font-size: 11px; opacity: 0.7; }
#simViewerBox {
  width: 100%; height: 380px; border: 1px solid var(--color-border); border-radius: 8px;
  position: relative; background: #fafafa;
}
.sim-style-switch { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.sim-style-switch button {
  padding: 6px 12px; border: 1px solid var(--color-border); border-radius: 6px;
  background: #fff; cursor: pointer;
}
.sim-style-switch button.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.molecule-facts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px;
  margin-top: 10px; font-size: 13px;
}
.molecule-facts-grid .k { color: var(--color-text-muted); font-size: 11px; }
.molecule-facts-grid .v { font-weight: 700; }

/* -------------------- 路易斯点式结构共用元素 -------------------- */
.lewis-atom-circle {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fff; border: 1.5px solid var(--color-text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; z-index: 2;
}
.lewis-dot {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--color-text); z-index: 3;
}
.lewis-bond-line {
  position: absolute; background: var(--color-text); transform-origin: 0 50%; z-index: 1;
}
.lewis-stage {
  position: relative; width: 100%; min-height: 260px; background: var(--color-bg);
  border-radius: 10px; margin: 12px 0;
}

/* -------------------- Bond Builder -------------------- */
.bond-example-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.bond-example-row .group-label { font-size: 11px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; margin-right: 4px; align-self: center; }
.bond-example-btn {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border);
  background: #fff; font-size: 13px; cursor: pointer;
}
.bond-example-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.bond-step-panel { font-size: 13.5px; line-height: 1.6; margin-top: 10px; }
.bond-step-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.ion-charge-tag {
  display: inline-block; font-weight: 700; font-size: 15px; padding: 2px 8px; border-radius: 6px;
}
.ion-charge-tag.cation { background: #E3F2FD; color: #1565C0; }
.ion-charge-tag.anion { background: #FBEAEA; color: var(--color-danger); }

/* -------------------- Lewis Structure Builder -------------------- */
.lewis-step-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.lewis-step-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--color-border); font-size: 13px; color: var(--color-text-muted);
}
.lewis-step-item.done { border-color: #1D8A3F; background: #E6F7EC; color: var(--color-text); }
.lewis-step-item.current { border-color: var(--color-primary); background: #eef4fa; color: var(--color-text); font-weight: 600; }
.lewis-step-num {
  width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0;
}
.lewis-step-item.done .lewis-step-num { background: #1D8A3F; border-color: #1D8A3F; color: #fff; }
.lewis-octet-badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.lewis-octet-badge.ok { background: #E6F7EC; color: #1D8A3F; }
.lewis-octet-badge.exception { background: #FFF4E5; color: #B26A00; }

/* -------------------- Equation Balancer -------------------- */
.balance-equation-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 20px; font-weight: 700; margin: 16px 0; }
.balance-species { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.balance-coef-controls { display: flex; align-items: center; gap: 4px; }
.balance-coef-controls button {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--color-border);
  background: #fff; font-weight: 700; cursor: pointer; font-size: 14px;
}
.balance-coef-controls .coef-val { min-width: 18px; text-align: center; font-size: 16px; }
.balance-plus, .balance-arrow { color: var(--color-text-muted); }
.balance-atom-counts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.balance-atom-chip {
  font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--color-border);
  display: flex; gap: 6px; align-items: center;
}
.balance-atom-chip.match { border-color: #1D8A3F; background: #E6F7EC; }
.balance-atom-chip.mismatch { border-color: var(--color-danger); background: #FBEAEA; }
.balance-status-banner {
  margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
}
.balance-status-banner.balanced { background: #E6F7EC; color: #1D8A3F; }
.balance-status-banner.unbalanced { background: var(--color-bg); color: var(--color-text-muted); font-weight: 400; }
.balance-reaction-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.balance-reaction-picker button {
  font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--color-border);
  background: #fff; cursor: pointer;
}
.balance-reaction-picker button.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
