/**
 * FattyModel2D.css  —  Styles for FattyModel2D library
 * All classes prefixed with .fm2d- to avoid conflicts.
 * White / light theme.
 */

/* ─── Model wrapper ─────────────────────────────────────────────────────────── */
.fm2d-model {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
  min-height: 200px;
  font-family: 'DM Mono', monospace;
  background: #ffffff;
}
.fm2d-top-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.fm2d-body-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.fm2d-model.fm2d-fullscreen {
  position: fixed !important;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 9000;
  background: #ffffff;
}

/* ─── Canvas column ──────────────────────────────────────────────────────────── */
.fm2d-canvas-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

/* ─── Top rows ───────────────────────────────────────────────────────────────── */
.fm2d-top-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e2e6f0;
  flex-shrink: 0;
  background: #f4f6fb;
  min-height: 36px;
  overflow: hidden;
}

/* Row 1: Buttons + icons */
.fm2d-row-buttons {
  min-height: 36px;
}

/* fm2d-row-info removed — title+notation now live inside fm2d-row-buttons */

/* Rotated bonds — absolute overlay at top of canvas column */
.fm2d-row-rotated {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: 30px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 1px solid #e2e6f0;
  gap: 6px;
  padding: 0 10px;
  flex-wrap: wrap;
}

.fm2d-top-title {
  padding: 0 14px;
  border-right: 1px solid #e2e6f0;
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  color: #3a7000;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.fm2d-top-notation {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow: hidden;
  border-right: 1px solid #e2e6f0;
}

.fm2d-top-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  flex-shrink: 0;
}

/* ─── Rotated bonds row content — matches button-row palette ─────────────────── */
.fm2d-rotated-label {
  font-family: 'DM Mono', monospace;
  font-size: .55rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #9da3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.fm2d-rotated-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

/* Bond tags look like ctrl-btn chips */
.fm2d-rotated-bond {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  height: 22px;
  border: 1px solid #d8dcea;
  border-radius: 3px;
  background: transparent;
  cursor: default;
  transition: background .12s, border-color .12s;
}
.fm2d-rotated-bond:hover {
  background: rgba(0,0,0,.04);
  border-color: #9da3b8;
}

.fm2d-rotated-bond-name {
  font-family: 'DM Mono', monospace;
  font-size: .57rem;
  color: #7a8199;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Red circle × button — hidden until parent is hovered */
.fm2d-rotated-bond-x {
  display: none;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(196,60,26,.12);
  border: 1px solid rgba(196,60,26,.3);
  padding: 0;
  margin: 0;
  font-size: .55rem;
  line-height: 1;
  color: rgba(196,60,26,.7);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  flex-shrink: 0;
}
.fm2d-rotated-bond:hover .fm2d-rotated-bond-x { display: flex; }
.fm2d-rotated-bond-x:hover {
  background: #c43c1a;
  color: #fff;
  border-color: transparent;
}

/* Reset All — left-aligned, ctrl-btn style */
.fm2d-rotated-reset-all {
  font-family: 'DM Mono', monospace;
  font-size: .52rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0 9px;
  height: 22px;
  background: transparent;
  border: 1px solid #d8dcea;
  color: #7a8199;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
  flex-shrink: 0;
}
.fm2d-rotated-reset-all:hover {
  background: rgba(0,0,0,.04);
  color: #2a2e42;
  border-color: #9da3b8;
}

/* ─── Control buttons ────────────────────────────────────────────────────────── */
.fm2d-ctrl-btn {
  padding: 0 10px;
  height: 24px;
  background: transparent;
  border: 1px solid #d8dcea;
  color: #7a8199;
  font-family: 'DM Mono', monospace;
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
  line-height: 1;
}
.fm2d-ctrl-btn:hover {
  border-color: #9da3b8;
  color: #2a2e42;
}
.fm2d-ctrl-btn.fm2d-ctrl-active {
  border-color: #5a9200;
  color: #3a6200;
  background: rgba(90,146,0,.08);
}

/* ─── Canvas area ───────────────────────────────────────────────────────────���─ */
.fm2d-canvas-area {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 36px;
  overflow: hidden;
  background: #ffffff;
}

.fm2d-svg {
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
}

/* ─── FA Notation bar ─────────────────────────────────��─────────────────────── */
.fm2d-notation {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 2px;
  font-family: 'DM Mono', monospace;
  font-size: .78rem;
  user-select: none;
  overflow: hidden;
}

.fm2d-notation-part {
  padding: 2px 3px;
  border-radius: 3px;
  cursor: default;
  transition: background .15s;
}
.fm2d-notation-part:hover { background: rgba(90,146,0,.12); }

.fm2d-n-sat   { font-weight: 600; color: #2a7200; letter-spacing: .04em; }
.fm2d-n-len   { color: #1a3a80; }
.fm2d-n-db    { color: #1a3a80; }
.fm2d-n-omega { color: #8a5200; font-style: italic; }
.fm2d-n-cis   { color: #856000; }
.fm2d-n-trans { color: #900030; }
.fm2d-notation-sep { color: #9da3b8; padding: 2px 0; }

/* ─── Icon/utility buttons ──────────────────────────────────────────────────── */
.fm2d-btn, .fm2d-btn-icon {
  background: rgba(0,0,0,.04);
  border: 1px solid #d8dcea;
  color: #7a8199;
  width: 28px; height: 28px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: color .15s, border-color .15s, background .15s;
}
.fm2d-btn:hover, .fm2d-btn-icon:hover {
  color: #3a6200;
  border-color: #5a9200;
  background: rgba(90,146,0,.08);
}

.fm2d-btn-info {
  font-style: italic;
  font-weight: 700;
  font-family: serif;
  font-size: 13px;
}

/* ─── Icon section in top row ────────────────────────────────────────────────── */
.fm2d-top-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-left: 1px solid #e2e6f0;
  flex-shrink: 0;
}

/* ─── Connected toggle switch groups ─────────────────────────────────────────── */
.fm2d-btn-group {
  display: inline-flex;
  border: 1px solid #d8dcea;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color .15s;
}
.fm2d-btn-group:hover { border-color: #9da3b8; }
.fm2d-btn-group .fm2d-ctrl-btn {
  border: none;
  border-left: 1px solid #d8dcea;
  border-radius: 0;
  padding: 0 8px;
}
.fm2d-btn-group .fm2d-ctrl-btn:first-child { border-left: none; }
.fm2d-btn-group .fm2d-ctrl-btn:hover { background: rgba(0,0,0,.04); color: #2a2e42; }
.fm2d-btn-group .fm2d-ctrl-btn.fm2d-ctrl-active { background: rgba(90,146,0,.1); color: #3a6200; }
.fm2d-btn-group-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.fm2d-btn-group-label {
  font-family: 'DM Mono', monospace;
  font-size: .56rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #9da3b8;
  white-space: nowrap;
}

/* ─── Hide info button when stats panel is open ──────────────────────────��───── */
.fm2d-model:has(.fm2d-stats-panel.fm2d-open) .fm2d-btn-info { display: none !important; }

/* ─── Data panel ────────────────────────────────���────────────────────────────── */
.fm2d-data-panel {
  position: absolute;
  inset: 0;
  background: #f7f8fd;
  overflow: auto;
  z-index: 55;
  padding: 10px 12px 12px;
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
}
/* ─── Stats panel sidebar ────────────────────────────────────────────────────── */
.fm2d-stats-panel {
  width: 0;
  min-width: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 0px solid #e2e6f0;
  background: #f9fafd;
  position: relative;
  overflow: visible;
  transition: width .25s ease, border-left-width .25s ease;
}
.fm2d-stats-panel.fm2d-open {
  width: 220px;
  border-left-width: 1px;
}
.fm2d-stats-inner {
  width: 220px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.fm2d-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #e2e6f0;
  min-height: 36px;
  flex-shrink: 0;
  background: #f4f6fb;
}
.fm2d-cfg-title {
  font-family: 'DM Mono', monospace;
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #9da3b8;
  white-space: nowrap;
}
.fm2d-stats-close {
  background: transparent;
  border: none;
  color: #9da3b8;
  font-size: 15px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}
.fm2d-stats-close:hover { color: #2a2e42; }
.fm2d-stats-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

/* ─── Stats pull-tab (‹ arrow shown when panel is hidden) ─────────────────────── */
.fm2d-stats-tab {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 48px;
  background: #f4f6fb;
  border: 1px solid #e2e6f0;
  border-right: none;
  border-radius: 5px 0 0 5px;
  color: #9da3b8;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
  transition: color .15s, background .15s;
}
.fm2d-stats-tab:hover { background: #eef0fa; color: #3a6200; }

/* ─── EIB (Element Info Box) ─────────────────────────────────────────────────── */
.fm2d-eib {
  position: absolute;
  inset: 0;
  background: #f9fafd;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform .2s ease;
  z-index: 30;
}
.fm2d-eib.fm2d-eib-open { transform: translateX(0); }
.fm2d-eib-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #e2e6f0;
  min-height: 36px;
  flex-shrink: 0;
  background: #f4f6fb;
  transition: background .2s ease, border-color .2s ease;
}
.fm2d-eib.fm2d-eib-open .fm2d-eib-header {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}
.fm2d-eib-header-actions {
  display: flex;
  gap: 5px;
  margin-right: auto;
}
.fm2d-eib-action-btn {
  font-size: .58rem !important;
  padding: 2px 8px !important;
  background: rgba(37,99,235,.1) !important;
  border-color: rgba(37,99,235,.3) !important;
  color: #1d4ed8 !important;
}
.fm2d-eib-action-btn:hover {
  background: rgba(37,99,235,.2) !important;
}
.fm2d-eib-title {
  font-family: 'DM Mono', monospace;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #3a4060;
  font-weight: 600;
}
.fm2d-eib-close {
  background: transparent;
  border: none;
  color: #9da3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color .15s;
}
.fm2d-eib-close:hover { color: #2a2e42; }
.fm2d-eib-divider { height: 1px; background: #e2e6f0; flex-shrink: 0; }
.fm2d-eib-body {
  flex: 1;
  padding: 10px 14px;
  font-family: 'DM Mono', monospace;
  font-size: .61rem;
  color: #4a5270;
  line-height: 1.75;
  white-space: pre-line;
  overflow-y: auto;
}
.fm2d-eib-actions {
  padding: 8px 12px 12px;
  border-top: 1px solid #e2e6f0;
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.fm2d-eib-actions:empty { display: none; }

/* ─── SMILES bar ──────────────────────────────────────────────────────────────── */
.fm2d-smiles-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e2e6f0;
  background: #f9fafd;
  min-height: 30px;
  flex-shrink: 0;
  padding: 0 10px;
  gap: 6px;
  position: relative;
}
.fm2d-smiles-display-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.fm2d-smiles-text {
  font-family: 'DM Mono', monospace;
  font-size: .6rem;
  color: #6a7090;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .15s;
  padding: 2px 0;
}
.fm2d-smiles-text:hover { color: #2a2e42; }
/* Flip / Edit buttons — hidden until SMILES section is hovered */
.fm2d-sa-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  flex-shrink: 0;
}
.fm2d-smiles-bar:hover .fm2d-sa-btn,
.fm2d-smiles-bar.fm2d-editing .fm2d-sa-btn {
  opacity: 1;
  pointer-events: auto;
}
.fm2d-smiles-edit-group {
  display: none;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.fm2d-smiles-bar.fm2d-editing .fm2d-smiles-display-group { display: none; }
.fm2d-smiles-bar.fm2d-editing .fm2d-smiles-edit-group    { display: flex; }
.fm2d-smiles-input {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  height: 22px;
  border: 1px solid #d8dcea;
  border-radius: 3px;
  background: #ffffff;
  color: #2a2e42;
  font-family: 'DM Mono', monospace;
  font-size: .6rem;
  padding: 0 8px;
  outline: none;
  transition: border-color .15s;
}
.fm2d-smiles-input:focus { border-color: #5a9200; }
.fm2d-smiles-apply  { border-color: #5a9200 !important; color: #3a6200 !important; }
.fm2d-smiles-apply:hover { background: rgba(90,146,0,.1) !important; }

/* ─── SVG wrap ─────────────────────────────────────────────────────────────────── */
.fm2d-svg-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

/* ─── Stats table rows ─────────────────────────────────────────────────────────── */
.fm2d-stat-row {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #edf0f8;
}
.fm2d-stat-row:last-child { border-bottom: none; }
.fm2d-stat-main {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  min-height: 28px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.fm2d-stat-row:hover > .fm2d-stat-main { background: rgba(0,0,0,.03); }
.fm2d-stat-row.fm2d-stat-selected > .fm2d-stat-main { background: rgba(90,146,0,.09); }
.fm2d-stat-tri {
  font-size: .45rem;
  color: #c8ccda;
  transition: transform .15s, color .15s;
  flex-shrink: 0;
  width: 10px;
  text-align: center;
}
.fm2d-stat-row.fm2d-open > .fm2d-stat-main > .fm2d-stat-tri {
  transform: rotate(90deg);
  color: #5a9200;
}
.fm2d-stat-label {
  font-family: 'DM Mono', monospace;
  font-size: .57rem;
  color: #7a8199;
  text-transform: uppercase;
  letter-spacing: .06em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm2d-stat-value {
  font-family: 'DM Mono', monospace;
  font-size: .62rem;
  color: #2a3050;
  font-weight: 600;
  flex-shrink: 0;
  text-align: right;
}
.fm2d-stat-help {
  display: none;
  font-family: 'DM Mono', monospace;
  font-size: .56rem;
  color: #8a90a8;
  padding: 0 10px 8px 26px;
  line-height: 1.65;
  white-space: pre-line;
}
.fm2d-stat-row.fm2d-open .fm2d-stat-help { display: block; }
.fm2d-stat-children {
  border-top: 1px solid #edf0f8;
  background: #f4f6fb;
}
.fm2d-stat-child > .fm2d-stat-main { padding-left: 22px; }
.fm2d-stat-child .fm2d-stat-tri { visibility: hidden; }

/* ─── Data panel (atom table) ───────────────────────────────────────────────────── */
.fm2d-data-panel {
  position: absolute;
  inset: 0;
  background: #f7f8fd;
  overflow: auto;
  z-index: 55;
  padding: 10px 12px 12px;
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
}
.fm2d-data-panel table {
  border-collapse: collapse;
  white-space: nowrap;
  min-width: 100%;
}
.fm2d-data-panel th, .fm2d-data-panel td {
  padding: 3px 10px 3px 6px;
  text-align: left;
  border-bottom: 1px solid #e8eaf4;
  color: #4a5270;
}
.fm2d-data-panel th {
  font-weight: 600;
  color: #2a3050;
  border-bottom: 2px solid #d8dcea;
  background: #f0f2fa;
  position: sticky;
  top: 0;
}
.fm2d-data-panel tr:hover td { background: rgba(90,146,0,.05); }

/* ─── Fullscreen overlay ──────────────────────────────────────────────────────── */
.fm2d-fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8999;
}
.fm2d-fullscreen-overlay .fm2d-model {
  width: 90vw;
  max-width: 1100px;
  height: 80vh;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
}

/* ─── Data table refinements ─────────────────────────────────────────────────── */
.fm2d-data-table {
  border-collapse: collapse;
  white-space: nowrap;
  width: 100%;
  font-family: 'DM Mono', monospace;
  font-size: .62rem;
}
.fm2d-data-table th,
.fm2d-data-table td {
  padding: 4px 12px 4px 8px;
  text-align: left;
  border-bottom: 1px solid #e8eaf4;
  color: #4a5270;
  vertical-align: middle;
}
.fm2d-data-table th {
  font-weight: 600;
  color: #2a3050;
  background: #f0f2fa;
  position: sticky;
  top: 0;
  z-index: 1;
}
/* Sub-header row (row 2 of thead) */
.fm2d-data-table thead tr:first-child th {
  border-bottom: 1px solid #d8dcea;
}
.fm2d-data-table thead tr:last-child th {
  border-bottom: 2px solid #d8dcea;
  font-size: .56rem;
  color: #7a8199;
  font-weight: 500;
}
/* "Next Bond" group header — centre the label over its 3 sub-columns */
.fm2d-data-table thead tr:first-child th[colspan] {
  text-align: center;
  border-left: 1px solid #d8dcea;
}
.fm2d-data-table tbody tr:hover td { background: rgba(90,146,0,.05); }
.fm2d-data-table td:nth-child(1) { color: #2a3050; font-weight: 600; }
.fm2d-data-table td:nth-child(2) { color: #7a8199; font-style: italic; }

/* ── Lightbox modal ─────────────────────────────────────────────────────────── */
.fm2d-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99998;
  align-items: center;
  justify-content: center;
}
.fm2d-lightbox.fm2d-open {
  display: flex;
}
.fm2d-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 40, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.fm2d-lightbox-dialog {
  position: relative;
  z-index: 99999;
  background: #ffffff;
  border: 1px solid #e2e6f0;
  border-radius: 10px;
  box-shadow: 0 16px 56px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.10);
  width: 90vw;
  height: 85vh;
  max-width: 96vw;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.fm2d-window-btns {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 5px;
  flex-shrink: 0;
  border-bottom: 1px solid #e8ecf4;
  background: #f8f9fc;
  border-radius: 10px 10px 0 0;
}
.fm2d-window-btns .fm2d-btn-icon {
  position: static;
  background: transparent;
  border: 1px solid #dde2ee;
  border-radius: 5px;
  color: #9da3b8;
  font-size: .85rem;
  line-height: 1;
  padding: 3px 7px;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.fm2d-window-btns .fm2d-btn-icon:hover {
  color: #2a2e42;
  background: #e2e6f0;
  border-color: #b0b8ce;
}
.fm2d-lightbox-fullscreen {
  max-width: 100vw !important;
  max-height: 100vh !important;
  width: 100vw;
  height: 100vh;
  border-radius: 0 !important;
}
.fm2d-lightbox-content {
  overflow: auto;
  flex: 1;
}
.fm2d-lightbox-wrap {
  min-width: 480px;
  min-height: 340px;
}

.fm2d-lightbox-content .fm2d-canvas-area { min-height: 60vh; }

/* ─── Checkbox-style toggle buttons (Zigzag / H's / Labels) ──────────────────── */
.fm2d-check-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border: 1.5px solid #c8cfe0;
  border-radius: 5px;
  background: #f0f2f8;
  color: #7a8199;
  font-family: 'DM Mono', monospace;
  font-size: .63rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
}
.fm2d-check-btn:hover {
  border-color: #9da3b8;
  color: #2a2e42;
}
/* ─── Checkbox-style toggle buttons ─────────────────────────────────────────── */
.fm2d-check-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border: 1.5px solid #c8cfe0;
  border-radius: 5px;
  background: #f0f2f8;
  color: #7a8199;
  font-family: 'DM Mono', monospace;
  font-size: .63rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
}
.fm2d-check-btn:hover {
  border-color: #9da3b8;
  color: #2a2e42;
}
.fm2d-check-icon {
  width: 12px; height: 12px;
  border: 1.5px solid #c0c7d8;
  border-radius: 3px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
  color: transparent;
  font-weight: 700;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
}

/* ── Blue active state — check-btns AND all ctrl-btns in the buttons row ─────── */
.fm2d-check-btn.fm2d-ctrl-active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}
.fm2d-check-btn.fm2d-ctrl-active .fm2d-check-icon {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.5);
  color: #ffffff;
}
.fm2d-check-btn.fm2d-ctrl-active .fm2d-check-icon::before { content: '✓'; }

/* All ctrl-btns in the buttons row get blue active (overrides green default) */
.fm2d-row-buttons .fm2d-ctrl-btn.fm2d-ctrl-active,
.fm2d-row-buttons .fm2d-btn-group .fm2d-ctrl-btn.fm2d-ctrl-active {
  border-color: #1d4ed8;
  color: #1e40af;
  background: rgba(37,99,235,.10);
}

/* ─── SMILES bar ──────────────────────────────────────────────────────────────── */
/* Flip / Edit action buttons: bigger icon, no text-transform */
.fm2d-sa-btn {
  font-size: 1rem !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 0 7px !important;
  line-height: 1 !important;
}

/* smiles-text max-width */
.fm2d-smiles-text { max-width: 320px; }

/* Notation: saturation label gets a right border to separate it from the formula */
.fm2d-n-sat {
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid #d0d5e8;
}

/* row-rotated override removed — handled by absolute positioning above */

/* ─── EIB (element info box) action buttons — below body text ────────────────── */
.fm2d-eib-actions {
  padding: 6px 12px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.fm2d-eib-actions .fm2d-ctrl-btn {
  border-color: #1d4ed8;
  color: #1e40af;
  background: rgba(37,99,235,.07);
}
.fm2d-eib-actions .fm2d-ctrl-btn:hover {
  background: rgba(37,99,235,.15);
}

/* ─── Lightbox ──────────────────────────────────────────────────────────────── */
.fm2d-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99998;
  align-items: center;
  justify-content: center;
}
.fm2d-lightbox.fm2d-open { display: flex; }
.fm2d-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 40, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.fm2d-lightbox-dialog {
  position: relative;
  z-index: 99999;
  background: #ffffff;
  border: 1px solid #e2e6f0;
  border-radius: 10px;
  box-shadow: 0 16px 56px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.10);
  width: 90vw;
  height: 85vh;
  max-width: 96vw;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.fm2d-window-btns {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 5px;
  flex-shrink: 0;
  border-bottom: 1px solid #e8ecf4;
  background: #f8f9fc;
  border-radius: 10px 10px 0 0;
}
.fm2d-window-btns .fm2d-btn-icon {
  position: static;
  background: transparent;
  border: 1px solid #dde2ee;
  border-radius: 5px;
  color: #9da3b8;
  font-size: .85rem;
  line-height: 1;
  padding: 3px 7px;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.fm2d-window-btns .fm2d-btn-icon:hover {
  color: #2a2e42;
  background: #e2e6f0;
  border-color: #b0b8ce;
}
.fm2d-lightbox-fullscreen {
  max-width: 100vw !important;
  max-height: 100vh !important;
  width: 100vw; height: 100vh;
  border-radius: 0 !important;
}
.fm2d-lightbox-content {
  overflow: auto;
  flex: 1;
}
.fm2d-lightbox-wrap { min-width: 480px; min-height: 340px; }
.fm2d-lightbox-content .fm2d-canvas-area { min-height: 60vh; }
