:root {
  --sea: #0c2433;
  --sea-deep: #071823;
  --foam: #e6efec;
  --mist: #9db4bd;
  --glass: rgba(16, 44, 60, 0.82);
  --line: rgba(157, 180, 189, 0.22);
  --me: #f2b544;
  --agent: #7fd1b9;
  --project: #a99bf0;
  --prompt: #f28c9b;
  --task: #6fb7f0;
  --note: #8fa3ad;
  --radius-panel: 18px;
  --radius-ctl: 9px;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: radial-gradient(120% 90% at 50% 40%, var(--sea) 0%, var(--sea-deep) 100%); color: var(--foam); font-size: 15px; line-height: 1.5; }
#graph { position: fixed; inset: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--me); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Top bar */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 16px; align-items: center; padding: 14px 20px; pointer-events: none; }
.top > * { pointer-events: auto; }
.mark { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--me); }
#search { width: 240px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 7px 12px; }
.tabs { margin-left: auto; display: flex; gap: 4px; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs button { background: none; border: 0; padding: 6px 14px; border-radius: 999px; color: var(--mist); }
.tabs button[aria-pressed="true"], .tabs button:hover { color: var(--foam); background: rgba(230, 239, 236, 0.08); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--prompt); color: var(--sea-deep); font-weight: 700; font-size: 12px; }

/* Team roster: the AIs, left edge */
#roster { position: fixed; left: 20px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; }
#roster button { text-shadow: 0 1px 6px var(--sea-deep), 0 0 2px var(--sea-deep); display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; color: var(--mist); text-align: left; border-radius: var(--radius-ctl); }
#roster button:hover { color: var(--foam); background: rgba(230, 239, 236, 0.06); }
#roster .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--agent); box-shadow: 0 0 0 0 var(--agent); }
#roster .dot.live { animation: pulse 1.6s ease-out 2; }
#roster small { color: var(--prompt); font-weight: 700; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(127, 209, 185, 0.8); } to { box-shadow: 0 0 0 12px rgba(127, 209, 185, 0); } }

/* Side panel */
#panel { position: fixed; top: 70px; right: 20px; bottom: 170px; width: min(460px, calc(100vw - 40px)); background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 22px 24px; overflow-y: auto; }
#panel .close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 24px; color: var(--mist); }
#panel h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
#panel h3 { margin: 22px 0 8px; font-size: 15px; color: var(--mist); font-weight: 500; }
.sub { color: var(--mist); margin: 0 0 14px; font-size: 13px; }
.note-body { max-width: 62ch; }
.note-body a.wl { color: var(--agent); text-decoration: none; border-bottom: 1px dotted var(--agent); cursor: pointer; }
.note-body pre { white-space: pre-wrap; background: rgba(7, 24, 35, 0.6); padding: 12px; border-radius: var(--radius-ctl); }
.props { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.props span { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--mist); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .meta { font-size: 13px; color: var(--mist); }
.list .unread { color: var(--prompt); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips button { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px; color: var(--mist); }
.chips button[aria-pressed="true"] { color: var(--sea-deep); background: var(--agent); border-color: var(--agent); }

.board { display: grid; grid-template-columns: 1fr; gap: 4px; }
.task { display: flex; gap: 10px; align-items: baseline; }
.task select { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; font-size: 13px; }
.status-done { opacity: 0.55; text-decoration: line-through; }

.vars label { display: block; font-size: 13px; color: var(--mist); margin-top: 8px; }
.vars input, .vars textarea { width: 100%; background: rgba(7, 24, 35, 0.6); border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 8px 10px; }
.launch { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Buttons */
.primary, .launch button, .cmd-actions button { border: 1px solid var(--line); background: rgba(230, 239, 236, 0.06); border-radius: var(--radius-ctl); padding: 7px 14px; }
.primary { background: var(--me); color: var(--sea-deep); border-color: var(--me); font-weight: 700; }
.cmd-actions .primary, .launch .primary { background: var(--me); color: var(--sea-deep); border-color: var(--me); }
.cmd-actions button:hover, .launch button:hover { border-color: var(--mist); }

/* Command bar */
#command { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(760px, calc(100vw - 40px)); background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 12px 14px; }
#cmd-text { width: 100%; resize: none; background: none; border: 0; outline: none; font-size: 17px; padding: 4px 2px 8px; max-height: 140px; }
.cmd-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmd-actions select { background: rgba(7, 24, 35, 0.6); border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 7px 8px; }
.cmd-actions .primary { margin-left: auto; }
#cmd-hint { margin: 8px 2px 0; font-size: 13px; color: var(--mist); min-height: 1em; }
#cmd-hint:empty { display: none; }

/* Token gate */
#gate { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(7, 24, 35, 0.85); padding: 16px; }
#gate form { width: min(420px, 100%); background: var(--sea); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 26px; display: grid; gap: 12px; }
#gate h2 { margin: 0; }
#gate p { margin: 0; color: var(--mist); }
#gate input { background: var(--sea-deep); border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 9px 12px; }

/* Phone */
@media (max-width: 720px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  #search { flex: 1; width: auto; }
  .tabs { margin-left: 0; width: 100%; justify-content: space-between; }
  .tabs button { padding: 6px 10px; }
  #roster { top: auto; bottom: 170px; left: 16px; transform: none; flex-direction: row; flex-wrap: wrap; gap: 2px; }
  #roster .name { display: none; }
  #panel { top: 104px; left: 16px; right: 16px; width: auto; bottom: 160px; }
  #command { width: calc(100vw - 32px); bottom: 16px; }
  .cmd-actions .primary { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #roster .dot.live { animation: none; box-shadow: 0 0 0 3px rgba(127, 209, 185, 0.5); }
}

.scene-nav-info { display: none; }
