:root,
[data-theme="light"] {
  --bg: #f5f3ef;
  --surface: rgba(249, 248, 245, .72);
  --surface-solid: #f9f8f5;
  --surface2: rgba(253, 252, 250, .8);
  --surface2-solid: #fdfcfa;
  --offset: #ede9e3;
  --divider: #ddd9d2;
  --border: rgba(205, 200, 192, .6);
  --border-solid: #cdc8c0;
  --text: #1e1c17;
  --muted: #6b6860;
  --faint: #aaa89f;
  --accent: #b08060;
  --accent-l: rgba(242, 232, 222, .7);
  --accent-l-solid: #f2e8de;
  --success: #437a22;
  --success-l: #d4dfcc;
  --tag-bg: rgba(240, 237, 232, .7);
  --mono: 'DM Mono', monospace;
  --glass-border: rgba(255, 255, 255, .35);
  --glass-shine: rgba(255, 255, 255, .12);
  --r-sm: .375rem;
  --r-md: .5rem;
  --r-lg: .75rem;
  --r-xl: 1rem;
  --r-2xl: 1.25rem;
  --r-3xl: 1.5rem;
  --r-full: 9999px;
  --tr: .2s ease-in-out;
  --tr-bounce: .3s cubic-bezier(.34, 1.56, .64, 1);
  --sh-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --sh-md: 0 4px 6px -1px rgba(0, 0, 0, .07), 0 2px 4px -1px rgba(0, 0, 0, .04);
  --sh-lg: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -2px rgba(0, 0, 0, .03);
  --fd: 'Playfair Display', Georgia, serif;
  --fb: 'DM Sans', system-ui, sans-serif;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased
}

body {
  min-height: 100dvh;
  font-family: var(--fb);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

img {
  display: block;
  max-width: 100%;
  height: auto
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit
}

h1,
h2,
h3,
h4 {
  font-family: var(--fd);
  line-height: 1.2;
  text-wrap: balance;
  margin: 0;
}

p {
  text-wrap: pretty
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--r-sm)
}

.lucide {
  display: inline-block;
  vertical-align: middle;
  width: 1.2em;
  height: 1.2em;
  stroke-width: 2.2
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================================
   HEADER — Glassmorphic
   ================================================================ */
.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  padding: .875rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between
}

.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit
}

.logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: transform var(--tr)
}

.logo:hover .logo-mark {
  transform: rotate(-8deg) scale(1.08)
}

.logo-name {
  font-family: var(--fd);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -.02em
}

.logo-name span {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: .75rem
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .45rem .9rem;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all var(--tr);
}

.nav-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-l);
  transform: translateY(-1px);
}

.nb-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  border-radius: var(--r-full);
  background: var(--primary-l);
  border: 1.5px solid var(--primary);
  font-size: .72rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .04em;
  text-transform: uppercase
}

.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all var(--tr)
}

.theme-btn:hover {
  color: var(--text);
  background: var(--offset);
  transform: rotate(20deg)
}

/* ================================================================
   LAYOUT
   ================================================================ */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 2rem 2rem;
  gap: 2rem
}

@media(max-width:960px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 1rem .85rem;
    gap: 1.25rem
  }
}

/* ================================================================
   PROGRESS — Clickable, animated gradient
   ================================================================ */
.prog-wrap {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-top: .65rem;
  margin-bottom: .25rem
}

.prog-bar-o {
  height: 4px;
  background: var(--offset);
  border-radius: var(--r-full);
  overflow: hidden
}

.prog-bar-i {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  background-size: 200% 100%;
  animation: shimmer-bar 3s linear infinite;
  transition: width .5s cubic-bezier(.16, 1, .3, 1)
}

@keyframes shimmer-bar {
  0% {
    background-position: 0% 50%
  }
  100% {
    background-position: 200% 50%
  }
}

.prog-steps {
  display: flex;
  align-items: center;
  gap: 0
}

.prog-step {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .68rem;
  color: var(--faint);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  cursor: default;
  transition: color var(--tr);
  position: relative
}

.prog-step.clickable {
  cursor: pointer
}

.prog-step.clickable:hover {
  color: var(--primary)
}

.prog-step.active {
  color: var(--primary)
}

.prog-step.done {
  color: var(--muted)
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-solid);
  flex-shrink: 0;
  transition: all var(--tr);
  position: relative
}

.prog-step.clickable:hover .step-dot {
  transform: scale(1.3);
  box-shadow: var(--sh-glow)
}

.prog-step.active .step-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l-solid);
  animation: pulse-dot 2s ease-in-out infinite
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--primary-l-solid)
  }
  50% {
    box-shadow: 0 0 0 6px transparent
  }
}

.prog-step.done .step-dot {
  background: var(--accent)
}

.prog-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

/* ================================================================
   WIZARD
   ================================================================ */
.wiz {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0
}

.wiz-title {
  font-size: clamp(1.4rem, 0.95rem+1.6vw, 2.05rem);
  font-weight: 500;
  letter-spacing: -.02em;
  margin: 0 0 .25rem 0;
  background: linear-gradient(135deg, var(--text), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

.wiz-sub {
  font-size: .88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
  max-width: 620px
}

/* ================================================================
   CARDS — Glassmorphic
   ================================================================ */
.qcard {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-3xl);
  padding: 1.35rem 1.6rem;
  box-shadow: var(--sh-md);
  display: none;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  min-height: 440px;
  width: 100%;
  box-sizing: border-box;
}


.qcard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent)
}

.qcard.vis {
  display: flex;
  animation: cardIn .45s cubic-bezier(.16, 1, .3, 1)
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.98)
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1)
  }
}

.q-eye {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  font-weight: 700;
  margin-bottom: .15rem
}

.q-label {
  font-size: 1.18rem;
  font-family: var(--fd);
  font-weight: 500;
  margin-top: .15rem;
  margin-bottom: .2rem
}

.q-hint {
  font-size: .84rem;
  color: var(--muted);
  margin-top: .1rem
}

/* SECTION DIVIDER inside card */
.q-section {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  padding: .35rem 0 .2rem;
  border-top: 1px solid var(--divider);
  margin-top: .15rem
}

/* ================================================================
   PILLS — with bounce
   ================================================================ */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem
}

.pill {
  padding: .45rem 1.05rem;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  font-size: .84rem;
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--fb);
  transition: all var(--tr)
}

.pill:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-l);
  transform: translateY(-1px)
}

.pill.sel,
.pill.msel {
  border-color: var(--primary);
  background: var(--primary-l);
  color: var(--primary);
  font-weight: 500;
  transform: scale(1);
  animation: pillPop .3s cubic-bezier(.34, 1.56, .64, 1)
}

@keyframes pillPop {
  0% {
    transform: scale(1)
  }
  50% {
    transform: scale(1.06)
  }
  100% {
    transform: scale(1)
  }
}

/* ================================================================
   THUMBNAILS
   ================================================================ */
.thumb-row {
  display: flex;
  gap: .625rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scrollbar-width: thin;
  scroll-snap-type: x mandatory;
}

.thumb {
  flex-shrink: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 2.5px solid transparent;
  cursor: pointer;
  position: relative;
  transition: all var(--tr);
  scroll-snap-align: start;
}

.thumb:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md)
}

.thumb.sel {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l-solid), var(--sh-glow)
}

.thumb img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  transition: transform .4s ease
}

.thumb:hover img {
  transform: scale(1.08)
}

.thumb-lbl {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(10, 8, 5, .78));
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
  padding: .2rem .4rem;
  text-align: center;
  letter-spacing: .05em;
  text-transform: uppercase
}

.thumb-chk {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: .65rem
}

.thumb.sel .thumb-chk {
  display: flex
}

/* ================================================================
   SWATCHES — Larger
   ================================================================ */
.swatch-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem
}

.swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem
}

.swatch {
  width: 54px;
  height: 54px;
  border-radius: var(--r-lg);
  border: 2.5px solid transparent;
  cursor: pointer;
  position: relative;
  transition: all var(--tr-bounce)
}

.swatch:hover {
  transform: scale(1.12);
  box-shadow: var(--sh-md)
}

.swatch.sel {
  border-color: var(--text);
  box-shadow: var(--sh-md), var(--sh-glow);
  transform: scale(1.05)
}

.swatch-chk {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center
}

.swatch.sel .swatch-chk {
  display: flex
}

.swatch-name {
  font-size: .58rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  max-width: 58px;
  line-height: 1.2
}

/* Live palette strip */
.palette-strip {
  display: flex;
  gap: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  height: 36px;
  margin-top: .75rem;
  box-shadow: var(--sh-sm);
  transition: all var(--tr)
}

.palette-strip:empty {
  display: none
}

.palette-chip {
  flex: 1;
  min-width: 40px;
  position: relative;
  transition: all .3s ease
}

.palette-chip-label {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  color: #fff
}

/* ================================================================
   SLIDERS
   ================================================================ */
.slider-block {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--muted)
}

.slider-row {
  display: flex;
  align-items: center;
  gap: .75rem
}

input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: var(--offset);
  border-radius: var(--r-full);
  outline: none;
  cursor: pointer
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: 3px solid var(--surface-solid);
  box-shadow: var(--sh-sm);
  transition: transform var(--tr)
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15)
}

.sv {
  min-width: 32px;
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-l);
  padding: 3px 6px;
  border-radius: var(--r-sm);
  font-family: var(--mono)
}

/* ================================================================
   TEXTAREA
   ================================================================ */
.q-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: .75rem 1rem;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--fb);
  font-size: .95rem;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--tr), box-shadow var(--tr)
}

.q-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l-solid)
}

.q-textarea::placeholder {
  color: var(--faint)
}

/* ================================================================
   NAV BUTTONS
   ================================================================ */
.card-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .5rem
}

.btn-ghost {
  padding: .55rem 1.1rem;
  border-radius: var(--r-lg);
  font-size: .85rem;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: all var(--tr)
}

.btn-ghost:hover {
  background: var(--offset);
  color: var(--text);
  transform: translateX(-2px)
}

.btn-next {
  padding: .65rem 1.5rem;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 80%, var(--accent)));
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--sh-sm);
  transition: all var(--tr)
}

.btn-next:hover {
  box-shadow: var(--sh-md), var(--sh-glow);
  transform: translateY(-2px)
}

.btn-gen {
  padding: 1rem 2rem;
  border-radius: var(--r-xl);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  background-size: 200% 200%;
  animation: shimmer-bar 3s linear infinite;
  box-shadow: var(--sh-md);
  transition: all var(--tr)
}

.btn-gen:hover {
  box-shadow: var(--sh-lg), var(--sh-glow);
  transform: translateY(-2px)
}

.btn-gen:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  animation: none
}

/* ================================================================
   RIGHT PANEL
   ================================================================ */
.rpanel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem
}

.sticky-right {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px
}

@media(max-width:960px) {
  .sticky-right {
    position: static;
    max-height: none
  }
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0
  }
  to {
    transform: scale(1);
    opacity: 1
  }
}

/* ================================================================
   SUMMARY — Glassmorphic
   ================================================================ */
.sum-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-3xl);
  padding: 1.25rem;
  box-shadow: var(--sh-sm);
  position: relative
}

.sum-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent)
}

.sum-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .875rem;
  display: flex;
  align-items: center;
  gap: .5rem
}

.sum-rows {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.sum-row {
  display: flex;
  gap: .6rem;
  align-items: flex-start
}

.sum-k {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  min-width: 72px;
  padding-top: 2px;
  flex-shrink: 0
}

.sum-v {
  font-size: .78rem;
  color: var(--muted);
  transition: color var(--tr)
}

.sum-v.filled {
  color: var(--text)
}

/* ================================================================
   OUTPUT CARD — Glassmorphic
   ================================================================ */
.out-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-3xl);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  position: relative
}

.out-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent);
  z-index: 1
}

.out-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--divider);
  background: var(--surface2)
}

.out-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem
}

.out-body {
  padding: 1.25rem;
  min-height: 100px
}

/* Prompt Tabs */
.ptabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  padding: .625rem 1.25rem;
  border-bottom: 1px solid var(--divider);
  background: var(--offset)
}

.ptab {
  padding: .28rem .7rem;
  border-radius: var(--r-full);
  font-size: .7rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--tr)
}

.ptab:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px)
}

.ptab.active {
  border-color: var(--primary);
  background: var(--primary-l);
  color: var(--primary)
}

/* Prompt Sections */
.prompt-section {
  display: none;
  flex-direction: column;
  gap: 1rem
}

.prompt-section.vis {
  display: flex;
  animation: cardIn .3s ease
}

.prompt-block {
  display: flex;
  flex-direction: column;
  gap: .4rem
}

.pb-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .4rem
}

.pb-label svg {
  flex-shrink: 0
}

.pb-text {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--tag-bg);
  padding: .75rem 1rem;
  border-radius: var(--r-lg);
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
  word-break: break-word
}

.pb-text[contenteditable="true"] {
  outline: none;
  border-left: 3px solid var(--accent);
  border-right: 1px dashed rgba(212, 160, 23, 0.4);
  border-top: 1px dashed rgba(212, 160, 23, 0.2);
  border-bottom: 1px dashed rgba(212, 160, 23, 0.2);
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.pb-text[contenteditable="true"]:hover {
  border-right-color: var(--accent);
  border-top-color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.pb-text[contenteditable="true"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.25);
  background: var(--surface);
}

.pb-edit-hint {
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.pb-text mark {
  background: var(--primary-l);
  color: var(--primary);
  border-radius: 2px;
  padding: 0 2px
}

/* Placeholder & Thinking */
.ph {
  color: var(--faint);
  font-size: .84rem;
  font-style: italic;
  line-height: 1.7;
  padding: .5rem 0
}

.thinking {
  display: none;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .84rem;
  padding: .5rem 0
}

.thinking.vis {
  display: flex
}

.td {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: boing 1.2s ease-in-out infinite
}

.td:nth-child(2) {
  animation-delay: .2s
}

.td:nth-child(3) {
  animation-delay: .4s
}

@keyframes boing {
  0%,
  80%,
  100% {
    transform: scale(1)
  }
  40% {
    transform: scale(1.5)
  }
}

/* Copy Buttons */
.btn-copy {
  padding: .35rem .8rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-size: .72rem;
  color: var(--muted);
  display: none;
  align-items: center;
  gap: .35rem;
  cursor: pointer;
  transition: all var(--tr)
}

.btn-copy:hover {
  background: var(--offset);
  color: var(--text)
}

.btn-copy.ok {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-l)
}

.btn-copy-all {
  display: none;
  margin: .75rem 1.25rem 1.25rem;
  padding: .7rem;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  font-size: .78rem;
  font-weight: 600;
  background: var(--primary-l);
  width: calc(100% - 2.5rem);
  cursor: pointer;
  transition: all var(--tr)
}

.btn-copy-all:hover {
  background: var(--primary);
  color: #fff
}

.btn-copy-all.vis {
  display: block
}

/* ================================================================
   RATIONALE CARD
   ================================================================ */
.rat-card {
  background: var(--accent-l);
  border: 1px solid var(--accent);
  border-radius: var(--r-3xl);
  padding: 1.25rem 1.5rem;
  display: none;
  flex-direction: column;
  gap: .875rem
}

.rat-card.vis {
  display: flex;
  animation: cardIn .3s ease
}

.rat-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent)
}

.rat-row {
  display: flex;
  flex-direction: column;
  gap: .2rem
}

.rat-k {
  font-size: .7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .06em
}

.rat-v {
  font-size: .8rem;
  color: var(--text);
  line-height: 1.55
}

/* ================================================================
   TEXTURE PREVIEW STRIP (Step 5)
   ================================================================ */
.tex-preview {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding: .5rem 0 .25rem;
  scrollbar-width: thin;
  min-height: 60px;
  align-items: flex-start;
  flex-wrap: nowrap
}

.tex-card {
  min-width: 130px;
  max-width: 150px;
  background: var(--surface2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--tr);
  flex-shrink: 0;
  animation: popIn .35s cubic-bezier(.34, 1.56, .64, 1)
}

.tex-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md)
}

.tex-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 75%;
  overflow: hidden;
  background: var(--offset)
}

.tex-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease
}

.tex-card:hover .tex-img-wrap img {
  transform: scale(1.06)
}

.tex-img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  color: var(--faint);
  text-align: center;
  padding: .5rem;
  font-style: italic;
  line-height: 1.4
}

.tex-label {
  padding: .4rem .6rem .1rem;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.tex-badge {
  font-size: .56rem;
  color: var(--muted);
  padding: 0 .6rem .5rem;
  font-style: italic
}

.tex-empty {
  font-size: .8rem;
  color: var(--muted);
  padding: .25rem 0;
  font-style: italic
}

.tex-attrib {
  margin-top: .3rem;
  font-size: .65rem;
  color: var(--faint)
}

.sum-card .tex-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  overflow: visible;
  min-height: auto;
  padding: 0;
}

.sum-card .tex-card {
  width: calc(50% - 0.25rem);
  min-width: 0;
  max-width: none;
  flex-shrink: 0;
}

/* Export MD Button */
.btn-export-md {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--r-lg);
  background: var(--accent-l);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr);
  white-space: nowrap;
  margin-top: .5rem
}

.btn-export-md:hover {
  background: var(--accent);
  color: #fff
}

.btn-export-md svg {
  flex-shrink: 0
}

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  background: var(--text);
  color: var(--bg);
  padding: .75rem 1.25rem;
  border-radius: var(--r-lg);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--sh-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s cubic-bezier(.16, 1, .3, 1);
  pointer-events: none
}

.toast.show {
  opacity: 1;
  transform: translateY(0)
}

/* ================================================================
   MATERIAL HOVER PREVIEW CARD
   ================================================================ */
.material-hover-card {
  position: fixed;
  z-index: 1000;
  width: 150px;
  background: var(--surface2);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: 0.5rem;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.material-hover-card.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.hover-card-img-wrap {
  width: 100%;
  padding-top: 100%;
  /* Square aspect ratio */
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--offset);
}

.hover-card-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hover-card-info {
  padding: 0.2rem 0.4rem;
}

.hover-card-title {
  font-family: var(--fb);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.hover-card-badge {
  font-size: 0.62rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.1rem;
}

/* ================================================================
   COLOR CATEGORIES & FILTER BAR
   ================================================================ */
.color-section-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.color-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--divider);
}

.filter-btn {
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--tr);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-l);
}

.filter-btn.active {
  border-color: var(--primary);
  background: var(--primary-l);
  color: var(--primary);
  font-weight: 500;
}

/* Add custom swatch style */
.swatch-item-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.swatch-add-btn {
  width: 54px;
  height: 54px;
  border-radius: var(--r-lg);
  border: 2px dashed var(--border-solid);
  background: var(--surface2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--tr-bounce);
}

.swatch-add-btn:hover {
  transform: scale(1.12);
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-l);
  box-shadow: var(--sh-md);
}

.swatch-add-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

/* Custom color modal */
.custom-color-dialog {
  border: 1px solid var(--glass-border);
  border-radius: var(--r-3xl);
  background: var(--surface-solid);
  box-shadow: var(--sh-lg);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 2rem);
  margin: auto;
  color: var(--text);
  overflow: hidden;
  outline: none;
}

/* Modern dialog backdrop styling */
.custom-color-dialog::backdrop {
  background-color: rgba(20, 18, 16, 0.6);
  backdrop-filter: blur(8px);
}

.dialog-content {
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--divider);
}

.dialog-header h3 {
  font-size: 1.25rem;
  font-family: var(--fd);
  font-weight: 500;
}

.close-dialog-btn {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--tr);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-dialog-btn:hover {
  color: var(--text);
  background: var(--offset);
}

.dialog-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 60dvh;
  overflow-y: auto;
}

/* Tabs inside Modal */
.input-tabs {
  display: flex;
  border-radius: var(--r-md);
  background: var(--offset);
  padding: 0.25rem;
  gap: 0.25rem;
}

.tab-btn {
  flex: 1;
  padding: 0.45rem;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--tr);
}

.tab-btn.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--sh-sm);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.hex-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Styling native color picker */
input[type="color"] {
  -webkit-appearance: none;
  border: 1.5px solid var(--border);
  width: 48px;
  height: 40px;
  border-radius: var(--r-md);
  cursor: pointer;
  background: none;
  padding: 0;
  overflow: hidden;
  transition: border-color var(--tr);
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: var(--r-md);
}

.ral-select,
.dialog-body input[type="text"] {
  flex: 1;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 0.75rem;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--fb);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.ral-select:focus,
.dialog-body input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l-solid);
}

/* Preview Box inside Dialog */
.color-preview-box-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--r-lg);
  background: var(--offset);
  border: 1px dashed var(--border-solid);
}

.color-preview-box {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-preview-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.preview-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.preview-hex {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--divider);
  background: var(--offset);
}

.btn-secondary {
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all var(--tr);
}

.btn-secondary:hover {
  background: var(--offset);
  color: var(--text);
}

.btn-primary {
  padding: 0.55rem 1.25rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  transition: all var(--tr);
}

.btn-primary:hover {
  background: var(--primary-h);
  box-shadow: var(--sh-sm);
}

/* ================================================================
   ENGINE SWITCH (Nano Banana / Midjourney)
   ================================================================ */
.engine-switch {
  display: flex;
  background: var(--offset);
  border-radius: var(--r-full);
  padding: 0.2rem;
  border: 1px solid var(--border);
  gap: 0.15rem;
}

.engine-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--tr);
}

.engine-btn:hover {
  color: var(--text);
}

.engine-btn.active {
  background: var(--surface-solid);
  color: var(--primary);
  box-shadow: var(--sh-sm);
}

.engine-btn.active svg {
  color: var(--primary);
}

/* ================================================================
   MOBILE TWEAKS
   ================================================================ */
@media(max-width:640px) {
  .hdr {
    padding: .75rem 1rem
  }

  .nb-badge {
    display: none
  }

  .pill {
    padding: .5rem 1rem;
    font-size: .82rem
  }

  .swatch {
    width: 48px;
    height: 48px
  }

  .thumb img {
    width: 78px;
    height: 78px
  }

  .qcard {
    min-height: 420px;
  }
}

/* ================================================================
   FOOTER
   ================================================================ */
.ftr {
  margin-top: auto;
  padding: 2.5rem 2rem;
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--divider);
}

.ftr a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--tr);
}

.ftr a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ================================================================
   SHARED ONBOARDING INTRO BANNER
   ================================================================ */
.intro-banner {
  background: linear-gradient(135deg, var(--primary-l), var(--accent-l));
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  margin-bottom: 20px;
}

.intro-banner-icon {
  font-size: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.intro-banner-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}

.intro-banner-text strong {
  color: var(--primary);
}

.intro-banner-close {
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border: none;
  background: transparent;
  border-radius: 4px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.intro-banner-close:hover {
  color: var(--text);
  background: var(--surface2);
}

/* ================================================================
   SHARED IMAGE GENERATOR CARD & LIGHTBOX
   ================================================================ */
.image-gen-card {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.2rem;
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.gen-settings-toggle {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gen-settings-toggle:hover {
  color: var(--primary);
}

.gen-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--r-md);
  padding: 0.85rem;
  margin-top: 5px;
  border: 1px dashed var(--border);
}

[data-theme="dark"] .gen-settings-panel {
  background: rgba(255, 255, 255, 0.02);
}

.gen-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gen-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.gen-info {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

@keyframes rotateSeal {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--r-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  header, footer, .sidebar, .nav-btn, button, .gen-settings-toggle, #imageGenContainer, .toast, .q-eye, .step-badge, .q-hint, .btn-ghost, .btn-next, .btn-gen, #progSteps, #cfProgressWrap, .progress-container, .left-panel, .rpanel-nav, .top-nav, .rpanel-header {
    display: none !important;
  }
  .qcard {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    min-height: 0 !important;
  }
  .prompt-section, .prompt-block, .pb-text, .pb-wrap {
    background: #f3f4f6 !important;
    border: 1px solid #d1d5db !important;
    color: #000000 !important;
    box-shadow: none !important;
  }
  .qcard:not(.vis) {
    display: none !important;
  }
}

.wiz-foot {
  position: sticky !important;
  bottom: 0 !important;
  background: var(--bg) !important;
  z-index: 100 !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  margin-top: 8px !important;
  border-top: 1px solid var(--divider) !important;
  box-shadow: 0 -10px 20px -10px rgba(0,0,0,0.5) !important;
}

@keyframes sumHighlight {
  0% {
    box-shadow: var(--sh-lg);
    border-color: var(--divider);
  }
  30% {
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.4), var(--sh-lg);
    border-color: var(--primary) !important;
  }
  100% {
    box-shadow: var(--sh-lg);
    border-color: var(--divider);
  }
}

.sum-flash {
  animation: sumHighlight 0.8s ease-out;
}


