/* Style preset selection */
.style-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 24px 0 14px;
}

.style-heading h4 {
  margin: 4px 0;
  font-size: 20px;
}

.style-heading p {
  margin: 0;
  color: var(--muted);
}

.style-filters {
  min-width: 400px;
  display: flex;
  gap: 8px;
}

.style-grid {
  max-height: 430px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 2px;
  overflow: auto;
}

.style-card {
  min-height: 142px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--ink-950);
  text-align: left;
}

.style-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.style-card.selected {
  border-color: var(--brand-600);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-600);
}

.style-card span {
  color: var(--brand-700);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.style-card b {
  font-size: 16px;
}

.style-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.style-card em {
  margin-top: auto;
  color: var(--ink-500);
  font-size: 11px;
  font-style: normal;
}

.compatibility-note {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--neutral-status-bg);
  color: var(--neutral-status);
}

.compatibility-note.ok {
  background: var(--success-bg);
  color: var(--success);
}

.compatibility-note.conflict {
  background: var(--danger-bg);
  color: var(--danger);
}

.custom-style {
  margin-bottom: 18px;
}

/* Search, comparison and candidates */
.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 112px;
  gap: 10px;
}

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

.search-results article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
}

.search-results article.search-result {
  padding: 0;
  overflow: hidden;
  background: var(--surface-1);
}

.search-results b {
  display: block;
  margin: 10px 0 6px;
}

.result-body {
  padding: 16px;
}

.asset-preview {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  overflow: hidden;
  background: var(--studio-canvas);
}

.asset-preview img {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: cover;
  background: var(--studio-surface);
}

.asset-preview img:only-child {
  grid-column: 1 / -1;
}

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

.compare-table {
  overflow: auto;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
}

.compare-head,
.compare-row {
  min-width: 940px;
  display: grid;
  grid-template-columns: 150px 200px minmax(280px, 1.4fr) minmax(220px, 1fr) 82px;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.compare-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}

.compare-row {
  margin: 0;
  background: var(--surface-1);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.compare-row:hover {
  background: var(--surface-2);
}

.compare-row b {
  display: flex;
  flex-direction: column;
}

.compare-row small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
}

.compare-row input {
  width: auto;
  min-height: 0;
  display: inline;
  margin-right: 7px;
}

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

.candidate-grid article,
.revision-list article {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

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

.revision-list article {
  align-items: center;
  flex-direction: row;
}

.revision-list small {
  margin-left: auto;
}

.variant-compare {
  max-height: 610px;
  overflow: auto;
}

/* Beginner-first workflow */
.rail-label {
  margin: 8px 12px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rail-label.secondary {
  margin-top: 20px;
}

.advanced-menu {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-default);
}

.advanced-menu > summary {
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.advanced-menu > summary::after {
  content: "+";
  float: right;
}

.advanced-menu[open] > summary::after {
  content: "−";
}

.advanced-menu .step {
  width: 100%;
  margin-top: 8px;
}

.workflow-step {
  position: relative;
}

.workflow-step.locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.workflow-step.done:not(.active) {
  border-color: #b8cebf;
  background: var(--success-bg);
  color: var(--success);
}

.step-guide {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: start;
  gap: 4px 22px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid #b9d0c1;
  border-radius: var(--radius-md);
  background: var(--success-bg);
}

.step-guide b {
  grid-row: 1 / 3;
  color: var(--success);
  font-size: 16px;
}

.step-guide p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.step-guide span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.step-guide.automatic {
  border-color: #b7d2de;
  background: var(--info-bg);
}

.step-guide.automatic b {
  color: var(--info);
}

.step-guide.completed {
  border-color: #b9d0c1;
  background: var(--success-bg);
}

.helper {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.resume-project {
  margin-bottom: 16px;
}

.resume-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.advanced-settings {
  margin: 18px 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.advanced-settings > summary {
  padding: 14px 16px;
  color: var(--ink-600);
  font-weight: 700;
  cursor: pointer;
}

.main-cta {
  min-height: 44px;
  font-size: 14px;
}

.essential-options {
  max-width: 720px;
}

.creation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: "main summary";
  align-items: start;
  gap: 16px;
}

.creation-layout .creation-brief {
  grid-area: main;
}

.creation-layout .snapshot-picker {
  position: sticky;
  top: 80px;
  grid-area: summary;
}

.creation-layout .snapshot-picker .grid3 {
  grid-template-columns: 1fr;
  gap: 0;
}

.creation-layout .snapshot-picker h4 {
  margin: 6px 0 14px;
  font-size: 20px;
}

.creation-layout .snapshot-picker .actions button {
  flex: 1 1 130px;
}

.asset-optional {
  margin-top: 12px;
}

.waiting-card,
.progress-summary {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.activity-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
}

.activity-line i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--info);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(53, 106, 131, 0); }
}

.mother-grid.beginner div {
  min-height: 108px;
}

.engineering-details {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
}

.engineering-details > summary {
  padding: 13px 16px;
  color: #d2ddd6;
  font-weight: 700;
  cursor: pointer;
}

.engineering-details .mother-grid {
  padding: 0 12px 12px;
}

.mother-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.mother-card .mother-actions .soft {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.confirmed-note {
  color: #d7e8dc;
  font-weight: 700;
}

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

/* Results and studio surfaces */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.result-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.result-card h4 {
  margin: 4px 0 0;
  font-size: 20px;
}

.result-card p {
  line-height: 1.6;
}

.result-opening {
  min-height: 68px;
}

.scene-summary {
  margin: 16px 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--studio-line);
  border-radius: var(--radius-md);
  background: var(--studio-canvas);
  color: var(--studio-text);
}

.scene-summary summary {
  padding: 12px 14px;
  border-bottom: 1px solid transparent;
  color: var(--studio-text);
  font-weight: 700;
  cursor: pointer;
}

.scene-summary[open] summary {
  border-bottom-color: var(--studio-line);
}

.scene-summary ol {
  margin: 0;
  padding: 4px 18px 12px 36px;
}

.scene-summary li {
  margin: 12px 0;
  padding-left: 4px;
}

.scene-summary li span,
.scene-summary li small {
  display: block;
  margin: 4px 0;
  line-height: 1.5;
}

.scene-summary li small {
  color: var(--studio-muted);
}

.result-actions {
  margin-top: 24px;
}

.result-actions h4 {
  margin-top: 0;
}

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

.result-tool-actions button {
  min-height: 48px;
  margin: 0;
}

.result-tool-actions .subtle {
  color: var(--muted);
  font-size: 12px;
}

#view-task-detail [data-deliverable-panel="images"] {
  padding: 14px;
  border: 1px solid var(--studio-line);
  border-radius: var(--radius-md);
  background: var(--studio-canvas);
}

#view-task-detail [data-deliverable-panel="images"] .image-variant-head {
  border-color: var(--studio-line);
  background: var(--studio-surface);
  color: var(--studio-text);
}

#view-task-detail [data-deliverable-panel="images"] .deliverable-image {
  border-color: var(--studio-line);
  background: var(--studio-surface);
  color: var(--studio-text);
}

#view-task-detail [data-deliverable-panel="images"] .deliverable-image img {
  background: var(--studio-canvas);
}

#view-task-detail [data-deliverable-panel="images"] .deliverable-image a {
  color: #9bcbb2;
}

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

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

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

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

@media (max-width: 900px) {
  .style-heading {
    display: block;
  }

  .style-filters {
    min-width: 0;
    margin-top: 12px;
  }

  .style-grid,
  .candidate-grid,
  .search-results,
  .simple-stages,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .search-row,
  .resume-row,
  .result-tool-actions {
    grid-template-columns: 1fr;
  }

  .creation-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "summary" "main";
  }

  .creation-layout .snapshot-picker {
    position: static;
  }

  .step-guide {
    grid-template-columns: 1fr;
  }

  .step-guide b {
    grid-row: auto;
  }

  .mother-actions {
    flex-direction: column;
  }

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