:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --text: #16151a;
  --muted: #6b6873;
  --border: #dedad1;
  --accent: #ff3b5c;
  --accent-ink: #ffffff;
  --accent-2: #19c3c0;
  --ok: #138a52;
  --warn: #b35c00;
  --err: #c9253f;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e12;
    --surface: #18171d;
    --surface-2: #222129;
    --text: #f3f1ec;
    --muted: #9a97a3;
    --border: #2d2b35;
    --accent: #ff4d6b;
    --accent-2: #2ad4d0;
    --ok: #3ccf8a;
    --warn: #f0a24a;
    --err: #ff6b82;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.hidden { display: none !important; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent-2) 0 50%, var(--accent) 50% 100%);
  transform: rotate(12deg);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}

.account-name { min-width: 0; line-height: 1.2; }
.account-name strong, .account-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name span { color: var(--muted); font-size: 13px; }

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-primary:hover:not(:disabled) { background: var(--text); opacity: 0.88; }

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-accent:hover:not(:disabled) { background: var(--accent); opacity: 0.9; }

.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn-block { width: 100%; }

/* Landing */
.hero {
  padding: 56px 0 40px;
  display: grid;
  gap: 32px;
}

.hero h1 {
  font-size: clamp(40px, 9vw, 76px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead { font-size: 19px; color: var(--muted); max-width: 520px; margin: 18px 0 28px; }

.fine { font-size: 13px; color: var(--muted); margin-top: 12px; }

.steps {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  padding: 0;
  margin: 0 0 56px;
  list-style: none;
  counter-reset: step;
}

.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}

.steps h3 { font-size: 18px; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }

@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}

/* Cards and layout */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.composer {
  display: grid;
  gap: 16px;
  padding: 16px 0 40px;
}

@media (min-width: 860px) {
  .composer { grid-template-columns: 340px 1fr; align-items: start; }
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }

.label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.help { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

.posting-to {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 22px;
}

.posting-to .avatar { width: 40px; height: 40px; }
.posting-to small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  aspect-ratio: 9 / 16;
  max-height: 560px;
  width: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
}

.dropzone.drag { border-color: var(--accent); }
.dropzone.has-video { border-style: solid; padding: 0; background: #000; cursor: default; }
.dropzone video { width: 100%; height: 100%; object-fit: contain; }
.dropzone strong { display: block; font-size: 17px; margin-bottom: 4px; }
.dropzone span { color: var(--muted); font-size: 14px; }

.video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.video-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inputs */
textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

textarea { min-height: 110px; resize: vertical; }

textarea:focus, select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent); }

.counter { text-align: right; font-size: 13px; color: var(--muted); margin-top: 4px; }

.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.check.disabled { opacity: 0.45; cursor: not-allowed; }
.check.disabled small { font-size: 12px; color: var(--muted); }

.check-block {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  margin-top: 10px;
}

.check-block input { width: 18px; height: 18px; accent-color: var(--accent); margin: 3px 0 0; flex: none; }
.check-block strong { display: block; }
.check-block span { color: var(--muted); font-size: 14px; }

/* Switch */
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.switch {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
}

.switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.15s ease;
}

.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Notices */
.notice {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.notice.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.notice.err { border-color: color-mix(in srgb, var(--err) 45%, transparent); color: var(--err); }
.notice.label-note { margin-top: 10px; color: var(--text); }

.inline-err { color: var(--err); font-size: 14px; margin-top: 8px; }

.declaration { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.declaration a { color: var(--text); font-weight: 600; }

.missing { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.missing li::before { content: "\2022  "; color: var(--accent); }

.post-wrap { position: relative; }
.post-wrap[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 280px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  z-index: 5;
  text-align: center;
}

/* Skeleton */
.skeleton { display: grid; gap: 12px; padding: 24px 0; }
.skeleton div { height: 18px; border-radius: 8px; background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; }
.skeleton div:nth-child(2) { width: 70%; }
.skeleton div:nth-child(3) { width: 45%; }

@keyframes pulse { 50% { opacity: 0.5; } }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal h2 { font-size: 24px; margin-bottom: 14px; }

.summary { margin: 0 0 18px; display: grid; gap: 8px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; font-size: 15px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 600; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Status */
.status-view { max-width: 520px; margin: 24px auto 56px; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 14px 0 6px;
}

.progress div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.2s ease;
}

.timeline { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.timeline li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.timeline li::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex: none;
}
.timeline li.active { color: var(--text); font-weight: 600; }
.timeline li.active::before { border-color: var(--accent); animation: pulse 1s infinite; }
.timeline li.done { color: var(--text); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.failed { color: var(--err); font-weight: 600; }
.timeline li.failed::before { background: var(--err); border-color: var(--err); }

/* History */
.history { padding-bottom: 48px; }
.history ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
}
.history li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.badge.ok { color: var(--ok); }
.badge.err { color: var(--err); }

/* Footer and legal */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer a { color: var(--muted); }

.legal { max-width: 720px; padding: 24px 0 56px; }
.legal h1 { font-size: clamp(32px, 7vw, 48px); margin-bottom: 8px; }
.legal h2 { font-size: 22px; margin: 32px 0 8px; }
.legal p, .legal li { color: var(--text); }
.legal .fine { margin-bottom: 24px; }

/* Inside the Storycoin page's iframe: just the composer */
.embed .topbar .brand, .embed .footer, .embed .history { display: none; }
.embed .wrap { padding: 0 12px; }
.embed body { background: transparent; }
