:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --ink: #132033;
  --muted: #61708a;
  --line: #d9e2f0;
  --line-strong: #b5c4d8;
  --primary: #1e40af;
  --primary-soft: #e8eefc;
  --secondary: #0f766e;
  --secondary-soft: #e4f5f3;
  --accent: #b45309;
  --accent-soft: #fff2d8;
  --danger: #b42335;
  --shadow: 0 22px 70px rgba(29, 52, 88, 0.12);
  --radius: 8px;
  font-family: Inter, "Fira Sans", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(30, 64, 175, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 64, 175, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbff 0%, #f3f8fb 46%, #fff9ed 100%);
  background-size: 34px 34px, 34px 34px, 100% 100%;
  color: var(--ink);
}

button,
textarea,
input {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(30, 64, 175, 0.24);
  outline-offset: 2px;
}

.lab-app {
  width: min(1540px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 34px) 28px;
}

.lab-topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(181, 196, 216, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  padding: 10px 12px;
  box-shadow: 0 14px 42px rgba(29, 52, 88, 0.08);
}

.brand-link {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(30, 64, 175, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(226, 239, 252, 0.86)),
    var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 10px 26px rgba(30, 64, 175, 0.12);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-link strong,
.brand-link small {
  display: block;
}

.brand-link strong {
  color: #0f1b2d;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 820;
}

.brand-link small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.top-actions a,
.export-actions button,
.sample-row button,
.dock-tabs button,
.draft-actions button,
.work-card button,
.quiz-meta button,
.quiz-options button,
.quiz-medal-actions button {
  min-height: 42px;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #26364e;
  padding: 0 13px;
  font-weight: 760;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.top-actions a:hover,
.export-actions button:hover,
.sample-row button:hover,
.dock-tabs button:hover,
.draft-actions button:hover,
.work-card button:hover,
.quiz-meta button:hover,
.quiz-options button:hover,
.quiz-medal-actions button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.top-actions a:active,
.export-actions button:active,
.sample-row button:active,
.dock-tabs button:active,
.draft-actions button:active,
.work-card button:active,
.generate-button:active,
.quiz-meta button:active,
.quiz-options button:active,
.quiz-medal-actions button:active {
  transform: translateY(1px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.control-panel,
.draft-panel,
.result-panel,
.works-panel {
  min-width: 0;
  border: 1px solid rgba(181, 196, 216, 0.8);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.panel-heading p,
.result-toolbar p {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 860;
  text-transform: uppercase;
}

.panel-heading h1,
.result-toolbar h2 {
  margin: 0;
  color: #0f1b2d;
  line-height: 1.08;
}

.panel-heading h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.result-toolbar h2 {
  font-size: clamp(20px, 2vw, 28px);
}

.visual-form {
  display: grid;
  gap: 15px;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-block span,
.choice-group legend {
  color: #25344c;
  font-size: 13px;
  font-weight: 820;
}

.field-block textarea {
  width: 100%;
  min-height: 114px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--ink);
  padding: 12px;
  line-height: 1.5;
}

.choice-group {
  min-width: 0;
  display: grid;
  gap: 8px;
  margin: 0;
  border: 0;
  padding: 0;
}

.segmented-grid,
.segmented-row {
  display: grid;
  gap: 8px;
}

.segmented-grid {
  grid-template-columns: 1fr;
}

.segmented-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.output-type-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-grid label,
.segmented-row label {
  min-width: 0;
  cursor: pointer;
}

.segmented-grid input,
.segmented-row input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-grid span,
.segmented-row span {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #26364e;
  padding: 10px 12px;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.segmented-row span {
  min-height: 46px;
  align-items: center;
  text-align: center;
  font-weight: 820;
}

.segmented-grid b {
  font-size: 14px;
}

.segmented-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.segmented-grid input:checked + span,
.segmented-row input:checked + span {
  border-color: rgba(30, 64, 175, 0.5);
  background: var(--primary-soft);
  color: #15337f;
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.12);
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sample-row button {
  min-height: 38px;
  padding: 0 10px;
  color: #4b5565;
  font-size: 13px;
  font-weight: 740;
}

.generate-button {
  min-height: 50px;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #19378f;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  padding: 0 18px;
  font-weight: 860;
  box-shadow: 0 16px 32px rgba(30, 64, 175, 0.22);
  transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
}

.generate-button:hover {
  filter: brightness(1.04);
}

.generate-button[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
}

.generate-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-panel {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.status-dot.is-busy {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.14);
}

.status-dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 53, 0.12);
}

.status-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

.result-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.draft-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.result-panel,
.works-panel {
  grid-column: 2;
}

.draft-toolbar,
.works-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.draft-toolbar p,
.works-heading p {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 860;
  text-transform: uppercase;
}

.draft-toolbar h2,
.works-heading h2 {
  margin: 0;
  color: #0f1b2d;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.12;
}

#draftEventCount,
#worksCount {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #26364e;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
}

.draft-editor-wrap textarea,
.revision-box textarea {
  min-height: 0;
}

.draft-editor-wrap #draftEditor {
  min-height: 250px;
  font-size: 14px;
}

.draft-summary {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 12px;
}

.draft-summary > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.draft-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.draft-facts section {
  min-width: 0;
  border: 1px solid #e6edf6;
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.draft-facts h3 {
  margin: 0 0 7px;
  color: #14213a;
  font-size: 14px;
}

.draft-facts p,
.draft-facts li {
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.draft-facts p {
  margin: 0;
}

.draft-facts ol,
.draft-facts ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.draft-facts li span {
  display: block;
  color: var(--muted);
}

.revision-box {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.draft-actions button {
  min-height: 42px;
}

.draft-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#buildChartButton {
  border-color: #19378f;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
}

.works-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.works-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.works-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 16px;
  color: var(--muted);
}

.works-empty strong,
.works-empty span {
  display: block;
}

.works-empty strong {
  margin-bottom: 4px;
  color: #132033;
}

.work-card button {
  width: 100%;
  min-height: 104px;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  text-align: left;
}

.work-card strong {
  width: 100%;
  color: #14213a;
  font-size: 14px;
  line-height: 1.25;
}

.work-card span,
.work-card small {
  color: var(--muted);
  line-height: 1.35;
}

.result-toolbar {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.artifact-tabs {
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 8px;
}

.artifact-tabs:empty {
  display: none;
}

.artifact-tabs button {
  min-width: 150px;
  min-height: 48px;
  flex: 0 0 auto;
  appearance: none;
  display: grid;
  gap: 2px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #26364e;
  padding: 8px 12px;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.artifact-tabs button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.artifact-tabs button:active {
  transform: translateY(1px);
}

.artifact-tabs button.is-active {
  border-color: rgba(30, 64, 175, 0.5);
  background: var(--primary-soft);
  color: #15337f;
}

.artifact-tabs strong,
.artifact-tabs span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-tabs strong {
  font-size: 13px;
  font-weight: 880;
}

.artifact-tabs span {
  color: var(--muted);
  font-size: 12px;
}

.export-actions button {
  min-height: 40px;
  padding: 0 12px;
}

.chart-frame {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    #fff;
  background-size: 24px 24px;
}

.chart-canvas {
  min-width: 920px;
  min-height: 560px;
  display: grid;
}

.chart-canvas svg {
  width: 100%;
  min-width: 920px;
  height: auto;
  display: block;
}

.data-dock {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.dock-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  padding: 8px;
}

.dock-tabs button {
  min-height: 38px;
  flex: 0 0 auto;
}

.dock-tabs button.is-active {
  border-color: rgba(30, 64, 175, 0.5);
  background: var(--primary-soft);
  color: #15337f;
}

.dock-content {
  min-height: 190px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e6edf6;
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #35445c;
  font-size: 12px;
  text-transform: uppercase;
}

.data-table td {
  color: #26364e;
  line-height: 1.42;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.map-data-grid {
  display: grid;
  gap: 14px;
}

.map-data-grid h3 {
  margin: 0 0 8px;
  color: #14213a;
  font-size: 15px;
}

.compact-table {
  min-width: 560px;
}

.analysis-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 12px;
}

.analysis-card h3 {
  margin: 0 0 8px;
  color: #14213a;
  font-size: 15px;
}

.analysis-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.45;
}

.json-view {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #10233f;
  font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.empty-state {
  min-height: 560px;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: #132033;
  font-size: 22px;
}

.quiz-mode-active {
  overflow: hidden;
}

.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(30, 64, 175, 0.052) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 64, 175, 0.044) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbff 0%, #eef5fd 48%, #fff8ea 100%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  color: var(--ink);
}

.quiz-topbar,
.quiz-options-bar,
.quiz-medal-card {
  border: 1px solid rgba(181, 196, 216, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 54px rgba(29, 52, 88, 0.12);
}

.quiz-topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.quiz-title-block {
  min-width: 0;
}

.quiz-title-block p,
.quiz-options-bar p,
.quiz-medal-card p {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.quiz-title-block h2 {
  margin: 0;
  color: #0f1b2d;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
}

.quiz-meta span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #26364e;
  padding: 0 12px;
  font-weight: 820;
}

.quiz-board-wrap {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(181, 196, 216, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
  padding: 14px;
}

.quiz-board {
  min-width: 900px;
  min-height: 100%;
  display: grid;
}

.quiz-timeline-card {
  min-height: 100%;
  position: relative;
  border: 1px solid var(--quiz-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  padding: 34px 42px 40px;
}

.quiz-chart-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 18px;
  align-items: end;
}

.quiz-chart-head p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--quiz-primary);
  font-size: 13px;
  font-weight: 900;
}

.quiz-chart-head h3 {
  min-width: 0;
  margin: 0;
  color: #101b2f;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.04;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-chart-head span {
  color: #687894;
  font-size: 15px;
  font-weight: 760;
}

.quiz-timeline {
  position: relative;
  display: grid;
  gap: 18px;
  margin-top: 26px;
  padding: 8px 0 8px;
}

.quiz-timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  border-radius: 999px;
  background: var(--quiz-primary);
  transform: translateX(-50%);
}

.quiz-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
  align-items: center;
  min-height: 78px;
}

.quiz-date-node {
  grid-column: 2;
  justify-self: center;
  z-index: 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 5px solid #fff;
  border-radius: 50%;
  background: var(--quiz-accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(180, 83, 9, 0.25);
}

.quiz-date-node span {
  font-weight: 900;
  font-size: 15px;
  text-align: center;
  line-height: 1.05;
}

.quiz-answer-slot {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid #dbe5f2;
  border-radius: var(--radius);
  background: #fff;
  padding: 12px 16px;
  color: #111c30;
  box-shadow: 0 10px 24px rgba(29, 52, 88, 0.055);
}

.quiz-row.is-left .quiz-answer-slot {
  grid-column: 1;
  justify-self: end;
  width: min(420px, 100%);
}

.quiz-row.is-right .quiz-answer-slot {
  grid-column: 3;
  justify-self: start;
  width: min(420px, 100%);
}

.quiz-answer-slot strong {
  font-size: 17px;
  line-height: 1.18;
}

.quiz-answer-slot small {
  color: #687894;
  font-size: 13px;
}

.quiz-row.is-filled .quiz-answer-slot {
  border-color: rgba(15, 118, 110, 0.36);
  background: #f1fbf8;
}

.quiz-row.is-current .quiz-answer-slot {
  border-color: var(--quiz-primary);
  background: #fffaf1;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.12), 0 14px 28px rgba(29, 52, 88, 0.08);
}

.slot-line {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbe5f2, #edf3fb, #dbe5f2);
}

.quiz-options-bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.quiz-options-bar strong {
  display: block;
  color: #0f1b2d;
  font-size: 18px;
}

.quiz-options {
  min-width: 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quiz-options button {
  min-width: 220px;
  max-width: 280px;
  min-height: 68px;
  flex: 0 0 auto;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  text-align: left;
}

.quiz-options button strong {
  width: 100%;
  color: #162238;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-options button span {
  color: #65748d;
  font-size: 12px;
}

.quiz-options button[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
  background: #eef4f1;
}

.quiz-medal-modal {
  position: fixed;
  inset: 0;
  z-index: 1010;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.quiz-medal-card {
  width: min(440px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
}

.medal-mark {
  width: 92px;
  height: 106px;
  color: #b45309;
}

.medal-mark svg {
  width: 100%;
  height: 100%;
  fill: #fff4d6;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quiz-medal-card h3 {
  margin: 0;
  color: #101b2f;
  font-size: 30px;
  line-height: 1.1;
}

.quiz-medal-card span {
  color: #526176;
  line-height: 1.45;
}

.quiz-medal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 980px) {
  .lab-topbar,
  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .export-actions {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .draft-panel,
  .result-panel,
  .works-panel {
    grid-column: auto;
  }

  .control-panel {
    position: static;
  }

  .draft-toolbar,
  .works-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .draft-facts,
  .works-list {
    grid-template-columns: 1fr;
  }

  .chart-canvas {
    min-width: 760px;
    min-height: 520px;
  }

  .chart-canvas svg {
    min-width: 760px;
  }

  .quiz-topbar,
  .quiz-options-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .quiz-meta {
    justify-content: flex-start;
  }

  .quiz-board {
    min-width: 760px;
  }

  .quiz-chart-head h3 {
    white-space: normal;
  }
}

@media (max-width: 620px) {
  .lab-app {
    padding: 12px 10px 20px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand-link strong {
    font-size: 18px;
  }

  .top-actions a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .segmented-grid.compact,
  .segmented-row,
  .analysis-grid,
  .draft-facts,
  .works-list {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .draft-panel,
  .result-panel,
  .works-panel {
    padding: 12px;
  }

  .draft-editor-wrap #draftEditor {
    min-height: 220px;
  }

  .chart-canvas {
    min-width: 680px;
  }

  .chart-canvas svg {
    min-width: 680px;
  }

  .quiz-overlay {
    padding: 10px;
  }

  .quiz-board {
    min-width: 680px;
  }

  .quiz-timeline-card {
    padding: 24px 24px 30px;
  }

  .quiz-options-bar {
    grid-template-columns: 1fr;
  }

  .quiz-options button {
    min-width: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
