:root {
  --bg: #F4F6F8; --surface: #FFFFFF; --surface2: #EEF2F6; --ink: #101828; --muted: #556070;
  --border: #E2E6EB; --border2: #C9D0D9; --acc: #2447D6; --acc-ink: #FFFFFF; --acc-soft: #E1E8FD;
  --keep: #1B7A43; --danger: #A32020; --danger-border: #E3B5B5; --warn-bg: #FBEBCB; --warn-ink: #6B4204;
  --overlay: rgba(16, 24, 40, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F141B; --surface: #171E27; --surface2: #1F2833; --ink: #EEF1F5; --muted: #A4AEBB;
    --border: #2A3441; --border2: #3A4656; --acc: #4A69F0; --acc-soft: #22305E;
    --keep: #2E9A5C; --danger: #F08A8A; --danger-border: #6B3535; --warn-bg: #4A3A12; --warn-ink: #F6D58A;
    --overlay: rgba(0, 0, 0, 0.6);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 15px/1.4 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.ic { flex: none; vertical-align: middle; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 20px) 16px 120px; }
.screen { display: flex; flex-direction: column; gap: 14px; }

/* header */
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.head h1 { font-size: 28px; font-weight: 700; line-height: 1.1; }
.head .sub { font-size: 13px; color: var(--muted); }
.head-actions { display: flex; gap: 8px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--ink); color: var(--bg); font-weight: 600; }
.iconbtn { min-width: 44px; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; }
.topbar { display: flex; align-items: center; gap: 8px; }
.topbar h2 { font-size: 18px; font-weight: 700; }
.topbar .sub { font-size: 12px; color: var(--muted); }

/* inputs */
.input { width: 100%; height: 48px; border: 1px solid var(--border2); border-radius: 12px; background: var(--surface); padding: 0 14px; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { width: 100%; min-height: 84px; border: 1px solid var(--border2); border-radius: 12px; background: var(--surface); padding: 12px 14px; resize: vertical; }
.input:focus, .textarea:focus { outline: 2px solid var(--acc); outline-offset: 1px; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* chips and tags */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 44px; padding: 0 16px; border-radius: 22px; border: none; font-weight: 500; font-size: 14px; white-space: nowrap; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border2); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); box-shadow: none; }
.tagbtn { height: 44px; padding: 0 16px; border-radius: 22px; border: none; font-weight: 500; font-size: 14px; white-space: nowrap; }
.tagbtn.on { box-shadow: inset 0 0 0 2px currentColor; }
.tagbtn.dashed { background: var(--surface); color: var(--ink); border: 1.5px dashed var(--border2); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tagrow { display: flex; flex-wrap: wrap; gap: 8px; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface2); border-radius: 14px; }
.seg button { flex: 1; height: 44px; border: none; border-radius: 10px; background: transparent; font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--ink); color: var(--bg); }

/* cards */
.list { display: flex; flex-direction: column; gap: 12px; }
.card { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; cursor: pointer; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 500; }
.pill.totry { background: #E1E8FD; color: #1F3AA8; }
.pill.kept { background: #DDF1E4; color: #14653A; }
.pill.removed { background: #FBE4E4; color: #8A1C1C; }

.thumb { position: relative; flex: none; width: 96px; height: 76px; border-radius: 10px; overflow: hidden; display: block; }
.thumb.big { width: 100%; height: 190px; border-radius: 16px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.k-reel { background: #FCE4EE; color: #8F1B47; }
.k-video { background: #FDE3E1; color: #9B1C1C; }
.k-post { background: #EDE4FB; color: #4B2A8A; }
.k-web { background: #E8ECF1; color: #334155; }
.play { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: rgba(16, 24, 40, 0.62); color: #fff; display: flex; align-items: center; justify-content: center; }
.thumb.big .play { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
.thumb.big .play .ic { width: 30px; height: 30px; }

.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }

/* buttons */
.btn { height: 48px; border: none; border-radius: 12px; padding: 0 16px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.block { width: 100%; }
.btn.flex { flex: 1; }
.btn.small { height: 44px; font-size: 14px; }
.btn.primary { background: var(--acc); color: var(--acc-ink); }
.btn.secondary { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border2); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.keep { background: var(--keep); color: #fff; }
.btn.remove { background: var(--surface); color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger-border); }
.btn.tall { height: 56px; }
.row { display: flex; gap: 8px; }

.fab { position: fixed; right: max(16px, calc(50% - 224px)); bottom: calc(env(safe-area-inset-bottom) + 20px); width: 60px; height: 60px; border-radius: 30px; border: none; background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(36, 71, 214, 0.35); z-index: 5; }

.prompt { background: var(--surface); border: 2px solid var(--acc); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.prompt p { font-size: 14px; font-weight: 600; line-height: 1.35; }

/* detail */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.titleinput { width: 100%; border: 1px solid transparent; border-radius: 10px; background: transparent; padding: 6px 8px; margin: -6px -8px; font-size: 20px; font-weight: 700; line-height: 1.25; }
.titleinput:focus { outline: 2px solid var(--acc); background: var(--surface); }
.urlrow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.note-small { font-size: 12px; color: var(--muted); }

/* review */
.reviewcard { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; touch-action: pan-y; transition: transform 0.15s; }
.progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress > div { height: 100%; background: var(--acc); }

/* sheets */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 12px 20px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 16px; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border2); align-self: center; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head h3 { font-size: 18px; font-weight: 700; }
.sheet-head .sub { font-size: 13px; color: var(--muted); }
.badge { width: 44px; height: 44px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.badge.ok { background: #DDF1E4; color: #14653A; }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.err { color: var(--danger); font-size: 13px; }

/* settings */
.setrow { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 8px 8px 12px; }
.setrow .grow { flex: 1; min-width: 0; }
.section { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.section h3 { font-size: 16px; font-weight: 700; }
.swatch { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); }

.signin { min-height: 80dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 0 12px; }
.signin h1 { font-size: 30px; font-weight: 700; }
.signin p { color: var(--muted); max-width: 320px; }
.logo { width: 72px; height: 72px; border-radius: 18px; background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 40; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
