:root {
  --bg: #0e1015; --surface: #161a22; --surface-2: #1d2230; --line: rgba(255, 255, 255, 0.1);
  --text: #f5f6f8; --text-2: #b8bfc9; --text-3: #8891a0; --accent: #006bff; --ok: #22c55e; --warn: #ffb020; --bad: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif; }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; outline: none; }
[hidden] { display: none !important; }

.btn { border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 700; cursor: pointer; color: #fff; background: var(--surface-2); }
.btn--primary { background: var(--accent); box-shadow: 0 8px 24px rgba(0, 107, 255, 0.35); }
.btn--primary:hover { background: #2a82ff; }
.btn--small { padding: 8px 12px; font-size: 13px; }
.btn--ok { background: var(--ok); }
.btn--warn { background: #3a2a10; color: #ffcf73; border: 1px solid #6b4d16; }
.chip { border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover, .chip.on { border-color: var(--accent); background: rgba(0, 107, 255, 0.2); }

/* sign in */
.login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20;
  background: radial-gradient(900px 600px at 70% 10%, #13306b 0%, rgba(19, 48, 107, 0) 60%), var(--bg); }
.login__card { width: min(420px, calc(100% - 32px)); text-align: center; padding: 36px 28px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.login__card img { border-radius: 50%; background: #e8f0ff; }
.login__card h1 { margin: 12px 0 6px; font-size: 28px; }
.login__card p { color: var(--text-2); margin: 0 0 20px; line-height: 1.5; }
.login__err { color: #ff8a8a !important; margin-top: 14px !important; }

/* HUD */
.hud { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 14px; background: rgba(14, 16, 21, 0.72); backdrop-filter: blur(10px); border: 1px solid var(--line); }
.hud__brand { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.hud__brand img { border-radius: 50%; background: #e8f0ff; }
.hud__project { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.hud__project select { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; }
.hud__online { display: flex; gap: 6px; flex-wrap: wrap; }
.hud__online span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.hud__online span::before { content: "●"; margin-right: 5px; color: var(--ok); }
.hud__me { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }

.ticker { position: fixed; left: 12px; top: 74px; z-index: 4; max-width: min(420px, calc(100% - 24px)); font-size: 12.5px; color: var(--text-2);
  background: rgba(14, 16, 21, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; line-height: 1.6; }
.ticker b { color: var(--text); }
.hint { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; margin: 0; font-size: 12.5px; color: var(--text-2);
  background: rgba(14, 16, 21, 0.65); padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.meetBtn { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 6; }

/* agent panel */
.panel { position: fixed; top: 72px; right: 12px; bottom: 12px; width: min(420px, calc(100% - 24px)); z-index: 8; overflow: auto;
  background: rgba(22, 26, 34, 0.96); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.panel__close { position: absolute; top: 10px; right: 10px; background: none; border: 0; color: var(--text-2); font-size: 16px; cursor: pointer; }
.panel__head { display: flex; gap: 12px; align-items: center; }
.panel__dot { width: 38px; height: 38px; border-radius: 50%; flex: none; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18); }
.panel__head h2 { margin: 0; font-size: 19px; }
.panel__head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.panel__blurb { color: var(--text-2); font-size: 13.5px; margin: 12px 0 14px; }
.task { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: rgba(255, 255, 255, 0.02); }
.task__top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; cursor: pointer; }
.task__title { font-weight: 700; font-size: 14px; }
.task__meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge--todo { background: #2a2f3d; color: #c9d0dc; } .badge--working { background: #1d3557; color: #8fc1ff; }
.badge--review { background: #4a3510; color: #ffcf73; } .badge--approved, .badge--done { background: #123a24; color: #7ee2a0; }
.badge--revise { background: #4a1616; color: #ff9b9b; }
.task__body { margin-top: 10px; font-size: 13.5px; line-height: 1.6; color: var(--text); border-top: 1px solid var(--line); padding-top: 10px; overflow-wrap: anywhere; }
.task__body h3, .task__body h4 { margin: 12px 0 6px; font-size: 14.5px; }
.task__body ul, .task__body ol { padding-left: 20px; margin: 6px 0; }
.task__body code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.task__body table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 6px 0; }
.task__body td, .task__body th { border: 1px solid var(--line); padding: 5px 7px; text-align: left; }
.task__note { margin-top: 8px; font-size: 12.5px; color: #ffb4b4; }
.task__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.task__actions textarea { flex: 1 1 100%; min-height: 54px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; font-size: 13px; }
.panel__new { display: flex; gap: 8px; margin-top: 14px; position: sticky; bottom: -18px; background: rgba(22, 26, 34, 0.98); padding: 10px 0 4px; }
.panel__new input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; }
.empty { color: var(--text-3); font-size: 13px; }

/* meeting call */
.meet { position: fixed; right: 12px; bottom: 12px; width: min(560px, calc(100% - 24px)); height: min(380px, 55vh); z-index: 9;
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #000; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.meet__bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--surface); }
.meet iframe { flex: 1; border: 0; width: 100%; }

@media (max-width: 640px) {
  .hint { display: none; }
  .hud__me span { display: none; }
  .ticker { top: auto; bottom: 110px; }
}

.iconbtn { background: none; border: 0; cursor: pointer; font-size: 14px; padding: 2px 4px; opacity: 0.7; }
.iconbtn:hover { opacity: 1; }
.linkbtn { background: none; border: 0; color: #5c9dff; cursor: pointer; font: inherit; font-size: 12.5px; padding: 0; }
.persona { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 107, 255, 0.08); border: 1px solid rgba(0, 107, 255, 0.25); font-size: 13px; line-height: 1.55; }
.persona__head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.persona textarea { width: 100%; min-height: 84px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; font-size: 13px; }
.chip--static { cursor: default; background: rgba(0, 107, 255, 0.18); border-color: rgba(0, 107, 255, 0.45); }
.btn--lift { background: #ffb020; color: #1b1407; box-shadow: 0 8px 24px rgba(255, 176, 32, 0.35); }

.editor { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(5, 8, 14, 0.55); backdrop-filter: blur(3px); }
.editor__card { width: min(760px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); position: relative; }
.editor__head h2 { margin: 0 0 12px; font-size: 19px; }
.editor__body { display: flex; gap: 18px; }
.editor__preview { flex: none; width: 240px; height: 320px; border-radius: 14px; background: radial-gradient(circle at 50% 35%, #2b3550, #141924 70%); }
.editor__opts { flex: 1; min-width: 0; display: grid; gap: 10px; align-content: start; }
.ed__row span { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.ed__vals { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); cursor: pointer; padding: 0; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.pill { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
.pill.on { border-color: var(--accent); background: rgba(0, 107, 255, 0.25); }
.editor__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 640px) { .editor__body { flex-direction: column; align-items: center; } .editor__preview { width: 200px; height: 260px; } }

.editor__side { flex: 1; min-width: 0; }
.ed__job { display: block; margin-bottom: 12px; }
.ed__job span { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.ed__job input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13.5px; }
.ed__job[hidden] { display: none; }

.liftBox { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.meeting { position: fixed; left: 12px; bottom: 56px; z-index: 7; width: min(400px, calc(100% - 24px)); max-height: 52vh; display: flex; flex-direction: column;
  background: rgba(22, 26, 34, 0.95); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
.meeting__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.meeting__mode { margin: 4px 0 8px; font-size: 11.5px; color: var(--text-3); }
.meeting__log { flex: 1; min-height: 60px; overflow: auto; display: grid; gap: 6px; align-content: start; font-size: 13px; line-height: 1.5; padding-right: 4px; }
.mlog { padding: 6px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); }
.mlog--agent { background: rgba(0, 107, 255, 0.12); }
.mlog--me { background: rgba(255, 176, 32, 0.1); }
.mlog--sys { color: var(--text-3); }
.meeting__actions { display: flex; gap: 6px; margin: 8px 0; }
.meeting__ask { display: flex; gap: 6px; }
.meeting__ask select { max-width: 120px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 12px; }
.meeting__ask input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; }
#micBtn.on { border-color: #ef4444; background: rgba(239, 68, 68, 0.25); }
@media (max-width: 640px) { .meeting { bottom: 110px; max-height: 45vh; } }

.css3d { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
canvas.webgl { position: fixed; inset: 0; z-index: 1; }
.tvPanel { position: fixed; left: 12px; bottom: 56px; z-index: 7; width: min(360px, calc(100% - 24px)); background: rgba(22, 26, 34, 0.95); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; display: grid; gap: 8px; font-size: 13px; }
.tvPanel form { display: flex; gap: 6px; }
.tvPanel input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; }
.tvPanel__row { display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 11.5px; }
.tvPanel[hidden] { display: none; }

.sitBtn { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); z-index: 6; }
.meeting__invite { display: flex; gap: 6px; margin-bottom: 6px; }
.meeting__invite select { flex: 1; min-width: 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 12px; padding: 5px; }
.meeting__guests { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.guest { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 9px; font-size: 12px; }
.guest i { width: 8px; height: 8px; border-radius: 50%; }
.guest button { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 11px; padding: 0 4px; }
.guest--empty { color: var(--text-3); padding: 3px 9px; }
.emotes { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); z-index: 6; display: grid; gap: 6px;
  background: rgba(22, 26, 34, 0.9); border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.emotes[hidden] { display: none; }
.emotes button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 22px; cursor: pointer; }
.emotes button:hover { background: #2a3142; transform: scale(1.08); }
.chat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 12px 0; }
.chat__log { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; }
.cmsg { max-width: 88%; padding: 7px 10px; border-radius: 12px; font-size: 13px; line-height: 1.45; color: var(--text); background: var(--bg); }
.cmsg b { display: block; font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.cmsg--me { align-self: flex-end; background: var(--accent); color: #fff; }
.cmsg--agent { align-self: flex-start; }
.cmsg--sys, .cmsg--hint { align-self: center; background: none; color: var(--text-3); font-size: 12px; text-align: center; }
.cmsg--typing { color: var(--text-3); font-style: italic; }
.chat__form { display: flex; gap: 6px; }
.chat__form input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; }
.joy { position: fixed; right: 22px; bottom: 76px; z-index: 6; width: 128px; height: 128px; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.10), rgba(22, 26, 34, 0.55)); border: 2px solid rgba(255, 255, 255, 0.22);
  display: grid; place-items: center; user-select: none; -webkit-user-select: none; }
.joy[hidden] { display: none; }
.joy__knob { width: 54px; height: 54px; border-radius: 50%; background: rgba(245, 246, 248, 0.85); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); pointer-events: none; transition: transform 0.06s; }
body.touch .hint { display: none; }
body.touch .emotes { top: 150px; bottom: auto; transform: none; grid-auto-flow: column; }
body.touch canvas.webgl { touch-action: none; }
body.touch .ticker { top: auto; bottom: 14px; }
body.touch .meetBtn { left: auto; right: 16px; bottom: 270px; transform: none; z-index: 8; }
body.touch .sitBtn { left: auto; right: 16px; bottom: 216px; transform: none; z-index: 8; }
.chip--end { margin-left: auto; border-color: rgba(239, 68, 68, 0.5); }
.cand { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; display: grid; gap: 6px; font-size: 12.5px; }
.cand[hidden], .cand__decide[hidden] { display: none; }
.cand__row { display: flex; gap: 6px; }
.cand__row input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12.5px; }
.cand__decide { display: grid; gap: 6px; color: var(--text-2); }
.meeting__min { display: none; margin-left: 4px; }
body.touch .meeting__min { display: inline-block; font-size: 20px; color: var(--text); padding: 2px 10px; background: var(--surface-2); border-radius: 8px; }
body.touch .meeting { bottom: 76px; max-height: 60vh; }
body.touch .meeting.meeting--min { width: calc(100% - 190px); }
body.touch .meeting.meeting--min > :not(.meeting__head) { display: none; }
body.touch .meeting.meeting--min .switch span { display: none; }
.coffeeBtn { bottom: 152px; }
body.touch .coffeeBtn { bottom: 324px; }
