:root{
  color-scheme:dark;
  --bg:#050506;
  --bg2:#0a0a0c;
  --panel:#0f1012;
  --panel2:#151518;
  --line:#2a2a2f;
  --line-hot:#5d151f;
  --text:#f4f1ef;
  --muted:#969299;
  --red:#ff3247;
  --red2:#a70d1c;
  --red3:#5c0b13;
  --green:#38da89;
  --shadow:0 26px 80px #000a;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(ellipse at 18% 35%,#8d101d1e 0,transparent 38%),
    radial-gradient(ellipse at 72% 35%,#4e0a1214 0,transparent 34%),
    linear-gradient(145deg,#030304,#09090b 58%,#040405);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.18;
  background-image:
    linear-gradient(31deg,#ff324707 1px,transparent 1px),
    linear-gradient(121deg,#ffffff05 1px,transparent 1px);
  background-size:42px 42px,67px 67px;
  mask-image:linear-gradient(145deg,#000,transparent 85%);
}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
button:disabled{opacity:.5;cursor:not-allowed}
.hidden{display:none!important}
.screen{min-height:100vh;padding:24px}
.center{display:grid;place-items:center}
.card,.panel{
  background:linear-gradient(180deg,#141417f5,#0b0b0df5);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:var(--shadow);
}
.eyebrow{
  margin:0 0 8px;
  color:#e9394c;
  font:800 10px/1.2 var(--mono);
  letter-spacing:.17em;
  text-transform:uppercase;
}
.muted{color:var(--muted);font-size:12px}
.error{min-height:1.2em;color:#ff7f8d}
label{display:grid;gap:7px;color:#b8b4ba;font-size:11px;font-weight:750;margin:13px 0}
input,textarea,select{
  width:100%;
  background:#08080a;
  color:#fff;
  border:1px solid #313136;
  border-radius:9px;
  padding:11px 12px;
  outline:none;
}
input:focus,textarea:focus,select:focus{border-color:#8d1c29;box-shadow:0 0 0 3px #ff32470d}
textarea{resize:vertical}
button{
  border:1px solid #631722;
  background:linear-gradient(180deg,#f1263b,#a40d1c);
  color:#fff;
  border-radius:9px;
  padding:10px 15px;
  font-weight:850;
}
button:hover{filter:brightness(1.07)}
.ghost{background:#111114;border-color:#34343a;color:#d5d0d4}
.small{padding:8px 11px;font-size:11px}
.pill,.role-pill{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:0 10px;
  border:1px solid #34343b;
  border-radius:999px;
  background:#111114d9;
  color:#aaa5ab;
  font:700 10px/1 var(--mono);
  letter-spacing:.04em;
  white-space:nowrap;
}
.role-pill{border-color:#5a1720;color:#ff7583;background:#1a0b0e}
.ok{color:var(--green)!important}

/* Auth */
.auth-wrap{
  width:min(920px,96vw);
  display:grid;
  grid-template-columns:minmax(280px,.9fr) minmax(340px,460px);
  align-items:center;
  gap:28px;
}
.auth-art{min-height:520px;position:relative;display:grid;place-items:center;overflow:hidden}
.auth-art:before{
  content:"";
  position:absolute;
  width:430px;height:430px;border:1px solid #ff324741;border-radius:50%;
  box-shadow:0 0 80px #d20f2318,inset 0 0 80px #d20f230b;
}
.auth-art img{
  width:min(540px,100%);
  aspect-ratio:1;
  object-fit:cover;
  filter:contrast(1.08) saturate(1.08) drop-shadow(0 24px 30px #000);
  mask-image:radial-gradient(circle at 48% 48%,#000 58%,transparent 82%);
}
.auth-card{padding:29px}
.auth-card h1{
  margin:.12em 0 .25em;
  font-family:Impact,Haettenschweiler,"Arial Narrow Bold",sans-serif;
  font-size:clamp(46px,6vw,70px);
  letter-spacing:.02em;
  line-height:.88;
  text-transform:uppercase;
}
.auth-card form button{width:100%;margin-top:4px}

/* Hub shell */
.hub-shell{
  min-height:100dvh;
  position:relative;
  overflow-x:hidden;
  padding-bottom:92px;
}
.hub-topbar{
  height:66px;
  border-bottom:1px solid #ffffff0b;
  background:#070708df;
  backdrop-filter:blur(16px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 clamp(16px,3vw,42px);
  position:sticky;
  top:0;
  z-index:40;
}
.brand-lockup{
  border:0;
  background:transparent;
  padding:0;
  display:flex;
  align-items:center;
  gap:10px;
  color:#eee9e6;
}
.brand-lockup:hover{filter:none}
.brand-mark{
  width:31px;height:31px;
  display:grid;place-items:center;
  border:1px solid #70202b;
  border-radius:9px;
  background:#1a0d10;
  color:var(--red);
  font:900 15px/1 var(--mono);
  box-shadow:inset 0 0 18px #ff324710;
}
.brand-lockup>span:last-child{display:grid;text-align:left}
.brand-lockup b{font:800 10px/1.1 var(--mono);letter-spacing:.13em}
.brand-lockup small{margin-top:4px;color:#767178;font:650 8px/1 var(--mono);letter-spacing:.12em}
.top-actions{display:flex;align-items:center;gap:9px}

/* Home */
.home-view{
  min-height:calc(100dvh - 66px);
  max-width:1420px;
  margin:0 auto;
  padding:clamp(22px,3vw,46px) clamp(18px,3.6vw,58px) 100px;
  display:grid;
  grid-template-columns:minmax(330px,.92fr) minmax(430px,1.18fr) minmax(210px,.55fr);
  align-items:center;
  gap:clamp(24px,4vw,62px);
  position:relative;
}
.hero-art{
  min-height:560px;
  position:relative;
  display:grid;
  place-items:center;
  isolation:isolate;
}
.hero-art:before{
  content:"";
  position:absolute;
  inset:16% 6% 8%;
  border-radius:50%;
  background:radial-gradient(circle,#ff324714,transparent 67%);
  filter:blur(16px);
}
.hero-art img{
  position:relative;
  z-index:3;
  width:min(520px,120%);
  max-width:none;
  aspect-ratio:1;
  object-fit:cover;
  filter:contrast(1.1) saturate(1.12) drop-shadow(0 24px 28px #000c);
  mask-image:radial-gradient(ellipse at 50% 48%,#000 54%,#000d 66%,transparent 83%);
}
.hero-ring{
  position:absolute;
  z-index:1;
  width:78%;aspect-ratio:1;
  border:1px solid #ff32473d;
  border-radius:50%;
}
.ring-one{border-style:dashed;animation:orbit-spin 52s linear infinite}
.ring-two{width:59%;border-color:#ff9b7230;transform:rotate(31deg)}
.hero-cross{position:absolute;z-index:1;background:#ff32471f}
.cross-one{width:88%;height:1px}
.cross-two{height:79%;width:1px}
.art-tag{
  position:absolute;
  z-index:5;
  padding:5px 8px;
  border:1px solid #6a212b;
  background:#0c090add;
  color:#d6c7c9;
  font:700 7px/1 var(--mono);
  letter-spacing:.13em;
  box-shadow:2px 2px 0 #000a;
}
.tag-405{left:4%;top:22%;transform:rotate(-4deg)}
.tag-private{right:5%;bottom:17%;transform:rotate(3deg);color:#ff7584}
.hero-copy{align-self:center}
.home-kicker{
  display:flex;
  align-items:center;
  gap:8px;
  color:#9a9399;
  font:700 9px/1.2 var(--mono);
  letter-spacing:.14em;
  text-transform:uppercase;
}
.home-kicker span{width:7px;height:7px;border-radius:50%;background:var(--red);box-shadow:0 0 12px #ff3247aa}
.hero-copy h1{
  margin:19px 0 18px;
  max-width:720px;
  color:#f8f2ee;
  font-family:Impact,Haettenschweiler,"Arial Narrow Bold",sans-serif;
  font-size:clamp(62px,7vw,108px);
  font-weight:500;
  line-height:.82;
  letter-spacing:.014em;
  text-shadow:4px 4px 0 #2b0509,0 10px 40px #ff32470f;
}
.hero-sub{
  max-width:650px;
  margin:0 0 24px;
  color:#aba5aa;
  font-size:13px;
  line-height:1.65;
}
.home-command{
  border:1px solid #4d2027;
  border-radius:14px;
  background:linear-gradient(140deg,#151114f5,#0c0d0ff5);
  box-shadow:0 22px 70px #0007,inset 0 1px #ffffff08;
  padding:14px 15px 13px;
}
.home-command:focus-within{border-color:#842634;box-shadow:0 22px 70px #0007,0 0 0 3px #ff32470b}
.command-topline,.command-hints,.mode-row,.send-row{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.command-topline label{margin:0;display:flex;align-items:center;gap:8px;color:#827d82;font:700 9px var(--mono);letter-spacing:.08em}
.command-topline select{width:auto;max-width:260px;padding:7px 28px 7px 9px;font-size:10px}
.command-entry{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:end}
.command-entry textarea{
  min-height:82px;
  max-height:190px;
  border:0;
  background:transparent;
  padding:14px 4px 7px;
  font-size:15px;
  line-height:1.5;
}
.command-entry textarea:focus{box-shadow:none}
.command-entry button{min-width:72px;margin-bottom:6px}
.command-hints{
  border-top:1px solid #ffffff0c;
  padding-top:9px;
  color:#716d72;
  font:650 8px var(--mono);
  letter-spacing:.04em;
}
.quick-moves{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.quick-moves button{
  border:1px solid #2e2b30;
  border-radius:999px;
  background:#101013;
  color:#918b92;
  padding:7px 11px;
  font-size:9px;
}
.quick-moves button:hover{border-color:#5e1b25;color:#ff8591}
.hero-side{display:grid;gap:12px;align-self:center}
.hero-side article{
  border:1px solid #29282c;
  background:#0d0d10c9;
  border-radius:12px;
  padding:15px;
}
.hero-side strong{display:block;font-size:13px;margin:5px 0 7px}
.hero-side p{margin:0;color:#777278;font-size:10px;line-height:1.55}

/* Workspaces */
.workspace-view{
  max-width:1180px;
  min-height:calc(100dvh - 66px);
  margin:0 auto;
  padding:38px 22px 112px;
}
.workspace-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:22px;
  margin-bottom:18px;
}
.workspace-head h2{margin:0;font-size:clamp(31px,4vw,50px);letter-spacing:-.035em}
.workspace-head p{margin:7px 0 0;color:#8f8a90;font-size:12px;line-height:1.6}
.workspace-actions{display:flex;align-items:flex-end;gap:10px}
.workspace-actions label{margin:0;min-width:260px}
.panel{padding:18px}
.command-panel{box-shadow:none;background:#0b0b0e}
.chat-log{
  display:flex;flex-direction:column;gap:12px;
  min-height:300px;max-height:52vh;overflow:auto;padding:4px 2px 18px;
}
.turn{border:1px solid #28272c;background:#09090b;border-radius:12px;padding:13px}
.turn.owner{margin-left:9%}
.turn.ai{margin-right:9%;border-color:#4c171f;background:#0d090b}
.turn small{color:#747078}
.turn strong{display:block;margin-top:3px}
.turn pre{white-space:pre-wrap;word-break:break-word;margin:8px 0 0;font:inherit}
#chat-form textarea{min-height:112px}
.mode-row label{margin:0;display:flex;align-items:center;gap:7px}
.mode-row select{width:auto}
.send-row{margin-top:9px}

/* Projects & models */
.project-grid,.model-grid,.status-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}
.project-card,.model-card,.status-card{
  border:1px solid #29282d;
  border-radius:13px;
  background:linear-gradient(160deg,#121216,#0a0a0c);
  padding:15px;
}
.project-card{position:relative;min-height:150px}
.project-card h3,.model-card h3{margin:4px 0 8px}
.project-card p,.model-card p{margin:0;color:#89848a;font-size:11px;line-height:1.55}
.project-card button{margin-top:15px;background:#131316;border-color:#343139;color:#c9c4c8}
.project-badge{
  display:inline-flex;padding:4px 7px;border:1px solid #3a343a;border-radius:999px;
  color:#8f8890;font:700 8px var(--mono);text-transform:uppercase;letter-spacing:.08em
}
.model-card .model-role{color:#ff7584;font:800 9px var(--mono);letter-spacing:.12em;text-transform:uppercase}
.model-card strong{display:block;margin:8px 0 6px}
.model-card.current{border-color:#64202a;box-shadow:inset 0 0 26px #ff324709}
.status-grid{margin-top:2px}
.status-card strong{display:block;font-size:17px;margin-top:6px}
.memory-panel{display:grid;grid-template-columns:minmax(280px,.75fr) minmax(360px,1.25fr);gap:18px}
.stack{display:grid;gap:11px}
.memory{border:1px solid #29282d;border-radius:12px;padding:13px;background:#09090b}
.memory p{white-space:pre-wrap}
.memory a{color:#ff7f8d}

/* Markdown */
.md-response{margin-top:10px;display:grid;gap:10px;line-height:1.58}
.md-paragraph{margin:0}
.md-heading{margin:8px 0 0;letter-spacing:-.015em}
.md-response h3{font-size:19px}.md-response h4{font-size:17px}.md-response h5{font-size:15px}
.md-list{margin:0;padding-left:22px;display:grid;gap:6px}
.inline-code{background:#18181b;border:1px solid #303035;border-radius:5px;padding:1px 5px;font-family:var(--mono);font-size:.92em}
.citation{
  display:inline-flex;align-items:center;justify-content:center;min-width:25px;height:21px;padding:0 6px;margin:0 2px;
  border:1px solid #5b1a23;border-radius:999px;background:#210d11;color:#ff9ba5;text-decoration:none;font-size:10px;font-weight:800
}
.inline-link,.source-link{color:#ff8b96;text-decoration:none}
.inline-link:hover,.source-link:hover,.citation:hover{text-decoration:underline}
.sources{display:grid;gap:6px;margin-top:11px;padding-top:11px;border-top:1px solid #29282d}
.source-link{display:block;overflow-wrap:anywhere}
.table-wrap{overflow-x:auto;border:1px solid #2b2b2f;border-radius:10px}
.md-table{width:100%;border-collapse:collapse;min-width:520px;background:#08080a}
.md-table th,.md-table td{padding:9px 10px;border-bottom:1px solid #242429;border-right:1px solid #242429;text-align:left;vertical-align:top}
.md-table th{background:#141417;color:#f2eeee;font-size:11px}.md-table td{font-size:12px;color:#ddd8db}
.md-table tr:last-child td{border-bottom:0}.md-table th:last-child,.md-table td:last-child{border-right:0}

/* Bottom dock */
.bottom-dock{
  position:fixed;
  z-index:60;
  left:50%;
  bottom:13px;
  transform:translateX(-50%);
  display:flex;
  align-items:stretch;
  gap:3px;
  padding:6px;
  border:1px solid #47363b;
  border-radius:13px;
  background:#0b0b0de8;
  backdrop-filter:blur(18px);
  box-shadow:0 11px 35px #000b;
  max-width:calc(100vw - 24px);
}
.bottom-dock .nav{
  min-width:78px;
  min-height:43px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:0;
  background:transparent;
  color:#7e797f;
  padding:0 11px;
  border-radius:8px;
  font-size:10px;
}
.bottom-dock .nav span{font-size:15px;line-height:1}
.bottom-dock .nav b{font-weight:700}
.bottom-dock .nav:hover{filter:none;color:#ddd6da;background:#ffffff08}
.bottom-dock .nav.active{color:#ff6676;background:#ff324710}
.dock-player{
  min-width:245px;
  border-left:1px solid #302d31;
  margin-left:4px;
  padding:0 5px 0 12px;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:10px;
}
.dock-player small{display:block;color:#777178;font:700 7px var(--mono);letter-spacing:.12em}
.dock-player strong{display:block;margin-top:3px;font:750 9px var(--mono);color:#bdb6bb;white-space:nowrap}
.player-eq{display:flex;align-items:end;gap:2px;height:21px}
.player-eq i{display:block;width:2px;background:#ff4d60;border-radius:2px;animation:eq 1.1s ease-in-out infinite alternate}
.player-eq i:nth-child(1){height:7px}.player-eq i:nth-child(2){height:16px;animation-delay:.18s}.player-eq i:nth-child(3){height:11px;animation-delay:.31s}.player-eq i:nth-child(4){height:19px;animation-delay:.08s}.player-eq i:nth-child(5){height:9px;animation-delay:.26s}
.player-button{width:31px;height:31px;padding:0;border-radius:50%;background:#1a0d10;border-color:#5d1721;color:#ff6978}
.hub-footer{position:fixed;left:15px;bottom:15px;color:#4f4b50;font:650 8px var(--mono);letter-spacing:.05em;z-index:10}

@keyframes orbit-spin{to{transform:rotate(332deg)}}
@keyframes eq{to{height:5px}}

@media(max-width:1100px){
  .home-view{grid-template-columns:minmax(280px,.82fr) minmax(390px,1.18fr);gap:30px}
  .hero-side{grid-column:1/-1;grid-template-columns:1fr 1fr;margin-top:-20px}
  .hero-art{min-height:460px}
  .bottom-dock .nav{min-width:68px;padding:0 8px}
  .dock-player{min-width:210px}
}
@media(max-width:820px){
  .screen{padding:15px}
  .auth-wrap{grid-template-columns:1fr}
  .auth-art{display:none}
  .hub-topbar{height:58px;padding:0 14px}
  .role-pill{display:none}
  .home-view{
    min-height:calc(100dvh - 58px);
    grid-template-columns:1fr;
    gap:4px;
    padding:14px 16px 112px;
    align-content:center;
  }
  .hero-art{min-height:220px;height:220px}
  .hero-art img{width:min(360px,86vw)}
  .hero-ring{width:250px}
  .ring-two{width:185px}
  .tag-405{left:12%;top:10%}.tag-private{right:11%;bottom:8%}
  .hero-copy h1{font-size:clamp(52px,13vw,82px);margin:12px 0}
  .hero-sub{font-size:11px;margin-bottom:13px}
  .hero-side{display:none}
  .command-hints{font-size:7px}
  .workspace-view{padding:24px 14px 108px}
  .workspace-head{align-items:stretch;flex-direction:column}
  .workspace-actions{align-items:stretch}
  .workspace-actions label{min-width:0;width:100%}
  .memory-panel{grid-template-columns:1fr}
  .bottom-dock{
    left:10px;right:10px;transform:none;
    overflow-x:auto;
    justify-content:flex-start;
  }
  .bottom-dock .nav{flex:0 0 auto}
  .dock-player{flex:0 0 220px}
  .hub-footer{display:none}
}
@media(max-width:560px){
  .top-actions .pill{display:none}
  .brand-lockup small{display:none}
  .hero-art{height:185px;min-height:185px}
  .home-command{padding:11px}
  .command-entry{grid-template-columns:1fr}
  .command-entry button{width:100%;margin:0}
  .command-topline{align-items:stretch;flex-direction:column}
  .command-topline label{justify-content:space-between}
  .command-hints{display:none}
  .quick-moves{display:none}
  .turn.owner,.turn.ai{margin:0}
  .mode-row{align-items:stretch;flex-direction:column}
}
