:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f6f8;
  color: #18202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.danger {
  color: #a61b1b;
  border-color: #e3aaaa;
}

.contact-sheet {
  display: block;
  width: 100%;
  max-width: 1120px;
  min-height: 120px;
  margin: 12px auto 18px;
  background: #eef1f4;
  border: 1px solid #dce3ea;
  border-radius: 6px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto 12px;
}

.brand h1,
.deck-head h2,
h2 {
  margin: 0;
}

.brand p,
#deckMeta {
  color: #5c6875;
  margin: 6px 0 0;
}

.deck-head {
  min-width: 240px;
  text-align: right;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.header-actions button {
  width: auto;
  padding: 7px 12px;
}

.runtime-meta {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto 12px;
}

.workflow-steps > span {
  border: 1px solid #dce3ea;
  border-radius: 6px;
  padding: 9px 8px;
  background: #f8fafc;
  color: #5c6875;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.workflow-steps > span.active {
  border-color: #1f6feb;
  background: #eef4ff;
  color: #174ea6;
  font-weight: 700;
}

.workflow-steps > span.done {
  border-color: #b7dfc1;
  background: #edf8f0;
  color: #1a7f37;
}

.request-status {
  max-width: 1120px;
  border: 1px solid #b7d7ff;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 auto 12px;
  background: #eef6ff;
  color: #174ea6;
  font-size: 13px;
}

.panel {
  max-width: 1120px;
  margin: 0 auto 14px;
  background: #ffffff;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.wizard-step[hidden],
[hidden] {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  font-size: 13px;
  color: #344253;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cdd7e1;
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
  color: #18202a;
}

textarea {
  min-height: 290px;
  resize: vertical;
}

details textarea {
  min-height: 150px;
}

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

.grid label:last-child {
  grid-column: span 2;
}

.model-control {
  display: grid;
  gap: 8px;
  align-content: start;
}

.model-control label {
  margin: 12px 0 0;
}

.text-button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #1f6feb;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

.text-button.success {
  color: #1a7f37;
}

.text-button.failed {
  color: #b42318;
}

.text-button.running {
  color: #174ea6;
}

.text-button:disabled {
  cursor: wait;
  opacity: 1;
}

.text-button:hover,
.text-button:focus-visible {
  text-decoration: underline;
}

.text-button:focus-visible {
  outline: 2px solid #9cc2ff;
  outline-offset: 3px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.primary-actions {
  max-width: 520px;
}

.inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

button,
.download {
  border: 1px solid #1f6feb;
  background: #1f6feb;
  color: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.secondary {
  border-color: #cdd7e1;
  background: #f8fafc;
  color: #344253;
}

button:disabled,
.download.disabled {
  background: #e5ebf2;
  border-color: #d2dbe6;
  color: #7a8796;
  cursor: not-allowed;
  pointer-events: none;
}

.log summary {
  cursor: pointer;
  color: #18202a;
  font-weight: 600;
}

.config-dialog {
  width: min(700px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: #18202a;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24), 0 4px 12px rgba(15, 23, 42, 0.12);
}

.config-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.config-dialog form {
  display: grid;
  min-width: 0;
}

.config-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px 12px;
  border-bottom: 1px solid #e3e8ef;
  background: #fbfcfe;
}

.config-dialog h2 {
  font-size: 20px;
}

.config-dialog-header p {
  margin: 4px 0 0;
  max-width: 520px;
}

.config-dialog-body {
  padding: 8px 24px 12px;
}

.api-key-field {
  margin: 8px 0;
}

.api-key-help {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.field-label-row > label {
  margin: 0;
}

.visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #5c6875;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.visibility-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 34px;
  border: 1px solid #bdc8d4;
  border-radius: 999px;
  background: #dfe5eb;
  transition: background 150ms ease, border-color 150ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24);
  transition: transform 150ms ease;
}

.visibility-toggle input:checked + .toggle-track {
  border-color: #1f6feb;
  background: #1f6feb;
}

.visibility-toggle input:checked + .toggle-track::after {
  transform: translateX(14px);
}

.visibility-toggle input:focus-visible + .toggle-track {
  outline: 2px solid #8bb8ff;
  outline-offset: 2px;
}

.config-dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 24px 14px;
  border-top: 1px solid #e3e8ef;
  background: #fbfcfe;
}

.config-dialog-footer button {
  width: min(220px, 100%);
}

.dialog-close {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #6b7785;
  font-size: 17px;
  line-height: 1;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  border-color: #d8e0e8;
  background: #eef2f6;
  color: #18202a;
}

.dialog-close:focus-visible,
.field-clear:focus-visible {
  outline: 2px solid #8bb8ff;
  outline-offset: 2px;
}

.config-grid label:last-child {
  grid-column: auto;
}

.input-action {
  position: relative;
  display: block;
}

.input-action input {
  padding-right: 48px;
}

.field-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7a8796;
  font-size: 14px;
  line-height: 1;
}

.field-clear:hover,
.field-clear:focus-visible {
  background: #eef2f6;
  color: #b42318;
}

.config-status {
  min-height: 18px;
  margin: 12px 0 0;
}

.config-status.error {
  color: #b42318;
}

.api-key-help.error {
  color: #b42318;
}


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

.stream-column {
  border: 1px solid #dce3ea;
  border-radius: 6px;
  background: #fbfcfe;
  padding: 12px;
  min-height: 220px;
}

.stream-column h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.stream-column pre {
  min-height: 170px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  color: #344253;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 20px;
}

.section-head button,
.section-head .download {
  width: auto;
  min-width: 112px;
}

#outlineEditor {
  min-height: 520px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  line-height: 1.45;
}

.sample-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.sample-preview.has-style-reference {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sample-preview-panel {
  min-width: 0;
  margin: 0;
}

.sample-preview-panel figcaption {
  margin-bottom: 8px;
  color: #344253;
  font-size: 13px;
  font-weight: 600;
}

.sample-preview-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  background: #f8fafc;
}

.sample-preview-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sample-image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 18px;
  color: #7a8796;
  font-size: 13px;
  text-align: center;
}

.sample-generating-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  place-items: center;
  padding: 14px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.58);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sample-generating-overlay strong {
  font-size: 16px;
}

.sample-generating-overlay span {
  font-size: 13px;
  font-weight: 500;
}

.sample-generating-overlay[hidden] {
  display: none;
}

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

.progress {
  height: 12px;
  border-radius: 999px;
  background: #e7edf3;
  overflow: hidden;
  margin: 4px 0 16px;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: #2da44e;
  transition: width 180ms ease;
}

.slides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.slide {
  border: 1px solid #dce3ea;
  border-radius: 6px;
  padding: 10px;
  min-height: 92px;
  background: #fbfcfe;
}

.slide strong {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

.slide-image-wrap {
  position: relative;
  margin: 0 0 10px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  background: #f8fafc;
}

.slide-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slide-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 92px;
  color: #5c6875;
  font-size: 13px;
  background: #f8fafc;
}

.slide-edit-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.slide:hover .slide-edit-btn,
.slide:focus-within .slide-edit-btn {
  opacity: 1;
  transform: translateY(0);
}

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

.download-slide {
  display: grid;
  gap: 8px;
}

.download-slide-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  background: #f8fafc;
}

.download-slide-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.download-slide strong {
  font-size: 13px;
}

.slide-regenerate-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.download-slide:hover .slide-regenerate-btn,
.download-slide:focus-within .slide-regenerate-btn {
  opacity: 1;
  transform: translateY(0);
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #eef4ff;
  color: #174ea6;
}

.badge.blocked {
  background: #fff1f1;
  color: #b42318;
}

.badge.complete,
.badge.recorded,
.badge.accepted {
  background: #edf8f0;
  color: #1a7f37;
}

.slide-time-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  max-width: calc(100% - 16px);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(23, 78, 166, 0.9);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slide-time-badge.complete {
  background: rgba(26, 127, 55, 0.9);
}

.edit-dialog {
  width: min(920px, calc(100vw - 28px));
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 18px;
  color: #18202a;
}

.edit-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.confirm-dialog {
  width: min(440px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: #18202a;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24), 0 4px 12px rgba(15, 23, 42, 0.12);
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.project-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: #18202a;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24), 0 4px 12px rgba(15, 23, 42, 0.12);
}

.project-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.project-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #e3e8ef;
  background: #fbfcfe;
}

.project-dialog-header h2 {
  font-size: 20px;
}

.project-dialog-header p {
  margin: 6px 0 0;
  color: #5c6875;
  font-size: 12px;
}

.project-list {
  display: grid;
  gap: 10px;
  max-height: min(560px, calc(100vh - 210px));
  overflow: auto;
  padding: 16px 22px 22px;
}

.project-list-empty {
  margin: 24px 0;
  color: #7a8796;
  font-size: 14px;
  text-align: center;
}

.project-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  padding: 13px 14px;
  background: #fff;
}

.project-list-item.current {
  border-color: #8bb8ff;
  background: #f6f9ff;
}

.project-list-content {
  min-width: 0;
}

.project-list-title {
  display: block;
  overflow: hidden;
  color: #18202a;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 7px;
  color: #687584;
  font-size: 12px;
}

.project-list-item button {
  width: auto;
  min-width: 72px;
  padding: 7px 12px;
}

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

.project-dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid #e3e8ef;
  background: #fbfcfe;
}

.project-dialog-footer button {
  width: auto;
  min-width: 108px;
}

.confirm-dialog-body {
  padding: 24px;
}

.confirm-dialog-body h2 {
  font-size: 20px;
}

.confirm-dialog-body p {
  margin: 10px 0 22px;
  color: #5c6875;
  font-size: 14px;
  line-height: 1.6;
}

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

.danger-button {
  border-color: #cf222e;
  background: #cf222e;
  color: #fff;
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: #a40e26;
  background: #a40e26;
}

.edit-dialog img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  background: #f8fafc;
}

.slide-edit-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.slide-edit-image-wrap > img {
  display: block;
  width: 100%;
  height: 100%;
}

.slide-edit-generating-overlay {
  border-radius: 6px;
}

.slide-version-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e3e8ef;
}

.slide-version-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slide-version-head h3 {
  margin: 0;
  font-size: 15px;
}

.slide-version-head span {
  color: #667085;
  font-size: 12px;
}

.slide-version-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow: auto;
  padding: 1px;
}

.slide-version-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  border: 1px solid #dce3ea;
  padding: 7px;
  background: #fff;
  color: #18202a;
  text-align: left;
}

.slide-version-item:hover,
.slide-version-item:focus-visible {
  border-color: #8bb8ff;
  background: #f6f9ff;
}

.slide-version-item.current {
  border-color: #72b58a;
  background: #f2faf5;
}

.slide-version-item img {
  display: block;
  width: 88px;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 4px;
  object-fit: cover;
  background: #eef1f4;
}

.slide-version-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.slide-version-copy strong,
.slide-version-copy time,
.slide-version-copy small,
.slide-version-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slide-version-copy strong {
  font-size: 12px;
}

.slide-version-copy time,
.slide-version-copy small {
  color: #667085;
  font-size: 11px;
  font-weight: 400;
}

.slide-version-copy span {
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
}

.slide-version-item.current .slide-version-copy span {
  color: #18733b;
}

.edit-dialog textarea {
  min-height: 130px;
}

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

.sample-reference-grid figure {
  margin: 0;
}

.sample-reference-grid figcaption {
  margin-top: 6px;
  color: #5c6875;
  font-size: 12px;
}

.log {
  max-height: 360px;
  overflow: auto;
}

.log ol {
  margin: 0;
  padding-left: 22px;
}

.log li {
  margin: 8px 0;
  color: #344253;
}

.log time {
  display: inline-block;
  min-width: 42px;
  color: #7a8796;
  font-variant-numeric: tabular-nums;
}

.local-error-head {
  margin-top: 18px;
}

#localErrors li {
  color: #8a1f11;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .app-header {
    display: block;
  }

  .deck-head {
    min-width: 0;
    margin-top: 12px;
    text-align: left;
  }

  .header-actions {
    justify-content: flex-start;
  }

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

  .grid,
  .actions,
  .sample-reference-grid,
  .stream-panel,
  .sample-preview,
  .sample-preview.has-style-reference {
    grid-template-columns: 1fr;
  }

  .grid label:last-child {
    grid-column: auto;
  }

  .config-dialog-header,
  .config-dialog-body,
  .config-dialog-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .config-dialog-footer button {
    width: 100%;
  }

  .download-slides {
    grid-template-columns: 1fr;
  }

  .confirm-dialog-actions {
    grid-template-columns: 1fr;
  }

  .project-dialog-header,
  .project-list,
  .project-dialog-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .project-list-item {
    grid-template-columns: 1fr;
  }

  .project-list-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-list-actions button,
  .project-dialog-footer button {
    width: 100%;
  }

  #outlineEditor {
    min-height: 360px;
  }
}

/* Professional workspace refresh */
:root {
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --ink: #171a1f;
  --muted: #667085;
  --line: #e1e5ea;
  --line-strong: #cbd2da;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #edf4ff;
  --success: #15803d;
  --success-soft: #edf8f1;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --shadow-dialog: 0 24px 70px rgba(17, 24, 39, 0.22), 0 6px 18px rgba(17, 24, 39, 0.08);
  color: var(--ink);
  background: var(--page);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 0 24px 48px;
}

.app-header {
  display: flex;
  align-items: center;
  max-width: 1240px;
  min-height: 112px;
  margin: 0 auto;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: block;
  object-fit: cover;
}

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

.brand h1 {
  color: #111827;
  font-size: 23px;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p,
#deckMeta {
  margin: 5px 0 0;
  color: var(--muted);
}

.deck-head {
  display: grid;
  justify-items: end;
  min-width: min(520px, 48vw);
  margin: 0;
  text-align: right;
}

.deck-head h2 {
  max-width: 520px;
  overflow: hidden;
  color: #2f3640;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  gap: 7px;
  margin-top: 12px;
}

.header-actions button {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 12px;
}

.runtime-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.workflow-steps {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  max-width: 1240px;
  min-height: 54px;
  margin: 0 auto;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(17, 24, 39, 0.05);
  scrollbar-width: none;
}

.workflow-steps::-webkit-scrollbar {
  display: none;
}

.workflow-steps > span {
  display: grid;
  place-items: center;
  min-width: 104px;
  min-height: 38px;
  flex: 1 0 104px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: #7a8491;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.workflow-steps > span.active {
  border-color: #cfe0ff;
  background: var(--primary-soft);
  color: #174ea6;
  font-weight: 700;
}

.workflow-steps > span.done {
  border-color: transparent;
  background: transparent;
  color: var(--success);
  font-weight: 650;
}

.request-status {
  max-width: 1240px;
  margin: 16px auto 0;
  border: 1px solid #cfe0ff;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--surface);
  color: #174ea6;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.06);
}

.panel {
  max-width: 1240px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.wizard-step {
  margin: 0 auto;
  padding: 34px 0 26px;
}

.log {
  max-height: 420px;
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 18px;
  background: var(--surface);
}

.section-head {
  min-height: 42px;
  margin-bottom: 20px;
}

.section-head h2 {
  color: #1d232b;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

.setup-heading {
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.step-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

label {
  gap: 8px;
  margin: 0;
  color: #384250;
  font-size: 13px;
  font-weight: 650;
}

.wizard-step > label,
.wizard-step > .grid,
.wizard-step > details {
  margin-top: 20px;
}

input,
select,
textarea {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb7c2;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #98a1ad;
}

.title-field input {
  min-height: 54px;
  padding: 12px 14px;
  font-size: 17px;
  font-weight: 550;
}

textarea {
  min-height: 300px;
  resize: vertical;
}

.source-field textarea {
  min-height: 330px;
}

input[type="file"] {
  padding: 6px;
  color: var(--muted);
  font-size: 13px;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 5px 10px;
  background: var(--surface-subtle);
  color: #344054;
  font: inherit;
  cursor: pointer;
}

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

.grid label:last-child {
  grid-column: auto;
}

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

.advanced-input {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
}

.advanced-input summary,
.log summary {
  color: #46515f;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.advanced-input[open] summary {
  margin-bottom: 12px;
}

.advanced-input textarea {
  min-height: 160px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

button,
.download {
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled),
.download:hover:not(.disabled) {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:focus-visible,
.download:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #3c4653;
}

.secondary:hover:not(:disabled) {
  border-color: #aeb7c2;
  background: #f3f5f7;
  color: #20262e;
  box-shadow: none;
}

.danger {
  border-color: #fecaca;
  color: var(--danger-color);
}

.danger:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fff1f1;
  color: var(--danger-hover);
}

.danger-button,
.danger-button:hover:not(:disabled) {
  border-color: var(--danger-color);
  background: var(--danger-color);
  color: #fff;
}

.danger-button:hover:not(:disabled) {
  border-color: var(--danger-hover);
  background: var(--danger-hover);
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.16);
}

button:disabled,
.download.disabled {
  border-color: #dfe3e8;
  background: #e9ecf0;
  color: #8a94a2;
}

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

.primary-actions {
  max-width: none;
}

.primary-actions button {
  min-width: 150px;
}

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

.section-head .actions {
  margin-top: 0;
}

.text-button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  box-shadow: none;
}

.text-button:hover:not(:disabled) {
  border: 0;
  background: transparent;
  color: var(--primary-hover);
  box-shadow: none;
  transform: none;
}

.stream-panel {
  gap: 14px;
  margin-top: 24px;
}

.stream-column {
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--surface);
}

.stream-column h2 {
  color: #374151;
  font-size: 14px;
}

.stream-column pre {
  color: #475467;
  font-size: 12px;
  line-height: 1.65;
}

#outlineEditor {
  min-height: 540px;
  border-color: var(--line);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.65;
}

.sample-preview {
  gap: 18px;
}

.sample-preview-panel figcaption {
  margin-bottom: 9px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
}

.sample-preview-media,
.slide-image-wrap,
.download-slide-image {
  border-color: var(--line);
  border-radius: 8px;
  background: #eef1f4;
}

.sample-preview-media {
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.06);
}

.sample-image-placeholder {
  color: #7b8490;
  background: #eef1f4;
}

.sample-generating-overlay {
  border-radius: 8px;
  background: rgba(24, 30, 39, 0.74);
}

.progress {
  height: 8px;
  margin: 18px 0 22px;
  background: #dfe4ea;
}

#progressBar {
  background: var(--success);
}

.slides {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.slide {
  min-width: 0;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.05);
}

.slide strong,
.download-slide strong {
  margin: 0;
  overflow-wrap: anywhere;
  color: #374151;
  font-size: 13px;
  line-height: 1.45;
}

.slide-placeholder {
  color: #697586;
  background: #eef1f4;
}

.slide-edit-btn,
.slide-regenerate-btn {
  min-width: 36px;
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
}

.slide-edit-btn:hover:not(:disabled),
.slide-regenerate-btn:hover:not(:disabled) {
  border-color: #fff;
  background: #111827;
  box-shadow: none;
}

.slide-time-badge {
  border-radius: 5px;
  background: rgba(23, 78, 166, 0.92);
}

.slide-time-badge.complete {
  background: rgba(21, 128, 61, 0.92);
}

.download-slides {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.download-slide {
  min-width: 0;
  gap: 10px;
}

.download-slide-image {
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.06);
}

.badge {
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--primary-soft);
  color: #174ea6;
  font-size: 11px;
  font-weight: 650;
}

.log details[open] summary {
  margin-bottom: 16px;
}

.log ol {
  padding-left: 20px;
  border-top: 1px solid var(--line);
}

.log li {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f3;
  color: #4b5563;
  font-size: 12px;
}

dialog {
  color: var(--ink);
}

.config-dialog,
.confirm-dialog,
.project-dialog,
.edit-dialog {
  border: 1px solid rgba(203, 210, 218, 0.8);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}

.config-dialog::backdrop,
.confirm-dialog::backdrop,
.project-dialog::backdrop,
.edit-dialog::backdrop {
  background: rgba(17, 24, 39, 0.56);
  backdrop-filter: blur(2px);
}

.config-dialog-header,
.project-dialog-header {
  padding: 20px 22px 17px;
  border-color: var(--line);
  background: var(--surface);
}

.config-dialog-header h2,
.project-dialog-header h2,
.confirm-dialog-body h2,
.edit-dialog h2 {
  color: #1d232b;
  font-size: 20px;
  font-weight: 700;
}

.config-dialog-body {
  padding: 14px 22px 20px;
}

.config-dialog-footer,
.project-dialog-footer {
  padding: 14px 22px 18px;
  border-color: var(--line);
  background: var(--surface-subtle);
}

.dialog-close,
.field-clear {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: #687384;
  box-shadow: none;
}

.dialog-close:hover:not(:disabled),
.field-clear:hover:not(:disabled) {
  border-color: var(--line);
  background: #eff2f5;
  color: #20262e;
  box-shadow: none;
  transform: none;
}

.field-clear:hover:not(:disabled) {
  color: var(--danger-color);
}

.toggle-track {
  border-color: #b9c1cb;
  background: #dce1e7;
}

.visibility-toggle input:checked + .toggle-track {
  border-color: var(--primary);
  background: var(--primary);
}

.edit-dialog {
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 22px;
}

.confirm-dialog-body {
  padding: 25px;
}

.project-list {
  gap: 8px;
  padding: 14px 22px 18px;
  background: var(--surface);
}

.project-list-item {
  border-color: var(--line);
  border-radius: 6px;
  padding: 13px 14px;
  background: var(--surface);
  transition: border-color 140ms ease, background 140ms ease;
}

.project-list-item:hover {
  border-color: #bdc6d0;
  background: #fafbfc;
}

.project-list-item.current {
  border-color: #a8c6ff;
  background: #f4f8ff;
}

.project-list-title {
  color: #2a3039;
  font-weight: 680;
}

.project-list-meta {
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-header {
    align-items: flex-start;
  }

  .deck-head {
    min-width: 0;
  }

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

  .grid label:last-child {
    grid-column: span 2;
  }

  .config-grid label:last-child {
    grid-column: auto;
  }

  .download-slides {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 0 14px 32px;
  }

  .app-header {
    display: grid;
    gap: 16px;
    min-height: 0;
    padding: 18px 0 16px;
  }

  .brand h1 {
    font-size: 21px;
  }

  .deck-head {
    justify-items: start;
    margin: 0;
    text-align: left;
  }

  .deck-head h2 {
    max-width: 100%;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .workflow-steps {
    margin: 0 -14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    padding: 6px 14px;
  }

  .workflow-steps > span {
    min-width: 88px;
    flex-basis: 88px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .wizard-step {
    padding: 26px 0 20px;
  }

  .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
    min-height: 0;
    gap: 10px;
  }

  .section-head h2 {
    font-size: 20px;
  }

  .grid,
  .config-grid,
  .stream-panel,
  .sample-preview,
  .sample-preview.has-style-reference {
    grid-template-columns: 1fr;
  }

  .grid label:last-child,
  .config-grid label:last-child {
    grid-column: auto;
  }

  .source-field textarea {
    min-height: 280px;
  }

  .actions,
  .primary-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .primary-actions button,
  .actions button {
    width: 100%;
  }

  .section-head .inline-actions {
    display: flex;
    width: auto;
  }

  .section-head .inline-actions button {
    width: auto;
  }

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

  .download-slides {
    grid-template-columns: 1fr;
  }

  .log {
    padding: 13px 14px;
  }

  .config-dialog,
  .project-dialog,
  .confirm-dialog,
  .edit-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .config-dialog-header,
  .config-dialog-body,
  .config-dialog-footer,
  .project-dialog-header,
  .project-list,
  .project-dialog-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .project-list-item {
    grid-template-columns: 1fr;
  }

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

/* Reference-aligned bright workspace */
:root {
  --page: #f6f8fc;
  --surface: #ffffff;
  --surface-subtle: #f8faff;
  --ink: #111827;
  --muted: #667085;
  --line: #dfe5ee;
  --line-strong: #cbd5e1;
  --primary: #2864f0;
  --primary-hover: #1e52d6;
  --primary-soft: #eef4ff;
  --success: #12a150;
}

body {
  background: var(--page);
}

.app-shell {
  padding: 18px 28px 54px;
}

.app-header {
  max-width: 1460px;
  min-height: 92px;
  padding: 18px 28px;
  border: 1px solid #e4e9f1;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 32px rgba(31, 51, 86, 0.07);
}

.brand {
  gap: 16px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  border-radius: 14px;
  border: 1px solid #e3e8ef;
  background: #fff;
  box-shadow: 0 7px 18px rgba(31, 51, 86, 0.12);
}

.brand h1 {
  color: #101828;
  font-size: 25px;
  font-weight: 750;
}

.brand-subtitle {
  margin: 5px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.4;
}

.deck-head {
  min-width: 0;
}

.deck-head > h2,
.deck-head > #deckMeta {
  display: none;
}

.header-actions {
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 0;
}

.header-actions button {
  min-height: 44px;
  padding: 9px 16px;
  border-color: #d7deea;
  border-radius: 8px;
  background: #fff;
  color: #263244;
  font-size: 13px;
  box-shadow: 0 2px 7px rgba(31, 51, 86, 0.04);
}

.header-actions button:hover:not(:disabled) {
  border-color: #aec2ed;
  background: #f8faff;
  color: #174ea6;
}

.project-switcher-hint {
  position: relative;
  display: inline-flex;
}

.project-switcher-hint::after {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid #3b4654;
  border-radius: 6px;
  background: #253040;
  color: #fff;
  content: attr(data-tooltip);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.project-switcher-hint:hover::after,
.project-switcher-hint:focus-within::after {
  opacity: 1;
  transform: translateY(0);
}

.project-switcher-hint.is-empty button {
  border-style: dashed;
}

#openConfigBtn {
  border-color: var(--primary);
  color: var(--primary);
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 280px;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  padding: 9px 14px;
  background: #f9fbfd;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-status::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 3px #e8f8ef;
}

.api-status.offline::before {
  background: #f04438;
  box-shadow: 0 0 0 3px #fff0ef;
}

.workflow-steps {
  position: relative;
  top: auto;
  z-index: 1;
  max-width: 1340px;
  min-height: 86px;
  margin: 34px auto 20px;
  padding: 8px;
  overflow: visible;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(31, 51, 86, 0.05);
}

.workflow-steps > span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-width: 0;
  min-height: 68px;
  flex-basis: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  color: #344054;
  text-align: left;
}

.workflow-steps > span.active {
  border-color: #9ebcff;
  background: #f8fbff;
  box-shadow: 0 5px 16px rgba(40, 100, 240, 0.08);
}

.workflow-steps > span.done {
  color: #344054;
}

.step-index {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: #eef1f5;
  color: #344054;
  font-size: 15px;
  font-weight: 650;
}

.workflow-steps > span.active .step-index {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(40, 100, 240, 0.22);
}

.workflow-steps > span.done .step-index {
  background: #eaf8f0;
  color: var(--success);
}

.step-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.step-copy strong {
  color: #243044;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.step-copy small {
  overflow: hidden;
  color: #7b8797;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-steps > span.active .step-copy strong {
  color: var(--primary);
}

.request-status {
  max-width: 1340px;
}

.panel {
  max-width: 1340px;
}

.wizard-step {
  margin: 0 auto 24px;
  border: 1px solid #dde4ed;
  border-radius: 14px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 51, 86, 0.07);
}

.setup-heading {
  display: none;
}

.wizard-step > label:first-of-type {
  margin-top: 0;
}

.wizard-step > label,
.wizard-step > .grid,
.wizard-step > details {
  margin-top: 19px;
}

label {
  color: #182230;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 48px;
  border-color: #d5deea;
  border-radius: 7px;
  background: #fff;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b7c6da;
}

.title-field input {
  min-height: 50px;
  font-size: 14px;
  font-weight: 400;
}

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

.grid label:last-child {
  grid-column: span 2;
}

.config-grid label:last-child {
  grid-column: auto;
}

.source-field textarea {
  min-height: 170px;
}

.advanced-input {
  border: 1px solid #dde4ed;
  border-radius: 8px;
  padding: 14px 16px;
  background: #fbfcff;
}

.advanced-input summary {
  color: #344054;
}

#setupStep > .primary-actions {
  justify-content: flex-start;
  margin-top: 18px;
}

#createBtn {
  min-width: 320px;
  min-height: 48px;
  border-radius: 8px;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(40, 100, 240, 0.2);
  font-size: 14px;
}

.section-head {
  padding-bottom: 15px;
  border-bottom: 1px solid #e5eaf1;
}

.section-head h2 {
  font-size: 20px;
}

.stream-column,
.slide,
.sample-preview-media,
.download-slide-image {
  border-color: #dfe5ee;
  box-shadow: 0 6px 18px rgba(31, 51, 86, 0.05);
}

.log {
  max-width: 1340px;
  margin: 0 auto;
  border-color: #dde4ed;
  border-radius: 12px;
  padding: 18px 24px;
  background: #fff;
  box-shadow: 0 6px 22px rgba(31, 51, 86, 0.05);
}

.log summary {
  color: #1d2939;
  font-size: 14px;
}

.config-dialog,
.project-dialog,
.confirm-dialog,
.edit-dialog {
  border-color: #dce3ed;
  box-shadow: 0 28px 80px rgba(31, 51, 86, 0.22);
}

@media (max-width: 1120px) {
  .app-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .deck-head {
    width: 100%;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .workflow-steps {
    overflow-x: auto;
  }

  .workflow-steps > span {
    min-width: 200px;
    flex: 1 0 200px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 10px 12px 32px;
  }

  .app-header {
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 12px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .header-actions button {
    width: 100%;
  }

  .api-status {
    grid-column: span 2;
    width: 100%;
    max-width: none;
  }

  .workflow-steps {
    min-height: 70px;
    margin: 18px 0 14px;
    border-radius: 10px;
    padding: 6px;
  }

  .workflow-steps > span {
    min-width: 124px;
    min-height: 56px;
    flex-basis: 124px;
    gap: 8px;
    padding: 7px 9px;
  }

  .step-index {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 13px;
  }

  .step-copy small {
    display: none;
  }

  .wizard-step {
    margin-bottom: 14px;
    border-radius: 10px;
    padding: 18px 16px;
  }

  .grid,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .grid label:last-child,
  .config-grid label:last-child {
    grid-column: auto;
  }

  .source-field textarea {
    min-height: 210px;
  }

  #createBtn {
    width: 100%;
    min-width: 0;
  }

  .log {
    padding: 15px 16px;
  }
}

.style-picker {
  min-width: 0;
  margin: 19px 0 0;
  border: 0;
  padding: 0;
}

.style-picker legend {
  margin-bottom: 10px;
  color: #182230;
  font-size: 13px;
  font-weight: 700;
}

.style-group {
  min-width: 0;
}

.style-group + .style-group {
  margin-top: 22px;
  border-top: 1px solid #e3e8ef;
  padding-top: 18px;
}

.style-group-heading {
  margin: 0 0 9px;
  color: #5e6978;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.style-group-heading span {
  margin-left: 4px;
  color: #8a94a3;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

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

.style-options-contents {
  display: contents;
}

.style-option-shell {
  position: relative;
  min-width: 0;
}

.style-option-shell .style-option {
  display: block;
}

.style-preview-button {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 0;
  border: 1px solid rgba(52, 64, 84, 0.18);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.94);
  color: #243044;
  box-shadow: 0 6px 18px rgba(31, 51, 86, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.style-preview-button img {
  width: 20px;
  height: 20px;
}

.style-option-shell:hover .style-preview-button,
.style-preview-button:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.style-preview-button:hover:not(:disabled),
.style-preview-button:focus-visible {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 7px 20px rgba(37, 99, 235, 0.22);
  transform: translate(-50%, -50%) scale(1.04);
}

.style-option {
  position: relative;
  min-width: 0;
  margin: 0;
  cursor: pointer;
}

.style-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  opacity: 0;
}

.style-card {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 2px solid #d9e1ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(31, 51, 86, 0.05);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.style-card img,
.style-custom-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.style-card img {
  object-fit: cover;
  background: #eef2f6;
}

.style-card strong {
  min-width: 0;
  padding: 10px 11px;
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.style-custom-preview {
  display: grid;
  place-items: center;
  background: #f0f4f8;
  color: #667085;
  font-size: 38px;
  font-weight: 300;
}

.style-add-option {
  width: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.style-add-option:hover:not(:disabled),
.style-add-option:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.style-option:hover .style-card,
.style-add-option:hover:not(:disabled) .style-card {
  border-color: #9db9e8;
  box-shadow: 0 7px 18px rgba(31, 51, 86, 0.11);
  transform: translateY(-1px);
}

.style-option input:checked + .style-card {
  border-width: 3px;
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 9px 22px rgba(37, 99, 235, 0.18);
}

.style-option input:checked + .style-card::after {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary) url("/vendor/lucide-icons/check.svg") center / 14px 14px no-repeat;
  box-shadow: 0 2px 8px rgba(23, 78, 166, 0.32);
  content: "";
}

.style-option input:checked + .style-card strong {
  color: var(--primary);
  font-weight: 750;
}

.style-option input:focus-visible + .style-card {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.style-add-option:focus-visible .style-card {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.style-add-option:disabled {
  cursor: progress;
  opacity: 0.58;
}

.style-delete-button {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  border: 1px solid rgba(185, 28, 28, 0.22);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.94);
  color: #b42318;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(31, 51, 86, 0.16);
}

.style-delete-button:hover:not(:disabled),
.style-delete-button:focus-visible {
  border-color: #b42318;
  background: #fff;
  color: #8f1d14;
  box-shadow: 0 3px 9px rgba(31, 51, 86, 0.2);
  transform: none;
}

.style-file-input {
  position: fixed;
  width: 1px;
  height: 1px;
  min-height: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.style-preview-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #11151a;
  color: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.style-preview-dialog::backdrop {
  background: rgba(14, 18, 24, 0.78);
}

.style-preview-viewer {
  position: relative;
  padding: 54px 64px 20px;
}

.style-preview-stage {
  position: relative;
}

.style-preview-figure {
  min-width: 0;
  margin: 0;
}

.style-preview-figure > img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 150px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #080b0f;
}

.style-preview-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding-top: 12px;
}

.style-preview-meta {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.style-preview-figure figcaption strong {
  min-width: 0;
  overflow: hidden;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-preview-figure figcaption span {
  flex: 0 0 auto;
  color: #aab4c0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.style-preview-select {
  display: inline-flex;
  width: auto;
  min-width: 126px;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  white-space: nowrap;
}

.style-preview-select img {
  width: 17px;
  height: 17px;
}

.style-preview-figure figcaption .style-preview-select span {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.style-preview-select.is-selected,
.style-preview-select.is-selected:hover,
.style-preview-select.is-selected:focus-visible {
  border-color: #9dc5ac;
  background: #eaf7ee;
  color: #176b39;
  box-shadow: none;
  transform: none;
}

.style-preview-select.is-selected img {
  border-radius: 50%;
  padding: 2px;
  background: #176b39;
}

.style-preview-close,
.style-preview-nav {
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.94);
  color: #182230;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.25);
}

.style-preview-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
}

.style-preview-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-70%);
}

.style-preview-previous {
  left: -54px;
}

.style-preview-next {
  right: -54px;
}

.style-preview-close img,
.style-preview-nav img {
  width: 22px;
  height: 22px;
}

.style-preview-close:hover:not(:disabled),
.style-preview-close:focus-visible,
.style-preview-nav:hover:not(:disabled),
.style-preview-nav:focus-visible {
  border-color: #fff;
  background: #fff;
  color: #11151a;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.34);
  transform: none;
}

.style-preview-nav:hover:not(:disabled),
.style-preview-nav:focus-visible {
  transform: translateY(-70%) scale(1.04);
}

.style-preview-nav:disabled {
  cursor: default;
  opacity: 0.35;
}

@media (max-width: 1120px) {
  .style-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .style-group + .style-group {
    margin-top: 18px;
    padding-top: 15px;
  }

  .style-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .style-card strong {
    padding: 9px;
    font-size: 12px;
  }

  .style-preview-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .style-preview-viewer {
    padding: 48px 8px 14px;
  }

  .style-preview-nav {
    width: 38px;
    height: 38px;
    transform: translateY(-90%);
  }

  .style-preview-previous {
    left: 8px;
  }

  .style-preview-next {
    right: 8px;
  }

  .style-preview-nav:hover:not(:disabled),
  .style-preview-nav:focus-visible {
    transform: translateY(-90%) scale(1.04);
  }

  .style-preview-figure figcaption {
    align-items: stretch;
    padding: 10px 6px 0;
  }

  .style-preview-meta {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .style-preview-select {
    min-width: 112px;
    align-self: center;
    padding-inline: 11px;
  }
}

@media (hover: none) {
  .style-preview-button {
    opacity: 0.92;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(0.9);
  }
}
