:root {
  --brand: #6d4aff;
  --accent: #007aff;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --text: #000000;
  --text-2: #6b6b73;
  --line: rgba(60, 60, 67, 0.18);
  --fill: #e9e9ef;
  --fill-hi: #f7f7fa;
  --tab-h: 58px;
}
html[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --text: #ffffff;
  --text-2: #98989f;
  --line: rgba(84, 84, 88, 0.65);
  --fill: #2c2c2e;
  --fill-hi: #3a3a3c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
input, select, textarea { outline: none; }
svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
svg.sm { width: 18px; height: 18px; }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px;
  background: var(--surface); border-bottom: 0.5px solid var(--line);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); flex: 0 0 auto;
}
.icon-btn:hover { background: var(--fill); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: 0.02em; flex: 0 0 auto; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 16px; font-weight: 800; line-height: 1;
}
.search {
  flex: 1; max-width: 600px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 14px; background: var(--fill); border-radius: 999px; color: var(--text-2);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; }
.search input::placeholder { color: var(--text-2); }
.actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; margin-left: 6px; background: var(--fill);
  display: grid; place-items: center; color: var(--text-2);
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px 72px; }
.wrap.narrow { max-width: 720px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.page-sub { color: var(--text-2); font-size: 15px; margin-bottom: 24px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); margin: 28px 0 8px 16px; }

.grid { display: grid; gap: 28px 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { display: block; min-width: 0; }
.thumb { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: var(--fill); overflow: hidden; }
.thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--fill-hi), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.meta { display: flex; gap: 12px; margin-top: 12px; }
.meta .dot { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); flex: 0 0 auto; }
.meta .lines { flex: 1; min-width: 0; padding-top: 2px; }
.line { height: 12px; border-radius: 6px; background: var(--fill); margin-bottom: 8px; }
.line.w1 { width: 92%; }
.line.w2 { width: 60%; }
.line.w3 { width: 45%; height: 10px; }
@media (prefers-reduced-motion: reduce) { .thumb::after { animation: none; } }

.group {
  background: var(--surface); border-radius: 14px; overflow: hidden;
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 12px 16px; font-size: 16px;
}
.row + .row { border-top: 0.5px solid var(--line); margin-left: 16px; padding-left: 0; }
.row .label small { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.row .value { color: var(--text-2); }
select.pick {
  border: 0; background: transparent; font-size: 16px; color: var(--accent); padding: 4px 0; cursor: pointer; text-align: right;
}
.switch { position: relative; width: 51px; height: 31px; flex: 0 0 auto; }
.switch input { opacity: 0; position: absolute; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-hi); cursor: pointer; transition: background 0.2s; }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.switch input:checked + .track { background: #34c759; }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent); }

.field { display: grid; gap: 6px; padding: 12px 16px; }
.field + .field { border-top: 0.5px solid var(--line); }
.field label { font-size: 13px; color: var(--text-2); }
.field input[type="text"], .field textarea {
  width: 100%; border: 0; background: transparent; font-size: 16px; padding: 4px 0; resize: vertical;
}
.field input[type="file"] { font-size: 15px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-ext {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent);
}
.post-title { font-size: 15px; font-weight: 600; color: var(--text); }
.post-desc { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-stage { background: var(--surface); border-radius: 18px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 220px; position: relative; }
.post-stage img { display: block; max-width: 100%; height: auto; }
.post-stage iframe { width: 100%; height: 75vh; border: 0; }
.thumb-ext.big { position: relative; width: 100%; min-height: 220px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.post-full-desc { white-space: pre-wrap; margin: 12px 0; }
.post-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.post-actions .btn { text-decoration: none; }
a.card { color: inherit; text-decoration: none; }
.auto-thumb img, .auto-thumb .doc {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; display: block; background: var(--fill);
}
.auto-thumb .doc {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-2);
}
.auto-thumb .doc b { font-size: 28px; color: var(--accent); letter-spacing: 0.04em; }
.auto-thumb .doc span { font-size: 13px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field .hint { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.btn {
  display: block; width: 100%; height: 50px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; margin-top: 20px;
}
a.btn { display: flex; align-items: center; justify-content: center; box-sizing: border-box; text-align: center; text-decoration: none; line-height: 1; }
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn:hover { filter: brightness(1.05); }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty .ico {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; color: var(--text-2);
}
.empty .ico svg { width: 30px; height: 30px; }
.empty h2 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.chips a { padding: 8px 14px; border-radius: 999px; background: var(--surface); font-size: 15px; }

.drawer { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.side {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 82vw);
  background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto;
}
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.side nav { display: grid; gap: 4px; }
.side nav a {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; font-size: 16px;
}
.side nav a:hover { background: var(--fill); }
.side nav a[aria-current="page"] { color: var(--accent); background: var(--fill); }
.side-account { margin-top: auto; padding: 12px; border-radius: 12px; font-size: 16px; color: var(--accent); font-weight: 600; }
.avatar span { font-size: 14px; font-weight: 600; color: var(--text); }

.tabbar { display: none; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); max-width: calc(100vw - 32px);
}

@media (max-width: 800px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .menu-btn, .search, .hide-sm { display: none; }
  .wrap { padding: 16px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px); }
  .page-title { font-size: 24px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--line);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 10px; font-weight: 500; color: var(--text-2); padding-top: 6px;
  }
  .tabbar a svg { width: 26px; height: 26px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .toast { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); }
}
