:root {
  color-scheme: dark;
  --bg: #090b09;
  --panel: #121512;
  --panel-2: #181c18;
  --line: #2a302a;
  --text: #f2f5ef;
  --muted: #929b91;
  --acid: #b4ef73;
  --acid-soft: #d9ffad;
  --danger: #ef766d;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 84% -10%, rgba(180,239,115,.09), transparent 33%), var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { width: min(1240px, 100%); min-height: 100vh; margin: 0 auto; padding: 0 28px 100px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 78px; border-bottom: 1px solid rgba(255,255,255,.07); background: rgba(9,11,9,.82); backdrop-filter: blur(22px); }
.brand-lockup, .top-actions { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { display: block; font-size: 16px; }
.brand-lockup span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .18em; }
.brand-mark { display: grid; width: 54px; height: 54px; place-items: center; border: 1px solid rgba(180,239,115,.34); border-radius: 18px 6px 18px 6px; background: linear-gradient(145deg, var(--acid), #70a83d); color: #10150c; font-family: Georgia, serif; font-size: 28px; font-weight: 800; box-shadow: 0 18px 50px rgba(89,138,43,.24); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 13px 5px 13px 5px; font-size: 20px; }
.icon-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--text); font-size: 20px; }
.sync-state { color: var(--muted); font-size: 13px; }
.hero-row { display: flex; align-items: end; justify-content: space-between; padding: 68px 4px 38px; }
.eyebrow { margin: 0 0 10px; color: var(--acid); font-size: 12px; font-weight: 800; letter-spacing: .22em; }
.hero-row h1 { margin: 0; font-size: clamp(44px, 8vw, 78px); line-height: .95; letter-spacing: -.06em; }
.hero-row > div > p:last-child { margin: 15px 0 0; color: var(--muted); font-size: 16px; }
.count-block { display: flex; align-items: baseline; gap: 8px; padding-bottom: 8px; }
.count-block strong { color: var(--acid-soft); font-size: 42px; }
.count-block span { color: var(--muted); font-size: 14px; }
.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 14px; align-items: center; margin-bottom: 28px; }
.search-box { display: flex; align-items: center; min-height: 54px; padding: 0 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: 0 14px 50px rgba(0,0,0,.22); }
.search-box > span { margin-right: 12px; color: var(--acid); font-size: 28px; transform: rotate(-15deg); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.search-box kbd { padding: 4px 7px; border: 1px solid #343b34; border-radius: 6px; color: #737c72; font-size: 11px; }
.filter-row { display: flex; gap: 8px; }
.filter-chip, .secondary-button { min-height: 44px; padding: 0 17px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); }
.filter-chip.active { border-color: var(--acid); background: var(--acid); color: #10140d; font-weight: 750; }
.primary-button { min-height: 50px; padding: 0 22px; border: 0; border-radius: 15px; background: var(--acid); color: #10140d; font-weight: 800; box-shadow: 0 12px 30px rgba(91,141,45,.2); }
.add-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.gallery { columns: 4 240px; column-gap: 16px; }
.card { position: relative; width: 100%; margin: 0 0 16px; padding: 0; break-inside: avoid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); text-align: left; transition: transform .22s ease, border-color .22s ease; }
.card:hover { border-color: #536348; transform: translateY(-3px); }
.card img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--panel-2); }
.card:nth-child(3n+2) img { aspect-ratio: 1 / 1.28; }
.card-body { position: relative; padding: 16px; }
.card-body::before { position: absolute; right: 14px; top: -12px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--acid); color: #0b0e09; content: "↗"; font-size: 13px; font-weight: 900; }
.card h2 { margin: 0; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.p-code { margin: 8px 0 0; overflow: hidden; color: var(--acid-soft); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { padding: 5px 8px; border: 1px solid rgba(180,239,115,.19); border-radius: 7px; color: #b9ccaa; font-size: 11px; }
.favorite-badge { position: absolute; top: 12px; right: 12px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(9,11,9,.64); color: var(--acid-soft); backdrop-filter: blur(12px); }
.empty-state { padding: 120px 20px; color: var(--muted); text-align: center; }
.empty-state > div { color: var(--acid); font-size: 70px; }
.empty-state h2 { margin: 8px 0; color: var(--text); font-size: 22px; }
.empty-state p { margin: 0; }
dialog { max-width: none; padding: 0; border: 1px solid var(--line); background: #0d100d; color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.68); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.detail-dialog { width: min(1000px, calc(100% - 32px)); max-height: calc(100dvh - 32px); border-radius: 28px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); min-height: 650px; }
.detail-media { position: relative; min-height: 520px; background: #050605; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-pane { overflow-y: auto; max-height: calc(100dvh - 34px); padding: 32px; }
.detail-pane h2 { margin: 5px 0 0; font-size: 34px; letter-spacing: -.03em; }
.detail-top { display: flex; justify-content: space-between; gap: 20px; }
.detail-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 25px 0 30px; }
.detail-buttons button:first-child { grid-column: 1 / -1; }
.copy-button { min-height: 70px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); color: var(--text); text-align: left; }
.copy-button.primary-copy { border-color: var(--acid); background: var(--acid); color: #10140d; }
.copy-button strong, .copy-button small { display: block; }
.copy-button small { margin-top: 4px; opacity: .62; }
.content-section { margin-top: 26px; }
.content-section > span { color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .16em; }
.content-box { max-height: 180px; margin-top: 10px; padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: #c4cbc1; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.content-box.code { border-color: #3e4e34; color: var(--acid-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.manage-row { display: flex; gap: 10px; margin-top: 30px; }
.danger-button { border-color: #59302c; color: var(--danger); }
.editor-dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100dvh - 28px); overflow: auto; border-radius: 26px; }
.editor-dialog form { padding: 28px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-head h2 { margin: 0; font-size: 32px; }
.close-button { flex: 0 0 auto; }
.editor-copy, .login-copy { margin: 8px 0 25px; color: var(--muted); line-height: 1.6; }
label { display: grid; gap: 9px; margin-top: 20px; color: #d5dad2; font-size: 14px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: var(--panel); color: var(--text); font-size: 16px; }
input { min-height: 50px; padding: 0 15px; }
textarea { min-height: 190px; padding: 14px 15px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus { border-color: #6b8b50; box-shadow: 0 0 0 3px rgba(180,239,115,.09); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.image-picker { position: relative; display: grid; min-height: 260px; padding: 15px; place-items: center; overflow: hidden; border: 1px dashed #3d473a; border-radius: 18px; background: var(--panel); color: var(--muted); text-align: center; cursor: pointer; }
.image-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.image-picker img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.image-picker > span { display: grid; gap: 8px; }
.image-picker b { color: var(--acid); font-size: 48px; font-weight: 300; }
.image-picker small { position: absolute; right: 14px; bottom: 12px; padding: 6px 9px; border-radius: 999px; background: rgba(0,0,0,.62); color: #bdc4b9; font-size: 11px; }
.parse-preview { display: grid; grid-template-columns: 86px 1fr; gap: 10px 14px; margin-top: 20px; padding: 16px; border: 1px solid #34432d; border-radius: 15px; background: #131911; }
.parse-preview span { color: var(--acid); font-size: 12px; font-weight: 750; }
.parse-preview code, .parse-preview p { margin: 0; overflow: hidden; color: #c4cec0; font-size: 13px; line-height: 1.55; }
.form-error { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.login-view { display: grid; min-height: 100dvh; padding: 24px; place-items: center; overflow: hidden; }
.login-glow { position: fixed; width: 420px; height: 420px; border-radius: 50%; background: rgba(180,239,115,.12); filter: blur(90px); transform: translate(180px,-130px); }
.login-card { position: relative; width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 28px; background: rgba(16,19,16,.92); box-shadow: 0 30px 90px rgba(0,0,0,.48); }
.login-card .brand-mark { margin-bottom: 34px; }
.login-card h1 { margin: 0; font-size: 36px; letter-spacing: -.04em; }
.login-card .primary-button { width: 100%; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); z-index: 100; padding: 12px 18px; border: 1px solid #3b4438; border-radius: 999px; background: #1a2018; color: var(--text); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
  .app-shell { padding: 0 16px 110px; }
  .topbar { min-height: 66px; }
  .sync-state { display: none; }
  .hero-row { align-items: end; padding: 46px 2px 28px; }
  .hero-row h1 { font-size: 52px; }
  .count-block strong { font-size: 30px; }
  .toolbar { grid-template-columns: 1fr auto; }
  .search-box { grid-column: 1 / -1; }
  .search-box kbd { display: none; }
  .add-button { position: fixed; right: 18px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 18; min-height: 58px; border-radius: 999px; box-shadow: 0 18px 40px rgba(0,0,0,.48); }
  .gallery { columns: 2 145px; column-gap: 11px; }
  .card { margin-bottom: 11px; border-radius: 17px; }
  .card-body { padding: 12px; }
  .card h2 { font-size: 15px; }
  .card-body::before { display: none; }
  .tag:nth-child(n+3) { display: none; }
  .detail-dialog { width: 100%; max-height: 100dvh; border-width: 0; border-radius: 0; }
  .detail-layout { display: block; min-height: 100dvh; }
  .detail-media { height: 56dvh; min-height: 390px; }
  .detail-pane { position: relative; max-height: none; margin-top: -24px; padding: 26px 18px 80px; border-radius: 24px 24px 0 0; background: #0d100d; }
  .detail-pane h2 { font-size: 28px; }
  .editor-dialog { width: 100%; max-height: 94dvh; margin-bottom: 0; border-width: 1px 0 0; border-radius: 24px 24px 0 0; }
  .editor-dialog form { padding: 22px 18px calc(28px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .image-picker { min-height: 220px; }
  .login-card { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
