/* MSE-only layout: shared typography, palette, and controls load afterward. */
h1 {
  margin: 24px 0;
  color: var(--accent-secondary);
  text-decoration: underline;
  text-decoration-color: var(--accent-primary);
  text-underline-offset: 6px;
}

h2 {
  margin: 0;
  color: var(--accent-secondary);
}

a {
  color: var(--accent-primary);
}

.back-link {
  display: inline-block;
}

/* Shared panel appearance used by questions, results, and documentation. */
.card {
  margin: 14px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.controls-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controls-card .button-row {
  margin-top: 0;
  margin-left: auto;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Keep teaching definitions visually secondary to the dimension name. */
.dimension-description {
  font-family: var(--body-font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted-text);
}

.inline-option {
  display: inline-flex;
  align-items: center;
  margin: 8px 18px 0 0;
  font-size: 17px;
}

.compact-inline {
  margin-top: 0;
}

.output-style-row {
  margin-bottom: 12px;
}

.small-label,
.info-label,
.observation-box label,
.orientation-label {
  color: var(--accent-secondary);
  font-weight: 700;
}

.small-label {
  margin-right: 12px;
}

/* Lay out adjacent answer buttons and allow them to wrap. */
.segmented-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.button-row {
  margin-top: 14px;
}

.tiny-button {
  padding: 7px 11px;
  color: var(--accent-secondary);
  font-size: 13px;
}

/* Lay out the separate orientation domains in the MSE. */
.orientation-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.orientation-row {
  display: grid;
  grid-template-columns: 90px auto auto 1fr;
  align-items: center;
  gap: 8px;
}

/* Optional observation fields start hidden; the open class reveals them. */
.observation-box {
  display: none;
  margin-top: 16px;
}

.observation-box.open {
  display: block;
}

.observation-box label {
  display: block;
  margin-bottom: 6px;
}

/* Size and style the note and free-text fields. */
textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 16px;
  resize: vertical;
}

.observation-text {
  min-height: 80px;
}

/* Expandable MSE teaching/reference panels. */
.more-info {
  margin-top: 12px;
}

.more-info summary {
  color: var(--accent-secondary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.info-content {
  margin-top: 10px;
  padding: 9px 12px;
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-small);
  background: var(--surface-2);
}

/* Definitions and nuanced teaching notes share one readable text treatment. */
.option-explanations,
.question-block {
  margin: 0;
}
.question-block {
  margin-top: 8px;
}
.option-explanations p,
.question-list li {
  font-size: 14px;
}
.option-explanations strong {
  color: var(--accent-primary);
}
.info-label {
  display: inline-block;
  margin-bottom: 2px;
}
/* Native markers align wrapped notes and follow the theme's yellow/gold accent. */
.question-list {
  margin: 4px 0 0;
  padding-inline-start: 1.25em;
  list-style: disc outside;
}
.question-list li::marker {
  color: var(--accent-secondary);
}
#copyStatus {
  margin-left: 8px;
  color: var(--accent-secondary);
  font-weight: 400;
}

/* Compact mode hides teaching content and makes the form denser. */
.compact-mode .more-info,
.compact-mode .learning-only {
  display: none;
}

.compact-mode .page-shell {
  max-width: 1200px;
  margin-top: 20px;
}

.compact-mode #mse-fields {
  display: block;
}

/* Compact mode still keeps category headings above their own field grid. */
.compact-mode .mse-category-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 10px;
}

.compact-mode .card {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-small);
}

.compact-mode .controls-card,
.compact-mode .output-card {
  margin: 10px 0;
}

.compact-mode .segmented-options {
  gap: 6px;
  margin-top: 8px;
}

.compact-mode .tiny-button,
.compact-mode .observation-box {
  display: none !important;
}

.compact-mode .orientation-row {
  grid-template-columns: 70px auto auto;
}

.compact-mode textarea {
  min-height: 120px;
  font-size: 14px;
}

/* Smaller-screen adjustments: reduce columns and spacing to fit the available width. */
@media (max-width: 700px) {
  .card {
    padding: 18px;
  }

  .orientation-row {
    grid-template-columns: 72px auto auto;
  }
}

/* Multi-select sections use squarer tag-style buttons as a visual cue. */
.multi-select-options .segment-button {
  border-radius: 8px;
}

.multi-select-options .segment-button.selected::before {
  content: "✓ ";
}

/* The same categories organize the form and the copied list output. */
.mse-category {
  margin: 32px 0;
}
.mse-category-title {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--accent-primary);
  color: var(--accent-secondary);
}

/* Learn uses one quiet category panel with full-width dimension rows.
   Dividers separate findings without enclosing every dimension in its own box. */
body:not(.compact-mode) .mse-category {
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}
body:not(.compact-mode) .mse-category-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
body:not(.compact-mode) .mse-category-fields > .card {
  min-width: 0;
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body:not(.compact-mode) .mse-category-fields > .card + .card {
  border-top: 1px solid var(--border);
}
body:not(.compact-mode) .mse-category-fields > .card:last-child {
  padding-bottom: 0;
}
body:not(.compact-mode) .mse-category-title {
  margin-bottom: 0;
  padding-bottom: 14px;
  border-bottom-color: var(--border);
}
body:not(.compact-mode) .section-header h3 {
  color: var(--text);
}
body:not(.compact-mode) .dimension-description {
  font-size: 13px;
}
body:not(.compact-mode) .tiny-button {
  margin: 0;
  color: var(--muted-text);
  font-weight: 400;
  white-space: nowrap;
}
body:not(.compact-mode) .more-info > summary,
body:not(.compact-mode) .context-panel > summary {
  color: var(--muted-text);
  font-size: 14px;
  font-weight: 400;
  padding: 5px 0;
}
body:not(.compact-mode) .more-info > summary:hover,
body:not(.compact-mode) .context-panel > summary:hover {
  color: var(--text);
}
body:not(.compact-mode) .more-info .info-content {
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
@media (max-width: 700px) {
  body:not(.compact-mode) .mse-category {
    padding: 16px;
  }
}
/* Teaching text uses comfortable line spacing even within the tighter form. */
.more-info .option-explanations p,
.more-info .question-list li {
  line-height: 1.5;
  margin: 6px 0;
}
.more-info .info-content {
  max-width: none;
}

/* Diagram and label occupy separate columns so long names cannot overlap. */
.descriptor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}
.descriptor-card {
  min-width: 0;
}
.descriptor-heading {
  margin: 0;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--body-font);
  font-size: 15px;
  font-weight: 600;
}
/* Color only the vocabulary label; SVG shapes and lettering keep the text color. */
.descriptor-heading > span {
  color: var(--accent-primary);
}
.descriptor-diagram {
  width: 100px;
  height: 48px;
  color: var(--text);
}
.descriptor-body {
  padding: 0 14px 14px;
}

.descriptor-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 700px) {
  .descriptor-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .descriptor-heading {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 8px;
  }
  .descriptor-diagram {
    width: 80px;
  }
}
.section-header h3 {
  margin: 0;
  color: var(--accent-secondary);
}

/* Optional context remains available in every mode, including Compact. */
.context-panel {
  margin-top: 14px;
}
.context-panel summary {
  color: var(--accent-primary);
  cursor: pointer;
  font-weight: 600;
}
.context-fields {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.context-fields label {
  font-weight: 600;
}
.context-choices {
  min-width: 0;
  margin: 0;
  padding: 8px 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.context-choices legend {
  font-weight: 600;
  color: var(--accent-secondary);
}
.context-choices label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 400;
}
.context-choices input {
  accent-color: var(--accent-primary);
}
.context-choices:disabled {
  opacity: 0.55;
}
.context-note,
.compact-mode .context-note {
  min-height: 96px;
}
.context-select:focus-visible,
.context-source:focus-visible,
.context-panel summary:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 3px;
}
.context-source:disabled {
  opacity: 0.55;
}
.context-observations {
  min-width: 0;
  margin: 8px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.context-observations legend {
  padding: 0 6px;
  color: var(--accent-secondary);
}
.context-observations label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
  font-weight: 400;
}
.context-observations input {
  accent-color: var(--accent-primary);
}
@media (max-width: 700px) {
  .section-header {
    flex-wrap: wrap;
  }
}

/* Other descriptions stay available in both modes and only show when selected. */
.other-entry {
  margin-top: 12px;
}
.other-text {
  min-height: 112px;
}
