:root {
  --bg: #f4f4f6;
  --card: #ffffff;
  --ink: #141414;
  --g1: #6b6b70;
  --g2: #a0a0a6;
  --line: #e4e4e8;
  --soft: #f0f0f3;
  --red: #d0342c;
  --radius: 10px;
  --fs: 13px;
  --fs-s: 11.5px;
  --fs-h: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: var(--fs)/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: var(--fs-h); }
h3 { font-size: var(--fs); }
p { margin: 0; }
.muted { color: var(--g1); }
.small { font-size: var(--fs-s); }
.tiny { font-size: 10.5px; color: var(--g2); }
.err { color: var(--red); }
.hidden, [hidden] { display: none !important; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 16px 8px; display: flex;
  align-items: center; justify-content: space-between; gap: 10px;
  padding-top: max(12px, env(safe-area-inset-top)); }
.brand { font-weight: 600; font-size: var(--fs); cursor: pointer; letter-spacing: 0; }
.top-right { display: flex; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px;
  font-size: var(--fs-s); line-height: 1.3; white-space: nowrap; }
.chip.ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; padding: 4px 9px; font-size: var(--fs-s); color: var(--g1); }
.seg button.on { background: var(--ink); color: #fff; }

/* layout */
.screen { padding: 4px 16px 32px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--soft); }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 2px 4px; }
.links a, .links span { color: var(--g1); text-decoration: none; font-size: var(--fs-s); cursor: pointer; }
.links a:hover { color: var(--ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px;
  padding: 10px 14px; border: 1px solid var(--line); background: var(--card); font-size: var(--fs); line-height: 1.2;
  text-decoration: none; min-height: 38px; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:disabled { background: var(--g2); border-color: var(--g2); cursor: default; }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 10px; min-height: 30px; font-size: var(--fs-s); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--g1); }
.btn.danger { color: var(--red); }
.btn:active { opacity: .85; }
.btn .sub { font-size: 10.5px; opacity: .7; margin-left: 4px; }

/* list */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0;
  border-top: 1px solid var(--line); cursor: pointer; }
.item:first-child { border-top: 0; }
.item .t { font-weight: 500; }
.item .d { color: var(--g1); font-size: var(--fs-s); }
.item .arrow { color: var(--g2); }
.item.on .t::after { content: " ·"; color: var(--g2); }

/* forms */
textarea, input[type=text], input[type=email], input[type=tel] {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit;
  background: var(--card); color: var(--ink); outline: none; resize: vertical; }
textarea { min-height: 72px; }
textarea:focus, input:focus { border-color: var(--g2); }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-s); color: var(--g1); }
label.check input { margin: 2px 0 0; }

/* image area */
.pic { position: relative; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.pic img { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; background: #fff; }
.pic .cap { padding: 8px 12px; font-size: var(--fs-s); color: var(--g1); border-top: 1px solid var(--line); }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.thumb { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; border: 2px solid transparent;
  background: var(--soft); cursor: pointer; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.on { border-color: var(--ink); }
.thumb .n { position: absolute; left: 0; bottom: 0; background: rgba(20,20,20,.7); color: #fff; font-size: 9.5px; padding: 1px 4px; border-radius: 0 4px 0 0; }
.refs { display: flex; gap: 6px; flex-wrap: wrap; }
.ref { width: 48px; height: 48px; border-radius: 6px; overflow: hidden; position: relative; background: var(--soft); border: 1px solid var(--line); }
.ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref .x { position: absolute; top: -1px; right: -1px; width: 16px; height: 16px; border-radius: 0 6px 0 6px; background: var(--ink); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; cursor: pointer; }
.add { width: 48px; height: 48px; border: 1px dashed var(--g2); border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--g1); font-size: 18px; cursor: pointer; background: transparent; }

/* hero */
.hero img { width: 100%; height: auto; display: block; border-radius: var(--radius); }
.band { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 14px; }
.band .muted { color: rgba(255,255,255,.7); }

/* sheet (bottom menu) */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(20,20,20,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { width: 100%; max-width: 520px; background: var(--card); border-radius: 14px 14px 0 0; padding: 14px 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; max-height: 85vh; overflow: auto; }
.sheet .panel h2 { margin-bottom: 4px; }

/* overlay progress */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(244,244,246,.92); display: flex; align-items: center; justify-content: center; padding: 20px; }
.overlay .box { background: var(--card); border-radius: var(--radius); padding: 18px 16px; width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.spin { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; margin: 0 auto 4px; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: #fff;
  padding: 9px 14px; border-radius: 8px; font-size: var(--fs-s); max-width: 90vw; text-align: center; }

/* steps */
.step-n { font-size: var(--fs-s); color: var(--g2); }
.slide img { width: 100%; height: auto; border-radius: 8px; display: block; }
.slide .txt { line-height: 1.5; }
.slide b { font-weight: 600; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 9px 11px; border-radius: 10px; max-width: 92%; white-space: pre-wrap; }
.msg.q { background: var(--ink); color: #fff; align-self: flex-end; }
.msg.a { background: var(--soft); align-self: flex-start; }
.tg-widget { min-height: 44px; display: flex; justify-content: center; }
.code-in { letter-spacing: .3em; text-align: center; font-size: 18px; }
.pkg { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.pkg.on { border-color: var(--ink); }
.pkg .price { font-weight: 600; }
.ok { color: #1f7a3f; }
@media (min-width: 560px) { .top, .screen { padding-left: 0; padding-right: 0; } }
