:root {
  --bg: #0a0908;
  --bg-elev: #12100e;
  --card: #181512;
  --ink: #faf6f0;
  --muted: #9e958a;
  --gold: #e0b34e;
  --gold-2: #f0d78c;
  --line: rgba(250, 246, 240, 0.09);
  --chat-w: min(100vw, 360px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Inter", system-ui, sans-serif;
  --display: "Syne", var(--font);
  --radius: 16px;
  --tap: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(224, 179, 78, 0.12), transparent 55%),
    radial-gradient(600px 300px at 0% 100%, rgba(224, 179, 78, 0.06), transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.45;
}
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* —— Logo —— */
.logo, .logo-mini {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  text-decoration: none;
  color: inherit;
  letter-spacing: -0.03em;
}
.logo-brush {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  background: linear-gradient(120deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-works {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  opacity: 0.92;
}
.logo-mini .logo-brush,
.logo-mini .logo-works { font-size: 0.85rem; }

/* —— Top bar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  padding-top: max(0.65rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(10, 9, 8, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.top-cluster {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.icon-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--tap);
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 0.85rem;
  font-weight: 500;
}
.icon-chip.ghost { background: transparent; }
.icon-chip:hover { border-color: rgba(224, 179, 78, 0.45); }
.chip-ico { color: var(--gold); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 1.15rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #1a1408;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.sm { min-height: 38px; padding: 0 0.9rem; font-size: 0.82rem; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.block { width: 100%; }
.btn.publish-now {
  min-height: var(--tap);
  padding: 0 1rem;
  box-shadow: 0 0 0 1px rgba(224, 179, 78, 0.25), 0 8px 24px rgba(224, 179, 78, 0.15);
}

/* —— Chat panel —— */
.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: var(--chat-w);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  animation: slideIn 0.22s ease;
}
@keyframes slideIn {
  from { transform: translateX(12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.chat-head, .modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.chat-head strong { font-family: var(--display); }
.x {
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1.35rem;
  color: var(--muted);
  line-height: 1;
}
.x:hover { color: var(--ink); background: var(--line); }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.bubble {
  max-width: 92%;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  font-size: 0.9rem;
}
.bubble.bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
}
.bubble.user {
  align-self: flex-end;
  background: rgba(224, 179, 78, 0.18);
  border: 1px solid rgba(224, 179, 78, 0.35);
}
.chat-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem;
  padding-bottom: max(0.75rem, var(--safe-b));
  border-top: 1px solid var(--line);
}
.chat-form input {
  flex: 1;
  min-height: var(--tap);
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
}

/* —— Modals —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 0;
  background: rgba(0, 0, 0, 0.62);
}
.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: min(92dvh, 640px);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 0 1rem 1.25rem;
  padding-bottom: max(1.25rem, var(--safe-b));
  animation: up 0.22s ease;
}
.modal-card.wide { max-width: 720px; }
@keyframes up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-card h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  padding-top: 0.25rem;
}
.muted { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 1rem; }
.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.field input {
  min-height: var(--tap);
  padding: 0 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
}
.tiny { font-size: 0.75rem; color: var(--muted); margin-top: 0.75rem; }
.honest { line-height: 1.5; }
.checkline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkline input { width: 18px; height: 18px; accent-color: var(--gold); }
.pub-grid {
  display: grid;
  gap: 1rem;
}
.pub-out {
  min-height: 140px;
  padding: 0.85rem;
  border-radius: 12px;
  background: #070706;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  color: #cfc6b8;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 220px;
}

/* —— Stage / pages —— */
.stage {
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
}
.pages-rail {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pages-rail::-webkit-scrollbar { display: none; }
.page-tab, .page-add {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.02);
}
.page-tab.active {
  color: #1a1408;
  background: var(--gold);
  border-color: transparent;
  font-weight: 600;
}
.page-add {
  width: 38px;
  padding: 0;
  font-size: 1.2rem;
  color: var(--gold);
}
.page { display: none; animation: fade 0.2s ease; }
.page.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.hero-creative {
  text-align: center;
  padding: 1.5rem 0.25rem 1.75rem;
}
.kicker {
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}
.hero-creative h1, .preview-page h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 8vw, 3.25rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  outline: none;
  margin-bottom: 0.75rem;
}
.lede {
  color: var(--muted);
  max-width: 28rem;
  margin: 0 auto 1.25rem;
  outline: none;
  font-size: 1rem;
}
.spark-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.spark {
  min-height: 40px;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.85rem;
}
.spark:hover, .spark:active {
  border-color: rgba(224, 179, 78, 0.5);
  background: rgba(224, 179, 78, 0.1);
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.block-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}
.block {
  text-align: left;
  padding: 1rem 0.9rem;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.02);
  transition: 0.15s ease;
  cursor: pointer;
  min-height: 110px;
}
.block.on {
  border-style: solid;
  border-color: rgba(224, 179, 78, 0.45);
  background: linear-gradient(160deg, rgba(224, 179, 78, 0.12), var(--card));
}
.block .b-ico { font-size: 1.35rem; display: block; margin-bottom: 0.35rem; }
.block h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }
.block p { font-size: 0.78rem; color: var(--muted); }

/* Look / editor */
.look-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.look-bar h2 { font-family: var(--display); font-size: 1.35rem; }
.editor-frame {
  position: relative;
  height: min(70dvh, 580px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background: #111;
}
.editor-frame iframe { width: 100%; height: 100%; border: 0; }
.editor-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 0.85rem;
  text-align: center;
  background: rgba(10, 9, 8, 0.9);
  backdrop-filter: blur(6px);
}
.editor-cover.gone { display: none; }

/* Shop / story previews */
.preview-page {
  padding: 1rem 0.25rem 2rem;
  text-align: center;
}
.product-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 1.25rem 0 1.5rem;
}
.product {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.65rem;
  text-align: left;
}
.product .ph {
  aspect-ratio: 1;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background:
    linear-gradient(145deg, rgba(224, 179, 78, 0.25), transparent),
    #2a241c;
}
.product strong { display: block; font-size: 0.85rem; }
.product span { font-size: 0.75rem; color: var(--muted); }
.story-body {
  max-width: 32rem;
  margin: 0 auto 1.5rem;
  color: var(--muted);
  outline: none;
  text-align: left;
  font-size: 1.05rem;
  line-height: 1.65;
}
.story { text-align: left; }
.story .kicker, .story h2 { text-align: left; }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1rem;
  padding-bottom: max(1.25rem, var(--safe-b));
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
}

/* Desktop */
@media (min-width: 768px) {
  .topbar { padding: 0.75rem 1.5rem; }
  .stage { padding: 1.25rem 1.5rem 4rem; }
  .block-grid { grid-template-columns: repeat(3, 1fr); }
  .modal { place-items: center; padding: 1rem; }
  .modal-card {
    border-radius: 20px;
    padding: 0 1.25rem 1.35rem;
  }
  .pub-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .chip-txt { display: inline; }
  .chat-panel { top: 57px; height: calc(100dvh - 57px); border-radius: 16px 0 0 0; }
}
@media (max-width: 767px) {
  .chip-txt { /* keep short labels on mobile */ }
  .product-row { grid-template-columns: 1fr 1fr 1fr; }
  .product strong { font-size: 0.75rem; }
}
@media (max-width: 380px) {
  .product-row { grid-template-columns: 1fr; }
  .btn.publish-now { padding: 0 0.75rem; }
}
