:root {
  --bg: #16141a;
  --card: #221f28;
  --line: #36313f;
  --text: #f3eff7;
  --muted: #a49cb0;
  --accent: #f2a3c0;
  --accent-ink: #2a1520;
  --error: #ff8a8a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Inter, system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.top h1 { margin: 0; font: italic 500 26px "Playfair Display", serif; }

.screen { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 6px; font-size: 19px; }

.muted { color: var(--muted); margin: 0 0 14px; }
.small { font-size: 13px; }
.error { color: var(--error); margin: 10px 0 0; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
input:not([type]), input[type=password], input[type=number], textarea, select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* stops iOS zoom-on-focus */
}
input[type=range] { width: 100%; margin-top: 8px; accent-color: var(--accent); }
input[type=color] {
  display: block; width: 100%; height: 40px; margin-top: 5px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 3px;
}

button {
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); width: 100%; }
button:disabled { opacity: .4; cursor: default; }
button.ghost { width: 100%; }
.chip { padding: 6px 12px; font-size: 13px; }

.row { display: flex; gap: 10px; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.drop {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  margin-bottom: 14px;
  cursor: pointer;
  overflow: hidden;
  color: var(--muted);
}
.drop img { max-width: 100%; max-height: 320px; display: block; }
.small-drop { min-height: 70px; }

.strip { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.strip .thumb { position: relative; }
.strip img { width: 68px; height: 68px; object-fit: cover; border-radius: 10px; display: block; }
.strip .x {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; padding: 0;
  font-size: 13px; line-height: 22px; background: var(--card);
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font-weight: 500; font-size: 14px; }
.pill .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #fff4; }

.vibe-label { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.vibe-label strong { color: var(--text); }

.banner {
  background: #3a2c12; color: #ffd98a; border-radius: 12px; padding: 10px 14px;
  font-size: 14px; margin-bottom: 16px;
}

.variants { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.variants canvas {
  width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; display: block;
  border: 2px solid transparent; cursor: pointer;
}
.variants canvas.on { border-color: var(--accent); }

.preview-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
#big { width: min(100%, 320px); aspect-ratio: 9 / 16; border-radius: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center;
}

.loading { position: relative; color: transparent !important; }
.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid var(--accent-ink); border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- accounts & groups ---------- */

.title-btn { all: unset; cursor: pointer; font: inherit; }
button.link {
  background: none; border: 0; padding: 8px 0; color: var(--accent); font-weight: 600; width: auto;
}
button.spaced { margin-top: 10px; }
button.danger, .danger-text { color: var(--error); }
button.small { padding: 7px 12px; font-size: 13px; width: auto; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg); padding: 4px; border-radius: 999px; }
.tab { flex: 1; border: 0; padding: 9px; }
.tab.on { background: var(--card); }

.banner.info { background: #1f2c3a; color: #a9d4ff; }

.code-box {
  font: 600 22px/1.3 "Space Mono", monospace; letter-spacing: .06em; text-align: center;
  padding: 16px; margin: 6px 0 12px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--accent);
  user-select: all; word-break: break-all;
}
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); margin: 14px 0; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.callout { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.callout p { margin: 0 0 10px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.list li:first-child { border-top: 0; }
.list .icon { width: 18px; flex: none; text-align: center; }
.list .sub { color: var(--muted); font-size: 13px; display: block; }

.list-buttons { display: grid; gap: 8px; margin-bottom: 14px; }
.list-buttons button {
  text-align: left; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.list-buttons .tag { font-size: 12px; font-weight: 500; color: var(--muted); }

.member { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.member:first-child { border-top: 0; }
.member .actions { display: flex; gap: 6px; }

details { margin-top: 10px; }
summary { cursor: pointer; padding: 8px 0; font-weight: 600; }

.prose p, .prose li { color: var(--text); }
.prose ol, .prose ul { padding-left: 20px; margin: 8px 0; }
.prose li { margin-bottom: 8px; }

.steps { padding-left: 20px; margin: 6px 0 12px; font-size: 14px; }
.steps li { margin-bottom: 6px; }
.steps a { color: var(--accent); }
.provider-pick { display: flex; gap: 8px; margin-bottom: 12px; }
.provider-pick button { flex: 1; padding: 10px; border-radius: 12px; text-align: left; font-weight: 500; font-size: 14px; }
.provider-pick button.on { border-color: var(--accent); background: #f2a3c01a; }
.provider-pick strong { display: block; font-size: 15px; }
.status-line { padding: 10px 12px; border-radius: 10px; background: var(--bg); margin-bottom: 12px; font-size: 14px; }

/* ---------- reels ---------- */

.mode-tabs { margin-bottom: 16px; }
.strip .badge {
  position: absolute; left: 4px; bottom: 4px; font-size: 10px; line-height: 1;
  background: #000a; color: #fff; padding: 3px 5px; border-radius: 6px;
}
#reel-canvas { width: min(100%, 320px); aspect-ratio: 9 / 16; border-radius: 12px; background: #000; }
progress { width: 100%; height: 8px; accent-color: var(--accent); margin-bottom: 8px; }

/* ---------- words choice ---------- */

.field-title { margin: 4px 0 8px; font-size: 14px; color: var(--muted); }
.choice { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.choice button { padding: 8px 14px; font-size: 14px; font-weight: 500; }
.choice button.on { border-color: var(--accent); background: #f2a3c01a; color: var(--text); }

/* ---------- drag & edit ---------- */

.stage { position: relative; width: min(100%, 320px); touch-action: none; }
.stage #big { width: 100%; display: block; }
.sel-box { position: absolute; border: 2px dashed #fff; border-radius: 6px; box-shadow: 0 0 0 1px #0006; pointer-events: none; }
.sticker-del {
  position: absolute; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: var(--error); color: #fff; border: 0; font-size: 18px; line-height: 28px; transform: translate(-50%, -50%);
}
.center { text-align: center; }
.sticker-tray { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 14px; }
.sticker-tray button { width: auto; font-size: 22px; padding: 6px 8px; border-radius: 10px; line-height: 1; }

/* ---------- copies & ideas ---------- */

.group-title { margin: 6px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.variants.ideas { grid-template-columns: repeat(3, 1fr); margin-bottom: 4px; }
.variants figure { margin: 0; }
.variants figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }
