/* Clubface builder: calm and plain. One blue for actions, white cards on a soft grey page. */
[hidden] { display: none !important; }
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #17202b;
  --ink-2: #4a5462;
  --muted: #6b7583;
  --line: #e1e6ec;
  --soft: #eef1f5;
  --accent: #0a5bd3;
  --accent-hover: #084ab0;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fc;
  --ok: #157347;
  --warn-bg: #fff4dc;
  --warn-ink: #7a4b00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1318; --panel: #161c23; --ink: #e9eef4; --ink-2: #b9c2cd; --muted: #8b96a3; --line: #28313b;
    --soft: #1e252e; --accent: #4f8ff0; --accent-hover: #6da2f3; --accent-ink: #0e1318; --accent-soft: #1a2a42;
    --ok: #5cc68a; --warn-bg: #3a2e12; --warn-ink: #f2d38a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1318; --panel: #161c23; --ink: #e9eef4; --ink-2: #b9c2cd; --muted: #8b96a3; --line: #28313b;
  --soft: #1e252e; --accent: #4f8ff0; --accent-hover: #6da2f3; --accent-ink: #0e1318; --accent-soft: #1a2a42;
  --ok: #5cc68a; --warn-bg: #3a2e12; --warn-ink: #f2d38a; --shadow: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
code { font: 12.5px ui-monospace, Menlo, Consolas, monospace; background: var(--soft); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
b { font-weight: 600; }
.muted { display: block; font-size: 13px; color: var(--muted); }
.muted.inline { display: inline; }

/* ---------- top bar ---------- */
.top { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; white-space: nowrap; }
.mark { width: 30px; height: 30px; flex: none; color: var(--ink); }
.top-tools { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sync { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- buttons and controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border: 1px solid var(--accent);
  border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 15px; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: var(--panel); color: var(--accent); border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; }
.link:hover { text-decoration: underline; }
.btn:focus-visible, .link:focus-visible, .seg button:focus-visible, .steps button:focus-visible, .row-main:focus-visible, .block-head:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.seg button { flex: 1 1 auto; border: 0; background: none; padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.seg.wide { display: flex; margin-bottom: 14px; }
.seg.opts { display: flex; flex-wrap: wrap; }
.seg.opts button { padding: 7px 8px; font-size: 13.5px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 40px; height: 24px; border-radius: 24px; background: var(--line); position: relative; transition: background .2s; }
.switch span:after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span:after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: block; margin-top: 16px; font-size: 14px; font-weight: 600; }
.field input, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-weight: 400; background: var(--panel); color: var(--ink); }
.field input:focus, textarea:focus, .media-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field small { display: block; margin-top: 6px; font-size: 13px; font-weight: 400; color: var(--muted); }
.page-pick { margin: 0 0 20px; padding: 12px 14px; border-radius: var(--radius); background: var(--soft); font-size: 13px; color: var(--muted); }
.page-pick select { display: block; width: 100%; margin-top: 6px; padding: 10px 36px 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); background: var(--panel); appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 18px center, right 13px center; background-size: 5px 5px; background-repeat: no-repeat; }
.page-pick select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { font: 12px/1.4 ui-monospace, Menlo, monospace; margin: 10px 0; }

.warn { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
.ok { margin: 10px 0 0; color: var(--ok); font-size: 14px; font-weight: 600; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 420px 1fr; height: calc(100% - 60px); }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.steps button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 2px; border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.steps button:hover { background: var(--soft); }
.steps .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); font-size: 13px; }
.steps button.on { color: var(--accent); }
.steps button.on .n { background: var(--accent); color: var(--accent-ink); }

.step { flex: 1; overflow-y: auto; padding: 22px 20px 0; }
.step h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.lead { margin: 0 0 18px; color: var(--ink-2); }
.note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.empty-note { padding: 18px; border-radius: var(--radius); background: var(--soft); color: var(--ink-2); text-align: center; }
.step-foot { position: sticky; bottom: 0; margin: 22px -20px 0; padding: 14px 20px 18px; background: linear-gradient(transparent, var(--panel) 30%); }
.card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-top: 16px; }

.more { margin-top: 12px; font-size: 14px; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.more ol { margin: 10px 0; padding-left: 20px; color: var(--ink-2); }
.more p { margin: 0 0 6px; color: var(--ink-2); }

/* ---------- step 1: pages ---------- */
.page-list { display: grid; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.page-row { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 0; border-top: 1px solid var(--line); background: var(--panel); }
.page-row:first-child { border-top: 0; }
.page-row.on { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.row-main { flex: 1; min-width: 0; display: block; text-align: left; border: 0; background: none; padding: 12px 0 12px 16px; cursor: pointer; }
.row-main b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .muted { font-size: 12.5px; }
.row-acts { display: flex; gap: 14px; flex: none; }
.row-acts .link { font-size: 13px; }

.drop { display: grid; gap: 2px; text-align: center; padding: 24px 14px; border: 1.5px dashed #b9c4d2; border-radius: var(--radius);
  background: var(--soft); cursor: pointer; transition: border-color .15s, background .15s; }
.drop strong { color: var(--accent); font-size: 15px; }
.drop span { font-size: 13px; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.compact { padding: 14px; }

/* ---------- step 2: look ---------- */
.choice { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice .meta { flex: 1; min-width: 0; }
.swatch { display: grid; grid-template-columns: repeat(3, 12px); gap: 3px; flex: none; }
.swatch i { height: 30px; border-radius: 3px; background: #111; }
.swatch i:nth-child(2) { background: #8a8a8a; }
.swatch i:nth-child(3) { background: #fff; border: 1px solid var(--line); }
.tick { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); flex: none; position: relative; }
.tick:after { content: ""; position: absolute; left: 8px; top: 4px; width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* look settings (also used inside block cards) */
.ctl > span { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.ctl small, .tip { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.ctl + .ctl { margin-top: 16px; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.swatches button.on, .swatches .own.on { outline: 2px solid var(--accent); outline-offset: 3px; }
.swatches .own { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.swatches input[type=color] { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.swatches input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.look-group + .look-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.look-group h3 { margin: 0 0 12px; font-size: 15px; }

/* ---------- step 3: blocks ---------- */
.block { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--panel); }
.block-head { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: var(--radius); }
.block-head:hover { background: var(--soft); }
.block-head .meta { flex: 1; min-width: 0; }
.block-head b { display: block; font-size: 15px; }
.block-head .muted { font-size: 13px; }
.chev { width: 9px; height: 9px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); margin: -4px 4px 0; flex: none; transition: transform .15s; }
.block.open .chev { transform: rotate(-135deg); margin-top: 4px; }
.thumb { width: 52px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--soft); flex: none; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.block-body { display: grid; gap: 16px; padding: 4px 14px 16px; border-top: 1px solid var(--line); }
.block-body > * { min-width: 0; }
.block-body > .row-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; font-size: 13px; color: var(--muted); }

.media-for { display: grid; gap: 10px; padding-top: 14px; border-top: 1px dashed var(--line); }
.media-for > * { min-width: 0; }
.media-row { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.media-row > * { min-width: 0; }
.media-row .row-head { display: flex; align-items: center; gap: 10px; }
.media-row .row-head .meta { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-row .thumb { width: 44px; height: 32px; border-radius: 6px; }
.media-row input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; background: var(--panel); color: var(--ink); }
.media-row .row-label { display: block; margin-bottom: -4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.media-row .row-opt { display: grid; gap: 6px; }
.media-row select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; background: var(--panel); color: var(--ink); }
.media-row small { margin-top: -4px; font-size: 13px; color: var(--muted); }
.media-row small.good { color: var(--ok); }
.media-row small.bad { color: var(--warn-ink); }

.coming { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mini { display: flex; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.tag { padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ---------- step 4: publish ---------- */
.mode-help { margin: 0 0 4px; color: var(--ink-2); font-size: 14px; }
.sum-page { margin-top: 10px; font-size: 14px; }
.sum-page ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.where { margin: 18px 0; padding-left: 20px; color: var(--ink-2); }
.where li + li { margin-top: 4px; }
.code-actions { display: grid; gap: 10px; }

/* ---------- preview ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 20px 20px; gap: 12px; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.now { font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stage-tools { display: flex; align-items: center; gap: 16px; }
.frame-wrap { flex: 1; position: relative; min-height: 0; overflow: hidden; border-radius: var(--radius); }
/* the page is drawn at a real computer (or phone) width, then scaled down to fit (app.js) */
.frame-wrap iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; box-shadow: var(--shadow); border-radius: 4px; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  border: 1.5px dashed #c5cfdb; border-radius: var(--radius); color: var(--muted); }
.empty b { color: var(--ink); font-size: 18px; }

/* ---------- account dialog ---------- */
dialog#account { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 64px rgba(16,24,40,.28); }
dialog#account::backdrop { background: rgba(14,19,24,.45); }
.dlg-close { position: absolute; right: 18px; top: 18px; }
#account h2 { margin: 0 0 4px; font-size: 20px; }
#account .hint { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
#account .hint.small { font-size: 13px; color: var(--muted); }
#account .tabs { margin: 16px 0; }
#account form.acct { display: grid; gap: 4px; }
#account form.acct .field:first-of-type { margin-top: 0; }
#account form.acct .btn { margin-top: 14px; }
#account .err { padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
#account .members { list-style: none; margin: 8px 0 16px; padding: 0; border-top: 1px solid var(--line); }
#account .members li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
#account .invite { display: flex; gap: 8px; margin-top: 8px; }
#account .invite input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: 12px ui-monospace, monospace; background: var(--soft); color: var(--ink); }
#account .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- small screens: steps on top, preview underneath ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .step { overflow: visible; }
  .step-foot { position: static; background: none; }
  .stage { height: 85vh; padding: 14px 16px 16px; }
  .top { padding: 0 16px; }
  .sync { display: none; }
}
