:root {
  --red: #ff2a1a;
  --red-hot: #ff5a3c;
  --ember: #ff8a3a;
  --red-deep: #7a0000;
  --red-dark: #2a0000;
  --ink: #120000;
  --text: #ffe2dc;
  --text-dim: #d7958a;
  --panel: rgba(140, 6, 0, 0.28);
  --panel-edge: rgba(255, 90, 60, 0.45);
  --display: "Arial Black", "Segoe UI Black", Impact, sans-serif;
  --ui: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: #000; color: var(--text); font-family: var(--ui); user-select: none; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Animated logo (assets/logo.png has a transparent background, centred on the fire ring). */
.demon-logo { position: relative; width: 100%; height: 100%; }
.demon-logo > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.dl-face, .dl-ring { object-fit: contain; }
.dl-face {
  -webkit-mask: radial-gradient(circle closest-side, #000 69%, transparent 72%);
  mask: radial-gradient(circle closest-side, #000 69%, transparent 72%);
  animation: faceBreath 4s ease-in-out infinite;
}
.dl-ring {
  -webkit-mask: radial-gradient(circle closest-side, transparent 65%, #000 68%);
  mask: radial-gradient(circle closest-side, transparent 65%, #000 68%);
  animation: ringSpin 26s linear infinite, ringFlicker 1.7s steps(1, end) infinite;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes ringFlicker {
  0% { filter: brightness(1) saturate(1.1); }
  13% { filter: brightness(1.25) saturate(1.3); }
  27% { filter: brightness(0.95); }
  41% { filter: brightness(1.35) saturate(1.4) drop-shadow(0 0 6px rgba(255, 90, 20, .8)); }
  58% { filter: brightness(1.05); }
  72% { filter: brightness(1.2) saturate(1.2); }
  86% { filter: brightness(0.9); }
}
@keyframes faceBreath { 50% { transform: scale(1.02); } }
.dl-eye {
  width: 16%; height: 10%; left: auto; top: auto; border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(ellipse, rgba(255, 70, 40, 0.95), rgba(255, 0, 0, 0.35) 45%, transparent 70%);
  animation: eyeGlow 2.6s ease-in-out infinite;
}
.dl-eye.l { left: 26.7%; top: 36.3%; }
.dl-eye.r { left: 54.3%; top: 36.3%; }
@keyframes eyeGlow {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  45% { opacity: 1; transform: scale(1.15); }
  48% { opacity: 0.2; }   /* quick blink */
  52% { opacity: 1; }
}
.dl-grin { /* glint sweeping across the teeth */
  left: 29%; top: 50%; width: 42%; height: 13%; overflow: hidden; border-radius: 0 0 50% 50% / 0 0 100% 100%;
  mix-blend-mode: screen;
  background: linear-gradient(100deg, transparent 40%, rgba(255, 230, 220, 0.75) 50%, transparent 60%) no-repeat;
  background-size: 250% 100%; animation: grinGlint 5s ease-in-out infinite;
}
@keyframes grinGlint { 0%, 60% { background-position: 150% 0; } 85%, 100% { background-position: -60% 0; } }
.demon-logo.mini .dl-grin { display: none; }

/* ============================ BOOT ============================ */
#boot { position: fixed; inset: 0; z-index: 100; background: #000; overflow: hidden; cursor: none; }
#boot.leaving { transition: opacity 1.2s ease; opacity: 0; pointer-events: none; }
#boot.skip { transition: opacity 0.45s ease; opacity: 0; pointer-events: none; }
#bootCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

#bootStage {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2.2vmin; pointer-events: none;
}
#bootRays {
  position: absolute; left: 50%; top: 50%; width: 140vmax; height: 140vmax;
  margin: -70vmax 0 0 -70vmax; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 40, 20, 0.16) 0deg 4deg, transparent 4deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0,0,0,0.6) 18%, transparent 45%);
  mask: radial-gradient(circle, #000 0%, rgba(0,0,0,0.6) 18%, transparent 45%);
  transform: translateY(-6vmin);
}
#boot.reveal #bootRays { animation: raysIn 2s ease forwards, spin 40s linear infinite; }
@keyframes raysIn { to { opacity: 1; } }
@keyframes spin { to { transform: translateY(-6vmin) rotate(360deg); } }

#bootLogo {
  position: relative; width: 38vmin; height: 38vmin; opacity: 0;
  transform: scale(0.25); filter: blur(24px) brightness(4);
}
#boot.reveal #bootLogo {
  transition: transform 1.6s cubic-bezier(.16, 1.2, .3, 1), filter 1.4s ease-out, opacity 0.5s ease-out;
  opacity: 1; transform: scale(1); filter: blur(0) brightness(1) drop-shadow(0 0 4vmin rgba(255, 40, 10, 0.55));
}
#boot.reveal #bootLogo::after {
  content: ""; position: absolute; inset: -8%; border-radius: 50%;
  box-shadow: 0 0 6vmin 1vmin rgba(255, 50, 20, 0.35), inset 0 0 4vmin rgba(255, 60, 20, 0.25);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.45; transform: scale(1.03); } }

#bootTitle {
  position: relative; margin: 0; font-family: var(--display); font-weight: 900;
  font-size: 9.5vmin; letter-spacing: 1.6vmin; line-height: 1; white-space: nowrap;
  padding-left: 1.6vmin; /* balance trailing letter-spacing */
}
#bootTitle .ch {
  display: inline-block; opacity: 0; transform: translateY(3vmin) scale(1.4); filter: blur(10px);
  background: linear-gradient(180deg, #fff 0%, #ffd2c4 30%, #ff3a22 58%, #8c0000 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#boot.title .ch {
  transition: opacity .5s ease, transform .7s cubic-bezier(.2, 1.4, .4, 1), filter .6s ease;
  opacity: 1; transform: none; filter: blur(0) drop-shadow(0 0 1.4vmin rgba(255, 40, 10, 0.75));
}
#bootTitle::after { /* metallic sheen sweep */
  content: ""; position: absolute; inset: -10% auto -10% -30%; width: 18%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  mix-blend-mode: overlay; opacity: 0; transform: skewX(-20deg);
}
#boot.sheen #bootTitle::after { animation: sheen 1.1s ease-in-out forwards; }
@keyframes sheen { 0% { left: -30%; opacity: 1; } 100% { left: 115%; opacity: 1; } }

#bootTagline {
  margin: 0; font-size: 2.2vmin; letter-spacing: 1.1vmin; text-transform: uppercase;
  color: #ff9a86; opacity: 0; transform: translateY(1vmin); text-shadow: 0 0 1.2vmin rgba(255, 40, 10, 0.8);
}
#boot.tagline #bootTagline { transition: opacity 1.2s ease, transform 1.2s ease; opacity: 0.85; transform: none; }

#bootFlash {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 46%, #fff 0%, #ffd0b0 12%, #ff3a1a 35%, rgba(120, 0, 0, 0.6) 70%, rgba(0,0,0,0) 100%);
}
#boot.flash #bootFlash { animation: flash 1.5s ease-out forwards; }
@keyframes flash { 0% { opacity: 0; } 5% { opacity: 1; } 100% { opacity: 0; } }

#bootFooter {
  position: absolute; bottom: 4vmin; left: 0; right: 0; text-align: center;
  font-size: 1.5vmin; letter-spacing: 0.3vmin; color: #a8564a; opacity: 0;
}
#boot.tagline #bootFooter { transition: opacity 1.5s ease 0.4s; opacity: 0.8; }
#bootStart {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5vmin; background: radial-gradient(circle at 50% 45%, #2a0200, #000 65%); cursor: pointer;
}
#bootStart[hidden] { display: none; }
#bootStart .demon-logo { width: 30vmin; height: 30vmin; filter: drop-shadow(0 0 3vmin rgba(255, 40, 10, 0.5)); }
#bootStart span {
  font-family: "Bahnschrift", "Segoe UI", sans-serif; font-weight: 700; font-size: 2.6vmin; letter-spacing: 1vmin;
  text-transform: uppercase; color: #ff8a6a; text-shadow: 0 0 1.2vmin rgba(255, 40, 10, 0.8); animation: statusPulse 1.4s ease-in-out infinite;
}

#bootSkip {
  position: absolute; right: 3vmin; bottom: 3vmin; font-size: 1.4vmin; color: #5a2a24;
  letter-spacing: 0.2vmin; text-transform: uppercase;
}

/* ============================ BROWSER ============================ */
#app {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: var(--ink); opacity: 0; transform: scale(1.08); filter: brightness(2.5) blur(6px);
}
#app.on { transition: opacity 1.1s ease, transform 1.3s cubic-bezier(.2, .9, .3, 1), filter 1.2s ease; opacity: 1; transform: none; filter: none; }

/* --- page area --- */
#views { position: relative; flex: 1; overflow: hidden; background: #000; }
#ambient { position: absolute; inset: 0; width: 100%; height: 100%; }

/* --- home dashboard --- */
#home { position: absolute; inset: 0; overflow: hidden; }
#home.hidden { display: none; }
#dash {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 2vw; padding: 0 4vw;
}
#dashOrb { position: relative; width: min(58vh, 46vw); height: min(58vh, 46vw); flex-shrink: 0; }
#orbCanvas { position: absolute; inset: -20%; width: 140%; height: 140%; }
.orb-logo {
  position: absolute; inset: 22%; border-radius: 50%;
  animation: orbBob 5s ease-in-out infinite;
}
.orb-logo .demon-logo { filter: drop-shadow(0 0 16px rgba(255, 60, 10, 0.7)); }
#dash.pulse .orb-logo { animation: orbKick .55s cubic-bezier(.2, 1.6, .4, 1), orbBob 5s ease-in-out infinite; }
@keyframes orbBob { 50% { transform: translateY(-1.2%) scale(1.015); } }
@keyframes orbKick { 0% { transform: scale(1); } 35% { transform: scale(1.08); filter: brightness(1.6); } 100% { transform: scale(1); } }

#dashMenuWrap { position: relative; width: min(470px, 40vw); }
#dashTitle {
  position: absolute; left: 70px; top: -64px; font-family: var(--display); font-size: clamp(16px, 2.4vh, 24px);
  letter-spacing: 6px; color: #ff7a52; text-shadow: 0 0 12px rgba(255, 40, 10, 0.8);
  transition: opacity .25s, transform .25s;
}
#dashTitle.swap { opacity: 0; transform: translateX(20px); }
#dashMenu { display: flex; flex-direction: column; gap: clamp(10px, 2.6vh, 26px); }

.dash-item {
  --shift: 0px;
  position: relative; display: flex; align-items: center; height: clamp(40px, 6.4vh, 56px);
  padding: 0; border: none; background: none; cursor: pointer; text-align: left;
  transform: translateX(var(--shift)); opacity: 0;
  animation: itemIn .5s cubic-bezier(.2, 1.3, .4, 1) forwards; animation-delay: calc(var(--i) * 70ms);
}
.dash-item.out { animation: itemOut .22s ease-in forwards; animation-delay: calc(var(--i) * 30ms); }
@keyframes itemIn { from { opacity: 0; transform: translateX(calc(var(--shift) + 80px)); } to { opacity: 1; transform: translateX(var(--shift)); } }
@keyframes itemOut { to { opacity: 0; transform: translateX(calc(var(--shift) + 60px)); } }

/* glowing socket sphere on the left of each option */
.node {
  position: relative; width: clamp(40px, 6.4vh, 56px); height: clamp(40px, 6.4vh, 56px); border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 50% 50%, rgba(40, 0, 0, 0.9) 38%, rgba(255, 60, 20, 0.5) 52%, rgba(120, 0, 0, 0.7) 64%, rgba(255, 70, 30, 0.35) 72%, transparent 74%);
  box-shadow: 0 0 14px rgba(255, 40, 10, 0.35);
}
.node::before { /* rotating dashed ring */
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px dashed rgba(255, 80, 40, 0.45); animation: spinPlain 9s linear infinite;
}
.node-core {
  position: absolute; inset: 30%; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffb08a, #e0200a 55%, #4a0000);
  box-shadow: 0 0 8px rgba(255, 50, 20, 0.6); transition: transform .2s, box-shadow .2s, filter .2s;
}
@keyframes spinPlain { to { transform: rotate(360deg); } }

.stem { width: 18px; height: 3px; background: linear-gradient(90deg, rgba(255, 60, 30, 0.8), rgba(255, 60, 30, 0.3)); flex-shrink: 0; }

.bar {
  position: relative; flex: 1; height: 62%; display: flex; align-items: center; padding: 0 22px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
  background: linear-gradient(90deg, rgba(120, 8, 0, 0.75), rgba(60, 0, 0, 0.55));
  transition: background .2s;
}
.bar::before { /* bright edge line */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  clip-path: inherit;
  background: linear-gradient(90deg, rgba(255, 90, 50, 0.9), rgba(255, 60, 30, 0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); padding: 2px;
}
.label {
  font-family: "Bahnschrift", "Segoe UI", sans-serif; font-weight: 700; font-size: clamp(14px, 2.3vh, 21px);
  letter-spacing: 3px; text-transform: uppercase; color: #ffbfae; text-shadow: 0 0 6px rgba(255, 40, 10, 0.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dash-item.sel .bar {
  background: linear-gradient(90deg, #ffb070, #ff4a1c 45%, #c01205);
  box-shadow: 0 0 22px rgba(255, 60, 20, 0.8);
}
.dash-item.sel .bar::after { /* sweeping highlight on the selected bar */
  content: ""; position: absolute; top: 0; bottom: 0; width: 30%; left: -30%;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 220, 0.6), transparent);
  animation: barSweep 2.4s ease-in-out infinite;
}
@keyframes barSweep { 0% { left: -30%; } 55%, 100% { left: 110%; } }
.dash-item.sel .label { color: #3a0000; text-shadow: 0 1px 0 rgba(255, 220, 200, 0.5); }
.dash-item.sel .node-core { transform: scale(1.25); filter: brightness(1.5); box-shadow: 0 0 18px 4px rgba(255, 90, 30, 0.9); animation: nodePulse 1.2s ease-in-out infinite; }
.dash-item.sel .node { box-shadow: 0 0 26px rgba(255, 60, 20, 0.7); }
@keyframes nodePulse { 50% { filter: brightness(2); } }

#dashStatus {
  position: absolute; left: 70px; right: 0; top: calc(100% + 22px); min-height: 1em;
  font-family: "Bahnschrift", "Segoe UI", sans-serif; font-size: 14px; letter-spacing: 2px; color: #ffb09a;
  white-space: pre-line; user-select: text;
}
#dashStatus.working { text-transform: uppercase; animation: statusPulse 1s ease-in-out infinite; }
#dashStatus.error { color: #ff8070; letter-spacing: 0.5px; max-height: 30vh; overflow: auto; }
@keyframes statusPulse { 50% { opacity: 0.4; } }

/* status note on the right of a menu bar (e.g. a friend's "Playing Stay Quiet") */
.note {
  margin-left: auto; padding-left: 14px; font-family: "Bahnschrift", "Segoe UI", sans-serif; font-size: clamp(11px, 1.6vh, 14px);
  letter-spacing: 1px; color: #ff9a80; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%;
}
.note:empty { display: none; }
.dash-item.sel .note { color: #5a0800; }
#dashMenu.still .dash-item { animation: none; opacity: 1; transform: translateX(var(--shift)); }

/* gamer card: who is signed in, top-left of the dashboard */
#gamerCard {
  position: absolute; left: 28px; top: 22px; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px;
  border-radius: 34px 10px 10px 34px; border: 1px solid rgba(255, 90, 50, 0.45);
  background: linear-gradient(90deg, rgba(150, 10, 0, 0.55), rgba(40, 0, 0, 0.35)); box-shadow: 0 0 22px rgba(255, 40, 10, 0.25);
  font-family: "Bahnschrift", "Segoe UI", sans-serif; color: #ffd9d0;
}
#gamerCard[hidden] { display: none; }
#gamerCard .gc-orb { width: 46px; height: 46px; flex-shrink: 0; }
#gamerCard .gc-tag { font-weight: 700; font-size: 18px; letter-spacing: 2px; }
#gamerCard .gc-sub { font-size: 12px; letter-spacing: 1.5px; color: #ff9a80; text-transform: uppercase; }
#gamerCard .gc-badge { margin-left: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: #e0200a; box-shadow: 0 0 10px rgba(255, 40, 10, .8); }
#gamerCard .gc-badge:empty { display: none; }

/* readable by search engines and screen readers, not drawn on screen */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* text entry in dashboard style */
#dashPrompt {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(90, 0, 0, 0.7), rgba(10, 0, 0, 0.88)); backdrop-filter: blur(3px);
}
.dp-panel {
  width: min(440px, 90vw); display: flex; flex-direction: column; gap: 14px; padding: 26px 28px;
  border: 2px solid rgba(255, 90, 50, 0.7); border-radius: 14px; background: linear-gradient(160deg, rgba(110, 8, 0, 0.92), rgba(30, 0, 0, 0.95));
  box-shadow: 0 0 40px rgba(255, 40, 10, 0.45); font-family: "Bahnschrift", "Segoe UI", sans-serif;
}
.dp-title { font-weight: 700; font-size: 20px; letter-spacing: 5px; text-transform: uppercase; color: #ff8a62; text-shadow: 0 0 10px rgba(255, 40, 10, .8); }
.dp-fields { display: flex; flex-direction: column; gap: 12px; }
.dp-fields label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #ffb09a; }
.dp-fields input {
  height: 42px; padding: 0 14px; border-radius: 8px; border: 1px solid rgba(255, 90, 50, 0.6); outline: none; user-select: text;
  background: rgba(10, 0, 0, 0.8); color: #fff; font: 600 17px "Bahnschrift", "Segoe UI", sans-serif; letter-spacing: 1px;
}
.dp-fields input:focus { border-color: #ff5a3c; box-shadow: 0 0 14px rgba(255, 40, 10, 0.5); }
.dp-error { color: #ff8070; font-size: 14px; }
.dp-error:empty { display: none; }
.dp-row { display: flex; gap: 10px; justify-content: flex-end; }
.dp-row button {
  height: 40px; padding: 0 22px; border-radius: 20px; cursor: pointer; border: 1px solid rgba(255, 120, 80, 0.7);
  font: 700 14px "Bahnschrift", "Segoe UI", sans-serif; letter-spacing: 2px; text-transform: uppercase; color: #fff;
  background: linear-gradient(#e0300f, #8a0a00);
}
.dp-row .dp-cancel { background: rgba(60, 0, 0, 0.8); color: #ffbfae; }
.dp-row button:hover { filter: brightness(1.2); }
/* the highlighted box or button when moving with the controller or keyboard */
.dp-row button:focus { outline: none; border-color: #ffd0b0; box-shadow: 0 0 0 2px #ff5a3c, 0 0 18px rgba(255, 60, 20, 0.9); filter: brightness(1.15); }
/* How to Use and other step lists */
.dp-panel:has(.dp-steps) { width: min(620px, 92vw); }
.dp-steps {
  margin: 0; padding: 4px 6px 4px 30px; max-height: min(56vh, 460px); overflow-y: auto; scrollbar-color: #a8250c transparent;
  display: flex; flex-direction: column; gap: 10px; color: #ffe2dc; font-size: 17px; line-height: 1.4; letter-spacing: .3px;
}
.dp-steps li::marker { color: #ff7a52; font-weight: 700; }

@media (max-width: 860px) {
  #dash { flex-direction: column; gap: 10px; padding-top: 20px; }
  #dashOrb { width: 34vh; height: 34vh; }
  #dashMenuWrap { width: min(470px, 90vw); }
  #dashTitle { top: -40px; }
  /* the menu sits under the orb here, so long menus (signed in: 8 items) get tighter */
  #dashMenu { gap: clamp(6px, min(2.6vh, calc(14vh / var(--n, 6))), 26px); }
  .dash-item { height: clamp(32px, min(6.4vh, calc(38vh / var(--n, 6))), 56px); }
}
@media (max-width: 520px) {
  /* phones: no outward curve, smaller text, so long names fit */
  .dash-item { --shift: 0px !important; }
  .bar { padding: 0 18px 0 12px; min-width: 0; }
  .label { font-size: 13px; letter-spacing: 1.5px; }
  .note { max-width: 40%; }
  #dashTitle { left: 50px; font-size: 15px; letter-spacing: 4px; }
}
