:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #15201a;
  --muted: #5d6a62;
  --line: #e4e2da;
  --green: #138a4a;
  --green-soft: #e3f4ea;
  --amber: #b86e00;
  --amber-soft: #fff1d9;
  --red: #c23b32;
  --red-soft: #fde6e3;
  --blue: #2457d6;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 8px 24px rgba(20, 30, 25, 0.08);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1411;
    --card: #182019;
    --ink: #eef3ef;
    --muted: #9aa8a0;
    --line: #2a352e;
    --green: #3ccf7f;
    --green-soft: #173525;
    --amber: #f0b552;
    --amber-soft: #3a2c12;
    --red: #ff7a70;
    --red-soft: #3b1a17;
    --blue: #7ea2ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
h1, h2, h3 { font-family: 'Inter Tight', 'Inter', system-ui, sans-serif; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
a { color: var(--blue); }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
[hidden] { display: none !important; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-family: 'Inter Tight', sans-serif; font-size: 18px; text-decoration: none; color: var(--ink); }
.brand .dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6ef0a4, var(--green) 60%); box-shadow: 0 0 0 4px var(--green-soft), 0 0 18px rgba(30, 200, 110, 0.55); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 18px; font-weight: 600; text-decoration: none; color: var(--ink); transition: transform 0.08s, background 0.2s; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: 0.5; cursor: default; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #06210f; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--ink); white-space: nowrap; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.wait { background: transparent; border: 1px dashed var(--line); color: var(--muted); }

/* ---- network-style post preview ---- */
.post { padding: 16px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--line) center/cover; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; }
.who { min-width: 0; flex: 1; }
.who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 13px; color: var(--muted); }
.net { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.net.bluesky { background: #1185fe; }
.net.mastodon { background: #6364ff; }
.net.pinterest { background: #e60023; }
.net.instagram { background: linear-gradient(45deg, #f9a825, #e1306c, #833ab4); }
.net.linkedin { background: #0a66c2; }
.net.twitter, .net.threads { background: #111; }
.net.facebook { background: #1877f2; }
.net.other { background: var(--muted); }
.post-text { white-space: pre-wrap; word-wrap: break-word; }
.post-text .tag, .post-text .mention, .post-text .url { color: var(--blue); }
.media { display: grid; gap: 4px; margin-top: 12px; border-radius: 12px; overflow: hidden; }
.media.n2 { grid-template-columns: 1fr 1fr; }
.media.n3, .media.n4 { grid-template-columns: 1fr 1fr; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--line); aspect-ratio: 16 / 10; }
.media.n1 img, .media.n1 video { aspect-ratio: auto; max-height: 420px; }
.post.photo .media { margin: -16px -16px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.post.photo .media img { aspect-ratio: 1 / 1; max-height: none; }
.post.pin .media img { aspect-ratio: 2 / 3; max-height: 460px; }
.pin-title { font-weight: 700; font-size: 17px; margin-top: 10px; }
.linkcard { display: block; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--ink); }
.linkcard img { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; display: block; }
.linkcard div { padding: 10px 12px; font-size: 13px; }
.thread-item { border-left: 2px solid var(--line); margin: 12px 0 0 18px; padding-left: 14px; }
.post-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.over { color: var(--red); font-weight: 600; }

/* ---- toast ---- */
.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(440px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); animation: up 0.25s ease-out; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; }
@keyframes up { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- bottom sheet ---- */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 15, 12, 0.45); z-index: 40; display: grid; align-items: end; justify-items: center; animation: fade 0.2s; }
.sheet { background: var(--card); width: min(560px, 100%); border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; animation: up 0.25s ease-out; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes fade { from { opacity: 0; } }
