:root {
  --bg: #0d0912;
  --bg2: #17101f;
  --panel: rgba(25, 18, 32, .76);
  --panel2: rgba(45, 32, 55, .56);
  --text: #fff6ef;
  --muted: #cab8d2;
  --pink: #ff79c6;
  --blue: #8be9fd;
  --gold: #ffd98a;
  --amber: #ffb86c;
  --green: #55f08a;
  --danger: #ff6d7a;
  --radius: 28px;
  --shadow: 0 26px 88px rgba(0,0,0,.58);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255,121,198,.18), transparent 32%),
    radial-gradient(circle at 82% 12%, rgba(139,233,253,.16), transparent 30%),
    radial-gradient(circle at 50% 110%, rgba(255,184,108,.13), transparent 48%),
    linear-gradient(135deg, #09070c, #15101d 48%, #0d0912);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.026) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

.aurora {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background:
    conic-gradient(from 20deg at 30% 40%, transparent, rgba(255,121,198,.16), transparent, rgba(139,233,253,.14), transparent),
    conic-gradient(from 180deg at 70% 35%, transparent, rgba(255,217,138,.10), transparent, rgba(189,147,249,.16), transparent);
  filter: blur(52px) saturate(1.35);
  animation: auroraDrift 22s ease-in-out infinite alternate;
  opacity: .86;
}
#foxfire { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

.room { position: relative; z-index: 1; width: min(1480px, calc(100vw - 28px)); margin: 18px auto 34px; }
.topbar, .panel {
  border: 1px solid rgba(255,255,255,.115);
  background: linear-gradient(180deg, rgba(34,25,42,.78), rgba(15,11,22,.72));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.055);
  backdrop-filter: blur(18px);
}
.topbar {
  min-height: 76px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px 12px 18px;
  position: sticky;
  top: 12px;
  z-index: 5;
}
a { color: inherit; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-width: max-content; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle, rgba(255,121,198,.9), rgba(139,233,253,.5)); box-shadow: 0 0 28px rgba(255,121,198,.45); color: #170d16; font-weight: 900; }
.brand b { display: block; font-size: 19px; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.toplinks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.toplinks a, .ghost-btn {
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.toplinks a:hover, .ghost-btn:hover, button:hover { transform: translateY(-1px); border-color: rgba(255,217,138,.36); }

.hero { margin-top: 18px; border-radius: var(--radius); padding: clamp(16px, 2.2vw, 30px); display: grid; grid-template-columns: minmax(300px, .82fr) minmax(360px, 1.18fr); gap: 26px; overflow: hidden; position: relative; }
.hero::before { content: ""; position: absolute; inset: -1px; background: radial-gradient(circle at 24% 50%, var(--modeGlow, rgba(255,121,198,.18)), transparent 35%); opacity: .9; pointer-events: none; transition: background .5s ease; }
.stage, .dialogue { position: relative; z-index: 1; }
.stage { min-height: 690px; border-radius: 24px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)); border: 1px solid rgba(255,255,255,.1); overflow: hidden; display: grid; align-content: end; }
.window-glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 12%, rgba(255,255,255,.20), transparent 16%), radial-gradient(circle at 28% 38%, rgba(139,233,253,.16), transparent 30%), radial-gradient(circle at 74% 58%, rgba(255,121,198,.15), transparent 32%); animation: windowPulse 7s ease-in-out infinite; }
.portrait-frame { position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); width: min(78%, 390px); height: min(88%, 640px); border-radius: 30px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 30px 88px rgba(0,0,0,.52), 0 0 34px var(--modeGlow, rgba(255,121,198,.24)); background: #110c16; animation: breathe 5.8s ease-in-out infinite; }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; filter: saturate(1.05) contrast(1.02); transition: opacity .28s ease, filter .5s ease; }
.portrait-frame.switching img { opacity: .22; filter: blur(6px) saturate(1.4); }
.portrait-shine { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 12%, rgba(255,255,255,.16) 42%, transparent 55%); transform: translateX(-130%); animation: shine 8s ease-in-out infinite; mix-blend-mode: screen; pointer-events: none; }
.mood-orb { position: absolute; width: 12px; height: 12px; border-radius: 50%; filter: blur(.2px); opacity: .8; animation: orbFloat 4.5s ease-in-out infinite; }
.mood-blue { background: var(--blue); box-shadow: 0 0 18px var(--blue); left: 18%; top: 30%; }
.mood-pink { background: var(--pink); box-shadow: 0 0 18px var(--pink); right: 19%; top: 38%; animation-delay: -1.7s; }
.tail-glow { position: absolute; width: 240px; height: 90px; border: 2px solid rgba(255,255,255,.18); border-left: 0; border-radius: 0 90px 90px 0; filter: blur(1px); opacity: .5; animation: tailSway 6s ease-in-out infinite; pointer-events: none; }
.tail-one { right: -64px; bottom: 90px; transform: rotate(-18deg); border-color: rgba(255,121,198,.25); }
.tail-two { left: -64px; bottom: 142px; transform: scaleX(-1) rotate(-14deg); border-color: rgba(139,233,253,.22); animation-delay: -2s; }
.stage-footer { z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; padding: 0 18px 18px; }
.mode-pill, .mood-pill { border-radius: 999px; padding: 10px 13px; background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.14); font-weight: 900; }
.mode-pill { color: var(--gold); }
.mood-pill { color: var(--blue); }

.dialogue { align-self: stretch; display: grid; align-content: center; gap: 18px; padding: clamp(8px, 1.2vw, 16px); }
.eyebrow { margin: 0; color: var(--blue); text-transform: uppercase; letter-spacing: .19em; font-size: 12px; font-weight: 950; }
h1, h2, p { margin-top: 0; }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(54px, 8vw, 114px); line-height: .86; margin-bottom: 0; text-shadow: 0 0 28px var(--modeGlow, rgba(255,121,198,.33)); }
h2 { font-family: Georgia, 'Times New Roman', serif; font-size: 30px; margin-bottom: 8px; }
.essence { color: var(--muted); font-size: clamp(17px, 2vw, 24px); line-height: 1.35; max-width: 780px; }
.speech-card { border-radius: 24px; background: rgba(8,6,12,.56); border: 1px solid rgba(255,255,255,.13); padding: 22px; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.speaker { display: inline-block; margin-bottom: 10px; color: var(--pink); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 950; }
.speech-card p { margin: 0; font-size: clamp(19px, 2.4vw, 32px); line-height: 1.25; }
.mode-buttons, .ritual-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
button { transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.mode-buttons button, .ritual-buttons button, .status-stack button {
  appearance: none;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.062);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 15px;
  font-weight: 900;
  cursor: pointer;
}
.mode-buttons button.is-active { background: linear-gradient(135deg, var(--modeAccent, rgba(255,121,198,.55)), rgba(255,255,255,.08)); color: #120b16; border-color: rgba(255,255,255,.32); }
.ritual-buttons button { color: var(--gold); }

.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.dashboard-grid-v02 { grid-template-columns: 1.15fr 1fr repeat(4, minmax(0, 1fr)); }
.panel { border-radius: var(--radius); padding: 22px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head span { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.08); color: var(--gold); font-weight: 950; }
.panel p { color: var(--muted); line-height: 1.5; }
.live-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.live-list li, .status-stack button, .link-grid a { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-radius: 15px; padding: 13px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); }
.live-list b { color: var(--gold); }
.live-list span { text-align: right; color: var(--text); }
.status-stack { display: grid; gap: 10px; }
.status-stack button { text-align: left; width: 100%; }
.status-stack button span { color: var(--muted); font-weight: 700; }
.link-grid { display: grid; gap: 10px; }
.link-grid a { text-decoration: none; color: var(--text); font-weight: 900; }
.progress-orbits { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
.progress-orbits span { --size: 82px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--pink) var(--p), rgba(255,255,255,.09) 0); position: relative; }
.progress-orbits span::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #17101f; }
.progress-orbits b { position: relative; font-size: 13px; }
.lore-panel { display: grid; grid-template-columns: 1fr minmax(260px, 520px); gap: 20px; margin-top: 18px; align-items: center; }
.lore-panel img { width: 100%; border-radius: 22px; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 18px 44px rgba(0,0,0,.38); }
.pulse-pill { border-radius: 999px; padding: 10px 13px; background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.14); color: var(--pink); font-weight: 900; }
.room-constellation { position: absolute; inset: 24px; pointer-events: none; opacity: .72; }
.room-constellation span { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--modeAccent, var(--pink)); box-shadow: 0 0 22px var(--modeAccent, var(--pink)); animation: orbFloat 5.4s ease-in-out infinite; }
.room-constellation span:nth-child(1) { left: 18%; top: 12%; }
.room-constellation span:nth-child(2) { right: 16%; top: 22%; animation-delay: -1.8s; }
.room-constellation span:nth-child(3) { left: 42%; bottom: 16%; animation-delay: -3.2s; }
.mode-console { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-console div { border-radius: 18px; padding: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.mode-console span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; }
.mode-console b { color: var(--gold); line-height: 1.25; }
.status-panel { background: linear-gradient(180deg, rgba(24,38,50,.78), rgba(15,11,22,.72)); }
.presence-panel { background: linear-gradient(180deg, rgba(44,30,58,.80), rgba(16,10,23,.72)); }
.presence-panel .panel-head span { width: auto; padding: 0 11px; color: #160f1d; background: linear-gradient(135deg, var(--pink), var(--gold)); }
.status-panel .panel-head span { width: auto; padding: 0 11px; color: #10151b; background: linear-gradient(135deg, var(--blue), var(--gold)); }
.status-list li span { font-variant-numeric: tabular-nums; }
.status-note { display: block; margin-top: 12px; color: var(--muted); line-height: 1.35; }
.mode-deck { margin-top: 18px; }
.mode-card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.mode-card-grid article { border-radius: 18px; padding: 16px; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.055); cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.mode-card-grid article:hover, .mode-card-grid article.is-active { transform: translateY(-2px); border-color: rgba(255,217,138,.42); background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.045)); }
.mode-card-grid b { color: var(--gold); font-size: 18px; }
.mode-card-grid p { margin: 8px 0 0; font-size: 14px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); z-index: 20; background: rgba(13,9,18,.92); border: 1px solid rgba(255,217,138,.34); color: var(--text); border-radius: 999px; padding: 12px 18px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.room[data-mode="den"] { --modeAccent: #ffb86c; --modeGlow: rgba(255,184,108,.28); }
.room[data-mode="sysadmin"] { --modeAccent: #8be9fd; --modeGlow: rgba(139,233,253,.25); }
.room[data-mode="queen"] { --modeAccent: #ffd98a; --modeGlow: rgba(255,217,138,.27); }
.room[data-mode="guild"] { --modeAccent: #ff796f; --modeGlow: rgba(255,121,111,.23); }
.room[data-mode="private"] { --modeAccent: #ff79c6; --modeGlow: rgba(255,121,198,.30); }

@keyframes auroraDrift { to { transform: rotate(9deg) scale(1.08); opacity: .72; } }
@keyframes windowPulse { 50% { filter: brightness(1.24); transform: translateY(-6px); } }
@keyframes breathe { 50% { transform: translateX(-50%) translateY(-8px) scale(1.012); } }
@keyframes shine { 0%, 55% { transform: translateX(-130%); } 70%, 100% { transform: translateX(130%); } }
@keyframes orbFloat { 50% { transform: translateY(-16px) translateX(8px); opacity: 1; } }
@keyframes tailSway { 50% { transform: rotate(-10deg) translateY(-8px); opacity: .72; } }

@media (max-width: 1320px) { .dashboard-grid-v02 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .status-panel { grid-column: span 2; } }
@media (max-width: 1120px) { .dashboard-grid, .dashboard-grid-v02 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hero { grid-template-columns: 1fr; } .stage { min-height: 610px; } .mode-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .room { width: min(100vw - 16px, 1480px); margin-top: 8px; } .topbar { border-radius: 24px; align-items: stretch; flex-direction: column; } .toplinks { justify-content: flex-start; } .dashboard-grid, .dashboard-grid-v02, .lore-panel, .mode-console, .mode-card-grid { grid-template-columns: 1fr; } .status-panel { grid-column: auto; } .stage { min-height: 540px; } .portrait-frame { width: min(86%, 330px); height: 500px; } h1 { font-size: clamp(48px, 18vw, 76px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
