:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #09090b;
  color: #fafafa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: #09090b;
}

.app {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  overflow-x: hidden;
}

.app.has-preview-sticky {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.preview-sticky-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(640px, 100%);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #27272a;
  background: color-mix(in srgb, #18181b 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

.preview-sticky-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-sticky-bar-copy {
  min-width: 0;
}

.preview-sticky-bar-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #fafafa;
}

.preview-sticky-bar-meta {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: #a1a1aa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-sticky-bar .button {
  flex-shrink: 0;
  min-width: 108px;
}

.preview-iframe-panel {
  margin-bottom: 16px;
  overflow: hidden;
}

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

.preview-iframe-copy {
  min-width: 0;
}

.preview-iframe-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.preview-iframe-meta {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.preview-iframe-head .button {
  flex-shrink: 0;
}

.preview-iframe-frame {
  position: relative;
  height: min(420px, 58vh);
  min-height: 240px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #27272a;
  background: #ffffff;
}

.preview-iframe-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.preview-iframe-panel.is-live-updating .preview-iframe-frame {
  position: relative;
}

.preview-iframe-panel.is-live-updating .preview-iframe-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.06);
  pointer-events: none;
}

.preview-iframe-panel.is-live-updating .preview-iframe-title::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: #22c55e;
  vertical-align: middle;
  animation: preview-live-pulse 1.2s ease-in-out infinite;
}

@keyframes preview-live-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.header {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #71717a;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 28px;
}

.subtitle {
  margin: 8px 0 0;
  color: #a1a1aa;
  line-height: 1.5;
}

.card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.banner {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.banner.error {
  background: #451a1a;
  border: 1px solid #7f1d1d;
  color: #fecaca;
}

.banner.success {
  background: #052e16;
  border: 1px solid #166534;
  color: #bbf7d0;
}

.hidden {
  display: none !important;
}

.hint,
.label,
.field span {
  color: #a1a1aa;
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  background: #09090b;
  color: #fafafa;
  padding: 12px 14px;
  font: inherit;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid #52525b;
  outline-offset: 1px;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

legend {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #e4e4e7;
}

.placeholder-group {
  opacity: 0.65;
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.value {
  margin: 4px 0 0;
  font-size: 15px;
  color: #fafafa;
  word-break: break-word;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.button {
  appearance: none;
  border: 1px solid #52525b;
  border-radius: 12px;
  background: #27272a;
  color: #fafafa;
  padding: 14px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  background: #3f3f46;
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button.secondary {
  background: transparent;
}

.button.accent {
  background: #166534;
  border-color: #15803d;
}

.button.accent:hover {
  background: #15803d;
}

.button.danger {
  color: #fecaca;
  border-color: #7f1d1d;
}

.button.danger:hover {
  background: #451a1a;
}

.corrector-hint {
  border: 1px solid color-mix(in srgb, var(--color-accent, #2563eb) 35%, transparent);
  background: color-mix(in srgb, var(--color-accent, #2563eb) 8%, var(--color-surface, #fff));
}

.corrector-hint h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.reset-site-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #27272a;
}

.reset-site-hint {
  margin: 8px 0 0;
}

.workspace-wizard {
  margin-bottom: 12px;
  padding: 12px 10px;
  border: 1px solid #27272a;
  border-radius: 14px;
  background: #111113;
}

.wizard-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.wizard-step-item {
  min-width: 0;
}

.wizard-step-item > .wizard-step {
  width: 100%;
}

.wizard-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #71717a;
  font: inherit;
  text-align: center;
}

.wizard-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 11px;
  left: calc(50% + 14px);
  width: calc(100% - 28px + 6px);
  height: 2px;
  background: #3f3f46;
  pointer-events: none;
}

.wizard-step.is-done:not(:last-child)::after {
  background: #166534;
}

.wizard-step-marker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #3f3f46;
  background: #18181b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.wizard-step-label {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}

.wizard-step.is-done {
  color: #a1a1aa;
}

.wizard-step.is-done .wizard-step-marker {
  border-color: #166534;
  background: color-mix(in srgb, #166534 28%, #18181b);
  color: #86efac;
}

.wizard-step.is-current {
  color: #fafafa;
}

.wizard-step.is-current .wizard-step-marker {
  border-color: #86efac;
  background: color-mix(in srgb, #166534 32%, #18181b);
  color: #86efac;
  box-shadow: 0 0 0 3px color-mix(in srgb, #166534 24%, transparent);
}

.wizard-step.is-clickable {
  cursor: pointer;
}

.wizard-step.is-clickable:hover .wizard-step-label {
  color: #fafafa;
}

.wizard-step:disabled {
  cursor: default;
}

.progress-checklist {
  margin-bottom: 12px;
  padding: 14px 16px;
}

.progress-checklist-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #d4d4d8;
}

.progress-checklist-summary {
  margin: 0 0 12px;
  font-size: 12px;
  color: #a1a1aa;
}

.workspace-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.workspace-tab {
  appearance: none;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  background: #111113;
  color: #71717a;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.workspace-tab:not(.is-active) {
  opacity: 0.55;
}

.workspace-tab.is-active {
  opacity: 1;
  border-color: #a1a1aa;
  background: #18181b;
  color: #fafafa;
  box-shadow: inset 0 0 0 1px #52525b;
}

.workspace-tab:focus-visible {
  outline: 2px solid #71717a;
  outline-offset: 2px;
}

.site-panel-actions {
  margin-top: 16px;
}

.site-panel-actions .button {
  width: 100%;
}

.progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #71717a;
}

.progress-step[data-scroll-target] {
  cursor: pointer;
}

.progress-step[data-scroll-target]:hover {
  background: #27272a;
}

.progress-step.is-current {
  background: color-mix(in srgb, #166534 24%, #18181b);
  color: #fafafa;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #86efac 35%, transparent);
}

.progress-step.is-current .progress-step-marker {
  color: #86efac;
  font-weight: 700;
}

.progress-step.is-done {
  color: #a1a1aa;
}

.progress-step-marker {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 13px;
}

.progress-step.is-done .progress-step-marker {
  color: #86efac;
}

.progress-step-label {
  font-size: 13px;
  line-height: 1.35;
}

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

.wireframe-actions #submit-button {
  width: 100%;
}

.wireframe-actions #publish-button,
.wireframe-actions #save-button {
  width: 100%;
}

.connection-status {
  margin-bottom: 16px;
}

.connection-command {
  margin: 0 0 12px;
}

.connection-command code {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: #09090b;
  border: 1px solid #3f3f46;
  font-size: 13px;
  color: #e4e4e7;
}

.preview-page-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.preview-page-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #3f3f46;
  background: #09090b;
  color: #fafafa;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.build-versions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.build-version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #27272a;
  border-radius: 12px;
  background: #0d0d0f;
}

.build-version-item.is-active {
  border-color: #22c55e;
}

.build-version-copy {
  min-width: 0;
}

.build-version-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #fafafa;
}

.build-version-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: #a1a1aa;
}

.build-versions-hint {
  margin-top: 8px;
}

.preview-page-link:hover {
  border-color: #71717a;
}

.button.is-loading {
  opacity: 0.82;
  cursor: wait;
}

.link-row {
  margin-bottom: 14px;
}

.link-row:last-of-type {
  margin-bottom: 0;
}

.link {
  display: inline-block;
  margin-top: 6px;
  color: #86efac;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-all;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link:hover {
  color: #bbf7d0;
}

.error-details {
  margin-bottom: 16px;
}

.error-details details {
  border: 1px solid #3f3f46;
  border-radius: 12px;
  background: #111113;
  padding: 10px 12px;
}

.error-details summary {
  cursor: pointer;
  color: #d4d4d8;
  font-size: 13px;
}

.error-details pre {
  margin: 10px 0 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  color: #fca5a5;
}

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

.site-panel-head h2 {
  margin: 0;
}

.template-outdated-banner {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-color: #854d0e;
  background: color-mix(in srgb, #422006 72%, #18181b);
}

.template-outdated-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: #fde68a;
}

.template-outdated-hint {
  margin: 0 0 12px;
}

.template-outdated-banner .button {
  width: 100%;
}

.site-panel-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #d4d4d8;
}

.site-quick-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.site-quick-actions .button {
  width: 100%;
}

.site-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #3f3f46;
  color: #d4d4d8;
  background: #09090b;
}

.site-status-badge.is-draft {
  border-color: #854d0e;
  color: #fde68a;
  background: #422006;
}

.site-status-badge.is-published {
  border-color: #166534;
  color: #bbf7d0;
  background: #052e16;
}

.site-meta-line {
  margin: 0 0 14px;
  font-size: 12px;
  color: #71717a;
}

.copy-link-button {
  margin-top: 8px;
  width: 100%;
}

.result-text {
  margin: 8px 0 0;
  color: #d4d4d8;
  line-height: 1.6;
  white-space: pre-wrap;
}

.app-loading-title {
  margin: 0 0 8px;
  font-weight: 600;
}

.app-loading .hint {
  margin: 0;
}

.template-step-hint {
  margin: 0 0 20px;
  line-height: 1.5;
}

.template-catalog {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-card {
  position: relative;
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid #3f3f46;
  border-radius: 14px;
  background: #09090b;
  color: inherit;
  padding: 16px;
  cursor: pointer;
  opacity: 0.58;
  filter: saturate(0.82);
  transition:
    opacity 0.2s ease,
    filter 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.template-card:hover {
  opacity: 0.78;
  border-color: #52525b;
  background: #111113;
}

.template-card.selected {
  opacity: 1;
  filter: none;
  border-color: var(--template-accent, #6366f1);
  background: color-mix(in srgb, var(--template-accent, #6366f1) 10%, #141416);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--template-accent, #6366f1) 45%, transparent),
    0 14px 34px color-mix(in srgb, var(--template-accent, #6366f1) 22%, transparent);
  transform: translateY(-1px);
}

.template-card.selected .template-icon {
  border-color: color-mix(in srgb, var(--template-accent, #6366f1) 55%, #3f3f46);
  background: color-mix(in srgb, var(--template-accent, #6366f1) 16%, #18181b);
}

.template-card.selected .template-card-title,
.template-card.selected .template-card-description {
  color: #fafafa;
}

.template-card:not(.selected) .template-card-title {
  color: #d4d4d8;
}

.template-card:not(.selected) .template-card-description,
.template-card:not(.selected) .template-card-niche {
  color: #71717a;
}

.template-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--template-accent, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  pointer-events: none;
}

.template-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.template-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #3f3f46;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  background: #18181b;
}

.template-card-body {
  flex: 1;
  min-width: 0;
}

.template-card-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #fafafa;
}

.template-card-niche {
  margin: 0 0 8px;
  font-size: 12px;
  color: #71717a;
  line-height: 1.4;
}

.template-card-description {
  margin: 0;
  font-size: 13px;
  color: #a1a1aa;
  line-height: 1.5;
}

.template-swatches {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #27272a;
}

.swatch {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 1px solid #52525b;
  border-radius: 10px;
  background: #27272a;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  color: #0a0a0a;
  opacity: 0.42;
  filter: saturate(0.7) brightness(0.88);
  transition:
    opacity 0.2s ease,
    filter 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.template-card:not(.selected) .swatch {
  opacity: 0.34;
}

.template-card.selected .swatch:not(.selected):hover {
  opacity: 0.62;
  filter: saturate(0.85) brightness(0.95);
}

.swatch.selected {
  opacity: 1;
  filter: none;
  border-color: var(--swatch-accent, #fafafa);
  box-shadow:
    0 0 0 2px var(--swatch-accent, #fafafa),
    0 6px 16px color-mix(in srgb, var(--swatch-accent, #fafafa) 28%, transparent);
  transform: scale(1.04);
}

.swatch.selected .swatch-label {
  background: color-mix(in srgb, var(--swatch-accent, #6366f1) 12%, #ffffff) !important;
  font-weight: 800;
}

.swatch.selected .swatch-label::before {
  content: "✓ ";
}

.swatch-preview {
  width: 100%;
  height: 32px;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #3f3f46;
  background: linear-gradient(
    135deg,
    var(--swatch-bg, #fff) 0%,
    var(--swatch-bg, #fff) 55%,
    var(--swatch-accent, #000) 55%,
    var(--swatch-accent, #000) 100%
  );
}

.swatch-label {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: #0a0a0a !important;
  -webkit-text-fill-color: #0a0a0a;
  background: #ffffff !important;
}

.template-actions {
  margin-top: 4px;
}

.template-summary {
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #27272a;
}

.template-summary .label {
  display: block;
  margin-bottom: 6px;
}

.template-summary-text {
  margin: 0 0 8px;
  font-size: 14px;
  color: #e4e4e7;
  line-height: 1.5;
}

.link-button {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: #a1a1aa;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: #fafafa;
}

.section-editors {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.section-block {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #27272a;
}

.section-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

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

.section-block-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #e4e4e7;
}

.section-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-item {
  border: 1px solid #3f3f46;
  border-radius: 12px;
  padding: 14px;
  background: #09090b;
}

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

.section-item-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #d4d4d8;
}

.section-item-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  appearance: none;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  background: #18181b;
  color: #a1a1aa;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.icon-button:hover {
  color: #fafafa;
  border-color: #52525b;
}

.icon-button.danger:hover {
  color: #fecaca;
  border-color: #7f1d1d;
}

.button.ghost {
  background: transparent;
  border-style: dashed;
}

@media (min-width: 640px) {
  .actions {
    flex-direction: row;
  }

  .button {
    flex: 1;
  }
}
