/* Cru Jones is not shipped: only a demo copy was available and its web licence
   could not be verified. Put a web-licensed file at assets/fonts/cru-jones.ttf
   to enable it. Until then, and for glyphs it lacks, Pirata One is used. */
@font-face {
  font-family: "Cru Jones";
  src: url("assets/fonts/cru-jones.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

/* The other fonts are bundled locally (SIL Open Font License, see assets/fonts) */
@font-face {
  font-family: "Pirata One";
  src: url("assets/fonts/pirata-one-latin.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F;
}

@font-face {
  font-family: "Pirata One";
  src: url("assets/fonts/pirata-one-latin-ext.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0100-0130, U+0132-0151, U+0154-02AF, U+1E00-1EFF;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-0130, U+0132-0151, U+0154-02AF, U+1E00-1EFF;
}

:root {
  --white: #f1eeee;
  /* Opaque samples from the star, middle of the face and lower flame. */
  --burgundy: #49090a;
  --transition-tone: #391d29;
  --slate: #2a2f45;
  --brand-gradient: linear-gradient(to bottom right, var(--burgundy) 8%, var(--transition-tone) 50%, var(--slate) 92%);
  --steel: #a2b2ca;
  --pearl: #e2e6ed;
  --font: "Pirata One", "Old English Text MT", Georgia, serif;
  --brand: "Cru Jones", var(--font);
  --mono: "JetBrains Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { background: var(--brand-gradient) fixed; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  color: var(--white);
  font-family: var(--font);
  overflow-x: hidden;
}

/* ---------- Backdrop: heat glow, smoke, fire ---------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 8% 14%, rgba(101, 23, 22, .22), transparent 52%),
    radial-gradient(ellipse at 89% 82%, rgba(89, 103, 138, .23), transparent 58%);
  animation: pulse 5s ease-in-out infinite;
  pointer-events: none;
}

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.smoke {
  position: absolute;
  width: 90vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(108, 102, 120, .16), transparent);
}

.smoke-a { left: -35vmax; bottom: -20vmax; animation: drift 19s ease-in-out infinite alternate; }
.smoke-b { right: -40vmax; top: -25vmax; animation: drift 27s ease-in-out infinite alternate-reverse; }

/* Flame tongues along the bottom edge */
.fire {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -30px;
  height: 30vh;
  transform-origin: bottom;
  background:
    radial-gradient(ellipse 50% 100% at 50% 100%, rgba(123, 137, 164, .27), rgba(67, 77, 104, .18) 40%, transparent 70%) 0 100% / 170px 100% repeat-x;
  filter: blur(14px);
  animation: lick 1.9s ease-in-out infinite alternate;
}

.fire-back {
  height: 44vh;
  background:
    radial-gradient(ellipse 50% 100% at 50% 100%, rgba(97, 72, 82, .24), rgba(64, 43, 55, .2) 45%, transparent 70%) 60px 100% / 260px 100% repeat-x;
  animation: lick 3.1s ease-in-out infinite alternate-reverse;
}

.embers {
  position: fixed;
  inset: 0;
  z-index: 11;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Scrolling brand ribbons ---------- */

.ribbon {
  position: fixed;
  left: -5%;
  width: 110%;
  overflow: hidden;
  white-space: nowrap;
  padding: 5px 0;
  background: var(--brand-gradient);
  box-shadow: 0 0 24px rgba(127, 136, 154, .24);
  font: 700 12px/1.5 "Cru Jones", var(--mono);
  letter-spacing: .3em;
  color: var(--pearl);
  pointer-events: none;
}

.ribbon span { display: inline-block; animation: marquee 40s linear infinite; }
.ribbon-top { top: 10px; transform: rotate(-1.5deg); }
.ribbon-bottom { bottom: 10px; transform: rotate(1.5deg); }
.ribbon-bottom span { animation-direction: reverse; }

/* ---------- Content ---------- */

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto 0;
  padding: 36px 18px 40px;
}

.ascii {
  width: min(76vw, 47dvh, 540px);
  aspect-ratio: .89;
  margin-bottom: 10px;
}

.content {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.stars {
  margin-bottom: -14px;
  color: var(--steel);
  font-size: 18px;
  letter-spacing: .5em;
  text-shadow: 0 0 12px var(--transition-tone);
}

.stars b { font-size: 34px; color: var(--pearl); }

.title {
  font-family: var(--brand);
  font-size: clamp(46px, min(16vw, 12dvh), 112px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: .02em;
  white-space: nowrap;
  filter: drop-shadow(0 3px 0 var(--burgundy)) drop-shadow(0 0 14px rgba(66, 28, 36, .75)) drop-shadow(0 0 34px rgba(57, 68, 93, .7));
}

#typed {
  background: linear-gradient(135deg, #c6a9a3, #e2d6d2 30%, var(--pearl) 55%, #bbc8d9 75%, var(--steel)) 0 0 / 100% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: burn 2.4s ease-in-out infinite alternate;
}
.cursor {
  display: inline-block;
  width: .08em;
  height: .8em;
  margin-left: .04em;
  vertical-align: baseline;
  background: var(--steel);
  animation: blink 1s steps(1) infinite;
}

.card {
  position: relative;
  isolation: isolate;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  border-radius: 18px;
  box-shadow: 0 0 22px rgba(74, 22, 27, .45), 0 18px 40px -8px rgba(43, 54, 81, .55);
  transition: transform .25s, box-shadow .25s;
  animation: smoulder 2.6s ease-in-out infinite alternate;
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px) scale(1.02);
  animation: none;
  box-shadow: 0 0 20px var(--steel), 0 0 48px var(--transition-tone), 0 0 90px rgba(67, 80, 107, .7);
}

/* Burning border: a spinning gradient clipped by the frame, covered by a dark inner panel */
.frame {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
}

.frame::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1000px;
  height: 1000px;
  margin: -500px 0 0 -500px;
  background: repeating-conic-gradient(var(--burgundy) 0deg, #8a5755 50deg, var(--transition-tone) 90deg, var(--steel) 135deg, var(--burgundy) 180deg);
  animation: spin 4s linear infinite;
}

.frame::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 15px;
  background:
    radial-gradient(ellipse at bottom right, rgba(109, 125, 155, .27), transparent 58%),
    var(--brand-gradient);
}

.card:hover .frame::before,
.card:focus-within .frame::before { animation-duration: 1.2s; }

.card-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.card-name {
  font: 700 18px/1.35 var(--mono);
}

.card-sub,
.user-custom,
.user-activity { font: 12px/1.5 var(--mono); }

.card-sub { color: #d3d2da; }

.user { flex-wrap: wrap; }

.avatar {
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--steel), 0 0 20px rgba(143, 161, 188, .55);
}

.avatar-fallback,
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--brand-gradient);
  color: var(--steel);
  font-size: 32px;
}

.dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  border: 3px solid #2a1113;
  border-radius: 50%;
  background: #747f8d;
}

.dot[data-status="online"] { background: #3ba55d; }
.dot[data-status="idle"] { background: #faa81a; }
.dot[data-status="dnd"] { background: #ed4245; }

#user-handle, #user-status { display: block; }

.badges {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.badges li {
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  max-width: 100%;
  padding: 3px 5px;
  background: rgba(16, 14, 23, .5);
  border-radius: 6px;
  overflow-wrap: anywhere;
  font: 12px/1.5 var(--mono);
}

.badges img { display: block; width: 24px; height: 24px; object-fit: contain; }

.user-activity {
  width: 100%;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(162, 178, 202, .35);
  overflow-wrap: anywhere;
}

/* Second line (game) right under the Spotify line: no extra divider. */
.user-activity:not([hidden]) + .user-activity { border-top: 0; padding-top: 4px; }

.mute:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  border: 0;
  background: var(--brand-gradient);
  color: var(--white);
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .6s, visibility .6s;
}

.overlay.is-hidden { opacity: 0; visibility: hidden; }

.overlay-star {
  width: 72px;
  height: 72px;
  fill: var(--steel);
  animation: pulse 3s ease-in-out infinite;
}

.overlay-brand { font-family: var(--brand); font-size: clamp(60px, 18vw, 112px); letter-spacing: .02em; }

.overlay-hint {
  font: 700 14px var(--mono);
  letter-spacing: .35em;
  text-transform: uppercase;
  animation: pulse 2s ease-in-out infinite;
}

.mute {
  position: fixed;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(48px + env(safe-area-inset-bottom));
  z-index: 5;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .7);
  border: 1px solid rgba(236, 232, 225, .35);
  border-radius: 50%;
  cursor: pointer;
}

.mute svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--white);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.mute .speaker { fill: var(--white); stroke: none; }
.mute .cross { display: none; }
.mute[aria-pressed="true"] .cross { display: inline; }
.mute[aria-pressed="true"] .waves { display: none; }

/* Film grain: inline SVG noise, so no extra image file is needed */
.grain {
  position: fixed;
  inset: -100px;
  z-index: 20;
  pointer-events: none;
  opacity: .075;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .8s steps(4) infinite;
}

@keyframes pulse {
  50% { opacity: .55; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes burn { to { background-position: 0 100%; } }
@keyframes smoulder { to { box-shadow: 0 0 34px rgba(103, 42, 43, .5), 0 22px 54px -6px rgba(81, 97, 130, .6); } }
@keyframes lick { to { transform: scaleY(1.25) translateX(34px) skewX(-4deg); opacity: .75; } }
@keyframes drift { to { transform: translate(14vmax, -10vmax) scale(1.2); } }

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes grain {
  25% { transform: translate(-40px, 25px); }
  50% { transform: translate(30px, -45px); }
  75% { transform: translate(-20px, -30px); }
}

@media (max-width: 600px) {
  .ascii { width: min(76vw, 40dvh); }

  .mute {
    top: calc(42px + env(safe-area-inset-top));
    bottom: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
