:root {
  --accent: #0f6cbd;
  --accent-2: #2ed0ff;
  --accent-hover: #0a5aa0;
  --grad: linear-gradient(120deg, #0f6cbd, #2ed0ff);
  --grad-soft: linear-gradient(120deg, #e8f2fb, #eafaff);
  --radius: 10px;
  --radius-sm: 7px;
  font-family: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

/* Light theme (default) */
[data-theme="light"] {
  color-scheme: light;
  --fg: #1b1a19;
  --fg-2: #605e5c;
  --bg: #f5f7fa;
  --card: #ffffff;
  --card-2: #fbfcfe;
  --stroke: #e6e6e6;
  --stroke-2: #d9dde3;
  --hover: #f0f4f9;
  --accent-tint: #eff6fc;
  --shadow: 0 1.6px 3.6px rgba(0, 0, 0, 0.07), 0 0.3px 0.9px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 20px rgba(9, 30, 66, 0.12), 0 2px 6px rgba(9, 30, 66, 0.08);
  /* legacy aliases (workspace section) */
  --neutral-fg: var(--fg);
  --neutral-fg-2: var(--fg-2);
  --neutral-bg: var(--bg);
  --neutral-card: var(--card);
  --neutral-stroke: var(--stroke);
  --neutral-hover: var(--hover);
  --fluent-primary: var(--accent);
  --fluent-primary-hover: var(--accent-hover);
}

/* Dark theme */
[data-theme="dark"] {
  color-scheme: dark;
  --fg: #f3f2f1;
  --fg-2: #a9a7a5;
  --bg: #16181d;
  --card: #1f2229;
  --card-2: #242832;
  --stroke: #333842;
  --stroke-2: #3d4350;
  --hover: #2a2f3a;
  --accent-tint: #16324a;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 26px rgba(0, 0, 0, 0.5);
  /* legacy aliases (workspace section) */
  --neutral-fg: var(--fg);
  --neutral-fg-2: var(--fg-2);
  --neutral-bg: var(--bg);
  --neutral-card: var(--card);
  --neutral-stroke: var(--stroke);
  --neutral-hover: var(--hover);
  --fluent-primary: var(--accent);
  --fluent-primary-hover: var(--accent-hover);
}

* {
  box-sizing: border-box;
}

/* The [hidden] attribute must always win, even over class rules that set display
   (e.g. .landing { display: flex }). Without this, hiding views via .hidden = true fails. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Logo mark (self-contained SVG, blue→cyan, no purple) */
.logo-mark {
  width: 28px;
  height: 28px;
  flex: none;
  background: no-repeat center/contain
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><defs><linearGradient id="g" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="%230F6CBD"/><stop offset="1" stop-color="%232ED0FF"/></linearGradient></defs><path d="M4 16 H25" stroke="%23AEC3D6" stroke-width="2.6" stroke-linecap="round" fill="none"/><circle cx="9" cy="16" r="2.5" fill="%239DB4C7"/><circle cx="16.5" cy="16" r="2.5" fill="%239DB4C7"/><path d="M22 9.5 L30.5 16 L22 22.5 Z" fill="url(%23g)"/></svg>');
}
.logo-lg {
  width: 34px;
  height: 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
}
.brand-name {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Theme toggle icon */
.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  transition: background 0.15s, transform 0.12s, color 0.15s;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--accent);
  transform: translateY(-1px);
}
.theme-ico::before {
  content: "\2600";
  font-size: 16px;
}
[data-theme="dark"] .theme-ico::before {
  content: "\263D";
}

/* ============ Landing ============ */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(
      1100px 520px at 82% -8%,
      var(--accent-tint),
      transparent 60%
    ),
    var(--bg);
}
.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
}
.hero {
  flex: 1;
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 40px 60px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
.hero-copy h1 {
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 18px 0 16px;
}
.pill-tag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--stroke);
  padding: 5px 12px;
  border-radius: 999px;
}
.lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg-2);
  max-width: 30em;
}
.feature-chips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
}
.feature-chip {
  font-size: 13.5px;
  color: var(--fg-2);
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.feature-chip b {
  color: var(--fg);
}
.landing-foot {
  text-align: center;
  padding: 20px;
  font-size: 12.5px;
  color: var(--fg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.foot-sep {
  opacity: 0.5;
}

/* Microsoft lockup + brand squares */
.top-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.ms-lockup {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
}
.ms-logo {
  display: grid;
  grid-template-columns: 9px 9px;
  grid-template-rows: 9px 9px;
  gap: 2px;
}
.ms-logo i {
  display: block;
  width: 9px;
  height: 9px;
}
.ms-logo i:nth-child(1) {
  background: #f25022;
}
.ms-logo i:nth-child(2) {
  background: #7fba00;
}
.ms-logo i:nth-child(3) {
  background: #00a4ef;
}
.ms-logo i:nth-child(4) {
  background: #ffb900;
}
.header-ms {
  padding-right: 12px;
  border-right: 1px solid var(--stroke);
}
@media (max-width: 900px) {
  .header-ms {
    display: none;
  }
}

/* Brand-colored feature chips (Microsoft red / blue / green — no purple) */
.feature-chip {
  border-left: 3px solid var(--stroke);
}
.feature-chip:nth-child(1) {
  border-left-color: #f25022;
}
.feature-chip:nth-child(2) {
  border-left-color: #00a4ef;
}
.feature-chip:nth-child(3) {
  border-left-color: #7fba00;
}
.hint-inline {
  margin: 6px 0 0;
}

/* Timing panel */
.timing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
/* Insights groups */
.insight-group {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
  background: var(--card-2);
}
.insight-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  margin-bottom: 8px;
}
.insight-group .option-check:last-child {
  margin-bottom: 0;
}
.opt-note {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--fg-2);
}
.timer-field {
  margin-top: 10px;
}
.timer-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.timer-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 3px 5px;
  border: 1.5px solid var(--stroke);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.12s;
}
.timer-opt:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.timer-opt.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-tint);
}
.timer-opt img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.timer-opt span {
  font-size: 9px;
  color: var(--fg-2);
  line-height: 1;
  text-align: center;
}
.pace-readout {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.pace-on {
  background: rgba(16, 124, 65, 0.14);
  color: #0e7a3f;
}
.pace-under {
  background: rgba(15, 108, 189, 0.14);
  color: var(--accent);
}
.pace-over {
  background: rgba(209, 52, 56, 0.14);
  color: #c22b2f;
}
.auto-design-btn {
  width: 100%;
  margin: 10px 0 6px;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.14s;
}
.auto-design-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.ad-spark {
  color: #ffdf6b;
  font-size: 14px;
}
.timing-row {
  display: grid;
  grid-template-columns: 1fr 70px 40px;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.timing-row .t-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}
.timing-row .t-bar {
  height: 6px;
  border-radius: 4px;
  background: var(--hover);
  overflow: hidden;
}
.timing-row .t-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--grad);
}
.timing-row .t-time {
  text-align: right;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

/* Dropzone */
.hero-upload {
  display: flex;
  flex-direction: column;
}
.dropzone {
  border: 2px dashed var(--stroke-2);
  border-radius: 16px;
  background: var(--card);
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-tint);
  transform: scale(1.01);
}
.dropzone-icon {
  color: var(--accent);
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad-soft);
}
.dropzone h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}
.dropzone h2 .accent {
  color: var(--accent);
}
.dropzone .sub {
  margin: 0;
  color: var(--fg-2);
  font-size: 13px;
}
.dropzone .hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--fg-2);
}

/* ============ Buttons ============ */
.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 108, 189, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(15, 108, 189, 0.42);
}
.btn-ghost {
  background: var(--card);
  border-color: var(--stroke);
  color: var(--fg);
}
.btn-ghost:hover {
  background: var(--hover);
  transform: translateY(-1px);
}
.btn-sm {
  padding: 7px 13px;
  font-size: 12.5px;
}

/* ============ App header ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============ Segmented control ============ */
.segmented {
  display: inline-flex;
  background: var(--hover);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
  width: 100%;
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 7px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-2);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.segmented button:hover {
  color: var(--fg);
}
.segmented button.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.src-panel {
  margin-top: 14px;
}

/* status chip */
.status-chip {
  font-size: 12px;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--stroke-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Container option inline checkbox */
.option-check.inline {
  margin: 0;
  font-size: 12.5px;
}

/* Workspace: icon rail + sliding panel + preview stage */
.workspace {
  display: grid;
  grid-template-columns: 76px 320px 1fr;
  height: calc(100vh - 65px);
  overflow: hidden;
}

.rail {
  background: var(--card);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  padding: 10px 6px;
  gap: 4px;
}
.rail-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--fg-2);
  font-family: inherit;
  transition: background 0.14s, color 0.14s, transform 0.12s;
}
.rail-btn .ico {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}
.rail-btn .ico svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rail-btn .lbl {
  font-size: 11px;
  font-weight: 600;
}
.rail-btn:hover {
  background: var(--hover);
  color: var(--fg);
  transform: translateY(-1px);
}
.rail-btn.active {
  background: var(--accent-tint);
  color: var(--accent);
}
.rail-btn.active::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--grad);
}
/* Hover tooltip */
.rail-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: 100%;
  margin-left: 8px;
  top: 50%;
  transform: translateY(-50%) scale(0.96);
  background: var(--fg);
  color: var(--card);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  z-index: 30;
}
.rail-btn:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.panel-drawer {
  background: var(--neutral-card);
  border-right: 1px solid var(--neutral-stroke);
  overflow-y: auto;
  padding: 18px 16px 40px;
}
.tool-panel {
  display: none;
}
.tool-panel.active {
  display: block;
  animation: fade 0.18s ease;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.tool-panel h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.tool-panel h4.sub {
  margin: 18px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--neutral-fg-2);
}
.small {
  font-size: 12px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--accent-tint);
  color: var(--accent);
}

/* Style gallery */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.gallery-group-head {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  margin: 8px 0 -2px;
}
.gallery-group-head:first-child {
  margin-top: 0;
}
.gallery-group-head.sig {
  color: var(--accent);
  display: flex;
  align-items: center;
}
.gallery-group-head.sig::before {
  content: "\2726";
  margin-right: 5px;
  color: #ffb900;
  font-size: 11px;
}
.gallery-card {
  border: 1.5px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--card);
  transition: border-color 0.14s, box-shadow 0.16s, transform 0.14s;
}
.gallery-card.sig {
  border-color: var(--accent-tint);
}
.gallery-card.sig .thumb {
  background: linear-gradient(180deg, var(--accent-tint), var(--card));
}
.gallery-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.gallery-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-tint), var(--shadow);
}
.gallery-card .thumb {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-card .thumb svg {
  display: block;
  width: 100%;
}
.gallery-card .meta {
  padding: 11px 14px 13px;
}
.gallery-card .meta .name {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--grad);
  padding: 2px 7px;
  border-radius: 999px;
}
.gallery-card .meta .desc {
  font-size: 11.5px;
  color: var(--fg-2);
  margin-top: 3px;
  line-height: 1.4;
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.chip {
  border: 1px solid var(--neutral-stroke);
  background: var(--neutral-card);
  border-radius: 6px;
  padding: 8px 6px;
  font-size: 12.5px;
  cursor: pointer;
  text-transform: capitalize;
  transition: all 0.12s;
}
.chip:hover {
  background: var(--neutral-hover);
}
.chip.active {
  border-color: var(--fluent-primary);
  background: var(--accent-tint);
  color: var(--fluent-primary);
  font-weight: 600;
}

/* Fields */
.field {
  margin: 14px 0;
}
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--neutral-fg-2);
  margin-bottom: 6px;
}
select,
input[type="number"],
input[type="text"] {
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  background: var(--card);
  color: var(--fg);
}
select option {
  background: var(--card);
  color: var(--fg);
}
/* Hide the native number spinners so two-digit values aren't clipped in the narrow columns. */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.section-row input[type="number"] {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}
select:focus,
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
input::placeholder {
  color: var(--fg-2);
}
.option-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 10px 0;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
input[type="color"] {
  width: 42px;
  height: 32px;
  border: 1px solid var(--neutral-stroke);
  border-radius: 6px;
  padding: 2px;
  background: var(--neutral-card);
  cursor: pointer;
}

/* Palette */
.swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.1s;
}
.swatch:hover {
  transform: scale(1.08);
}
.swatch.active {
  box-shadow: 0 0 0 2px var(--fluent-primary);
}
.palette-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.palette-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--neutral-stroke);
  border-radius: 6px;
  cursor: pointer;
}
.palette-row:hover {
  background: var(--neutral-hover);
}
.palette-row.active {
  border-color: var(--fluent-primary);
}
.palette-row .name {
  font-size: 12px;
  text-transform: capitalize;
  color: var(--neutral-fg-2);
  width: 56px;
}
.palette-row .colors {
  display: flex;
  gap: 3px;
}
.palette-row .colors span {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

/* Per-state cards */
.state-card {
  border: 1px solid var(--neutral-stroke);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
}
.state-card .state-title {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.state-card .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.state-card .ctl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.state-card .ctl label {
  font-size: 12px;
  color: var(--neutral-fg-2);
  width: 44px;
}
.state-card input[type="range"] {
  flex: 1;
}

/* Sections editor */
.sections-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 10px;
}
.col-head {
  display: grid;
  grid-template-columns: 1fr 42px 42px 24px 24px;
  gap: 6px;
  font-size: 11px;
  color: var(--neutral-fg-2);
}
.col-head span:nth-child(4) {
  text-align: center;
  color: #d9a400;
}
.section-row {
  display: grid;
  grid-template-columns: 1fr 42px 42px 24px 24px;
  gap: 6px;
  align-items: center;
}
.section-row .star-toggle {
  border: none;
  background: transparent;
  color: var(--stroke-2);
  cursor: pointer;
  font-size: 15px;
  border-radius: 4px;
  transition: color 0.12s, transform 0.12s;
}
.section-row .star-toggle:hover {
  transform: scale(1.15);
  color: #ffb900;
}
.section-row .star-toggle.on {
  color: #ffb900;
}
.section-row .del {
  border: none;
  background: transparent;
  color: var(--neutral-fg-2);
  cursor: pointer;
  font-size: 15px;
  border-radius: 4px;
}
.section-row .del:hover {
  background: var(--neutral-hover);
  color: #d13438;
}

/* (button styles defined once, near the top) */

/* Preview stage */
.stage {
  overflow-y: auto;
  padding: 20px 24px 40px;
  background: var(--neutral-bg);
}
.stage-header {
  margin-bottom: 14px;
}
.stage-header h3 {
  margin: 0;
  font-size: 15px;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.preview-card {
  border: 1px solid var(--neutral-stroke);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--neutral-card);
}
.preview-card .cap {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-top: 1px solid var(--neutral-stroke);
  color: var(--neutral-fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-card svg {
  display: block;
  width: 100%;
}

.muted {
  color: var(--neutral-fg-2);
  font-size: 12.5px;
}
.error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fde7e9;
  color: #a4262c;
  font-size: 13px;
}
[data-theme="dark"] .error {
  background: #3a1e22;
  color: #f1707a;
}

/* Capability gating: disabled controls */
.option-check.disabled {
  opacity: 0.42;
  pointer-events: none;
  position: relative;
}
.option-check.disabled::after {
  content: attr(data-why);
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--fg-2);
}

/* Gallery + card hover elevation */
.gallery-card {
  transition: border-color 0.14s, box-shadow 0.16s, transform 0.14s;
}
.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.chip {
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.chip:hover {
  transform: translateY(-1px);
}
.swatch {
  transition: transform 0.12s, box-shadow 0.12s;
}

/* Tool panel entrance */
.tool-panel.active {
  animation: fade 0.2s ease;
}

/* Preview cards fade in + hover */
.preview-card {
  animation: fade 0.22s ease;
  transition: box-shadow 0.16s, transform 0.16s;
}
.preview-card:hover {
  box-shadow: var(--shadow-lg);
}

/* Container option range inputs */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
input[type="color"] {
  border: 1px solid var(--stroke);
  border-radius: 6px;
  width: 44px;
  height: 32px;
  padding: 2px;
  background: var(--card);
  cursor: pointer;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--neutral-stroke);
  border-top-color: var(--fluent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============ Responsive ============ */
/* Menu button + drawer scrim exist only on small screens. */
.menu-btn {
  display: none;
  margin-right: 4px;
}
.drawer-scrim {
  display: none;
}

/* Laptops: tighten the panel column. */
@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 72px 288px 1fr;
  }
}

/* Tablet / small laptop: the panel becomes a slide-in drawer over the preview. */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 16px 24px 48px;
  }
  .hero-copy h1 {
    font-size: 34px;
  }
  .menu-btn {
    display: inline-flex;
  }
  .workspace {
    grid-template-columns: 60px 1fr;
    position: relative;
  }
  .panel-drawer {
    position: absolute;
    top: 0;
    left: 60px;
    bottom: 0;
    width: min(340px, 82vw);
    z-index: 40;
    transform: translateX(-110%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .app.drawer-open .panel-drawer {
    transform: translateX(0);
  }
  .drawer-scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 35;
    animation: fade 0.2s ease;
  }
  .app.drawer-open .drawer-scrim {
    display: block;
  }
  .rail .lbl {
    display: none;
  }
  .rail-btn::after {
    display: none;
  }
}

/* Phone: rail collapses to icons only; header condenses; preview single column. */
@media (max-width: 640px) {
  .app-header {
    padding: 10px 14px;
    gap: 8px;
  }
  .brand-name {
    display: none;
  }
  #new-deck {
    display: none;
  }
  .workspace {
    grid-template-columns: 52px 1fr;
    height: calc(100vh - 57px);
  }
  .rail {
    padding: 8px 4px;
  }
  .rail-btn {
    padding: 9px 2px;
  }
  .preview-grid {
    grid-template-columns: 1fr;
  }
  .stage {
    padding: 14px 14px 32px;
  }
  .feature-chips {
    margin-top: 18px;
  }
  .landing-top {
    padding: 16px 18px;
  }
  .dropzone {
    padding: 34px 20px;
  }
}

/* Very small: hide the MS lockup in the header to save space. */
@media (max-width: 480px) {
  .hero-copy h1 {
    font-size: 28px;
  }
}

