:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16181d;
  --muted: #555c68;
  --line: #dde1e7;
  --accent: #1d5fd1;
  --accent-text: #ffffff;
  --link: #1a56c4;
  --ok: #1f7a3d;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --bad: #b3261e;
  --bad-bg: #fde8e6;
  --fold: #c2410c;
  --focus: #1d5fd1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2026;
    --surface-2: #262a31;
    --text: #e9ebef;
    --muted: #a7aeba;
    --line: #343943;
    --accent: #6ea2ff;
    --accent-text: #0d1220;
    --link: #8ab4ff;
    --ok: #6fd28f;
    --warn: #f3c25a;
    --warn-bg: #3a2f14;
    --bad: #ff8a80;
    --bad-bg: #3d1d1b;
    --fold: #fb923c;
    --focus: #8ab4ff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.top { padding: 28px 0 12px; }
h1 { font-size: clamp(1.45rem, 3.4vw, 2.1rem); line-height: 1.2; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { color: var(--muted); max-width: 70ch; margin: 0; }
h2 { font-size: 1.3rem; margin: 2rem 0 .6rem; line-height: 1.3; }
.h3 { font-size: 1rem; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.between { justify-content: space-between; }
.gap-s { gap: 6px; }
.lbl { font-weight: 600; }
.hint { color: var(--muted); font-size: .875rem; margin: .4rem 0 0; }
.note { color: var(--muted); font-size: .85rem; margin: 10px 0 14px; }

.btn {
  font: inherit; font-size: .95rem;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn.small { font-size: .85rem; padding: 6px 10px; min-height: 36px; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.tool { margin-top: 12px; }
.fmt { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 8px; }
.fmt .hint { margin: 0 0 0 4px; }
textarea {
  width: 100%; min-height: 200px; resize: vertical;
  font: inherit; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
input[type=text] { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; }
input[type=file] { font-size: .85rem; max-width: 100%; color: var(--text); }
.field label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.warn { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: .9rem; margin: 8px 0 0; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .875rem; color: var(--muted); margin-top: 10px; }
.stats b { color: var(--text); font-variant-numeric: tabular-nums; }

.profile { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.profile summary, .faq summary { cursor: pointer; font-weight: 600; }

.drafts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.draft-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.draft-list li { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 6px 6px 6px 10px; }
.draft-list .dtext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.draft-list time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.controls { margin-top: 18px; }
.seg { border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 0; display: inline-flex; background: var(--surface); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { padding: 6px 14px; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.seg input:checked + label { background: var(--accent); color: var(--accent-text); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; }

.previews { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .previews { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1140px) { .previews { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.previews.desktop { grid-template-columns: 1fr; }
@media (min-width: 1000px) { .previews.desktop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pv { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pv-name { font-weight: 700; font-size: .95rem; margin: 0; }
.pv-tag { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }

.mock { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface); margin: 0 auto; width: 100%; }
.previews:not(.desktop) .mock { max-width: 380px; }
.mock .who { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; font-size: .9rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.mock.square .avatar { border-radius: 10px; }
.who-text { min-width: 0; line-height: 1.25; }
.who-name { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .94rem; line-height: 1.45; }
.body .ent { color: var(--link); }
.body .hid { background: var(--bad-bg); }
.body .over { background: var(--bad-bg); color: var(--bad); text-decoration: underline wavy; }
.morebtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); font-weight: 600; cursor: pointer; }
.morebtn:hover { text-decoration: underline; }
.foldmark { display: block; border-top: 2px dashed var(--fold); margin: 6px 0; position: relative; }
.foldmark span { position: absolute; right: 0; top: -11px; background: var(--surface); color: var(--fold); font-size: .7rem; font-weight: 700; padding: 0 4px; }
.mock .media { margin-top: 10px; background: var(--surface-2); border-radius: 8px; aspect-ratio: 4 / 5; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.mock.ig .media { margin: 0 0 10px; aspect-ratio: 1; }
.mock .ig-name { font-weight: 700; }
.mock .actions { display: flex; gap: 18px; margin-top: 10px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); padding-top: 8px; }

.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); width: 0; }
.meter.near i { background: var(--warn); }
.meter.over i { background: var(--bad); }
.pv-count { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.pv-count .left { color: var(--muted); }
.pv-count .bad { color: var(--bad); font-weight: 700; }
.pv-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--muted); }
.pv-msgs { margin: 0; padding: 0; list-style: none; font-size: .82rem; }
.pv-msgs li { padding: 4px 8px; border-radius: 6px; margin-top: 4px; }
.pv-msgs .w { background: var(--warn-bg); color: var(--warn); }
.pv-msgs .e { background: var(--bad-bg); color: var(--bad); }
.pv-msgs .i { color: var(--muted); padding-left: 0; }

.hook { margin-top: 20px; }
.hook h2 { margin-top: 0; }
.hooks { display: grid; gap: 10px; margin-top: 12px; }
.hk { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.hk h3 { font-size: .9rem; margin: 0 0 6px; }
.hk .pair { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .hk .pair { grid-template-columns: 1fr 1fr; } }
.hk .lab { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hk .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; background: var(--surface-2); border-radius: 6px; padding: 6px 8px; margin-top: 2px; }

.content { max-width: 820px; padding-bottom: 32px; }
.content li { margin-bottom: .3rem; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 640px; }
caption { text-align: left; padding: 10px 12px; color: var(--muted); font-size: .85rem; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq p { margin: .5rem 0 0; color: var(--text); }
.updated { color: var(--muted); font-size: .9rem; }

.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: .9rem; color: var(--muted); }
.foot p { margin: .3rem 0; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .15s; }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
