:root {
  color-scheme: light dark;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eaeef5;
  --ink: #0f172a;
  --muted: #5b6678;
  --line: #dde3ec;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --warn: #b4530f;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16; --surface: #141a24; --surface-2: #1c2431; --ink: #eef2f8;
    --muted: #97a3b6; --line: #263041; --accent: #5b8cff; --accent-ink: #06101f;
    --warn: #e0a458;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Any explicit `display` beats the user-agent's [hidden] rule, and several
   components below set one. Keep [hidden] authoritative. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}
h1, h2, h3 { letter-spacing: -0.025em; line-height: 1.15; margin: 0 0 .4em; }
h2 { font-size: 1.6rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
       background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }

/* ---------- boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--bg); padding: 2rem; text-align: center;
}
.boot__inner { max-width: 22rem; }
.boot__mark { margin: 0 auto 1rem; }
.boot h1 { font-size: 1.5rem; }
.boot p { color: var(--muted); font-size: .95rem; }
.boot__note { font-size: .85rem; opacity: .8; }
.bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 1.2rem 0 .8rem; }
.bar__fill { height: 100%; width: 0%; background: var(--accent); border-radius: 99px;
             transition: width .35s ease; }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .5rem;
  padding: calc(.6rem + var(--safe-t)) .9rem .6rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar strong { flex: 1; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  width: 38px; height: 38px; border-radius: 10px; font-size: 1.05rem; cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.icon-btn:active { background: var(--surface-2); }

main { padding: 1.1rem .9rem calc(2.5rem + var(--safe-b)); max-width: 780px; margin-inline: auto; }
.kicker { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
          color: var(--accent); font-weight: 700; margin: 0 0 .5rem; }
.lede { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; }

/* ---------- form ---------- */
.field { display: block; margin-bottom: .9rem; border: 0; padding: 0; }
.field > span, .field > legend { display: block; font-size: .85rem; font-weight: 600;
                                 color: var(--muted); margin-bottom: .3rem; padding: 0; }
.field em { font-style: normal; font-weight: 400; opacity: .7; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; padding: .8rem .85rem; border-radius: 11px; background: var(--surface);
  border: 1.5px solid var(--line); color: var(--ink); -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                           linear-gradient(135deg, currentColor 50%, transparent 50%);
         background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
         background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
textarea { resize: vertical; min-height: 6.5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.row { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 520px) { .row { grid-template-columns: 1fr 1fr; } }

.switch { margin: 1rem 0; }
.switch label { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.switch input { width: auto; }

#price-rows { display: grid; gap: .55rem; margin-top: .5rem; }
.price-row { display: grid; grid-template-columns: 1fr 7.5rem; gap: .5rem; align-items: center; }
.price-row span { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price-row input { padding: .55rem .6rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.3rem; border-radius: 999px; border: 1.5px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font-weight: 650;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--lg { padding: 1rem 1.5rem; font-size: 1.02rem; }
.btn--sm { padding: .5rem .9rem; font-size: .88rem; }
.actions { display: flex; flex-direction: column; gap: .6rem; margin: 1.4rem 0 0; }
.actions--end { margin-top: 2rem; }
@media (min-width: 520px) { .actions { flex-direction: row; } }

/* ---------- gallery ---------- */
.filters { position: sticky; top: calc(52px + var(--safe-t)); z-index: 30;
           background: color-mix(in srgb, var(--bg) 92%, transparent);
           backdrop-filter: blur(10px); margin: 0 -.9rem; padding: .55rem .9rem;
           border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem;
         scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface);
        color: var(--ink); padding: .4rem .8rem; border-radius: 999px;
        font-size: .87rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent);
                             color: var(--accent-ink); }

.tiles { display: grid; gap: 1rem; margin-top: 1rem;
         grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        overflow: hidden; display: flex; flex-direction: column; }
.tile[hidden] { display: none; }
.tile__shot { position: relative; height: 300px; overflow: hidden; background: #fff;
              border-bottom: 1px solid var(--line); }
.tile__shot iframe { width: 1180px; height: 1500px; border: 0; transform-origin: 0 0;
                     pointer-events: none; }
.tile__shot .spin { position: absolute; inset: 0; display: grid; place-items: center;
                    color: var(--muted); font-size: .85rem; background: var(--surface); }
.tile__body { padding: .8rem .9rem 1rem; display: grid; gap: .5rem; }
.tile__name { font-weight: 650; }
.tile__name span { color: var(--muted); font-weight: 400; }
.tile__blurb { color: var(--muted); font-size: .84rem; margin: 0; }

/* ---------- result ---------- */
.tabs { display: flex; gap: .3rem; margin: 1rem 0; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; color: var(--muted); padding: .6rem .8rem;
       font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.phone-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
               background: #fff; height: 62vh; min-height: 380px; }
.phone-frame iframe { width: 100%; height: 100%; border: 0; }
.card-preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
                background: #fff; }
.card-preview iframe { width: 100%; height: 460px; border: 0; }
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.todo li { background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
           padding: .8rem .9rem; }
.todo b { display: block; font-size: .85rem; color: var(--accent); margin-bottom: .2rem; }
.todo span { color: var(--muted); font-size: .92rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 0; }

/* ---------- library ---------- */
.sites { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: .6rem; }
.site { display: flex; align-items: stretch; gap: .4rem; background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.site__open { flex: 1; text-align: left; background: none; border: 0; color: var(--ink);
              padding: .9rem 1rem; cursor: pointer; display: grid; gap: .15rem;
              position: relative; }
.site__open:active { background: var(--surface-2); }
.site__name { font-weight: 650; }
.site__meta { color: var(--muted); font-size: .84rem; }
.site__live { position: absolute; top: .8rem; right: .8rem; font-size: .68rem;
              letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
              color: #0a7d4f; background: #0a7d4f1f; padding: .18rem .45rem;
              border-radius: 5px; }
.site__more { border: 0; border-left: 1px solid var(--line); background: none;
              color: var(--muted); width: 46px; font-size: 1.1rem; cursor: pointer; }
.site__more:active { background: var(--surface-2); }

/* ---------- publish ---------- */
.pub { background: var(--surface); border: 1px solid var(--line);
       border-radius: var(--radius); margin-bottom: .7rem; overflow: hidden; }
.pub > summary { padding: .95rem 1rem; cursor: pointer; list-style: none;
                 display: grid; gap: .1rem; }
.pub > summary::-webkit-details-marker { display: none; }
.pub > summary b { font-size: 1rem; }
.pub > summary span { color: var(--muted); font-size: .84rem; }
.pub[open] > summary { border-bottom: 1px solid var(--line); }
.pub__body { padding: 1rem; }
.pub__body .actions { margin-top: 1rem; }
.steps-list { margin: 0 0 .5rem; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.steps-list li { margin-bottom: .35rem; }
.steps-list b { color: var(--ink); }

.log { list-style: none; margin: 1rem 0 0; padding: .7rem .8rem; display: grid; gap: .35rem;
       background: var(--surface-2); border-radius: 10px;
       font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
       max-height: 15rem; overflow-y: auto; }
.log li { color: var(--muted); }
.log .log--ok { color: #0a7d4f; }
.log .log--warn { color: var(--warn); }
.log .log--err { color: #c0392b; }

.live { background: #0a7d4f14; border: 1px solid #0a7d4f4d; border-radius: var(--radius);
        padding: .9rem 1rem; margin-bottom: 1rem; display: grid; gap: .35rem; }
.live b { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #0a7d4f; }
.live a { word-break: break-all; font-size: .95rem; }
.live__acts { display: flex; gap: .5rem; margin-top: .4rem; }

/* ---------- sheet + toast ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45);
         display: grid; align-items: end; }
.sheet__panel { background: var(--surface); border-radius: 18px 18px 0 0;
                padding: 1.2rem 1rem calc(1.2rem + var(--safe-b)); display: grid; gap: .4rem;
                max-width: 780px; width: 100%; margin-inline: auto; }
.sheet__item { text-align: left; background: none; border: 0; border-radius: 10px;
               padding: .85rem .7rem; color: var(--ink); font-size: 1rem; cursor: pointer; }
.sheet__item:active { background: var(--surface-2); }
.sheet__item--warn { color: var(--warn); }
.sheet__meta { color: var(--muted); font-size: .78rem; margin: .5rem .7rem 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%);
         bottom: calc(1.5rem + var(--safe-b)); z-index: 80;
         background: var(--ink); color: var(--bg); padding: .7rem 1.1rem;
         border-radius: 999px; font-size: .9rem; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- logo picker --- */
.group { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1rem .4rem;
         margin: 0 0 .9rem; }
.group > legend { font-size: .85rem; font-weight: 600; padding: 0 .4rem; }
.logo-preview { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.logo-preview img { max-width: 140px; max-height: 64px; width: auto; height: auto;
                    background: repeating-conic-gradient(#0000 0 25%, #8883 0 50%)
                                50% / 14px 14px;
                    border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.logo-actions { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.hint.error { color: #d1344b; font-weight: 600; }

/* --- photos --- */
.photo-grid { display: grid; gap: .5rem; grid-template-columns: repeat(3, 1fr);
              margin-bottom: .6rem; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 10px;
              overflow: hidden; border: 1px solid var(--line); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
             border-radius: 50%; border: 0; background: rgba(0,0,0,.62); color: #fff;
             font-size: 17px; line-height: 1; cursor: pointer; }
