:root {
  --bg: #14161F;
  --card: #1E212E;
  --card2: #262A3A;
  --accent: #F47521;
  --txt: #ECECEC;
  --dim: #9AA0B0;
  --faint: #565C6B;
  --gold: #E8C161;
  --teal: #7FB6A8;
  --syn: #C5C9D3;
  --danger: #E5484D;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 720px; margin: 0 auto; padding: 0 12px 40px; }
.loading, .empty { color: var(--faint); padding: 14px 0; font-size: 13px; }
.empty.big { text-align: center; padding: 40px 0; font-size: 15px; }
.fatal { margin: 20vh auto; max-width: 480px; color: var(--dim); text-align: center; }
.fatal code { display: block; margin-top: 10px; color: var(--danger); font-size: 13px; white-space: pre-wrap; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0 6px; box-shadow: 0 8px 12px -8px rgba(0,0,0,.6); }
.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand img { width: 36px; height: 36px; flex: none; }
.brand-title { font-size: 22px; font-weight: 700; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); color: var(--txt); font-size: 20px; cursor: pointer; line-height: 1; }
.icon-btn:hover { background: var(--card2); }
.icon-btn.add { background: var(--accent); color: #14161F; font-weight: 700; font-size: 24px; }
.search { flex: 1; background: var(--card); border: 1px solid transparent; color: var(--txt); border-radius: var(--radius); padding: 10px 12px; font-size: 15px; }
.search:focus { outline: none; border-color: var(--accent); }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }

/* chips */
.chip { flex: 1; background: var(--card); color: var(--txt); border: 0; border-radius: 8px; padding: 9px 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip.small { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; }
.chip.on { background: var(--accent); color: #14161F; font-weight: 700; }

/* sections + cards */
.sec-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; padding: 16px 0 6px; cursor: pointer; text-align: left; }
.sec-head .caret { width: 12px; }
.sec-head .count { margin-left: auto; color: var(--faint); font-weight: 400; letter-spacing: 0; }
.card { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 10px 12px 10px 10px; margin-bottom: 6px; cursor: pointer; }
.card:hover { background: var(--card2); }
.poster { width: 56px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; background: #0d0f16; }
.poster.placeholder { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 22px; }
.col { flex: 1; min-width: 0; }
.title { font-weight: 700; font-size: 16px; }
.score { color: var(--gold); font-size: 12.5px; }
.note { color: var(--dim); font-size: 13px; }
.syn { color: var(--syn); font-size: 13px; line-height: 1.35; margin-top: 5px; }
.why { color: var(--teal); font-size: 12.5px; font-style: italic; margin-top: 2px; }
.verdicts { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.vline { font-size: 13px; color: var(--dim); }
.vline.mine { color: var(--accent); }
.vline .who { font-weight: 600; }
.vline .who::after { content: ':'; }
.vcomment { color: var(--syn); font-size: 12.5px; font-style: italic; }
.foot { color: var(--faint); font-size: 11px; padding: 18px 0; text-align: center; }
.foot a { color: var(--dim); }

/* dialogs */
.dlg { background: transparent; border: 0; padding: 0; max-width: min(96vw, 560px); width: 100%; color: var(--txt); }
.dlg::backdrop { background: rgba(0,0,0,.65); }
.dlg-body { background: #1A1D29; border-radius: 14px; padding: 18px 20px; max-height: 88vh; overflow: auto; }
.dlg h2 { margin: 0 0 4px; font-size: 19px; }
.dlg h3 { margin: 18px 0 6px; font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.links { display: flex; gap: 16px; font-size: 13px; margin-bottom: 4px; }
.links a { color: var(--dim); text-decoration: none; }
.links a:hover { color: var(--txt); }
.group { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 14px 0 4px; }
.chips { display: flex; gap: 4px; }
textarea, input:not([type=checkbox]), select { width: 100%; background: var(--card); border: 1px solid transparent; color: var(--txt); border-radius: 8px; padding: 10px; font: inherit; }
textarea { resize: vertical; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }
.dlg label { display: block; font-size: 12px; color: var(--dim); margin-top: 10px; }
.dlg label > * { margin-top: 4px; }
.btns { display: flex; gap: 8px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { background: var(--card); color: var(--txt); border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; cursor: pointer; }
.btn:hover { background: var(--card2); }
.btn.primary { background: var(--accent); color: #14161F; font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: default; }
.hint { color: var(--dim); font-size: 13px; margin: 6px 0; }
.auth-error { color: var(--danger); font-size: 13px; min-height: 1em; margin-top: 6px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1 1 140px; width: auto; }
.row label.inline { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; color: var(--dim); }
.list { display: flex; flex-direction: column; gap: 6px; }
.list .item { display: flex; gap: 6px; align-items: center; background: var(--card); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.list .item input[type=text] { flex: 1; padding: 6px 8px; width: auto; }
.list .item .name { flex: 1; }
.list .item .tag { color: var(--faint); font-size: 12px; }
.mini { background: var(--card2); border: 0; color: var(--txt); border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 13px; }
.mini:hover { background: #30354a; }
.mini.danger { color: var(--danger); }

/* auth */
.auth { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8px; }
.logo img { width: 44px; height: 44px; }
.logo h1 { margin: 0; font-size: 26px; }
.auth label { display: block; font-size: 12px; color: var(--dim); }
.auth label input { margin-top: 4px; }

/* gallery */
.gallery { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gallery .big { max-width: 100vw; max-height: 88vh; object-fit: contain; }
.gallery .cap { color: var(--dim); font-size: 13px; padding: 10px 16px; text-align: center; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(30,33,46,.7); color: #fff; border: 0; font-size: 32px; width: 44px; height: 64px; border-radius: 8px; cursor: pointer; }
.gallery .prev { left: 8px; }
.gallery .next { right: 8px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2A2E3E; color: var(--txt); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 30; box-shadow: 0 4px 20px rgba(0,0,0,.5); max-width: 90vw; }

@media (min-width: 600px) {
  .chip { padding: 9px 10px; }
  .poster { width: 64px; height: 92px; }
}

/* Google sign-in */
.gsi-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 4px 0; }
.gsi { min-height: 44px; }
.divider { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid #2A2E3E; }
/* Chrome paints an iframe on an opaque white backdrop when its colour scheme differs
   from the page's; Google's button iframe is light, so match it to keep it transparent. */
.gsi iframe { color-scheme: light; }

/* Claude run dialog */
.icon-btn.ai { background: #2b2350; color: #d8c8ff; font-size: 18px; }
.icon-btn.ai:hover { background: #372d66; }
.log { background: #0f1118; border-radius: 8px; padding: 10px 12px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; max-height: 40vh; overflow: auto; white-space: pre-wrap; color: var(--syn); margin-top: 8px; }
.summary { background: var(--card); border-left: 3px solid var(--teal); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 14px; line-height: 1.45; }
.notes { min-height: 180px; font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; }
.filters.people { margin-bottom: 4px; }
.filters.people .chip { background: #23263a; color: var(--dim); }
.filters.people .chip.on { background: #3a3f5c; color: var(--txt); }
