:root {
  --bg: #07090f;
  --panel: #121725;
  --panel-2: #1a2134;
  --line: #2a3350;
  --text: #eef2fb;
  --muted: #a5afc6;
  --cyan: #2fe3e6;
  --magenta: #e04dff;
  --blue: #3b6dff;
  --yellow: #ffe94d;
  --orange: #ff9b4d;
  --red: #ff5c7a;
  --green: #7dffb0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, select, input, textarea { font: inherit; color: var(--text); }
button, select {
  background: var(--panel-2); border: 1px solid #36405c; border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
}
button:hover, select:hover { border-color: var(--cyan); }
button:disabled { opacity: 0.45; cursor: default; border-color: #36405c; }
button.accent { background: linear-gradient(90deg, var(--cyan), var(--blue)); color: #04121a; border: none; font-weight: 700; }
button.danger { border-color: #5a2a3a; color: #ffb3c1; }
button.on { border-color: var(--yellow); color: var(--yellow); }
input, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
input:focus, textarea:focus, button:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: #0b0f19; border-bottom: 1px solid #1d2438; z-index: 3;
}
.bar .brand img { display: block; }
.bar .name { letter-spacing: 0.03em; background: linear-gradient(90deg, var(--cyan), var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar .group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#map-title { width: 14em; max-width: 40vw; }
.bar .account { margin-left: auto; }
body.present .edit-only { display: none !important; }

.stage { position: relative; flex: 1; min-height: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; cursor: grab;
  background: radial-gradient(900px 500px at 80% -10%, rgba(224, 77, 255, 0.10), transparent 60%),
              radial-gradient(800px 500px at -10% 40%, rgba(47, 227, 230, 0.08), transparent 60%), var(--bg); }
#board.panning { cursor: grabbing; }
#board.connecting { cursor: crosshair; }

.node rect.box { fill: var(--panel); stroke-width: 1.5; }
.node { cursor: pointer; }
.node text { fill: var(--text); font-size: 14px; }
.node text.kind { fill: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.node text.standing { fill: #ff9fe9; font-size: 12px; font-style: italic; }
.node tspan.compound { fill: var(--yellow); font-style: normal; }
.node text.stance { font-size: 11px; font-weight: 700; }
.node.sel text, .pill.sel text { user-select: text; -webkit-user-select: text; cursor: text; }
.panel, .caption, .toast, .hint { user-select: text; -webkit-user-select: text; }
.node.sel rect.box { stroke-width: 3; filter: drop-shadow(0 0 8px rgba(47, 227, 230, 0.6)); }
.node.ghost rect.box { fill: rgba(255, 47, 180, 0.08); stroke-dasharray: 6 4; }
.node.ghost text.ghost-text { fill: #ff2fb4; font-size: 13px; font-weight: 600; }
.panel .ghost-full { border-left-color: #ff2fb4; color: #ff7fd0; }
.node.t-axiom rect.box { stroke-dasharray: 8 3; }
.node.t-combiner rect.box { stroke-dasharray: 3 3; }
.node text.plus { font-size: 26px; font-weight: 700; }

.edge line { stroke-width: 2; }
.edge polygon { stroke: none; }
.pill { cursor: pointer; }
.pill rect { fill: #0b0f19; stroke-width: 1.5; }
.pill text { font-size: 12px; font-weight: 600; }
.pill.sel rect { stroke-width: 3; filter: drop-shadow(0 0 6px rgba(255, 233, 77, 0.7)); }
.pill .hit { fill: transparent; stroke: none; }

.dim { opacity: 0.13; }
.target-ok .box, .target-ok rect { stroke: var(--yellow) !important; }

.panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(360px, calc(100% - 24px));
  overflow: auto; background: rgba(18, 23, 37, 0.96); border: 1px solid #222b42; border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px; z-index: 2;
}
.panel.compact { bottom: auto; }
body.present .panel { display: none; }
.panel h2 { margin: 0; font-size: 17px; }
.panel h3 { margin: 4px 0 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.panel p { margin: 0; }
.panel .muted { color: var(--muted); }
.panel textarea { width: 100%; min-height: 84px; resize: vertical; }
.panel .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.panel .full { background: var(--bg); border-left: 3px solid var(--cyan); border-radius: 6px; padding: 8px 10px; }
.panel .warn { border: 1px solid #6b5f1a; background: rgba(255, 233, 77, 0.07); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.panel .warn ul { margin: 0; padding-left: 18px; }
.panel .standing { color: #ff9fe9; font-style: italic; }
.panel .stars button { padding: 4px 8px; }
.panel .stars button.on { color: var(--yellow); border-color: var(--yellow); }
.panel .tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.panel .note { margin: 0; padding: 8px 10px; border: 1px solid #ffe94d; border-radius: 8px; color: #f2f4fa; }
.panel .found { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.panel .found li { display: flex; gap: 8px; align-items: center; justify-content: space-between; border: 1px solid #2a3350; border-radius: 8px; padding: 6px 8px; }
.panel .found li span { flex: 1; user-select: text; }
.panel input[type="search"] { flex: 1; min-width: 0; }
.panel .history { font-size: 13px; color: var(--muted); margin: 0; padding-left: 18px; }
.panel label { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.panel input[type=range] { flex: 1; padding: 0; }
.panel input.num { width: 6.5em; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 13px; color: var(--muted); }

.hint, .caption, .toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: rgba(11, 15, 25, 0.95); border: 1px solid #36405c; border-radius: 12px; padding: 10px 14px; z-index: 4;
  max-width: min(640px, calc(100% - 32px));
}
.hint { top: 12px; color: var(--yellow); }
.caption { bottom: 18px; font-size: 17px; text-align: center; }
.toast { bottom: 18px; color: var(--yellow); }
body:not(.present) .toast { left: calc(50% - 180px); }

@media (max-width: 720px) {
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 42%; }
  .panel.compact { bottom: 8px; }
  #map-title, .bar .name { display: none; }
  .bar { gap: 6px; padding: 6px 8px; }
  .bar button, .bar select { padding: 5px 10px; font-size: 14px; }
  #map-select, #add-other, #file-menu { max-width: 9em; }
  .panel .more { display: none; }
  body:not(.present) .toast { left: 50%; bottom: calc(46% + 20px); }
}
body.present .toast { top: 12px; bottom: auto; }
.link-preview line { stroke-width: 2.5; }
.panel .postbox { display: flex; flex-direction: column; gap: 8px; }

/* First visit: what Ourgument is, and a nudge to sign up. */
.welcome {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, rgba(47, 227, 230, 0.12), transparent 50%),
    radial-gradient(circle at 75% 80%, rgba(224, 77, 255, 0.12), transparent 50%), rgba(7, 9, 15, 0.94);
  overflow: auto;
}
.welcome[hidden] { display: none; }
.welcome .card {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
}
.welcome h1 { margin: 0; font-size: 30px; color: var(--cyan); }
.welcome .lead { margin: 0; font-size: 18px; }
.welcome ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.welcome ul strong { color: var(--text); }
.welcome .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.welcome .actions button { font-size: 16px; padding: 10px 18px; }
.welcome .small { color: var(--muted); font-size: 14px; }
.welcome .signup { align-self: stretch; font-size: 19px; padding: 14px 18px; font-weight: 700; }
.welcome .signin-note { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.welcome .quiet { align-self: center; color: var(--muted); opacity: 0.65; font-size: 12px; }
.welcome .quiet:hover { opacity: 1; }
.starter p { margin: 0 0 8px; }
.starter .row { flex-wrap: wrap; }

/* The tutorial's coach card, out of the way of the board and the panel. */
.tutorial {
  position: absolute; left: 16px; top: 16px; z-index: 5; width: min(340px, calc(100% - 32px));
  background: rgba(11, 15, 25, 0.97); border: 1px solid var(--yellow); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.tutorial[hidden] { display: none; }
.tutorial p { margin: 0; }
.tutorial .muted { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.tutorial .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Signed-in home: the sea of orbs behind a feed of statements. */
.home { position: absolute; inset: 0; z-index: 6; background: radial-gradient(ellipse at 40% 40%, #0d1426, var(--bg) 70%); }
.home[hidden] { display: none; }
.home canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.home canvas.flat { background: radial-gradient(circle at 30% 30%, rgba(47, 227, 230, 0.15), transparent 40%), radial-gradient(circle at 70% 70%, rgba(224, 77, 255, 0.15), transparent 40%); }
.home-feed {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: rgba(18, 23, 37, 0.88); border: 1px solid #222b42; border-radius: 14px; backdrop-filter: blur(4px);
}
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-head h2 { margin: 0; font-size: 18px; }
.feed { overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.post-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: rgba(7, 9, 15, 0.6); }
.post-card.picked { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(255, 233, 77, 0.3); }
.post-card .text { margin: 0; font-size: 16px; user-select: text; }
.post-card .text.question { color: var(--yellow); }
.post-card .text.fallacy { color: #d9a6ff; }
.post-card .meta, .post-card .muted { color: var(--muted); font-size: 13px; }
.post-card .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.post-card .stances button { padding: 4px 10px; font-size: 13px; }
.post-card .stances button.on { color: var(--yellow); border-color: var(--yellow); }
.sea-hint { position: absolute; left: 16px; bottom: 12px; margin: 0; color: var(--muted); font-size: 13px; max-width: calc(100% - 470px); }
body.home .bar .group:not(.account) { display: none; }
body.home #home-btn { display: none; }
@media (max-width: 720px) {
  .home-feed { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 62%; }
  .sea-hint { display: none; }
}

/* Views: Agree is green, Disagree red, the rest are "Neither". */
:root { --agree: #4dff88; --disagree: #ff4d5e; }
.stance-buttons { display: flex; flex-direction: column; gap: 6px; }
.stance-buttons .row { display: flex; gap: 6px; flex-wrap: wrap; }
.stance-buttons button.agree { color: var(--agree); border-color: rgba(77, 255, 136, 0.55); }
.stance-buttons button.disagree { color: var(--disagree); border-color: rgba(255, 77, 94, 0.55); }
.stance-buttons button.agree.on { background: var(--agree); color: #04130a; border-color: var(--agree); }
.stance-buttons button.disagree.on { background: var(--disagree); color: #1a0306; border-color: var(--disagree); }
.stance-buttons button.neither.on { color: var(--yellow); border-color: var(--yellow); }
.stance-buttons .neither-row[hidden] { display: none; }

/* A post floating over the sea, with its inferences reaching off the screen. */
.float { position: absolute; inset: 0; z-index: 3; background: rgba(7, 9, 15, 0.35); }
.float[hidden] { display: none; }
body.floating .home-feed, body.floating .sea-hint { display: none; }
.float svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.float .stub .hit { cursor: pointer; pointer-events: stroke; }
.float .stub:hover line:not(.hit) { stroke-width: 4; opacity: 1; }
.fnode {
  position: absolute; transform: translate(-50%, -50%); background: rgba(18, 23, 37, 0.96);
  border: 1px solid var(--cyan); border-radius: 12px; padding: 10px 12px; color: var(--text); text-align: left; font: inherit;
}
.fnode.center { width: min(360px, 86vw); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 0 30px rgba(47, 227, 230, 0.25); }
.fnode.center .text { margin: 0; font-size: 17px; user-select: text; }
.fnode.center .meta { color: var(--muted); font-size: 13px; }
.fnode.near { width: min(220px, 40vw); font-size: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.fnode.near:hover { border-color: var(--yellow); }
.fnode .kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.fnode.question { border-color: var(--yellow); }
.fnode.fallacy { border-color: #b026ff; }
.fnode.clarification { border-color: #6f93ff; }
.float-empty { position: absolute; transform: translateX(-50%); color: var(--muted); margin: 0; }
.float-close {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%;
  font-size: 26px; line-height: 1; padding: 0; z-index: 2;
}
.float-tip {
  position: absolute; z-index: 3; max-width: 290px; padding: 8px 10px; border-radius: 10px; pointer-events: none;
  background: rgba(11, 15, 25, 0.97); border: 1px solid #36405c; display: flex; flex-direction: column; gap: 4px;
}
.float-tip[hidden] { display: none; }
.float-tip .kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.float-tip.good { border-color: var(--agree); color: var(--agree); }
.float-tip.bad { border-color: var(--disagree); color: var(--disagree); }
.post-card { cursor: pointer; }
.post-card:hover { border-color: #3f4b70; }
.welcome ul { color: var(--text); }

/* Printing a map: just the board, colours kept. */
@media print {
  @page { size: landscape; margin: 10mm; }
  .bar, .panel, .toast, .hint, .tutorial, .home, .welcome { display: none !important; }
  html, body, .stage, #board { background: #07090f !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .stage { position: static; height: 180mm; }
}
.fnode .respond button.agree { color: var(--agree); border-color: rgba(77, 255, 136, 0.55); }
.fnode .respond button.disagree { color: var(--disagree); border-color: rgba(255, 77, 94, 0.55); }
.fnode .compose { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.fnode .compose.agree .kind { color: var(--agree); }
.fnode .compose.disagree .kind { color: var(--disagree); }
.fnode .compose textarea { width: 100%; box-sizing: border-box; }
.fnode .compose .found { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.fnode .compose .found li { display: flex; gap: 8px; align-items: center; justify-content: space-between; border: 1px solid #2a3350; border-radius: 8px; padding: 6px 8px; font-size: 14px; }
.fnode .compose .found li span { flex: 1; }
.fnode .compose .note { margin: 0; padding: 6px 8px; border: 1px solid var(--yellow); border-radius: 8px; font-size: 14px; }
.fnode .compose .alts { display: flex; flex-direction: column; gap: 6px; }
.fnode .compose label { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.fnode.center { max-height: calc(100% - 24px); overflow: auto; }
