:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #222631;
  --text: #f1f3f7;
  --muted: #9aa3b2;
  --accent: #c6f432;
  --accent-ink: #0f1115;
  --danger: #ff6b6b;
  --border: #2b303c;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --text: #12151b;
    --muted: #5d6676;
    --accent: #5b8c00;
    --accent-ink: #ffffff;
    --border: #dde1e8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .3px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); font-size: 18px;
}

main { max-width: 720px; margin: 0 auto; padding: 14px 16px 40px; }

.quick-add form { display: flex; gap: 8px; }
.quick-add input { flex: 1; min-width: 0; }
input[type=url], input[type=text], input[type=search], textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }

.primary, .ghost {
  padding: 10px 14px; border-radius: 12px; font-weight: 600; white-space: nowrap;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.ghost { background: transparent; border: 1px solid var(--border); }

.filters { margin-top: 14px; display: grid; gap: 10px; }
.seg {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px;
}
.seg button {
  border: 0; background: transparent; padding: 8px 4px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 14px;
}
.seg button.active { background: var(--surface-2); color: var(--text); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.selectable { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.count { color: var(--muted); font-size: 13px; margin: 14px 2px 8px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  display: grid; grid-template-columns: 88px 1fr; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
}
.card.tried { opacity: .72; }
.thumb {
  width: 88px; height: 120px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; font-size: 30px; text-decoration: none;
  background: var(--surface-2); color: #fff;
}
.thumb { position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge {
  position: absolute; right: 4px; bottom: 4px; font-size: 13px; line-height: 1;
  background: rgba(0,0,0,.6); border-radius: 6px; padding: 3px;
}
.thumb.instagram { background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af); }
.thumb.tiktok { background: linear-gradient(135deg, #111, #25f4ee 160%); }
.thumb.youtube { background: #e62117; }
.thumb.facebook { background: #1877f2; }
.thumb.x { background: #000; }
.body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.title {
  font-weight: 650; margin: 0; font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.meta { color: var(--muted); font-size: 12px; }
.notes {
  color: var(--muted); font-size: 13px; margin: 0; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.actions button, .actions a {
  padding: 6px 10px; font-size: 13px; border-radius: 9px; text-decoration: none;
  background: var(--surface-2); border: 0; color: var(--text); font-weight: 600;
}
.actions .open { background: var(--accent); color: var(--accent-ink); }
.actions .on { color: var(--accent); }
.actions .del { color: var(--danger); margin-left: auto; background: transparent; }

.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty h2 { color: var(--text); margin: 8px 0; }
.empty-emoji { font-size: 48px; }

dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin: 0 0 12px; font-size: 19px; }
dialog h3 { margin: 14px 0 4px; font-size: 15px; }
dialog ol { padding-left: 20px; margin: 4px 0; }
dialog li { margin: 4px 0; }
dialog form > label { display: grid; gap: 5px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.row { display: flex; gap: 18px; margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 12px;
  background: var(--surface-2); border: 0; border-radius: 12px; margin-bottom: 8px;
}
.muted { color: var(--muted); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; transition: .25s; max-width: calc(100vw - 32px);
  display: flex; gap: 12px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 0; }
@media (prefers-color-scheme: light) { .toast button { color: #b6f02a; } }

.card.highlight { animation: pulse 1.4s ease; }
@keyframes pulse { 0%, 60% { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); } }

.shot-field { display: flex; gap: 12px; align-items: center; }
.shot-preview {
  flex: none; width: 72px; height: 96px; padding: 0; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 26px;
  display: grid; place-items: center;
}
.shot-preview.empty-shot { border-style: dashed; }
.shot-preview img { width: 100%; height: 100%; object-fit: cover; }
.shot-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shot-actions .small { width: 100%; margin: 0; font-size: 12px; }
.ghost.danger { color: var(--danger); }

.empty-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* First-run intro */
dialog.intro { padding: 0; overflow: hidden; width: min(440px, calc(100vw - 24px)); }
.slides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-behavior: smooth; scrollbar-width: none;
}
.slides::-webkit-scrollbar { display: none; }
.slides:focus { outline: none; }
.slide {
  flex: 0 0 100%; scroll-snap-align: start; padding: 28px 22px 8px;
  min-height: 420px; text-align: center;
}
.slide .hero {
  width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 26px; font-size: 44px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}
.slide h2 { font-size: 21px; margin: 0 0 10px; }
.slide p { color: var(--muted); margin: 0 0 12px; }
.slide ul, .slide ol { text-align: left; margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.compare li { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 600; font-size: 15px; }
.compare li::before { margin-right: 8px; }
.compare .bad { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--danger); }
.compare .bad::before { content: "✗"; color: var(--danger); }
.compare .good { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.compare .good::before { content: "✓"; color: var(--accent); }
.steps { counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-size: 15px; }
.steps li::before {
  content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.feature li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-size: 15px; }
.feature li span { font-size: 20px; line-height: 1.2; }
.tip { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; color: var(--text) !important; font-size: 14px; }
.intro-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 18px 18px; border-top: 1px solid var(--border);
}
.intro-nav .primary { min-width: 110px; }
.link-btn { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 10px 4px; }
.dots { display: flex; gap: 6px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: .2s; }
.dots span.on { background: var(--accent); width: 18px; border-radius: 4px; }

.shot-preview.loading span { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
