/* 4org3 OS shell — midnight · red · silver · white · v3 */
:root {
  --bg: #050506;
  --card: rgba(18, 18, 22, 0.9);
  --line: rgba(192, 192, 200, 0.12);
  --teal: #c8c8d0;       /* remapped → silver */
  --violet: #fb2c55;     /* remapped → hot red */
  --amber: #e8e8ed;      /* remapped → bright silver */
  --red: #e11d48;
  --silver: #c8c8d0;
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --glow-t: rgba(200, 200, 208, 0.28);
  --glow-v: rgba(225, 29, 72, 0.35);
  --glow-a: rgba(232, 232, 237, 0.22);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: #050506;
  overflow-x: hidden;
}

/* Ambient stage */
.fx-stage {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.fx-stage .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  mix-blend-mode: screen;
  animation: orbDrift 22s ease-in-out infinite alternate;
}
.fx-stage .orb-a {
  width: min(55vw, 560px); height: min(55vw, 560px);
  top: -18%; left: -12%;
  background: radial-gradient(circle, rgba(225,29,72,0.5), transparent 68%);
}
.fx-stage .orb-b {
  width: min(50vw, 500px); height: min(50vw, 500px);
  top: 5%; right: -14%;
  background: radial-gradient(circle, rgba(200,200,208,0.35), transparent 68%);
  animation-delay: -7s; animation-duration: 26s;
}
.fx-stage .orb-c {
  width: min(42vw, 420px); height: min(42vw, 420px);
  bottom: -12%; left: 35%;
  background: radial-gradient(circle, rgba(251,44,85,0.22), transparent 70%);
  animation-delay: -12s; animation-duration: 30s;
}
@keyframes orbDrift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, 5%) scale(1.06); }
  100% { transform: translate(-2%, 3%) scale(0.96); }
}
.fx-stage .grain {
  position: absolute; inset: 0; opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.fx-stage .vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 75% 70% at 50% 40%, transparent 40%, rgba(0,0,0,0.55) 100%);
}
.fx-stage .scan {
  position: absolute; inset: 0; opacity: 0.04;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px, rgba(0,0,0,0.4) 2px, rgba(0,0,0,0.4) 3px
  );
  animation: scanShift 12s linear infinite;
}
@keyframes scanShift {
  0% { transform: translateY(0); }
  100% { transform: translateY(12px); }
}

a { color: var(--teal); text-decoration: none; transition: color .15s, opacity .15s; }
a:hover { color: #5eead4; }

.shell {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.25rem 1.35rem 3.5rem;
}

/* Top bar */
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.15rem;
}
.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand img {
  width: 50px; height: 50px; border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 8px 32px var(--glow-t),
    0 0 40px rgba(167,139,250,0.15);
  animation: logoFloat 5.5s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.brand h1 {
  margin: 0; font-size: clamp(1.35rem, 2.5vw, 1.65rem); font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, #f8fafc 0%, #5eead4 40%, #c4b5fd 75%, #fcd34d 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }
.brand p {
  margin: 0.2rem 0 0; font-size: 10px; color: var(--muted);
  letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600;
}

/* Room switcher */
.rooms {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.35rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(145deg, rgba(10,14,26,0.9), rgba(8,10,18,0.95));
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}
.rooms a {
  font-size: 11px; padding: 0.45rem 0.95rem; border-radius: 999px;
  color: #94a3b8; border: 1px solid transparent; font-weight: 700;
  letter-spacing: 0.04em;
}
.rooms a:hover {
  color: #e2e8f0; text-decoration: none;
  background: rgba(30,41,59,0.7);
}
.rooms a.on {
  color: #041016;
  background: linear-gradient(110deg, #5eead4, #a78bfa 55%, #fbbf24);
  background-size: 180% auto;
  animation: shimmer 6s linear infinite;
  box-shadow: 0 0 24px rgba(45,212,191,0.35);
}

/* Law banner */
.law {
  position: relative;
  font-size: 12.5px; color: var(--muted); padding: 0.85rem 1.15rem;
  margin-bottom: 1.15rem; border-radius: 16px; line-height: 1.5;
  border: 1px solid rgba(167,139,250,0.28);
  background:
    linear-gradient(135deg, rgba(167,139,250,0.1), rgba(45,212,191,0.05));
  overflow: hidden;
}
.law::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, #a78bfa, #2dd4bf, #fbbf24);
  background-size: 100% 200%;
  animation: barFlow 4s linear infinite;
}
@keyframes barFlow {
  0% { background-position: 0 0; }
  100% { background-position: 0 200%; }
}
.law strong { color: #e9d5ff; font-weight: 700; }

/* Doors */
.doors {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem;
  margin-bottom: 1.15rem;
}
@media (max-width: 720px) { .doors { grid-template-columns: 1fr; } }

.door {
  position: relative;
  display: block; padding: 1.15rem 1.2rem; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(160deg, rgba(18,24,40,0.95), rgba(8,12,22,0.98));
  color: inherit; text-decoration: none !important;
  overflow: hidden;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .2s;
}
.door::after {
  content: "";
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,255,255,0.08), transparent 55%);
  transition: opacity .2s;
}
.door:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(0,0,0,0.45);
}
.door:hover::after { opacity: 1; }
.door .t {
  position: relative; z-index: 1;
  font-weight: 800; font-size: 1.05rem; margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}
.door .d {
  position: relative; z-index: 1;
  font-size: 12px; color: var(--muted); line-height: 1.45;
}
.door.sports {
  border-color: rgba(45,212,191,0.25);
  box-shadow: 0 0 0 0 rgba(45,212,191,0);
}
.door.sports:hover {
  border-color: rgba(45,212,191,0.55);
  box-shadow: 0 16px 40px rgba(45,212,191,0.12);
}
.door.sports .t { color: #5eead4; text-shadow: 0 0 24px rgba(45,212,191,0.4); }
.door.work {
  border-color: rgba(167,139,250,0.28);
}
.door.work:hover {
  border-color: rgba(167,139,250,0.55);
  box-shadow: 0 16px 40px rgba(167,139,250,0.12);
}
.door.work .t { color: #c4b5fd; text-shadow: 0 0 24px rgba(167,139,250,0.4); }
.door.brain {
  border-color: rgba(251,191,36,0.28);
}
.door.brain:hover {
  border-color: rgba(251,191,36,0.55);
  box-shadow: 0 16px 40px rgba(251,191,36,0.1);
}
.door.brain .t { color: #fcd34d; text-shadow: 0 0 24px rgba(251,191,36,0.35); }

/* Cards */
.grid2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
@media (max-width: 960px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

.card {
  position: relative;
  background:
    linear-gradient(155deg, rgba(18,24,42,0.92), rgba(8,12,22,0.96));
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 22px;
  padding: 1.1rem 1.2rem;
  box-shadow:
    0 20px 50px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  animation: cardIn 0.55s cubic-bezier(.2,.8,.2,1) both;
}
.card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
}
.card h2 {
  margin: 0 0 0.75rem; font-size: 0.7rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: #94a3b8; font-weight: 700;
  display: flex; align-items: center; gap: 0.4rem;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack .card:nth-child(2) { animation-delay: 0.06s; }
.stack .card:nth-child(3) { animation-delay: 0.12s; }

/* Metrics */
.metric {
  position: relative;
  padding: 0.8rem 0.9rem; border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  background: linear-gradient(160deg, rgba(12,18,32,0.95), rgba(6,10,18,0.98));
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.metric:hover {
  border-color: rgba(45,212,191,0.3);
  transform: translateY(-1px);
}
.metric .l {
  font-size: 10px; color: var(--muted); letter-spacing: 0.1em;
  text-transform: uppercase; font-weight: 600;
}
.metric .v {
  font-size: 1.25rem; font-weight: 800; font-family: ui-monospace, "Cascadia Code", monospace;
  margin-top: 0.25rem; color: #f1f5f9;
  text-shadow: 0 0 20px rgba(45,212,191,0.2);
}

/* Chat */
.chat-log {
  height: min(40vh, 360px); overflow: auto; border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(167,139,250,0.06), transparent 50%),
    #03060c;
  padding: 0.85rem;
  font-size: 13px; line-height: 1.5; margin-bottom: 0.7rem;
  scrollbar-width: thin; scrollbar-color: rgba(100,116,139,0.4) transparent;
}
.msg { margin-bottom: 0.7rem; animation: msgIn 0.35s ease both; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg .who {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #64748b; margin-bottom: 0.15rem; font-weight: 700;
}
.msg.user .who { color: #5eead4; }
.msg.alex .who { color: #c4b5fd; }
.msg.bus .who { color: #fcd34d; }
.msg .body { white-space: pre-wrap; color: #e2e8f0; }

.row { display: flex; gap: 0.5rem; }
.row input {
  flex: 1; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(8,12,22,0.9);
  color: var(--text); padding: 0.7rem 0.9rem; font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.row input:focus {
  outline: none;
  border-color: rgba(167,139,250,0.5);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.12);
}

.btn, .row button {
  border-radius: 14px;
  border: 1px solid rgba(45,212,191,0.45);
  background: linear-gradient(145deg, rgba(45,212,191,0.2), rgba(45,212,191,0.08));
  color: #5eead4;
  padding: 0.65rem 1.1rem; font: inherit; cursor: pointer; font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.btn:hover, .row button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(45,212,191,0.2);
  border-color: rgba(45,212,191,0.7);
}
.btn.ghost {
  border-color: rgba(255,255,255,0.1);
  color: #94a3b8;
  background: transparent;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.75rem; }
.chips button {
  font-size: 11px; padding: 0.38rem 0.75rem; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(15,23,42,0.85); color: #cbd5e1; font: inherit; font-weight: 600;
  transition: border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.chips button:hover {
  border-color: rgba(167,139,250,0.45); color: #e9d5ff;
  box-shadow: 0 0 16px rgba(167,139,250,0.15);
  transform: translateY(-1px);
}

.tile {
  display: block; width: 100%; text-align: left; border-radius: 16px;
  padding: 0.85rem 0.95rem; margin-bottom: 0.5rem;
  border: 1px solid rgba(255,255,255,0.07);
  background: linear-gradient(145deg, rgba(15,22,38,0.9), rgba(8,12,20,0.95));
  color: inherit; font: inherit; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile:hover {
  border-color: rgba(167,139,250,0.4);
  text-decoration: none; color: #e2e8f0;
  transform: translateX(3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.tile b { display: block; color: #f8fafc; margin-bottom: 0.2rem; font-size: 13px; }
.tile span { color: var(--muted); font-size: 11px; }

.list { font-size: 12px; color: #94a3b8; max-height: 300px; overflow: auto; }
.list .item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(30,41,59,0.75);
}
.list .item strong { color: #f1f5f9; }
.mono { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 11px; color: #64748b; }

/* Live pulse on brand sub when online */
.live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #2dd4bf; box-shadow: 0 0 10px #2dd4bf;
  margin-right: 0.35rem;
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

/* Grade chips on brain */
.grade-aaa {
  background: linear-gradient(90deg, #5eead4, #a78bfa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 800;
}

/* Company plan tracker */
.plan-phases { display: flex; flex-direction: column; gap: 0.85rem; max-height: 420px; overflow: auto; }
.plan-phase {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(10,14,26,0.95), rgba(6,10,18,0.98));
  padding: 0.75rem 0.9rem;
}
.plan-phase h3 {
  margin: 0 0 0.55rem;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c4b5fd;
  font-weight: 700;
}
.plan-phase h3 .ph-stats {
  float: right;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #64748b;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}
.plan-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid rgba(30,41,59,0.6);
  cursor: pointer;
  transition: background .12s;
  border-radius: 8px;
}
.plan-item:last-child { border-bottom: none; }
.plan-item:hover { background: rgba(167,139,250,0.06); }
.plan-item input {
  margin-top: 0.2rem;
  width: 15px; height: 15px;
  accent-color: #2dd4bf;
  cursor: pointer;
  flex-shrink: 0;
}
.plan-item .pt {
  font-size: 12.5px;
  color: #e2e8f0;
  line-height: 1.4;
}
.plan-item.done .pt {
  color: #64748b;
  text-decoration: line-through;
  text-decoration-color: rgba(45,212,191,0.45);
}
.plan-item .pt strong { color: #f1f5f9; font-weight: 700; }
.plan-item.done .pt strong { color: #64748b; }
