:root {
  --bg: #0e1116;
  --panel: #171b22;
  --line: #2a3140;
  --text: #e8ecf3;
  --muted: #9aa3b5;
  --accent: #c9a45c;
  --accent2: #6eb6ff;
  --keep: #3d9a6a;
  --keep-bg: #1a2f24;
  --drop: #b85c5c;
  --drop-bg: #2a1a1a;
  --radius: 14px;
  --dock-h: 9.5rem;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  height: 100%;
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
@media (min-width: 520px) {
  body { border-left: none; border-right: none; max-width: 520px; }
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.top {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #0b0d12;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; }
.brand strong { font-size: 1.02rem; letter-spacing: 0.02em; }
.brand .sub { color: var(--accent); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.ghost-btn {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.35rem 0.55rem; font-size: 0.75rem; cursor: pointer;
}
.ghost-btn:active { border-color: var(--accent); color: var(--accent); }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0; border-bottom: 1px solid var(--line);
  background: #0b0d12; position: sticky; top: 3.15rem; z-index: 19;
}
.tab {
  appearance: none; background: transparent; border: none;
  color: var(--muted); padding: 0.65rem 0.35rem; font-size: 0.82rem;
  cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active {
  color: var(--accent); border-bottom-color: var(--accent); font-weight: 600;
}
.tab-count {
  display: inline-block; min-width: 1.2em;
  font-variant-numeric: tabular-nums; opacity: 0.85;
}

.account-bar {
  display: flex; gap: 0.35rem; overflow-x: auto;
  padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.account-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  font-size: 0.75rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #12161d;
  cursor: pointer;
}
.chip.active {
  color: #1a1205; background: var(--accent); border-color: var(--accent); font-weight: 600;
}

.stage {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 0.85rem calc(var(--dock-h) + var(--safe-b) + 0.5rem);
  -webkit-overflow-scrolling: touch;
}

.empty {
  text-align: center; padding: 3rem 1rem; margin: 0;
}

.card-sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: min(70dvh, 640px);
}
.media-box {
  width: 100%;
  background: #12161d;
  min-height: 160px;
  max-height: min(52dvh, 440px);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-box img {
  width: 100%;
  height: auto;
  max-height: min(52dvh, 440px);
  object-fit: contain;
  object-position: center;
  display: block;
}
.media-box .ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.85rem;
  background: linear-gradient(145deg, #151922, #1c2330);
}
.card-meta {
  padding: 0.7rem 0.9rem 0;
  font-size: 0.75rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
}
.badge {
  font-size: 0.68rem; padding: 0.12rem 0.45rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: #12161d; color: var(--muted);
}
.badge.ok { color: #0d2a1a; background: #7dcea0; border-color: #7dcea0; }
.badge.warn { color: #2a1a05; background: #e0b36a; border-color: #e0b36a; }
.badge.keep { color: #d8f5e4; background: var(--keep-bg); border-color: var(--keep); }
.badge.drop { color: #f5d8d8; background: var(--drop-bg); border-color: var(--drop); }

.card-title {
  margin: 0.45rem 0.9rem 0.25rem;
  font-size: 1.05rem; color: var(--accent);
  font-weight: 600; line-height: 1.4;
}
.card-summary {
  margin: 0 0.9rem 0.55rem;
  color: #d5dae6; font-size: 0.88rem; line-height: 1.5;
}
.prompt-wrap {
  margin: 0 0.75rem 0.75rem;
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}
.prompt-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.35rem;
  color: var(--accent); font-size: 0.8rem; font-weight: 600;
}
.linkish {
  background: none; border: none; color: var(--accent2);
  font-size: 0.78rem; cursor: pointer; padding: 0.2rem;
}
.prompt-body {
  margin: 0; flex: 1;
  white-space: pre-wrap; word-break: break-word;
  background: #0b0d12;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font-size: 0.82rem; line-height: 1.6;
  color: #c8d0e0;
  font-family: var(--mono);
  max-height: 38vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.card-why {
  margin: 0 0.9rem 0.9rem;
  font-size: 0.78rem; line-height: 1.45;
}

.dock {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(100%, 520px);
  background: #0b0d12ee;
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 0.55rem 0.85rem calc(0.55rem + var(--safe-b));
  z-index: 30;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.pager {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 0.5rem;
}
.page-btn {
  background: #151922; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.75rem; font-size: 0.88rem; cursor: pointer;
  min-height: 44px;
}
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-btn:not(:disabled):active { border-color: var(--accent); }
.page-ind {
  font-size: 0.8rem; color: var(--muted);
  font-variant-numeric: tabular-nums; text-align: center;
  white-space: nowrap;
}
.curate-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem;
}
.act {
  border: none; border-radius: 12px;
  padding: 0.85rem 0.75rem; font-size: 1.02rem; font-weight: 700;
  cursor: pointer; min-height: 52px; letter-spacing: 0.04em;
}
.act.drop {
  background: var(--drop-bg); color: #f0c4c4;
  box-shadow: inset 0 0 0 1px var(--drop);
}
.act.keep {
  background: var(--keep-bg); color: #c8f0d8;
  box-shadow: inset 0 0 0 1px var(--keep);
}
.act:active { filter: brightness(1.12); }
.act:disabled { opacity: 0.4; cursor: not-allowed; }
.aux-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; min-height: 1.2rem;
}
.aux-link { font-size: 0.82rem; }
.sync-hint { font-size: 0.72rem; }
