:root {
  --ice: #eaf1f6;
  --frost: #f8fbfd;
  --ink: #10243d;
  --slate: #56677d;
  --glacier: #2b64d9;
  --line: #d3dee8;
  --mint: #17876a;
  --amber: #a86a12;
  --danger: #b4232f;
  --r-s: 8px;
  --r-m: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--sans);
  color: var(--ink);
  background: var(--ice);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.012em; }
h1 { font-size: 24px; font-weight: 680; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 640; }
p { margin: 0; }
a { color: var(--glacier); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--glacier); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--slate); }
.small { font-size: 13px; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--frost); color: var(--ink);
  border-radius: var(--r-s); padding: 9px 16px; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: #b8c8d8; }
.btn.primary { background: var(--glacier); border-color: var(--glacier); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.quiet { background: none; border-color: transparent; color: var(--slate); padding: 9px 10px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
label.f { display: block; margin-top: 14px; }
label.f > span { display: block; font-size: 13px; color: var(--slate); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-s);
  background: #fff;
}
textarea { min-height: 84px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f7; color: var(--slate); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--glacier); }
.pro {
  display: inline-block; font-size: 11px; font-weight: 650; color: var(--glacier);
  border: 1px solid currentColor; border-radius: 999px; padding: 0 7px; margin-left: 6px; vertical-align: 1px;
}

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; }
.login-lang { position: absolute; top: 14px; right: 16px; }
.langsw { font-weight: 600; }
.login-box { width: min(400px, 100%); }
.wordmark { font-weight: 720; font-size: 20px; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 9px; }
.wordmark i {
  width: 22px; height: 22px; border-radius: 7px; display: inline-block;
  background: linear-gradient(135deg, #cfe0f5, #f8fbfd 55%, #b9d0ee);
  border: 1px solid #b5c9e2;
}
.login h1 { margin: 28px 0 8px; }
.login form { margin-top: 22px; }
.login .btn { width: 100%; margin-top: 12px; padding: 11px 16px; }
.note { margin-top: 14px; font-size: 14px; }
.note.ok { color: var(--mint); }
.note.err { color: var(--danger); }

/* ---------- shell ---------- */
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--frost);
}
.top .site { font-weight: 600; }
.top .grow { flex: 1; }
.top .who { font-size: 14px; color: var(--slate); }
.plan { font-size: 12px; font-weight: 650; border-radius: 999px; padding: 2px 9px; background: #dde8f6; color: var(--glacier); }
.plan.free { background: #e6ebf0; color: var(--slate); }
.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--frost); }
.tabs button {
  border: 0; background: none; padding: 12px 12px 11px; cursor: pointer; color: var(--slate); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--glacier); }
main { padding: 24px; max-width: 1360px; margin: 0 auto; }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 380px 1fr; gap: 32px; align-items: start; }
.controls section { padding: 18px 0 22px; border-top: 1px solid var(--line); }
.controls section:first-of-type { border-top: 0; padding-top: 0; }
.controls section > p { margin-top: 4px; font-size: 13px; color: var(--slate); }
.tpls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.tpl {
  position: relative; border-radius: 10px; border: 1px solid var(--line); background: #eef2f6;
  cursor: pointer; padding: 0; overflow: hidden; text-align: left;
}
.tpl.dk { background: #1b2230; }
.tpl b {
  display: block; font-size: 12px; font-weight: 600; padding: 5px 8px; background: var(--frost); color: var(--ink);
  border-top: 1px solid var(--line);
}
.mini { position: relative; display: block; aspect-ratio: 4 / 3; }
.sh {
  position: absolute; display: flex; flex-direction: column; gap: 3px; padding: 5px;
  background: var(--c); border-radius: 5px; box-shadow: 0 2px 6px rgba(16,36,61,.22);
}
.sh i { display: block; height: 3px; border-radius: 2px; background: currentColor; opacity: .35; color: #8795a8; }
.sh i:first-child { width: 70%; }
.sh em { display: block; height: 6px; width: 60%; border-radius: 3px; background: var(--a); margin-top: 2px; }
.lay-corner .sh { left: 8%; bottom: 10%; width: 52%; }
.lay-bar .sh { left: 6%; right: 6%; bottom: 10%; flex-direction: row; align-items: center; }
.lay-bar .sh i { flex: 1; } .lay-bar .sh em { width: 22%; margin: 0; }
.lay-center .mini { background: rgba(16,36,61,.18); }
.lay-center .sh { left: 22%; right: 22%; top: 24%; }
.lay-pill .sh { left: 12%; right: 12%; bottom: 10%; flex-direction: row; align-items: center; border-radius: 999px; padding: 4px 6px; }
.lay-pill .sh i { flex: 1; } .lay-pill .sh i + i { display: none; } .lay-pill .sh em { width: 24%; margin: 0; border-radius: 999px; }
.lay-chat .sh { right: 10%; bottom: 30%; width: 50%; border-radius: 6px 6px 2px 6px; }
.lay-chat .sh em { border-radius: 999px; width: 40%; }
.av { position: absolute; right: 8%; bottom: 7%; width: 13%; aspect-ratio: 1; border-radius: 50%; background: var(--a); }
.lay-split .sh { left: 10%; right: 10%; bottom: 10%; padding: 5px 5px 5px 34%; overflow: hidden; }
.lay-split .sh::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 28%; background: var(--a); opacity: .35; }
.tpl[aria-pressed=true] { outline: 2px solid var(--glacier); outline-offset: 2px; }
.tpl:disabled { cursor: not-allowed; }
.tpl:disabled::after {
  content: "Pro"; position: absolute; top: 5px; right: 5px; font-size: 10px; font-weight: 700;
  background: var(--frost); color: var(--glacier); border-radius: 999px; padding: 0 6px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color { display: flex; gap: 8px; align-items: center; }
.color input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }
.langtabs { display: flex; gap: 6px; margin-top: 10px; }
.langtabs button { border: 1px solid var(--line); background: var(--frost); border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: 13px; }
.langtabs button[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* publish bar */
.pub {
  position: sticky; bottom: 0; margin: 8px -12px 0; padding: 14px 12px;
  background: var(--ice); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.state { font-size: 13px; display: inline-flex; align-items: center; gap: 7px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.live { color: var(--mint); }
.state.draft { color: var(--amber); }
.state.saving { color: var(--slate); }

/* preview window: the one bold element */
.preview { position: sticky; top: 16px; }
.window {
  border-radius: var(--r-m); overflow: hidden; border: 1px solid #c6d4e2;
  background: var(--frost); box-shadow: 0 30px 60px -30px rgba(16, 36, 61, .35);
}
.chrome { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chrome i { width: 10px; height: 10px; border-radius: 50%; background: #d6dee7; }
.chrome span { margin-left: 10px; font-size: 12.5px; color: var(--slate); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; }
#pv-stage {
  position: relative; height: 560px; overflow: hidden;
  background:
    radial-gradient(circle at 18% 70%, #ffb38a 0 90px, transparent 91px),
    radial-gradient(circle at 78% 30%, #7fb4ff 0 120px, transparent 121px),
    radial-gradient(circle at 60% 85%, #8fe0c4 0 80px, transparent 81px),
    #f3f6fa;
}
.fake { position: absolute; inset: 0; padding: 34px 40px; pointer-events: none; }
.fake .bar1 { height: 14px; width: 38%; background: #c9d5e2; border-radius: 4px; }
.fake .bar2 { height: 34px; width: 64%; background: #1f3350; border-radius: 6px; margin-top: 38px; opacity: .85; }
.fake .bar3 { height: 12px; width: 52%; background: #c9d5e2; border-radius: 4px; margin-top: 16px; }
.fake .bar4 { height: 12px; width: 46%; background: #c9d5e2; border-radius: 4px; margin-top: 10px; }
.pv-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dark-site #pv-stage { background:
    radial-gradient(circle at 18% 70%, #8a3f7c 0 90px, transparent 91px),
    radial-gradient(circle at 78% 30%, #2d5fb8 0 120px, transparent 121px),
    #141a26; }
.dark-site .fake .bar2 { background: #dfe7f2; }
.dark-site .fake .bar1, .dark-site .fake .bar3, .dark-site .fake .bar4 { background: #34405a; }

/* ---------- consent log ---------- */
.stats { display: flex; gap: 36px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 22px; }
.stat strong { display: block; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--slate); }
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #dde5ee; width: min(520px, 100%); margin-top: 6px; }
.split i { display: block; height: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--slate); margin-top: 8px; }
.legend b { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.tablewrap { overflow-x: auto; background: var(--frost); border: 1px solid var(--line); border-radius: var(--r-m); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--slate); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td code { font-size: 12.5px; color: var(--slate); }
.act-accept_all { color: var(--mint); font-weight: 600; }
.act-reject_all { color: var(--danger); font-weight: 600; }
.act-custom { color: var(--amber); font-weight: 600; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.empty { padding: 36px 20px; text-align: center; color: var(--slate); }

/* ---------- install ---------- */
.install { max-width: 760px; }
.install section { margin-bottom: 30px; }
.install p { margin-top: 6px; }
pre {
  background: var(--ink); color: #e8f0fa; border-radius: var(--r-s); padding: 14px 16px; overflow-x: auto;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 10px 0 8px;
}
.dz { border-top: 1px solid var(--line); padding-top: 22px; }

/* ---------- add site ---------- */
.addsite { max-width: 520px; margin: 48px auto; }
.addsite form { display: flex; gap: 10px; margin-top: 18px; }
.addsite form input { flex: 1; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 12px 30px -10px rgba(16,36,61,.5);
}
#toast.err { background: var(--danger); }

@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  #pv-stage { height: 440px; }
}
@media (max-width: 520px) {
  .top, .tabs, main { padding-left: 16px; padding-right: 16px; }
  .tpls { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .addsite form { flex-direction: column; }
  .fake { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
