/* Palette/fonts: see /css/site-theme.css */


* { box-sizing: border-box; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* body chrome from site-theme */


.shell {
  width: min(1280px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 0.75rem 0 2.5rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.85rem 1.1rem;
  margin-left: auto;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.landing { position: relative; }

.hero-plane {
  position: absolute;
  inset: -1.25rem -4vw auto;
  height: min(58vh, 380px);
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(30, 77, 123, 0.22), transparent 58%),
    repeating-linear-gradient(
      -16deg,
      transparent,
      transparent 18px,
      rgba(22, 32, 42, 0.035) 18px,
      rgba(22, 32, 42, 0.035) 19px
    );
  mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
}

.hero {
  position: relative;
  z-index: 1;
  padding: 2rem 0 1.5rem;
  max-width: 36rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.hero h1 {
  margin: 0 0 0.65rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--accent);
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-ghost:hover { background: rgba(30, 77, 123, 0.08); filter: none; }

.block {
  position: relative;
  z-index: 1;
  margin-top: 1.75rem;
  padding: 1.25rem 1.35rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.block h2 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
}

.section-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: 40rem;
}

.sample-list {
  display: grid;
  gap: 0.65rem;
}

.sample-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.sample-card strong {
  display: block;
  font-size: 1.05rem;
}

.sample-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.dropzone {
  padding: 1.5rem 1.25rem;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--accent);
  background: rgba(30, 77, 123, 0.05);
}

.drop-title {
  margin: 0;
  font-weight: 600;
}

.drop-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.status.is-error { color: var(--bad); }
.status.is-ok { color: var(--ok); }

.footnote {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Workspace */
.workspace {
  margin-top: 0.25rem;
  min-width: 0;
}

.workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.company-label {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.company-sub {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  min-width: 0;
}

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

.quiz-panel,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 0.8rem;
  min-width: 0;
}

.quiz-panel { position: sticky; top: 0.5rem; }

.table-panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.quiz-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.level-chip {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.level-chip.easy {
  border-color: #9cc4ae;
  color: var(--ok);
  background: rgba(31, 107, 74, 0.08);
}

.level-chip.medium {
  border-color: #d2c08a;
  color: #8a6a2f;
  background: rgba(138, 106, 47, 0.08);
}

.level-chip.hard {
  border-color: #d2a090;
  color: var(--bad);
  background: rgba(139, 58, 47, 0.08);
}

.points-chip {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 600;
}

.score-chip {
  display: inline-block;
  margin-left: auto;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--navy, var(--accent));
  background: rgba(18, 50, 77, 0.06);
  color: var(--navy-deep, var(--ink));
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 700;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.85rem 0 0.25rem;
}

.score-grid div {
  padding: 0.55rem 0.4rem;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.score-grid b {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--accent);
}

.score-grid span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.quiz-prompt {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}

.quiz-hint {
  margin: -0.2rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.quiz-formula {
  margin: -0.25rem 0 0.65rem;
  font-size: 0.82rem;
}

.quiz-formula code {
  display: block;
  padding: 0.45rem 0.55rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.calc-form {
  margin: 0.35rem 0 0;
}

.calc-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.calc-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}

.calc-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
}

.calc-input:focus {
  outline: none;
  border-color: var(--accent);
}

.quiz-choices {
  display: grid;
  gap: 0.35rem;
}

.choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.choice:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(30, 77, 123, 0.05);
}

.choice.is-correct {
  border-color: var(--ok);
  background: rgba(31, 107, 74, 0.12);
}

.choice.is-wrong {
  border-color: var(--bad);
  background: rgba(139, 58, 47, 0.1);
}

.choice:disabled { cursor: default; }

.quiz-feedback {
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

.quiz-feedback.ok {
  background: rgba(31, 107, 74, 0.12);
  border: 1px solid rgba(31, 107, 74, 0.35);
}

.quiz-feedback.bad {
  background: rgba(139, 58, 47, 0.1);
  border: 1px solid rgba(139, 58, 47, 0.35);
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.quiz-done .quiz-score {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
}

.quiz-review {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-panel h2 {
  margin: 0 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.table-note {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.table-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.25rem;
}

/* Keep DataTables scroll region inside the panel, not the page */
.table-wrap .dt-container,
.table-wrap .dt-scroll,
.table-wrap .dt-scroll-body,
.table-wrap .dt-scroll-head {
  max-width: 100%;
}

.table-wrap .dt-scroll-body {
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: 0.75rem;
  box-sizing: border-box;
}

.table-wrap .dt-scroll-head {
  overflow: hidden !important;
}

#stmt-table {
  width: max-content !important;
  max-width: none;
  font-size: 0.72rem;
}

#stmt-table th,
#stmt-table td {
  white-space: nowrap;
  padding: 0.28rem 0.4rem !important;
}

#stmt-table th {
  font-size: 0.68rem;
}

#stmt-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

#stmt-table tbody tr:hover {
  background: rgba(30, 77, 123, 0.06);
}

#stmt-table tbody tr.row-hl {
  background: var(--hl) !important;
}

#stmt-table tbody tr.row-hl-correct {
  background: rgba(31, 107, 74, 0.18) !important;
}

#stmt-table tbody tr.row-hl-wrong {
  background: rgba(139, 58, 47, 0.14) !important;
}

#stmt-table td.cell-hl {
  background: var(--hl-strong) !important;
  outline: 2px solid var(--accent-hot);
  outline-offset: -2px;
  font-weight: 600;
}

#stmt-table td.cell-copy {
  cursor: copy;
}

#stmt-table td.cell-copy:hover {
  outline-color: var(--accent);
}

#stmt-table td.cell-dim {
  opacity: 0.45;
}

.hint-unmasked {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ok);
}

.desk-calc {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.desk-calc-title {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.desk-calc-display {
  width: 100%;
  margin-bottom: 0.45rem;
  padding: 0.55rem 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 1.05rem;
  text-align: right;
  background: var(--panel);
}

.desk-calc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.desk-calc-tool {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.desk-calc-pad {
  display: grid;
  gap: 0.3rem;
}

.desk-calc-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
}

.desk-calc-row:first-child {
  grid-template-columns: repeat(3, 1fr);
}

.desk-calc-key {
  padding: 0.55rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.desk-calc-key:hover {
  border-color: var(--accent);
  background: rgba(30, 77, 123, 0.06);
}

.desk-calc-key.is-op {
  color: var(--accent);
}

.desk-calc-key.is-eq {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 40;
  padding: 0.55rem 0.9rem;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.copy-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hint-actions {
  margin: 0 0 0.75rem;
}

.hint-penalty {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--bad);
}

.quiz-formula.is-hint {
  margin-top: 0.55rem;
}

.quiz-formula.is-hint code {
  border-color: #d2c08a;
  background: rgba(255, 224, 138, 0.35);
}

.dt-container .dt-search { margin-bottom: 0.5rem; }
.dt-container .dt-length { margin-bottom: 0.5rem; }

.mode-click .table-panel {
  box-shadow: 0 0 0 2px rgba(196, 90, 40, 0.35);
}

@keyframes pulse-hl {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50% { box-shadow: inset 0 0 0 2px rgba(196, 90, 40, 0.5); }
}

.row-hl {
  animation: pulse-hl 1.4s ease-in-out 2;
}

/* Explore mode */
.explore-idle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.explore-period {
  margin: -0.15rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.explore-period-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.85rem;
  margin: -0.15rem 0 0.65rem;
}

.explore-period-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.explore-period-select {
  min-width: 9.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.25;
}

.explore-period-row > .explore-value {
  display: inline-flex;
  align-items: center;
  min-height: calc(0.86rem * 1.25 + 0.7rem + 2px);
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
}

.explore-value {
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, monospace);
  font-weight: 500;
  color: var(--ink);
}

.explore-def {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.explore-alias {
  margin: -0.45rem 0 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.explore-calc {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.explore-calc-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.formula-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.formula-steps li {
  margin: 0 0 0.35rem;
}

.formula-steps li:last-child {
  margin-bottom: 0;
}

.formula-steps .formula-code {
  display: block;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.formula-steps li:first-child .formula-code {
  border-color: #d2c08a;
  background: rgba(255, 224, 138, 0.35);
}

.formula-steps li:last-child .formula-code {
  border-color: rgba(31, 107, 74, 0.35);
  background: rgba(31, 107, 74, 0.08);
  font-weight: 600;
}

.explore-no-calc {
  margin: 0.35rem 0 0;
  padding: 0.65rem 0 0.15rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  position: relative;
  background: var(--panel);
}

#stmt-table tbody tr.row-hl-result {
  background: rgba(31, 107, 74, 0.12) !important;
}

#stmt-table tbody tr.row-hl-tour {
  background: rgba(196, 90, 40, 0.16) !important;
  animation: pulse-hl 1.2s ease-in-out infinite;
}

#stmt-table td.cell-result {
  background: rgba(31, 107, 74, 0.22) !important;
  outline: 2px solid var(--ok);
  outline-offset: -2px;
  font-weight: 600;
}

#stmt-table td.cell-tour {
  background: var(--hl-strong) !important;
  outline: 2px solid var(--accent-hot);
  outline-offset: -2px;
  font-weight: 700;
}

#stmt-table tbody tr.row-hl-picked {
  background: rgba(30, 77, 123, 0.14) !important;
}

#stmt-table td.cell-period-a {
  background: rgba(30, 77, 123, 0.2) !important;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  font-weight: 600;
}

#stmt-table td.cell-period-b {
  background: rgba(196, 90, 40, 0.14) !important;
  outline: 1px dashed var(--accent-hot);
  outline-offset: -1px;
}

#stmt-table td.cell-hidden {
  background: rgba(18, 50, 77, 0.12) !important;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.driver-picked {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.2rem;
  font-size: 0.86rem;
}

.driver-picked li {
  margin: 0.2rem 0;
}

/* Glossary workspace */
.shell-glossary {
  width: min(1440px, calc(100% - 1rem));
}

.glossary-workspace {
  margin-top: 0.25rem;
}

.glossary-layout {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: stretch;
}

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

.glossary-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 0.8rem;
  min-width: 0;
  max-height: calc(100vh - 6.5rem);
  overflow: auto;
  position: sticky;
  top: 0.5rem;
}

@media (max-width: 960px) {
  .glossary-panel {
    position: static;
    max-height: min(42vh, 360px);
  }
}

.glossary-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.35rem;
}

.glossary-panel-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}

.glossary-panel-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
}

.glossary-sort {
  min-width: 9.5rem;
  padding: 0.45rem 0.65rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
}

.glossary-sort:focus {
  outline: none;
  border-color: var(--accent);
}

.glossary-panel-lead {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.glossary-filter-label,
.glossary-sample-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.glossary-filter,
.glossary-sample {
  min-width: min(14rem, 100%);
  padding: 0.45rem 0.65rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
}

.glossary-filter:focus,
.glossary-sample:focus {
  outline: none;
  border-color: var(--accent);
}

.glossary-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: flex-end;
}

.glossary-upload {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.glossary-upload-btn {
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
}

.glossary-upload-btn.is-drag {
  border-color: var(--accent);
  background: rgba(30, 77, 123, 0.08);
}

.glossary-upload-status {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

.glossary-right {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  max-height: calc(100vh - 6.5rem);
}

/* Compact explain strip — keep the statement tall */
.glossary-right .quiz-panel {
  position: static;
  top: auto;
  z-index: auto;
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  padding: 0.55rem 0.7rem;
}

.glossary-right .table-panel {
  position: relative;
  z-index: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.glossary-right .table-panel h2 {
  margin-bottom: 0.15rem;
}

.glossary-right .table-note {
  margin-bottom: 0.4rem;
}

.explain-bar {
  min-width: 0;
}

.explain-bar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.85rem;
  margin: 0 0 0.3rem;
}

.explain-bar-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
}

.explain-bar-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.explain-bar-period {
  display: inline-flex;
  align-items: center;
}

.explain-bar-period .explore-period-select {
  min-width: 8.5rem;
}

.explain-bar-period-text {
  color: var(--muted);
  font-size: 0.84rem;
}

.explain-bar-def {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.explain-bar-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  min-width: 0;
}

.explain-bar-formula-line {
  flex: 1 1 12rem;
  min-width: 0;
  display: block;
  padding: 0.35rem 0.5rem;
  border: 1px solid #d2c08a;
  border-radius: 4px;
  background: rgba(255, 224, 138, 0.35);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.explain-steps-toggle {
  flex: 0 0 auto;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}

.explain-bar-steps {
  margin-top: 0.4rem;
}

.explain-bar-no-calc {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.glossary-right .explore-idle {
  margin: 0;
  font-size: 0.86rem;
}

.glossary-list-panel {
  display: grid;
  gap: 1rem;
}

.glossary-group-title {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.glossary-row-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.7rem;
  margin: 0 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.glossary-row-btn:hover {
  border-color: var(--accent);
  background: rgba(30, 77, 123, 0.05);
}

.glossary-row-btn.is-active {
  border-color: var(--accent);
  background: rgba(30, 77, 123, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.glossary-term {
  display: block;
  min-width: 0;
}

.glossary-term strong {
  display: block;
  font-size: 0.98rem;
  color: var(--ink);
}

.glossary-def {
  display: block;
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}
