:root {
  --bg: #0d0b0f;
  --panel: #16131b;
  --panel-2: #1f1b26;
  --line: #2c2735;
  --text: #efeaf4;
  --muted: #9a92a8;
  --gold: #e8b04b;
  --gold-dim: #a9803a;
  --accent: #c65d3b;
  --green: #4caf7d;
  --blue: #5b8def;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 80% -10%, #1c1622 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
.hidden { display: none !important; }

/* Layout */
.app { max-width: 980px; margin: 0 auto; padding: 0 16px 120px; }
header.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 4px; margin-bottom: 8px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .disc {
  width: 34px; height: 34px; border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, #111 0 2px, #241f2c 2px 4px);
  border: 2px solid var(--gold-dim); position: relative;
}
.brand .disc::after { content:""; position:absolute; inset:12px; border-radius:50%; background: var(--gold); }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.brand small { color: var(--muted); font-weight: 500; display:block; font-size: 11px; margin-top:-2px; }
.userchip { display:flex; align-items:center; gap:10px; color: var(--muted); font-size: 13px; }
.userchip button { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 10px; font-size: 12px; }

/* Tabs */
nav.tabs { display: flex; gap: 6px; margin: 6px 0 22px; }
nav.tabs button {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
nav.tabs button.active { color: #1a1520; background: var(--gold); border-color: var(--gold); }

/* Cards / panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin: 0 0 12px; }

/* Forms */
label { display:block; font-size: 12px; color: var(--muted); margin: 0 0 6px; letter-spacing:.3px; }
input, textarea, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 12px; font-size: 14px; font-family: var(--font);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold-dim); }
textarea { resize: vertical; min-height: 64px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field { margin-bottom: 14px; }
.btn {
  background: var(--gold); color: #1a1520; border: none; border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 14px; font-weight: 700; letter-spacing:.3px;
}
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.inline { display:flex; gap: 10px; align-items:center; flex-wrap: wrap; }

/* Capture mode switch */
.modeswitch { display:flex; gap:6px; margin-bottom:16px; background: var(--panel-2); padding:5px; border-radius: 999px; border:1px solid var(--line); }
.modeswitch button { flex:1; background: transparent; border:none; color: var(--muted); padding:9px; border-radius: 999px; font-weight:600; font-size:13px; }
.modeswitch button.active { background: var(--accent); color:#fff; }

/* Chips */
.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip { background: var(--panel-2); border:1px solid var(--line); color: var(--muted); padding:7px 12px; border-radius:999px; font-size:12.5px; font-weight:600; }
.chip.on { background: var(--gold); color:#1a1520; border-color: var(--gold); }
.chip.small { padding: 3px 9px; font-size: 11px; }

/* Vault list */
.filters { display:flex; gap:10px; flex-wrap: wrap; align-items:center; margin-bottom: 16px; }
.filters input[type=search] { flex:1; min-width: 180px; }
.filters select { width: auto; }
.crate-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.crate-card { background: var(--panel); border:1px solid var(--line); border-radius: var(--radius); overflow:hidden; display:flex; flex-direction:column; transition: border-color .15s, transform .15s; }
.crate-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.crate-card .thumb { aspect-ratio: 16/9; background: var(--panel-2) center/cover no-repeat; position:relative; }
.crate-card .thumb .kindtag { position:absolute; top:8px; left:8px; font-size:10px; text-transform:uppercase; letter-spacing:1px; background: rgba(0,0,0,.6); padding:4px 8px; border-radius:6px; color: var(--gold); }
.crate-card .thumb .tc { position:absolute; bottom:8px; right:8px; background: rgba(0,0,0,.75); padding:3px 8px; border-radius:6px; font-size:12px; font-variant-numeric: tabular-nums; }
.crate-card .body { padding: 12px 13px 14px; display:flex; flex-direction:column; gap:6px; flex:1; }
.crate-card .body .t { font-weight:700; font-size:15px; line-height:1.2; }
.crate-card .body .a { color: var(--muted); font-size: 13px; }
.crate-card .meta { display:flex; gap:6px; flex-wrap:wrap; margin-top:auto; padding-top:6px; }
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; vertical-align:middle; }
.st-idea { background: var(--blue); } .st-to_look_up { background: var(--gold); } .st-sampled { background: var(--green); } .st-archived { background: #6b6478; }
.empty { text-align:center; color: var(--muted); padding: 50px 20px; }
.empty .disc-lg { width:60px;height:60px;border-radius:50%;margin:0 auto 16px;background: repeating-radial-gradient(circle at 50% 50%, #111 0 3px, #241f2c 3px 6px); border:2px solid var(--gold-dim);}

/* Detail modal */
.overlay { position: fixed; inset:0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); z-index: 60; display:flex; align-items:flex-start; justify-content:center; padding: 40px 16px; overflow:auto; }
.modal { background: var(--panel); border:1px solid var(--line); border-radius: var(--radius); max-width: 640px; width:100%; box-shadow: var(--shadow); }
.modal .head { display:flex; justify-content:space-between; align-items:flex-start; padding: 18px; border-bottom:1px solid var(--line); }
.modal .head h2 { margin:0; font-size:19px; }
.modal .head .a { color: var(--muted); font-size:14px; margin-top:2px; }
.modal .close { background:transparent;border:none;color:var(--muted);font-size:24px;line-height:1; }
.modal .content { padding: 18px; }
.player { aspect-ratio:16/9; width:100%; border:none; border-radius: var(--radius-sm); background:#000; margin-bottom:14px; }
.kv { display:grid; grid-template-columns: auto 1fr; gap:6px 14px; font-size:13.5px; margin: 4px 0 14px; }
.kv dt { color: var(--muted); }
.insight { background: var(--panel-2); border:1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-top: 6px; }
.insight h4 { margin: 12px 0 6px; font-size:12px; text-transform:uppercase; letter-spacing:1px; color: var(--gold); }
.insight h4:first-child { margin-top:0; }
.insight ul { margin:0; padding-left: 18px; }
.insight li { margin-bottom:5px; font-size:13.5px; line-height:1.45; }
.insight .sum { font-style: italic; color: var(--text); font-size:14px; }
.spinner { display:inline-block; width:16px;height:16px;border:2px solid var(--line); border-top-color: var(--gold); border-radius:50%; animation: spin .7s linear infinite; vertical-align:middle;}
@keyframes spin { to { transform: rotate(360deg);} }

/* Auth */
.auth-wrap { max-width: 380px; margin: 8vh auto; }
.auth-wrap .panel { padding: 28px; }
.auth-wrap h2 { margin:0 0 4px; }
.auth-wrap p.sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.switch-auth { text-align:center; margin-top: 16px; color: var(--muted); font-size: 13px; }

/* Blog */
.blog-post { border-bottom: 1px solid var(--line); padding: 18px 0; }
.blog-post h3 { margin: 0 0 4px; font-size: 20px; }
.blog-post .date { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.blog-post .excerpt { color: #cdc6d8; font-size: 14.5px; line-height: 1.55; }
.blog-post .badge { font-size:10px; text-transform:uppercase; letter-spacing:1px; padding:3px 8px; border-radius:6px; }
.badge.draft { background: var(--panel-2); color: var(--muted); border:1px solid var(--line); }
.badge.published { background: rgba(76,175,125,.15); color: var(--green); border:1px solid rgba(76,175,125,.3); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border:1px solid var(--line); color: var(--text); padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); z-index: 100; font-size: 14px; }

@media (max-width: 640px) {
  .row, .row-3 { grid-template-columns: 1fr; }
  .crate-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 18px; }
}
