:root {
  --color-bg: #f1f5f4;
  --color-surface: #ffffff;
  --color-surface-soft: #f8faf9;
  --color-ink: #172523;
  --color-muted: #60716e;
  --color-subtle: #8a9996;
  --color-border: #d8e2df;
  --color-border-strong: #bccbc7;
  --color-primary: #0f766e;
  --color-primary-dark: #115e59;
  --color-primary-soft: #dff7f3;
  --color-code: #10201e;
  --color-code-text: #dceae7;
  --color-warning: #a15c0b;
  --color-math: #0f766e;
  --color-math-soft: #dff7f3;
  --color-math-non-template: #b45309;
  --color-math-non-template-soft: #fff2dd;
  --color-english: #7250a6;
  --color-english-soft: #f1eafe;
  --color-total: #2e607a;
  --shadow-sm: 0 1px 2px rgb(24 39 36 / 0.05);
  --shadow-md: 0 14px 36px rgb(24 39 36 / 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --header-height: 0px;
  font-family:
    Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--color-ink);
  background: var(--color-bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--color-bg);
}

body {
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:not(:disabled),
input[type="search"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid rgb(15 118 110 / 0.35);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--color-primary-dark);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

[hidden] {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: var(--header-height);
  padding: 12px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--color-border);
  background: rgb(255 255 255 / 0.96);
  box-shadow: var(--shadow-sm);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  margin-right: 12px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--color-primary);
}

.brand-mark svg,
.search-box svg,
.back-button svg,
.panel-action svg,
.empty-state svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.brand-copy p {
  margin: 0;
}

.brand-copy h1 {
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-copy p {
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 12px;
}

.version-badge {
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid #a7ddd6;
  border-radius: 999px;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.app-main {
  flex: 1;
  min-height: 0;
}

.dashboard-view {
  min-height: calc(100dvh - var(--header-height));
  overflow: visible;
}

.dashboard-content {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 3vw, 40px) 56px;
}

.overview-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(420px, 0.9fr);
  gap: 32px;
  align-items: end;
  overflow: hidden;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid #173f44;
  border-radius: var(--radius-lg);
  color: #f7fffd;
  background:
    radial-gradient(circle at 92% 10%, rgb(94 234 212 / 0.25), transparent 31%),
    radial-gradient(circle at 18% 120%, rgb(96 165 250 / 0.2), transparent 43%),
    linear-gradient(128deg, #102a2a 0%, #123a42 57%, #1e4263 100%);
  box-shadow: 0 22px 60px rgb(19 49 56 / 0.2);
}

.overview-card::after {
  position: absolute;
  top: -48px;
  right: -48px;
  width: 180px;
  height: 180px;
  border: 1px solid rgb(220 255 249 / 0.22);
  border-radius: 50%;
  content: "";
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.overview-card .eyebrow {
  color: #79e8d8;
}

.overview-card h2 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.overview-description {
  margin: 14px 0 0;
  color: #c6dcd9;
}

.overview-provenance {
  margin: 12px 0 0;
  color: #95b9b5;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.summary-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border: 1px solid rgb(220 255 249 / 0.18);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.1);
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.12);
  backdrop-filter: blur(14px);
}

.summary-strip div {
  min-width: 0;
  padding: 18px;
}

.summary-strip div + div {
  border-left: 1px solid rgb(220 255 249 / 0.16);
}

.summary-strip dt {
  color: #b4d2cf;
  font-size: 12px;
  font-weight: 600;
}

.summary-strip dd {
  margin: 4px 0 0;
  font-size: clamp(21px, 2vw, 28px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.source-section,
.distribution-section,
.filter-section {
  margin-top: 40px;
}

.section-heading,
.list-toolbar {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.section-heading h2,
.list-toolbar h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.section-heading > p {
  margin: 0 0 2px;
  color: var(--color-muted);
  font-size: 13px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.source-card,
.source-card-skeleton {
  min-height: 274px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.source-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  padding: 20px;
  color: var(--color-ink);
  text-align: left;
  box-shadow: 0 10px 22px rgb(24 39 36 / 0.06);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.source-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgb(24 39 36 / 0.12);
}

.source-card[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: #f0fcf9;
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.source-card[data-source="aidt-math-template"][aria-pressed="true"] {
  border-color: var(--color-math);
  background: #eefcf9;
  box-shadow: inset 0 0 0 1px var(--color-math);
}

.source-card[data-source="aidt-math-non-template"][aria-pressed="true"] {
  border-color: var(--color-math-non-template);
  background: #fff8ed;
  box-shadow: inset 0 0 0 1px var(--color-math-non-template);
}

.source-card[data-source="aidt-english-template"][aria-pressed="true"] {
  border-color: var(--color-english);
  background: #faf7ff;
  box-shadow: inset 0 0 0 1px var(--color-english);
}

.source-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: var(--color-total);
  content: "";
}

.source-card[data-source="aidt-math-template"]::before {
  background: var(--color-math);
}

.source-card[data-source="aidt-math-non-template"]::before {
  background: var(--color-math-non-template);
}

.source-card[data-source="aidt-english-template"]::before {
  background: var(--color-english);
}

.source-card[data-source="aidt-math-template"] {
  background: linear-gradient(145deg, #fff 0%, var(--color-math-soft) 180%);
}

.source-card[data-source="aidt-math-non-template"] {
  background: linear-gradient(145deg, #fff 0%, var(--color-math-non-template-soft) 180%);
}

.source-card[data-source="aidt-english-template"] {
  background: linear-gradient(145deg, #fff 0%, var(--color-english-soft) 180%);
}

.source-card-heading {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.source-label {
  font-size: 15px;
  font-weight: 750;
}

.source-caption {
  overflow: hidden;
  max-width: 58%;
  color: var(--color-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-total {
  display: block;
  margin-top: 9px;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.source-total small {
  margin-left: 4px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.conversion-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.conversion-metric {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 9px;
  background: rgb(255 255 255 / 0.68);
}

.conversion-metric small {
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 700;
}

.conversion-metric strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.conversion-metric.source-xml strong {
  color: var(--color-primary-dark);
}

.conversion-metric.source-quarantine strong {
  color: var(--color-warning);
}

.conversion-progress {
  display: block;
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7eeec;
}

.conversion-progress-converted {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), #31b7a9);
}

.source-card[data-source="aidt-english-template"] .conversion-progress-converted {
  background: linear-gradient(90deg, var(--color-english), #9c72d5);
}

.source-card[data-source="aidt-math-non-template"] .conversion-progress-converted {
  background: linear-gradient(90deg, var(--color-math-non-template), #e89739);
}

.source-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.interaction-chart-card {
  margin-top: 16px;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.chart-legend-item {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-legend-item::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-total);
  content: "";
}

.chart-legend-item[data-source="aidt-math-template"]::before {
  background: var(--color-math);
}

.chart-legend-item[data-source="aidt-math-non-template"]::before {
  background: var(--color-math-non-template);
}

.chart-legend-item[data-source="aidt-english-template"]::before {
  background: var(--color-english);
}

.interaction-chart {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.interaction-chart-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.85fr) minmax(160px, 2.4fr) 62px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--color-ink);
  background: transparent;
  text-align: left;
}

.interaction-chart-row:hover {
  border-color: #b9ddd7;
  background: #f3fbf9;
}

.interaction-chart-label {
  display: grid;
  min-width: 0;
}

.interaction-chart-label strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interaction-chart-label small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--color-subtle);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interaction-chart-track {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf2f1;
}

.interaction-chart-segment {
  height: 100%;
  background: var(--color-total);
  transition: filter 160ms ease;
}

.interaction-chart-segment:hover {
  filter: brightness(0.85);
}

.interaction-chart-segment[data-source="aidt-math-template"] {
  background: var(--color-math);
}

.interaction-chart-segment[data-source="aidt-math-non-template"] {
  background: var(--color-math-non-template);
}

.interaction-chart-segment[data-source="aidt-english-template"] {
  background: var(--color-english);
}

.interaction-chart-value {
  color: var(--color-ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.source-breakdown > span {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: 11px;
}

.source-breakdown > span > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-breakdown strong {
  flex: 0 0 auto;
  color: var(--color-ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.type-card,
.type-card-skeleton {
  min-height: 118px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 17px;
  color: var(--color-ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.type-card:hover {
  border-color: #8ccbc2;
  box-shadow: 0 8px 24px rgb(24 39 36 / 0.08);
}

.type-card[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: #f0fcf9;
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.type-card[aria-pressed="true"]::before {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  content: "";
}

.type-label {
  padding-right: 16px;
  font-size: 15px;
  font-weight: 750;
}

.type-qti-name {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--color-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-count {
  margin-top: auto;
  padding-top: 16px;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.type-count small {
  margin-left: 3px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
}

.type-card-skeleton,
.item-row-skeleton,
.source-card-skeleton {
  background: linear-gradient(90deg, #edf2f1 25%, #f8faf9 50%, #edf2f1 75%);
  background-size: 200% 100%;
  animation: shimmer 1.35s infinite;
}

.list-card {
  margin-top: 40px;
  overflow: visible;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.list-toolbar {
  position: sticky;
  z-index: 15;
  top: 0;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: rgb(255 255 255 / 0.96);
  box-shadow: 0 8px 20px rgb(24 39 36 / 0.06);
  backdrop-filter: blur(14px);
}

.result-count {
  margin: 5px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

.list-controls {
  display: flex;
  min-width: min(760px, 66vw);
  gap: 10px;
  align-items: end;
  justify-content: flex-end;
}

.filter-select,
.search-box {
  display: flex;
  min-height: 46px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: 11px;
  background: var(--color-surface-soft);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.filter-select {
  width: min(220px, 19vw);
  gap: 10px;
}

.filter-select > span {
  flex: 0 0 auto;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 750;
}

.filter-select select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 0;
  outline: 0;
  color: var(--color-ink);
  background: transparent;
  cursor: pointer;
  font-weight: 650;
  text-overflow: ellipsis;
}

.search-box {
  width: min(340px, 29vw);
}

.filter-select:focus-within,
.search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.12);
}

.search-box svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-right: 10px;
  color: var(--color-muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--color-ink);
  background: transparent;
  cursor: text;
}

.search-box input::placeholder {
  color: #7b8b88;
}

.item-list {
  min-height: 240px;
}

.item-row,
.item-row-skeleton {
  min-height: 84px;
  border-bottom: 1px solid var(--color-border);
}

.item-row {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(220px, 1.25fr) minmax(220px, 0.95fr) 28px;
  gap: 24px;
  align-items: center;
  padding: 14px 24px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-ink);
  background: transparent;
  text-align: left;
  transition: background-color 160ms ease;
}

.item-row:hover {
  background: #f3faf8;
}

.item-row:last-child {
  border-bottom: 0;
}

.item-primary,
.item-meta {
  min-width: 0;
}

.item-title {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-id {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--color-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.interaction-badge,
.detail-type-badge,
.source-badge,
.detail-source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #b9ddd7;
  border-radius: 999px;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  font-size: 11px;
  font-weight: 700;
}

.source-badge,
.detail-source-badge {
  border-color: #c7d3ed;
  color: #3d4b79;
  background: #edf1fb;
}

.source-badge[data-source="aidt-math-template"],
.detail-source-badge[data-source="aidt-math-template"] {
  border-color: #b9ddd7;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
}

.source-badge[data-source="aidt-math-non-template"],
.detail-source-badge[data-source="aidt-math-non-template"] {
  border-color: #f1c889;
  color: #8c4304;
  background: var(--color-math-non-template-soft);
}

.source-badge[data-source="aidt-english-template"],
.detail-source-badge[data-source="aidt-english-template"] {
  border-color: #d8c9ef;
  color: #62458c;
  background: #f4effc;
}

.row-arrow {
  color: var(--color-primary);
  font-size: 26px;
  line-height: 1;
  text-align: right;
}

.empty-state {
  padding: 72px 24px;
  color: var(--color-muted);
  text-align: center;
}

.empty-state svg {
  width: 44px;
  height: 44px;
  color: var(--color-primary);
}

.empty-state h3 {
  margin: 14px 0 4px;
  color: var(--color-ink);
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.infinite-loader {
  position: relative;
  display: flex;
  min-height: 70px;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}

.back-button,
.panel-action,
.detail-navigation-button {
  min-height: 44px;
  border: 1px solid var(--color-border-strong);
  border-radius: 10px;
  color: var(--color-ink);
  background: var(--color-surface);
  font-weight: 650;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.back-button:hover,
.panel-action:hover,
.detail-navigation-button:hover:not(:disabled) {
  border-color: #7ebdb5;
  background: #eff9f7;
}

.detail-navigation-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.loading-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid #b9d5d0;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.infinite-loader.loading .loading-spinner {
  display: block;
}

.scroll-sentinel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  pointer-events: none;
}

.detail-view {
  display: flex;
  height: calc(100dvh - var(--header-height));
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #eaf0ee;
}

.detail-toolbar {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 82px;
  padding: 12px clamp(14px, 2vw, 28px);
  border-bottom: 1px solid var(--color-border-strong);
  background: var(--color-surface);
}

.back-button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 0 13px 0 9px;
}

.back-button svg {
  width: 21px;
  height: 21px;
}

.detail-heading {
  min-width: 0;
}

.detail-heading h2,
.detail-heading p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-heading h2 {
  font-size: 16px;
  letter-spacing: -0.015em;
}

.detail-heading p {
  margin-top: 4px;
  color: var(--color-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
}

.detail-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.detail-actions {
  display: flex;
  min-width: 0;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
}

.detail-navigation {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: center;
}

.detail-navigation-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.detail-position {
  min-width: 58px;
  color: var(--color-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.split-view {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}

.split-view.xml-panel-collapsed {
  grid-template-columns: 58px minmax(0, 1fr);
}

.panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--color-surface);
}

.source-panel {
  border-right: 1px solid var(--color-border-strong);
  overflow: hidden;
}

.panel-header {
  display: flex;
  flex: 0 0 auto;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-soft);
}

.panel-header > div {
  display: flex;
  gap: 9px;
  align-items: center;
}

.source-panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 14px;
}

.panel-index {
  color: var(--color-primary);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.panel-action {
  display: inline-flex;
  min-height: 40px;
  gap: 6px;
  align-items: center;
  padding: 0 11px;
  font-size: 12px;
}

.panel-action svg {
  width: 17px;
  height: 17px;
}

.xml-panel-toggle {
  padding-right: 9px;
  padding-left: 9px;
}

.xml-panel-toggle svg {
  transition: transform 180ms ease;
}

.split-view.xml-panel-collapsed .source-panel .panel-header {
  justify-content: center;
  padding-right: 8px;
  padding-left: 8px;
}

.split-view.xml-panel-collapsed .source-panel .panel-header > div:first-child,
.split-view.xml-panel-collapsed #copy-xml,
.split-view.xml-panel-collapsed .xml-panel-toggle span {
  display: none;
}

.split-view.xml-panel-collapsed .source-panel-actions {
  display: block;
}

.split-view.xml-panel-collapsed .xml-panel-toggle {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.split-view.xml-panel-collapsed .xml-panel-toggle svg {
  transform: rotate(180deg);
}

.split-view.xml-panel-collapsed .source-panel .panel-scroll {
  visibility: hidden;
}

.preview-badge {
  padding: 5px 9px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  background: var(--color-surface);
  font-size: 10px;
  font-weight: 700;
}

.render-panel {
  overflow: hidden;
}

.comparison-stack {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(260px, 1fr) minmax(260px, 1fr);
  overflow: hidden;
}

.comparison-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
  background: var(--color-surface);
}

.comparison-pane + .comparison-pane {
  border-top: 1px solid var(--color-border-strong);
}

.comparison-pane-header {
  display: flex;
  flex: 0 0 auto;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-soft);
}

.comparison-pane-header > div {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: baseline;
}

.original-zoom-controls {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  align-items: center;
  padding: 2px;
  border: 1px solid #d8cbe8;
  border-radius: 7px;
  background: #fff;
}

.original-zoom-controls button {
  min-width: 29px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  color: #65428e;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.original-zoom-controls button:hover:not(:disabled) {
  background: #f1eafe;
}

.original-zoom-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.original-zoom-controls #original-zoom-reset {
  min-width: 46px;
  border-right: 1px solid #e2d8ed;
  border-left: 1px solid #e2d8ed;
  border-radius: 0;
  font-size: 10px;
}

.qti-zoom-controls {
  border-color: #b9d7d1;
}

.qti-zoom-controls button {
  color: var(--color-primary-dark);
}

.qti-zoom-controls button:hover:not(:disabled) {
  background: var(--color-primary-soft);
}

.qti-zoom-controls #qti-zoom-reset {
  min-width: 46px;
  border-right: 1px solid #c9e1dc;
  border-left: 1px solid #c9e1dc;
  border-radius: 0;
  font-size: 10px;
}

.comparison-pane-header h4,
.comparison-kicker {
  margin: 0;
}

.comparison-pane-header h4 {
  font-size: 13px;
}

.comparison-kicker {
  color: var(--color-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.comparison-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #b9d7d1;
  border-radius: 999px;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  font-size: 10px;
  font-weight: 800;
}

.source-comparison-badge {
  border-color: #d9c8ef;
  color: #65428e;
  background: var(--color-english-soft);
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #91a5a1 transparent;
  scrollbar-width: thin;
}

.xml-scroll {
  background: var(--color-code);
}

.xml-code {
  min-width: max-content;
  margin: 0;
  padding: 17px 0 40px;
  color: var(--color-code-text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
  tab-size: 2;
}

.xml-line {
  display: grid;
  grid-template-columns: 58px auto;
  min-height: 20px;
  padding-right: 24px;
}

.xml-line::before {
  padding-right: 14px;
  color: #637a76;
  content: attr(data-line);
  font-variant-numeric: tabular-nums;
  text-align: right;
  user-select: none;
}

.xml-line:hover {
  background: rgb(255 255 255 / 0.045);
}

.preview-scroll {
  background:
    linear-gradient(rgb(24 39 36 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(24 39 36 / 0.035) 1px, transparent 1px), #eef2f1;
  background-size: 24px 24px;
}

.question-canvas {
  --qti-zoom: 1;
  width: min(760px, calc(100% - 48px));
  min-height: calc(100% - 48px);
  margin: 24px auto;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid #d7e0de;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 18px 48px rgb(24 39 36 / 0.1);
}

.comparison-pane .question-canvas {
  min-height: 0;
}

.original-preview-scroll {
  background:
    linear-gradient(rgb(114 80 166 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(114 80 166 / 0.035) 1px, transparent 1px), #f7f4fa;
  background-size: 24px 24px;
}

.original-canvas {
  --original-zoom: 1;
  width: min(760px, calc(100% - 48px));
  min-height: calc(100% - 48px);
  margin: 24px auto;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid #ded6ea;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 14px 38px rgb(84 55 123 / 0.1);
}

.original-canvas.original-canvas-external {
  display: flex;
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.original-sheet {
  color: #231b2c;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  zoom: var(--original-zoom);
}

.original-sheet > :first-child {
  margin-top: 0;
}

.original-section-label {
  margin: 0 0 12px;
  color: #65428e;
  font-size: 11px;
  font-weight: 800;
}

.original-component {
  margin-top: 14px;
  border: 1px solid #e1d8eb;
  border-radius: 11px;
  overflow: hidden;
  background: #fdfcff;
}

.original-component-label {
  color: #65428e;
  background: #f7f1fc;
  border-bottom: 1px solid #e1d8eb;
}

.original-component-body {
  padding: 14px 16px;
}

.original-component-body > :first-child {
  margin-top: 0;
}

.original-choice-option {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid #e3d9ee;
  border-radius: 8px;
  cursor: pointer;
}

.original-choice-option + .original-choice-option {
  margin-top: 10px;
}

.original-choice-option input {
  flex: 0 0 auto;
  margin-top: 0.45em;
  accent-color: #7250a6;
}

.original-choice-option .original-source-element {
  min-width: 0;
}

.original-source-element img {
  display: block;
  max-width: 100%;
  margin: 8px auto;
  border-radius: 7px;
}

.original-source-table {
  margin: 4px 0;
  border-collapse: collapse;
}

.original-source-table-title {
  margin: 0 0 10px;
  font-weight: 600;
}

.original-source-table th,
.original-source-table td {
  padding: 8px 10px;
  border: 1px solid #c8bdd7;
  text-align: center;
}

.original-source-table th {
  background: #f3edfa;
}

.original-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 7px 0;
}

.original-input-row input {
  width: 118px;
  height: 34px;
  border: 1px solid #aa96bf;
  border-radius: 6px;
  background: #fff;
}

.original-transcript {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid #e1d8eb;
  border-radius: 9px;
  background: #faf7fd;
  font-size: 14px;
}

.original-transcript summary {
  color: #65428e;
  font-weight: 800;
  cursor: pointer;
}

.original-transcript p {
  margin: 10px 0 0;
}

.original-unavailable p {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
}

.original-html-frame {
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  zoom: var(--original-zoom);
}

.original-unavailable {
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed #cdbede;
  border-radius: 10px;
  text-align: center;
}

.question-sheet {
  color: #17201f;
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  zoom: var(--qti-zoom);
}

.question-sheet > :first-child {
  margin-top: 0;
}

.question-sheet p {
  margin: 0 0 18px;
}

.question-sheet .qti-underline {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-decoration-skip-ink: none;
  text-underline-offset: 0.14em;
}

/* 두 패널에 **같이** 건다 — 한쪽에만 걸면 원천이 가운데라고 말한 문항이
   원본 패널에서만 왼쪽으로 보여, 검수자가 「변환기가 없던 정렬을 넣었다」로 읽는다. */
.question-sheet .qti-align-left,
.original-canvas .qti-align-left {
  text-align: left;
}

.question-sheet .qti-align-center,
.original-canvas .qti-align-center {
  text-align: center;
}

.question-sheet .qti-align-right,
.original-canvas .qti-align-right {
  text-align: right;
}

.question-sheet img {
  display: block;
  max-width: 100%;
  margin: 16px auto;
  border-radius: 8px;
}

/* 공유 어휘 §2.1 Display CSS · §2.3 Margin CSS — 원천이 그 그림에 대해 **직접
   말한** 표현 지시다. 뷰어 기본값(위 `img` 규칙 · 아래 `p > img`)보다 특이도가
   높아야 실제로 이긴다 — class 만 붙이고 CSS 를 안 걸면 「실었는데 화면은 그대로」가
   되어 큐 69-b① 과 같은 오판이 난다. 공식 예시는 `!important` 를 쓰지만 그 문서가
   "not intended to be strictly used as provided" 라 밝히므로 특이도로 해결한다.
   두 패널에 같이 건다 (`docs/builder/viewer.md` 「정렬은 두 패널에 같이」). */
.question-sheet .qti-display-block,
.original-canvas .qti-display-block {
  display: block;
}

.question-sheet .qti-display-inline-block,
.original-canvas .qti-display-inline-block {
  display: inline-block;
}

.question-sheet .qti-margin-x-auto,
.original-canvas .qti-margin-x-auto {
  margin-left: auto;
  margin-right: auto;
}

.question-sheet .qti-margin-y-0,
.original-canvas .qti-margin-y-0 {
  margin-top: 0;
  margin-bottom: 0;
}

/* Template prompts can interleave card images with text and punctuation inside
 * one paragraph. Preserve that authored inline flow; a paragraph containing
 * only an image still uses the standalone centered treatment above. */
.question-sheet p > img {
  display: inline-block;
  margin: 0 0.2em;
  vertical-align: middle;
}

.question-sheet p > img:only-child {
  display: block;
  margin: 16px auto;
}

.qti-item-body {
  margin: 0 0 20px;
  border: 1px solid #b9d7d1;
  border-radius: 12px;
  overflow: hidden;
  background: #fcfefd;
}

.question-sheet .qti-component-label,
.original-component-label {
  margin: 0;
  padding: 7px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.question-sheet .qti-component-label {
  color: #176e65;
  background: #edf8f5;
  border-bottom: 1px solid #c9e1dc;
}

.qti-item-body-content {
  padding: 16px;
}

.qti-item-body-content > :first-child {
  margin-top: 0;
}

.question-sheet table {
  width: 100%;
  margin: 18px 0;
  border-collapse: collapse;
  font-size: 0.94em;
}

.question-sheet th,
.question-sheet td {
  padding: 9px 11px;
  border: 1px solid #b9c8c5;
  text-align: center;
}

.question-sheet th {
  background: #eff6f4;
  font-weight: 700;
}

.question-sheet math {
  max-width: 100%;
  font-size: 1.08em;
}

.qti-audio {
  display: block;
  width: min(100%, 540px);
  min-width: 230px;
  height: 42px;
  margin: 16px 0;
  accent-color: var(--color-primary);
}

.pci-module-unavailable {
  margin: 12px 0 0;
  color: #a15c0b;
  font-size: 14px;
}

/* QTI's calculation-grid PCI provides cells and inputs, while the player
 * supplies the conventional rule above the first answer row. */
.custom-interaction [data-layout-type="vertical-arithmetic"] > .qti-calculation-answer-row {
  border-top: 2px solid var(--color-ink);
  margin-top: 5px;
  padding-top: 5px;
}

.choice-interaction {
  display: grid;
  grid-template-columns: repeat(var(--qti-choice-columns, 1), minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.choice-interaction legend,
.order-interaction legend,
.qti-prompt {
  grid-column: 1 / -1;
  margin-bottom: 12px;
  font-weight: 700;
}

.choice-option {
  display: flex;
  min-height: 52px;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid #cad6d3;
  border-radius: 11px;
  background: #fbfdfc;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.choice-option .qti-audio {
  width: min(100%, 480px);
  margin: 2px 0;
}

.choice-option:hover {
  border-color: #72b8af;
  background: #f0faf8;
}

.choice-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.choice-option input {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  accent-color: var(--color-primary);
}

.order-interaction-wrapper,
.match-answer-overlay {
  margin: 24px 0 0;
}

.interaction-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
  margin: 0 0 14px;
}

.interaction-control {
  padding: 6px 11px;
  border: 1px solid #819590;
  border-radius: 7px;
  color: var(--color-ink);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.interaction-control:hover,
.interaction-control:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.14);
}

.order-interaction {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.order-choice-list {
  display: grid;
  grid-template-columns: repeat(var(--qti-choice-columns, 1), minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-choice-tile {
  display: flex;
  min-width: 0;
  min-height: 52px;
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #8ba7a1;
  border-radius: 11px;
  background: #fbfdfc;
  box-shadow: 0 2px 5px rgb(28 74 68 / 0.08);
  cursor: grab;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.order-choice-tile:focus-visible {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.18);
}

.order-choice-tile.is-dragging {
  opacity: 0.48;
  cursor: grabbing;
}

.order-choice-tile.is-drop-target {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: inset 0 0 0 2px var(--color-primary);
}

.order-choice-handle {
  flex: 0 0 auto;
  color: #78918c;
  font-size: 21px;
  line-height: 1;
}

.order-choice-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Four or more columns: compact tiles.  6 and 7 come from the converter's
   `data-choices-stacking` extension (queue 75), not from the official class. */
.order-interaction:is([data-choice-columns="4"], [data-choice-columns="5"], [data-choice-columns="6"], [data-choice-columns="7"]) .order-choice-tile {
  flex-direction: column;
  gap: 4px;
  padding: 7px 5px;
  text-align: center;
}

.order-interaction:is([data-choice-columns="4"], [data-choice-columns="5"], [data-choice-columns="6"], [data-choice-columns="7"]) .order-choice-handle {
  font-size: 17px;
}

.order-interaction:is([data-choice-columns="4"], [data-choice-columns="5"], [data-choice-columns="6"], [data-choice-columns="7"]) .order-choice-content {
  font-size: 13px;
}

.match-stage {
  position: relative;
  display: grid;
  color: var(--color-ink);
  font-size: 15px;
  line-height: 1.55;
  isolation: isolate;
}

.match-layout-left .match-stage {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 72px;
}

.match-layout-top .match-stage {
  grid-template-rows: repeat(2, auto);
  gap: 76px;
}

.match-set {
  position: relative;
  z-index: 3;
  display: flex;
  gap: 12px;
}

.match-layout-left .match-set {
  flex-direction: column;
}

.match-layout-top .match-set {
  display: grid;
  grid-template-columns: repeat(var(--qti-match-choice-count, 1), minmax(0, 1fr));
}

.match-choice {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  border: 1px solid #8ba7a1;
  border-radius: 10px;
  background: #fff;
}

.match-choice-content {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.match-choice-content > :first-child {
  margin-top: 0;
}

.match-choice-content > :last-child {
  margin-bottom: 0;
}

.match-choice img {
  max-height: 180px;
  object-fit: contain;
}

.match-dot {
  appearance: none;
  position: absolute;
  z-index: 4;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid #a42f4d;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 0.9);
  cursor: pointer;
}

.match-dot:hover,
.match-dot:focus-visible,
.match-dot.is-selected {
  outline: 0;
  background: #a42f4d;
  box-shadow:
    0 0 0 2px rgb(255 255 255 / 0.9),
    0 0 0 5px rgb(164 47 77 / 0.22);
}

.match-layout-left .match-set-first .match-dot {
  top: 50%;
  right: -7px;
  transform: translateY(-50%);
}

.match-layout-left .match-set-second .match-dot {
  top: 50%;
  left: -7px;
  transform: translateY(-50%);
}

.match-layout-top .match-set-first .match-dot {
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
}

.match-layout-top .match-set-second .match-dot {
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
}

.match-answer-lines {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.match-answer-line {
  stroke: #c23859;
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.match-answer-line-hit {
  stroke: transparent;
  stroke-width: 18;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
  cursor: pointer;
}

.inline-choice-select {
  display: inline-block;
  max-width: min(100%, 18rem);
  min-height: 36px;
  margin: 0 0.18em;
  padding: 5px 30px 5px 10px;
  border: 1px solid #819590;
  border-radius: 7px;
  color: var(--color-ink);
  background: #fff;
  vertical-align: middle;
  font: inherit;
  line-height: 1.3;
}

.inline-choice-select:focus {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.16);
}

.text-entry-input,
.structured-input,
.grid-input {
  border: 1px solid #819590;
  border-radius: 7px;
  color: var(--color-ink);
  background: #fff;
  text-align: center;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.text-entry-input {
  width: clamp(92px, 18vw, 160px);
  min-height: 42px;
  margin: 0 6px;
  padding: 7px 10px;
  vertical-align: middle;
}

.text-entry-input:focus,
.structured-input:focus,
.grid-input:focus {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.16);
}

.custom-interaction {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid #bfd7d2;
  border-radius: 13px;
  background: #f6fbfa;
}

.audio-recording-preview {
  max-width: 420px;
  padding: 18px;
  border: 1px solid #d8c9ef;
  border-radius: 11px;
  background: #fbf9ff;
}

.audio-recording-heading {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: space-between;
}

.audio-recording-heading strong {
  color: #4e3376;
  font-size: 14px;
}

.audio-recording-heading code {
  overflow: hidden;
  max-width: 180px;
  padding: 3px 6px;
  border-radius: 5px;
  color: #6c588a;
  background: #f0ebfa;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-recording-controls {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.record-button,
.stop-record-button {
  display: inline-flex;
  min-height: 40px;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #c6b3e4;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.record-button {
  color: #604083;
  background: #f4effc;
}

.stop-record-button {
  color: var(--color-muted);
  background: #fff;
}

.record-button:disabled,
.stop-record-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b9475f;
}

.audio-recording-note,
.scorer-rubric-notice {
  margin: 11px 0 0;
  color: #6e6380;
  font-size: 11px;
  line-height: 1.55;
}

.scorer-rubric-notice {
  padding: 10px 12px;
  border-left: 3px solid #b9add0;
  background: #f8f6fb;
}

.fraction-widgets {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: center;
}

.fraction-widget {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.fraction-stack {
  display: grid;
  gap: 5px;
  align-items: center;
}

.fraction-stack::after {
  grid-row: 2;
  border-top: 2px solid var(--color-ink);
  content: "";
}

.fraction-stack .structured-input:first-child {
  grid-row: 1;
}

.fraction-stack .structured-input:last-child {
  grid-row: 3;
}

.structured-input {
  width: 54px;
  min-height: 42px;
  padding: 5px;
}

.calculation-grid {
  display: grid;
  width: fit-content;
  min-width: 260px;
  gap: 5px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #d9e2df;
}

.calculation-cell {
  display: grid;
  min-width: 48px;
  min-height: 48px;
  place-items: center;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calculation-cell.answer-cell {
  border-top: 2px solid var(--color-ink);
  padding-top: 5px;
}

.grid-input {
  width: 44px;
  height: 42px;
  font-size: 19px;
  font-weight: 700;
}

.qti-overlay {
  position: relative;
  display: inline-block;
  max-width: none;
}

.qti-overlay > img {
  display: block;
  margin: 0;
  max-width: none;
}

.qti-overlay-layer {
  position: absolute;
  z-index: 1;
  width: max-content;
  max-width: none;
  line-height: 1.35;
}

.question-sheet .qti-overlay-layer {
  margin: 0;
}

.qti-overlay-layer > * {
  margin: 0;
}

.render-error,
.loading-card {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--color-muted);
  text-align: center;
}

.render-error strong {
  display: block;
  margin-bottom: 6px;
  color: #8b2b2b;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  background: #18312e;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1050px) {
  .overview-card {
    grid-template-columns: 1fr;
  }

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

  .list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .list-controls {
    width: 100%;
    min-width: 0;
  }

  .filter-select,
  .search-box {
    width: auto;
    flex: 1;
  }

  .detail-types {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 0px;
  }

  .brand-copy p,
  .version-badge {
    display: none;
  }

  .dashboard-content {
    padding-top: 20px;
  }

  .overview-card {
    gap: 24px;
    padding: 24px 20px;
  }

  .summary-strip div {
    padding: 14px 10px;
  }

  .summary-strip dt {
    font-size: 10px;
  }

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

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

  .interaction-chart-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
  }

  .interaction-chart-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .section-heading > p {
    display: none;
  }

  .list-toolbar {
    gap: 12px;
    align-items: center;
    padding: 14px;
  }

  .list-toolbar .eyebrow {
    display: none;
  }

  .list-toolbar h2 {
    font-size: 17px;
  }

  .result-count {
    margin-top: 2px;
    white-space: nowrap;
  }

  .list-controls {
    display: grid;
    min-width: 0;
    flex: 1;
    grid-template-columns: minmax(120px, 0.8fr) minmax(150px, 1.2fr);
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .filter-select,
  .search-box {
    width: 100%;
    flex: initial;
  }

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

  .item-row {
    grid-template-columns: minmax(0, 1fr) 24px;
    gap: 12px;
    padding: 15px 18px;
  }

  .item-meta {
    grid-column: 1;
    grid-row: 2;
  }

  .row-arrow {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .detail-toolbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .detail-types {
    display: none;
  }

  .detail-actions {
    width: 100%;
    grid-column: 1 / -1;
  }

  .detail-navigation {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .detail-navigation-button {
    justify-content: center;
  }

  .panel-header {
    padding-right: 10px;
    padding-left: 10px;
  }

  .panel-header h3 {
    font-size: 12px;
  }

  .panel-action {
    padding-right: 8px;
    padding-left: 8px;
  }

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

  .split-view.xml-panel-collapsed {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .split-view.xml-panel-collapsed .source-panel .panel-header {
    padding-right: 4px;
    padding-left: 4px;
  }

  .question-canvas {
    width: calc(100% - 16px);
    min-height: calc(100% - 16px);
    margin: 8px auto;
    padding: 20px 12px;
  }
}

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

  .type-card,
  .type-card-skeleton {
    min-height: 102px;
  }

  .list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .list-controls {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .search-box {
    grid-column: auto;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip div + div {
    border-top: 1px solid var(--color-border);
    border-left: 0;
  }

  .summary-strip div {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .summary-strip dd {
    margin: 0;
  }

  .preview-badge {
    display: none;
  }

  .panel-index {
    display: none;
  }
}

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