.app-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.app-tab {
  flex: 1;
  min-height: 48px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}

.app-tab:last-child {
  border-right: 0;
}

.app-tab:hover {
  background: var(--panel-tint);
  color: var(--text);
}

.app-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.app-tab:focus-visible,
.demo-button:focus-visible,
.demo-link-button:focus-visible,
.demo-tech-details summary:focus-visible {
  outline: 3px solid rgba(184, 104, 46, 0.45);
  outline-offset: -3px;
}

.app-view[hidden],
.demo-panel [hidden] {
  display: none !important;
}

.demo-panel {
  display: grid;
  gap: 14px;
}

.demo-intro {
  padding: 28px 30px;
  background:
    linear-gradient(105deg, rgba(245, 239, 227, 0.98), rgba(255, 253, 248, 0.98));
}

.demo-intro h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(25px, 3vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.demo-intro > p:last-child {
  max-width: 72ch;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
  word-break: keep-all;
}

.demo-method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  align-items: start;
  gap: 14px;
}

.sample-preview {
  min-width: 0;
  padding: 26px;
}

.sample-preview__head,
.sample-material-stage__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.sample-preview__head h3 {
  margin: 0;
  font-size: clamp(21px, 2.3vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.sample-preview__head p {
  max-width: 56ch;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
  word-break: keep-all;
}

.sample-preview__meta {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.sample-material-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.sample-material-tab {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.sample-material-tab:hover {
  background: var(--panel-tint);
  color: var(--text);
}

.sample-material-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.sample-material-tab:focus-visible,
.sample-page-tab:focus-visible,
.sample-material-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sample-material-stage {
  padding-top: 22px;
  outline: none;
}

.sample-material-stage__head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sample-slide-panel__number,
.sample-slide-panel__count {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.sample-material-stage__head h4 {
  margin: 6px 0 0;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.sample-slide-panel__count {
  flex: 0 0 auto;
  padding-top: 2px;
}

.sample-pptx-stage {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  background: #2f302d;
}

.sample-pptx-stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
}

.sample-image-bundle-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel-tint);
}

.sample-bundle-photo {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--panel);
}

.sample-bundle-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.sample-bundle-photo figcaption {
  padding: 7px 9px;
  color: var(--muted);
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
}

.sample-page-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sample-page-tab {
  flex: 0 0 112px;
  min-height: 64px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

.sample-page-tab:hover {
  background: var(--panel-tint);
}

.sample-page-tab.is-active {
  border-color: var(--primary);
  background: var(--panel-tint);
}

.demo-method {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 26px;
}

.demo-method--primary {
  border-color: var(--primary);
  background:
    linear-gradient(140deg, rgba(24, 77, 58, 0.98), rgba(15, 50, 37, 0.98));
  color: #fff;
}

.demo-method__number,
.demo-section-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.demo-method--primary .demo-method__number {
  color: #f2bd92;
}

.demo-method h3,
.demo-progress h3,
.demo-result h3 {
  margin: 0;
  font-size: clamp(21px, 2.3vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.demo-method > p {
  max-width: 60ch;
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.7;
  word-break: keep-all;
}

.demo-method--primary > p {
  color: #dce9e2;
}

.demo-file-facts,
.demo-input-data {
  display: grid;
  gap: 0;
  margin: 0 0 22px;
  border-top: 1px solid var(--border);
}

.demo-file-facts > div,
.demo-input-data > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.demo-file-facts dt,
.demo-input-data dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.demo-file-facts dd,
.demo-input-data dd {
  margin: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.demo-button,
.demo-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  background: var(--panel);
  color: var(--primary);
  font-weight: 850;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-button:hover,
.demo-link-button:hover {
  transform: translateY(-2px);
}

.demo-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.demo-button--secondary {
  border-color: var(--border-strong);
  color: var(--text);
}

.demo-button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.demo-method--primary > .demo-button--primary {
  width: 100%;
  margin-top: auto;
  border-color: #fff;
  background: #fff;
  color: var(--primary-strong);
}

.demo-link-button {
  border-color: transparent;
  background: transparent;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.demo-proof {
  display: grid;
  gap: 0;
  margin-bottom: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.demo-proof span {
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  color: #eef6f1;
  font-size: 13px;
  font-weight: 750;
}

.demo-proof span::before {
  content: "✓";
  display: inline-block;
  margin-right: 9px;
  color: #f2bd92;
}

.demo-progress,
.demo-result {
  padding: 28px;
}

.demo-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.demo-section-head .demo-section-kicker {
  margin-bottom: 8px;
}

#demoProgressCount,
#demoResultSource {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.demo-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  list-style: none;
}

.demo-step {
  min-height: 86px;
  padding: 15px;
  border-right: 1px solid var(--border);
  background: #fff;
}

.demo-step:last-child {
  border-right: 0;
}

.demo-step span,
.demo-step strong {
  display: block;
}

.demo-step span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.demo-step strong {
  font-size: 13px;
  line-height: 1.35;
}

.demo-step.is-active {
  background: var(--panel-tint);
  color: var(--primary-strong);
}

.demo-step.is-active span {
  color: var(--accent);
}

.demo-step.is-complete {
  background: var(--primary);
  color: #fff;
}

.demo-step.is-complete span {
  color: #dce9e2;
}

.demo-process-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 28px;
  margin-top: 24px;
}

.demo-process-log {
  min-height: 190px;
  padding: 20px;
  background: var(--code-bg);
  color: var(--code-text);
}

.demo-process-log > p {
  margin: 0 0 16px;
  color: #fff;
  font-weight: 800;
  line-height: 1.5;
}

.demo-process-log ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-process-log li {
  color: #ddd5c9;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.demo-process-log li::before {
  content: "→";
  margin-right: 8px;
  color: #f2bd92;
}

.demo-input-data {
  margin-bottom: 0;
}

.demo-error,
.demo-warning {
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: #7f2928;
}

.demo-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.demo-error p {
  margin: 5px 0 0;
  line-height: 1.55;
}

.demo-warning {
  margin: 0 0 22px;
  padding: 13px 15px;
  line-height: 1.55;
}

.demo-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 26px;
  border: 1px solid var(--border);
}

.demo-metrics > div {
  padding: 18px;
  border-right: 1px solid var(--border);
  background: #fff;
}

.demo-metrics > div:last-child {
  border-right: 0;
}

.demo-metrics strong,
.demo-metrics span {
  display: block;
}

.demo-metrics strong {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.demo-metrics span {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.demo-result-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.72fr) minmax(0, 1.28fr);
  gap: 28px;
}

.demo-result-grid h4 {
  margin: 0 0 14px;
  font-size: 17px;
}

#demoMappingList {
  border-top: 1px solid var(--border);
}

.demo-mapping-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.demo-mapping-row strong,
.demo-mapping-row span {
  display: block;
}

.demo-mapping-row strong {
  margin-bottom: 5px;
  font-size: 13px;
}

.demo-mapping-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.demo-mapping-row > span {
  align-self: center;
  color: var(--primary);
  font-weight: 850;
  white-space: nowrap;
}

.demo-tech-details {
  margin-top: 18px;
  border: 1px solid var(--border);
}

.demo-tech-details summary {
  padding: 13px 14px;
  font-weight: 850;
  cursor: pointer;
}

.demo-tech-details ul {
  margin: 0;
  padding: 0 32px 16px;
  color: var(--muted);
  line-height: 1.65;
}

.demo-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.demo-output-panel {
  border: 1px solid var(--border);
  background: #fff;
}

#demoPreview {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 0;
  background: #fdfbf7;
}

#demoCodePanel {
  max-height: 720px;
  overflow: auto;
  background: var(--code-bg);
}

#demoCodePanel pre {
  margin: 0;
  padding: 20px;
  color: var(--code-text);
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 980px) {
  .demo-method-grid,
  .demo-result-grid {
    grid-template-columns: 1fr;
  }

  .demo-method {
    min-height: 0;
  }

  .demo-process-grid {
    grid-template-columns: 1fr;
  }

  .demo-steps {
    grid-template-columns: 1fr;
  }

  .demo-step {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .demo-step:last-child {
    border-bottom: 0;
  }

  #demoPreview {
    min-height: 600px;
  }
}

@media (max-width: 760px) {
  .app-tabs {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .app-tab {
    min-height: 44px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .demo-intro,
  .sample-preview,
  .demo-method,
  .demo-progress,
  .demo-result {
    padding: 20px 16px;
  }

  .sample-preview__head,
  .sample-material-stage__head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .sample-preview__meta {
    padding-top: 0;
  }

  .sample-material-tabs {
    margin-top: 18px;
  }

  .sample-material-tab,
  .sample-page-tab {
    min-height: 44px;
  }

  .sample-image-bundle-stage {
    grid-template-columns: 1fr;
  }

  .demo-section-head,
  .demo-error {
    align-items: stretch;
    flex-direction: column;
  }

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

  .demo-metrics > div:nth-child(2) {
    border-right: 0;
  }

  .demo-metrics > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .demo-actions,
  .demo-result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .demo-button,
  .demo-link-button {
    width: 100%;
  }

  #demoPreview {
    min-height: 480px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tab,
  .sample-material-tab,
  .sample-page-tab,
  .demo-button,
  .demo-link-button {
    transition: none;
  }
}
