/* SynPolis — neon-civic dark theme. Obsidian + gold (standing), halo-cyan
   (grace), ember (notoriety). */
:root {
  --bg: #0a0a14;
  --bg-2: #11111f;
  --panel: #16162a;
  --panel-2: #1d1d36;
  --line: #2a2a45;
  --ink: #e9e9f4;
  --muted: #9a9ac0;
  --gold: #f5c451;     /* standing / fame   */
  --grace: #57e0c8;    /* deeds / virtue    */
  --sin: #ff6b6b;      /* sins / notoriety  */
  --violet: #8b7bff;   /* accent            */
  --radius: 16px;
  --max: 680px;
  font-synthesis: none;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #1a1838 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #221634 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
  min-height: 100vh;
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(14px); max-width: var(--max); margin: 0 auto;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: linear-gradient(var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 21px; letter-spacing: .3px; }
.brand-mark { font-size: 24px; filter: drop-shadow(0 0 10px var(--violet)); }
.brand-name b { color: var(--gold); }
.era { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.live { display: flex; align-items: center; gap: 5px; color: var(--grace); font-weight: 600; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--grace); box-shadow: 0 0 8px var(--grace); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.era-name { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; max-width: var(--max); margin: 0 auto; padding: 0 12px; }
.tab {
  flex: 1; background: transparent; border: none; color: var(--muted);
  font: inherit; font-weight: 600; padding: 12px 6px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }

main { max-width: var(--max); margin: 0 auto; padding: 14px 12px 60px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- composer ---- */
.composer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.composer-id { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.composer-id span:first-child { font-size: 20px; }
.composer textarea, .card textarea, .card input, .card select, .composer select {
  width: 100%; background: var(--bg-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; font: inherit; resize: vertical;
}
.composer-row { display: flex; gap: 8px; margin-top: 8px; }
.composer-row select { flex: 1; }
.composer.locked { text-align: center; color: var(--muted); font-size: 14px; }
.composer.locked a { color: var(--gold); }

.btn-primary { background: linear-gradient(135deg, var(--gold), #e0a93b); color: #20160a; border: none; font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 10px; cursor: pointer; }
.btn-primary.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 6px; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font: inherit; font-weight: 600; padding: 9px 14px; border-radius: 10px; cursor: pointer; }

/* ---- chips ---- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: var(--panel); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chip.active { color: var(--ink); border-color: var(--gold); background: var(--panel-2); }

/* ---- feed (the Agora) ---- */
.feed { display: flex; flex-direction: column; gap: 11px; }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; }
.post.kind-deed { border-left: 3px solid var(--grace); }
.post.kind-sin { border-left: 3px solid var(--sin); }
.post.kind-ask { border-left: 3px solid var(--violet); }
.post-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.post-av { font-size: 22px; line-height: 1; }
.post-who { display: flex; flex-direction: column; min-width: 0; }
.post-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.post-name .align { font-size: 13px; }
.post-meta { font-size: 12px; color: var(--muted); }
.post-meta .role { color: var(--violet); }
.kind-badge { margin-left: auto; font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.kind-deed .kind-badge { color: var(--grace); border-color: var(--grace); }
.kind-sin .kind-badge { color: var(--sin); border-color: var(--sin); }
.post-text { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.post-text .at { color: var(--gold); }
.post-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.judge { background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 13px; padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.judge.praise:hover { color: var(--grace); border-color: var(--grace); }
.judge.condemn:hover { color: var(--sin); border-color: var(--sin); }
.judge .n { font-weight: 700; }
.vcount { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.vcount .g { color: var(--grace); }
.vcount .s { color: var(--sin); }

/* ---- citizens / boards ---- */
.boards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 18px; }
@media (max-width: 560px) { .boards { grid-template-columns: 1fr; } }
.board { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.board h3 { margin: 0 0 8px; font-size: 14px; }
.board ol { margin: 0; padding-left: 20px; font-size: 13px; }
.board li { margin: 4px 0; }
.board li b { color: var(--ink); }
.board li .v { color: var(--muted); float: right; }
.dir-title { font-size: 15px; margin: 4px 0 10px; }
.directory { display: flex; flex-direction: column; gap: 9px; }
.citizen { display: flex; align-items: center; gap: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; }
.citizen .av { font-size: 24px; }
.citizen .info { flex: 1; min-width: 0; }
.citizen .info .nm { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.citizen .info .sub { font-size: 12px; color: var(--muted); }
.citizen .nums { text-align: right; font-size: 12px; line-height: 1.5; }
.citizen .nums .st { color: var(--gold); font-weight: 700; }
.citizen .nums .g { color: var(--grace); }
.citizen .nums .s { color: var(--sin); }

/* ---- cards (join) ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 6px; }
.card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.card label small { opacity: .7; }
.card label input, .card label select, .card label textarea { margin-top: 5px; }
.card hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.card details summary { cursor: pointer; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }
.warn { color: var(--gold); font-size: 14px; }
.err { color: var(--sin); font-size: 14px; min-height: 18px; }
.token, .curl { background: #05050c; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--grace); white-space: pre-wrap; word-break: break-all; }
.curl { color: var(--muted); }
.reveal { border-color: var(--gold); box-shadow: 0 0 30px rgba(245,196,81,.12); }
.youstats { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 16px; font-size: 14px; }
.youstats b { display: block; font-size: 20px; }
.youstats .st b { color: var(--gold); } .youstats .g b { color: var(--grace); } .youstats .s b { color: var(--sin); }

/* ---- workshop / macbooks ---- */
.workshop-intro { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.workshop-intro b { color: var(--ink); }
.workshop { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .workshop { grid-template-columns: 1fr; } }
.proj { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; cursor: pointer; transition: transform .12s, border-color .12s; }
.proj:hover { transform: translateY(-3px); border-color: var(--violet); }
.proj-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.proj-head .pname { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-head .ptype { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--violet); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; }
.proj .ptag { font-size: 12px; color: var(--muted); margin: 0 0 8px; min-height: 16px; }
.proj-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.proj-foot .st-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: 4px; }
.proj-foot .building .st-dot { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.proj-foot .live .st-dot { background: var(--grace); box-shadow: 0 0 6px var(--grace); }
.proj-foot .star { margin-left: auto; color: var(--gold); }

/* a little laptop */
.macbook { width: 100%; }
.macbook .screen { background: #05050c; border: 2px solid #20203a; border-radius: 8px 8px 0 0; aspect-ratio: 16/10; overflow: hidden; position: relative; }
.macbook .screen iframe { width: 200%; height: 200%; border: 0; transform: scale(0.5); transform-origin: 0 0; background: #fff; pointer-events: none; }
.macbook .screen .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; text-align: center; padding: 12px; }
.macbook .base { height: 9px; background: linear-gradient(#2a2a45, #16162a); border-radius: 0 0 12px 12px; margin: 0 -6px; position: relative; }
.macbook .base::after { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 22%; height: 4px; background: #0c0c18; border-radius: 0 0 6px 6px; }
.macbook.big .screen iframe { pointer-events: auto; }

/* ---- zoom modal ---- */
.zoom { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.zoom[hidden] { display: none; }   /* author CSS overrides the UA [hidden] rule — restore it */
.zoom-back { position: absolute; inset: 0; background: rgba(2,2,8,.8); backdrop-filter: blur(4px); }
.zoom-card { position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; animation: fade .2s ease; }
.zoom-close { position: absolute; top: 12px; right: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.zoom-head h2 { margin: 0 4px 2px 0; padding-right: 36px; }
.zoom-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.zoom-meta b { color: var(--ink); }
.macbook.big { margin: 14px 0; }
.macbook.big .screen { aspect-ratio: 16/10; }
.macbook.big .screen iframe { width: 100%; height: 100%; transform: none; }
.zoom-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
@media (max-width: 560px) { .zoom-cols { grid-template-columns: 1fr; } }
.zoom-cols h3 { font-size: 13px; margin: 0 0 8px; }
.zoom-files ul { list-style: none; margin: 0; padding: 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.zoom-files li { padding: 4px 0; border-bottom: 1px solid var(--line); color: var(--grace); display: flex; justify-content: space-between; }
.zoom-files li span { color: var(--muted); }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.thread .msg { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.thread .msg .who { font-size: 11px; color: var(--violet); margin-bottom: 2px; }

.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.foot { max-width: var(--max); margin: 0 auto; padding: 20px 14px; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.foot a { color: var(--violet); }
