/* Search & Inputs */
.search-wrapper {
  position: relative;
  width: clamp(160px, 14vw, 210px);
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 5px 44px 5px 28px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.kbd-badge {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
}

.temp-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 6px;
}

.temp-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  min-width: 92px;
}

.temp-slider {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(70px, 6vw, 100px);
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  outline: none;
}

.temp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  border: 2px solid var(--bg-base);
}

.btn-ghost-xs {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
}

.btn-ghost-xs:hover {
  color: var(--text-primary);
  border-color: var(--border-default);
}

.select-clean {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
}

.select-clean option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.select-clean:hover {
  border-color: var(--border-default);
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-tool:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-tool.active {
  background: var(--text-primary);
  color: var(--bg-base);
  border-color: var(--text-primary);
}

.btn-support {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

[data-theme="light"] .btn-support {
  border-color: rgba(217, 119, 6, 0.4);
  color: #d97706;
}

.btn-support:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
}

.btn-support.active {
  background: #f59e0b;
  color: #09090b;
  border-color: #f59e0b;
}

/* Theme Toggle Bar Switch (Pill Slider) */
.theme-switch-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 9999px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.theme-switch-bar:focus-visible .switch-bar-track {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.switch-bar-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 46px;
  height: 24px;
  padding: 0 4px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-sizing: border-box;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  user-select: none;
}

.theme-switch-bar:hover .switch-bar-track {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

[data-theme="light"] .switch-bar-track {
  background: #e2e8f0;
  border-color: rgba(15, 23, 42, 0.16);
}

[data-theme="light"] .theme-switch-bar:hover .switch-bar-track {
  background: #cbd5e1;
  border-color: rgba(15, 23, 42, 0.28);
}

.track-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  pointer-events: none;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.track-icon-moon {
  color: #94a3b8;
  opacity: 0;
}

.track-icon-sun {
  color: rgba(255, 255, 255, 0.4);
  opacity: 1;
}

[data-theme="light"] .track-icon-moon {
  color: #94a3b8;
  opacity: 1;
}

[data-theme="light"] .track-icon-sun {
  color: #cbd5e1;
  opacity: 0;
}

.switch-bar-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  transform: translateX(0);
  pointer-events: none;
  z-index: 2;
}

.thumb-icon-moon,
.thumb-icon-sun {
  display: none;
  pointer-events: none;
}

.thumb-icon-moon {
  display: block;
  color: #38bdf8;
}

[data-theme="light"] .switch-bar-thumb {
  transform: translateX(22px);
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25), 0 1px 2px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .thumb-icon-moon {
  display: none;
}

[data-theme="light"] .thumb-icon-sun {
  display: block;
  color: #d97706;
}

/* Segmented & Lab */
.segmented-control {
  display: inline-flex;
  background: var(--bg-base);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.lab-grid {
  display: grid;
  grid-template-columns: 200px 40px 200px 120px 1fr;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1150px) {
  .lab-grid {
    grid-template-columns: 1fr;
  }
}

.reactant-slot {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s;
}

.reactant-slot:hover, .reactant-slot:focus-visible {
  border-color: var(--border-default);
  outline: none;
}

.reactant-slot.active-slot {
  border-color: var(--text-primary);
  background: var(--bg-elevated);
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.slot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.reactant-slot.active-slot .slot-dot {
  background: var(--accent-emerald);
}

.slot-body {
  margin: 10px 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.slot-sym {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.slot-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.slot-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.lab-op-col {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-muted);
}

.btn-run-synth {
  background: var(--text-primary);
  color: var(--bg-base);
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s;
  width: 100%;
  height: 40px;
  align-self: center;
}

.btn-run-synth:hover {
  opacity: 0.9;
}

.synth-output {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(260px, 310px) 1fr 220px;
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .synth-output {
    grid-template-columns: 1fr;
  }
}

/* Molecular Bond Stage Container */
.mol-stage-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color 0.2s, border-color 0.2s;
}

[data-theme="light"] .mol-stage-box {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.mol-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
}

[data-theme="light"] .mol-stage-header {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

.mol-stage-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mol-stage-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-mol-tool {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
}

[data-theme="light"] .btn-mol-tool {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #64748b;
}

.btn-mol-tool:hover {
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-mol-tool.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

[data-theme="light"] .btn-mol-tool.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.mol-canvas-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 165px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

#reactionCanvas {
  width: 100%;
  height: 165px;
  border-radius: 0 0 6px 6px;
  background: transparent;
  display: block;
}

.synth-info-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.synth-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.synth-formula {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.synth-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.synth-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.stoich-panel {
  border-left: 1px solid var(--border-subtle);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stoich-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.stoich-row span {
  color: var(--text-muted);
}

.stoich-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.mass-bar-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  margin: 2px 0;
}

.mass-bar-fill-a {
  height: 100%;
  background: var(--accent-blue);
  transition: width 0.3s ease;
}

.mass-bar-fill-b {
  height: 100%;
  background: var(--accent-emerald);
  transition: width 0.3s ease;
}

.mass-legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.workbench-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.preset-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 4px;
}

.preset-btn {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 3px 9px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: 0.15s;
}

.preset-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.lab-history-log {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Comparator */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 260px 1fr;
  gap: 20px;
  align-items: center;
}

@media (max-width: 960px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

.compare-col {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 16px;
}

.compare-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.compare-subject-a {
  font-size: 11px;
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

.compare-subject-b {
  font-size: 11px;
  color: var(--accent-emerald);
  font-family: var(--font-mono);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.compare-table td {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.compare-table td:first-child {
  color: var(--text-muted);
}

.compare-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.radar-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.radar-legend {
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* Support / Saweria Drawer (Opsi B) */
.support-card {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, rgba(24, 24, 28, 0.9) 0%, rgba(18, 18, 21, 1) 100%);
}

.support-heart-icon {
  color: #f59e0b;
}

[data-theme="light"] .support-heart-icon {
  color: #d97706;
}

[data-theme="light"] .support-card {
  background: #ffffff;
  border-color: rgba(217, 119, 6, 0.32);
  box-shadow: 0 4px 20px rgba(217, 119, 6, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
}

.support-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

[data-theme="light"] .support-badge {
  background: rgba(217, 119, 6, 0.09);
  border-color: rgba(217, 119, 6, 0.3);
  color: #b45309;
}

.support-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 24px;
  align-items: center;
}

@media (max-width: 860px) {
  .support-grid {
    grid-template-columns: 1fr;
  }
}

.support-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.support-info p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  max-width: 780px;
  line-height: 1.5;
}

.support-pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .support-pillars {
    grid-template-columns: 1fr;
  }
}

.pillar-item {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: 6px;
  transition: background-color 0.2s, border-color 0.2s;
}

[data-theme="light"] .pillar-item {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.pillar-item strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

[data-theme="light"] .pillar-item strong {
  color: #0f172a;
}

.pillar-item span {
  font-size: 11px;
  color: var(--text-muted);
}

[data-theme="light"] .pillar-item span {
  color: #64748b;
}

.support-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn-saweria-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f59e0b;
  color: #09090b;
  font-weight: 600;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.btn-saweria-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

[data-theme="light"] .btn-saweria-primary {
  background: #f59e0b;
  color: #09090b;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

[data-theme="light"] .btn-saweria-primary:hover {
  background: #d97706;
  color: #ffffff;
}

.support-qr-box {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: background-color 0.2s, border-color 0.2s;
}

[data-theme="light"] .support-qr-box {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.qr-frame {
  background: #ffffff;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .qr-frame {
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.qr-image {
  display: block;
  width: 140px;
  height: 140px;
  object-fit: contain;
}

.qr-caption strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
}

[data-theme="light"] .qr-caption strong {
  color: #0f172a;
}

.qr-caption span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

[data-theme="light"] .qr-caption span {
  color: #64748b;
}

.qr-link {
  display: inline-block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #fbbf24;
  text-decoration: none;
  transition: color 0.15s;
}

.qr-link:hover {
  text-decoration: underline;
}

[data-theme="light"] .qr-link {
  color: #b45309;
  font-weight: 500;
}

[data-theme="light"] .qr-link:hover {
  color: #92400e;
}

/* Subbar & Grid Cells */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cat-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.cat-btn:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

.cat-btn.active {
  background: var(--bg-active);
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.cat-swatch {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.phase-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.phase-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.phase-dot-sm {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* Inspector */
.insp-tile {
  width: clamp(56px, 5vw, 72px);
  height: clamp(56px, 5vw, 72px);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

.insp-z {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
}

.insp-sym {
  font-family: var(--font-mono);
  font-size: clamp(20px, 1.8vw, 25px);
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1;
}

.insp-mass {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-muted);
  text-align: center;
}

.insp-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.insp-main {
  min-width: 0;
}

.insp-main h2 {
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insp-touch-actions {
  display: flex;
  gap: 4px;
}

.insp-cat-tag {
  font-size: 8.5px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.insp-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 8px;
}

.metric-cell small {
  display: block;
  font-size: 8.5px;
  color: var(--text-muted);
  line-height: 1.1;
}

.metric-cell strong {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.insp-quantum {
  border-left: 1px solid var(--border-subtle);
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.quantum-label {
  font-size: 8.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
}

.spectrum-bar {
  width: 100%;
  height: 16px;
  background: #050507;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  display: block;
}

.modal-spectrum-bar {
  height: 28px;
}

.orbital-boxes-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.orb-group {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 1px 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.orb-lbl {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-muted);
}

.orb-arrows {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-primary);
  letter-spacing: -1px;
}

/* Element Cell */
.el-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 2px solid var(--cat-color, #52525b);
  border-radius: 4px;
  padding: 2px 3px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: background-color 0.12s, border-color 0.12s;
  outline: none;
  min-width: 0;
  box-sizing: border-box;
}

.el-cell:hover, .el-cell:focus-visible, .el-cell.kb-selected {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  border-top-color: var(--cat-color, #fff);
  z-index: 10;
}

.el-cell.dimmed {
  opacity: 0.18;
  filter: grayscale(90%);
}

.el-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: clamp(7.5px, 0.65vw, 9px);
  color: var(--text-secondary);
  line-height: 1;
}

.el-phase-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

.el-cell-sym {
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.1;
}

.el-cell-bottom {
  text-align: center;
  overflow: hidden;
  line-height: 1;
}

.el-cell-name {
  font-size: clamp(7px, 0.6vw, 8.5px);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.el-cell-mass {
  font-family: var(--font-mono);
  font-size: clamp(6.5px, 0.55vw, 7.5px);
  color: var(--text-muted);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-actions {
  position: absolute;
  top: 1px;
  right: 1px;
  display: none;
  gap: 2px;
  background: var(--cell-actions-bg);
  padding: 1px 2px;
  border-radius: 3px;
  border: 1px solid var(--border-default);
  z-index: 5;
}

.el-cell:hover .cell-actions, .el-cell:focus-within .cell-actions {
  display: flex;
}

.cell-act-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 2px;
  cursor: pointer;
}

.cell-act-btn:hover {
  background: var(--text-primary);
  color: var(--bg-base);
}

.series-label {
  grid-column: 1 / 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-family: var(--font-mono);
  font-size: clamp(8.5px, 0.72vw, 10.5px);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  position: relative;
  box-shadow: var(--shadow-elevated);
}

@media (max-width: 820px) {
  .modal-window {
    grid-template-columns: 1fr;
  }
}

.modal-left {
  background: var(--bg-base);
  border-right: 1px solid var(--border-subtle);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.modal-left-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

#bohrCanvas {
  width: 250px;
  height: 250px;
}

.modal-right {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-element-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

.modal-element-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.btn-close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-close-modal:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.shell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 10px;
}

.shell-tag {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.modal-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.mono-muted {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.props-grid-modal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.prop-item {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  border-radius: 6px;
}

.prop-item small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

.prop-item span {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.decay-chain-box {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.btn-support-link {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

/* Command Palette */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.cmd-overlay.open {
  display: flex;
}

.cmd-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
}

.cmd-input-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
}

.cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
}

.cmd-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

.cmd-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.cmd-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmd-sym-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  width: 28px;
  text-align: center;
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   WELCOME / ONBOARDING MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 220;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.welcome-overlay.open {
  display: flex;
  opacity: 1;
}

.welcome-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  max-width: 590px;
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), 0 0 40px rgba(37, 99, 235, 0.18), 0 0 0 1px var(--border-subtle);
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

[data-theme="light"] .welcome-window {
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.welcome-overlay.open .welcome-window {
  transform: scale(1);
}

/* Atmospheric Nocturnal Landscape Hero */
.welcome-hero-landscape {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
  background: #0b1129;
}

.welcome-landscape-svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Twinkle animations for stars */
@keyframes starTwinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.3); }
}

.star-twinkle-1 {
  animation: starTwinkle 3.2s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.star-twinkle-2 {
  animation: starTwinkle 2.5s ease-in-out infinite 0.9s;
  transform-origin: center;
  transform-box: fill-box;
}

.star-twinkle-3 {
  animation: starTwinkle 3.8s ease-in-out infinite 1.7s;
  transform-origin: center;
  transform-box: fill-box;
}

/* Meteor drift micro-animations */
@keyframes meteorDrift1 {
  0% { opacity: 0.85; transform: translate(0, 0); }
  50% { opacity: 1; transform: translate(3px, 2px); }
  100% { opacity: 0.85; transform: translate(0, 0); }
}

@keyframes meteorDrift2 {
  0% { opacity: 0.8; transform: translate(0, 0); }
  50% { opacity: 1; transform: translate(-3px, 2px); }
  100% { opacity: 0.8; transform: translate(0, 0); }
}

.meteor-streak-1 {
  animation: meteorDrift1 4s ease-in-out infinite alternate;
}

.meteor-streak-2 {
  animation: meteorDrift2 4.5s ease-in-out infinite alternate 0.6s;
}

/* Centered Typography Overlay */
.welcome-hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  padding: 14px 20px 22px;
}

.welcome-hero-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #93c5fd;
  background: rgba(11, 17, 41, 0.65);
  border: 1px solid rgba(147, 197, 253, 0.28);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 7px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.welcome-hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #ffffff;
  line-height: 1.05;
  margin: 0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7), 0 0 28px rgba(59, 130, 246, 0.35);
}

.welcome-hero-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #bfdbfe;
  margin-top: 6px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.welcome-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(11, 17, 41, 0.55);
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.15s ease;
}

.welcome-close-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.2);
}

/* Modal Body Content */
.welcome-body {
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  background: var(--bg-surface);
  overflow-y: auto;
}

.welcome-tagline {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.welcome-features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .welcome-hero-landscape {
    height: 165px;
  }
  .welcome-hero-title {
    font-size: 26px;
    letter-spacing: 0.18em;
  }
  .welcome-hero-sub {
    font-size: 9px;
    letter-spacing: 0.16em;
  }
  .welcome-body {
    padding: 14px 16px 16px;
    gap: 11px;
  }
  .welcome-features-grid {
    grid-template-columns: 1fr;
  }
}

.w-feature-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.15s;
}

[data-theme="light"] .w-feature-card {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

.w-feature-card:hover {
  border-color: var(--border-default);
}

.w-feature-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 5px;
  flex-shrink: 0;
  line-height: 1.2;
}

[data-theme="light"] .w-feature-num {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}

.w-feature-body strong {
  display: block;
  font-size: 11.5px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.w-feature-body span {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Gen Z Developer Support Box */
.welcome-support-box {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.03) 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 10px;
  padding: 12px 14px;
  position: relative;
}

[data-theme="light"] .welcome-support-box {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.07) 0%, rgba(217, 119, 6, 0.02) 100%);
  border-color: rgba(217, 119, 6, 0.26);
}

.w-support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.w-support-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="light"] .w-support-tag {
  color: #b45309;
}

.w-saweria-link {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #f59e0b;
  text-decoration: none;
}

[data-theme="light"] .w-saweria-link {
  color: #b45309;
}

.w-saweria-link:hover {
  text-decoration: underline;
}

.w-support-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.w-support-text a {
  color: #f59e0b;
  font-weight: 600;
  text-decoration: underline;
}

[data-theme="light"] .w-support-text a {
  color: #b45309;
}

/* Footer: Checkbox on left, distinct button on right */
.welcome-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 2px;
}

.welcome-checklist {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.welcome-checklist input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-blue);
  cursor: pointer;
  margin: 0;
}

.welcome-checklist:hover span {
  color: var(--text-secondary);
}

/* Distinctive, Non-monotonous Start Button */
.btn-start-explore {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 9px 20px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-start-explore:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  filter: brightness(1.06);
}

.btn-start-explore:hover svg {
  transform: translateX(3px);
}

.btn-start-explore:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-start-explore svg {
  transition: transform 0.2s ease;
}

[data-theme="light"] .btn-start-explore {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
