/* OChem Board Tools — Molecule Studio + Calculators (static) */
/* The `hidden` attribute must win over class rules that set display (.chips,
   .viewer-empty, .viewer-2d all use display:flex and were leaking through). */
[hidden] { display: none !important; }
.studio-grid { display: grid; gap: 1.25rem; grid-template-columns: 1.5fr 1fr; }
@media (max-width: 880px) { .studio-grid { grid-template-columns: 1fr; } }

.search-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 220px; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.search-bar input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,60,94,0.12); }

.viewer-tile { width: 100%; height: 400px; border: 1px solid var(--border); border-radius: 12px; background: #fff; position: relative; overflow: hidden; }
.viewer-2d { display: flex; align-items: center; justify-content: center; min-height: 400px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 1rem; }
.viewer-2d svg { max-width: 100%; height: auto; }
.viewer-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 400px; border: 1px dashed var(--border); border-radius: 12px; color: var(--text-muted); text-align: center; gap: 0.5rem; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.tabs button { border: 0; background: transparent; padding: 0.35rem 0.9rem; border-radius: 6px; font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.tabs button.active { background: var(--blue); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { border: 1px solid var(--border); background: #fff; color: var(--text-muted); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.chip.active { border-color: var(--blue); background: #eaf0f8; color: var(--blue); }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }
.lib-item { border: 1px solid var(--border); background: var(--bg-light); border-radius: 8px; padding: 0.5rem 0.7rem; text-align: left; font: inherit; font-size: 0.88rem; font-weight: 500; color: var(--text-dark); cursor: pointer; }
.lib-item:hover { border-color: var(--yellow-dark); box-shadow: var(--shadow); }

.prop-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; margin: 1rem 0; }
.prop-list .k { font-size: 0.72rem; color: var(--text-muted); }
.prop-list .v { font-weight: 700; color: var(--text-dark); }

.rule { display: inline-flex; align-items: center; gap: 0.3rem; border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.78rem; font-weight: 700; }
.rule.pass { background: #e8f7ee; color: #2f855a; }
.rule.fail { background: #fdf6dc; color: #b48d1e; }

.calc-table { width: 100%; font-size: 0.9rem; border-collapse: collapse; margin-top: 0.75rem; }
.calc-table th { text-align: left; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; padding-bottom: 0.3rem; }
.calc-table td { border-top: 1px solid var(--border); padding: 0.3rem 0; }
.calc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.solved input { border-color: var(--yellow-dark) !important; background: #fffbe9 !important; font-weight: 700; }
.smiles { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem; color: var(--text-muted); word-break: break-all; }
.err { color: #ff7a85; font-size: 0.9rem; margin-top: 0.5rem; }
.gate-note { color: #ffd24a; background: rgba(244,197,66,0.10); border-left: 3px solid #f4c542; border-radius: 6px; padding: 0.5rem 0.7rem; font-size: 0.9rem; margin-top: 0.5rem; line-height: 1.45; }
.fg-row { margin-top: 0.75rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }

/* ===== Draw modal (dark instrument shell + white sketch "screen") ===== */
.draw-modal { position: fixed; inset: 0; background: rgba(4,9,15,0.72); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.draw-modal[hidden] { display: none; }
.draw-panel {
  background: var(--mb-panel); color: var(--mb-text);
  border: 1px solid var(--mb-line); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  width: 100%; max-width: 1000px; max-height: 94vh; overflow: auto;
  padding: 1.1rem 1.2rem 1.2rem;
}
.draw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.draw-head strong { font-family: 'Poppins', sans-serif; font-size: 1.15rem; color: var(--mb-text); }
.draw-sub { display: block; font-size: 0.84rem; color: var(--mb-text-dim); margin-top: 0.15rem; }
.draw-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.9rem; }
.composer-host { width: 100%; height: 360px; background: #fff; border: 1px solid var(--mb-line); border-radius: 8px; overflow: hidden; }

/* Periodic-table bar */
.ptable-bar { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; margin: 0.9rem 0 0.5rem; }
.ptable-label { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mb-cyan); }
.ptable-hint { font-size: 0.8rem; color: var(--mb-text-dim); flex: 1; min-width: 200px; }
.ptable-current { font-size: 0.85rem; color: var(--mb-text-dim); }
.ptable-current b { color: var(--mb-cyan); font-family: 'JetBrains Mono', monospace; font-size: 1rem; }

/* Periodic-table grid */
.ptable { display: grid; grid-template-columns: repeat(18, 1fr); gap: 3px; }
.ptable .el {
  position: relative; aspect-ratio: 1 / 1; min-width: 0;
  border: 0; border-radius: 4px; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: 'Open Sans', system-ui, sans-serif; color: #0c1a24; line-height: 1;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
}
.ptable .el .z { font-size: 0.42rem; opacity: 0.7; position: absolute; top: 2px; left: 3px; }
.ptable .el .sym { font-size: 0.78rem; font-weight: 700; }
.ptable .el:hover { transform: translateY(-1px); filter: brightness(1.12); box-shadow: 0 2px 6px rgba(0,0,0,0.4); z-index: 2; }
.ptable .el.active { box-shadow: 0 0 0 2px var(--mb-cyan), 0 2px 8px rgba(0,0,0,0.5); z-index: 3; }
.ptable .el.ph { background: transparent !important; color: var(--mb-text-dim); cursor: default; font-size: 0.5rem; border: 1px dashed var(--mb-line); }
.ptable .el.ph:hover { transform: none; filter: none; box-shadow: none; }
/* category colors */
.ptable .nm  { background: #6fcf97; }   /* nonmetal */
.ptable .ng  { background: #a99bff; }   /* noble gas */
.ptable .am  { background: #ff8a80; }   /* alkali metal */
.ptable .ae  { background: #ffb74d; }   /* alkaline earth */
.ptable .ml  { background: #4dd0c4; }   /* metalloid */
.ptable .hl  { background: #d4e157; }   /* halogen */
.ptable .tm  { background: #82a9d8; }   /* transition metal */
.ptable .ptm { background: #b0bec5; }   /* post-transition */
.ptable .ln  { background: #f48fb1; }   /* lanthanide */
.ptable .an  { background: #ce93d8; }   /* actinide */
.ptable .unk { background: #90a4ae; }   /* unknown */
@media (max-width: 720px) { .ptable .el .sym { font-size: 0.62rem; } .ptable .el .z { display: none; } }

/* ===== Studio surface polish (light premium) =====
   The 2D/3D viewers + sketcher are bright "screens"; the surrounding
   controls match the clean light chrome in assets/site.css. */
.viewer-tile, .viewer-2d {
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.viewer-empty { border-color: var(--border); color: var(--text-muted); }

.search-bar input {
  background: #fff; border-color: var(--border); color: var(--text-dark); border-radius: 10px;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,111,237,0.15); }

.tabs { border-color: var(--border); }
.tabs button { color: var(--text-muted); }
.tabs button.active { background: var(--accent); color: #fff; }

.chip { background: #fff; border-color: var(--border); color: var(--text-muted); }
.chip.active { border-color: var(--accent); background: rgba(47,111,237,0.10); color: var(--accent); }

.lib-item { background: var(--bg-light); border-color: var(--border-soft); color: var(--text-dark); }
.lib-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }

/* Property / data readouts — monospace values in brand navy */
.prop-list .k { color: var(--text-muted); }
.prop-list .v {
  color: var(--blue);
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
.calc-table th { color: var(--text-muted); }
.calc-table td { border-top-color: var(--border-soft); color: var(--text-dark); font-variant-numeric: tabular-nums; }
.smiles { color: var(--text-muted); }

/* Status pills */
.rule.pass { background: #e8f7ee; color: #2f855a; }
.rule.fail { background: #fdf6dc; color: #9a7a12; }

/* "Solved" calculator highlight — soft amber readout */
.solved input {
  border-color: var(--yellow-dark) !important;
  background: #fffbe9 !important;
  color: #7a5b00 !important; font-weight: 700;
}
.err { color: #ff7a85; }

/* Bare fields inside cards match the light input style */
.card input:not([type=checkbox]):not([type=radio]):not([type=range]),
.card select, .card textarea {
  background: #fff; border: 1px solid var(--border);
  color: var(--text-dark); border-radius: 8px; padding: 0.6rem 0.75rem; font: inherit;
}
.card input:focus, .card select:focus, .card textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,111,237,0.15);
}
.card input::placeholder { color: var(--text-muted); }

/* ===== Account chip (header) ===== */
.auth-chip { display: inline-flex; align-items: center; gap: 0.5rem; flex: none; }
.mymol-row a:hover { text-decoration: underline; }

/* ===== Collapsible calculator cards ===== */
.calc-collapse { padding: 0; overflow: hidden; }
.calc-head { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.6rem; padding: 1.05rem 1.25rem; user-select: none; }
.calc-head::-webkit-details-marker { display: none; }
.calc-head h3 { margin: 0; flex: 1; }
.calc-caret { color: var(--text-muted, #64748b); font-size: 0.78rem; transition: transform 0.15s ease; flex: none; }
.calc-collapse[open] .calc-caret { transform: rotate(90deg); }
.calc-head:hover h3 { color: var(--blue, #2348e0); }
.calc-body { padding: 0 1.25rem 1.25rem; }

/* ===== Stepped analysis panels (Studio right column) ===== */
.panel-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; }
.panel-head h3 { margin: 0; font-size: 1.05rem; }
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: var(--mb-cyan); color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 700; font-size: 0.8rem;
}
.panel-tag {
  margin-left: auto; font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--mb-text-dim); font-family: 'JetBrains Mono', ui-monospace, monospace; white-space: nowrap;
}
/* collapsible panels (Spectra / Orbitals / Conformers) */
details.panel > summary { list-style: none; cursor: pointer; margin: 0; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .panel-tag::after { content: "  ▸"; color: var(--mb-cyan); }
details.panel[open] > summary .panel-tag::after { content: "  ▾"; color: var(--mb-cyan); }
details.panel[open] > summary { margin-bottom: 0.6rem; }
details.panel > summary:hover .panel-head h3,
details.panel > summary:hover h3 { color: var(--mb-cyan); }
.panel-body { animation: panelIn 0.15s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
/* uniform spacing between the stacked analysis panels */
.studio-grid > div > .panel + .panel { margin-top: 1.25rem; }

/* keep the 3D viewer in view while you scroll/work the panels (desktop only) */
@media (min-width: 881px) {
  .viewer-sticky { position: sticky; top: 4.5rem; align-self: start; z-index: 1; }
}

/* nested "Advanced" disclosure inside the Quantum panel */
details.sub { margin-top: 0.6rem; border-top: 1px solid var(--mb-line); padding-top: 0.5rem; }
details.sub > summary { list-style: none; cursor: pointer; font-weight: 600; color: var(--mb-cyan); font-size: 0.9rem; }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary::before { content: "▸ "; }
details.sub[open] > summary::before { content: "▾ "; }
