/* v1olet CTF — v3 */

:root {
  --void: #0a0714;
  --void-2: #110c20;
  --void-3: #19132f;
  --ink: #f3efff;
  --muted: #a79fc9;
  --faint: #6e6690;
  --violet: #6840f4;
  --violet-hi: #8a66ff;
  --lilac: #c2b1ff;
  --gold: #f5cf7a;
  --silver: #dcd8f0;
  --bronze: #e8a06c;
  --line: rgba(194, 177, 255, 0.12);
  --line-strong: rgba(194, 177, 255, 0.26);

  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --wrap: 80rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: calc(5.5rem + env(safe-area-inset-top, 0px));
  -webkit-text-size-adjust: 100%;
  background: var(--void);
}

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
ul, ol, dl, dd { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, figure, blockquote, pre { margin: 0; }
button { font: inherit; }

:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--violet); color: #fff; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

/* film grain over everything */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* ==================================================================== intro */

.intro { display: none; }
.intro-on body { overflow: hidden; }
.intro-on .intro, .intro.is-lift {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: block;
  cursor: pointer;
}
/* violet layer that trails behind the panel when it lifts */
.intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--violet);
  transition: transform 0.95s cubic-bezier(0.76, 0, 0.24, 1) 0.12s;
}
.intro-panel {
  position: absolute;
  inset: 0;
  background: var(--void);
  display: grid;
  place-items: center;
  transition: transform 0.95s cubic-bezier(0.76, 0, 0.24, 1);
}
.intro.is-lift { pointer-events: none; }
.intro.is-lift .intro-panel { transform: translateY(-100%); }
.intro.is-lift::before { transform: translateY(-100%); }

.intro-mark {
  width: clamp(14rem, 42vw, 30rem);
  overflow: hidden;
  padding-block: 0.4rem;
}
.intro-mark img {
  width: 100%;
  height: auto;
  transform: translateY(110%) skewY(6deg);
  transition: transform 1.1s var(--ease);
}
.intro.is-in .intro-mark img { transform: none; }
.intro.is-out .intro-mark img { transform: translateY(-110%) skewY(-4deg); transition: transform 0.6s cubic-bezier(0.7, 0, 0.84, 0); }

.intro-bar {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + 2.2rem + env(safe-area-inset-bottom, 0px));
  height: 1px;
  background: var(--line);
  overflow: hidden;
}
.intro-bar span {
  display: block;
  height: 100%;
  background: var(--lilac);
  transform: scaleX(0);
  transform-origin: left;
}

.intro-tag, .intro-count, .intro-skip {
  position: absolute;
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  transition: opacity 0.35s, transform 0.5s var(--ease);
}
.intro-tag { left: var(--gutter); }
.intro-tag i {
  display: inline-block;
  width: 0.3rem;
  height: 0.3rem;
  margin: 0 0.7rem 0.15rem;
  border-radius: 50%;
  background: var(--violet-hi);
  vertical-align: middle;
}
.intro-count {
  left: 50%;
  translate: -50% 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.intro-skip {
  right: var(--gutter);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.intro-skip:hover { color: var(--ink); }
.intro.is-out .intro-tag, .intro.is-out .intro-count, .intro.is-out .intro-skip, .intro.is-out .intro-bar { opacity: 0; transform: translateY(-8px); transition: opacity 0.3s, transform 0.3s; }
@media (max-width: 560px) { .intro-tag i, .intro-tag { display: none; } }

/* ====================================================================== nav */

.nav {
  position: fixed;
  z-index: 60;
  top: calc(0.9rem + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 2 * var(--gutter)), 64rem);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.55rem 0.55rem 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  overflow: hidden;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), opacity 0.8s var(--ease), translate 0.8s var(--ease);
}
.intro-on .nav { opacity: 0; translate: 0 -1rem; }
.nav.is-scrolled {
  background: rgba(17, 12, 32, 0.66);
  border-color: var(--line);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 20px 50px -25px rgba(0, 0, 0, 0.9);
}
.nav-progress {
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--violet-hi), var(--lilac));
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
  transition: opacity 0.4s;
}
.nav.is-scrolled .nav-progress { opacity: 1; }

.nav-logo img { height: 1.45rem; width: auto; }

.nav-links { display: flex; gap: 0.25rem; margin-left: auto; }
.nav-links a {
  position: relative;
  text-decoration: none;
  font-size: 0.93rem;
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--ink); background: rgba(194, 177, 255, 0.08); }
.nav-links a.is-current { color: var(--ink); background: rgba(104, 64, 244, 0.22); }

.nav-cta {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--void);
  transition: background 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.nav-cta:hover { background: var(--violet); color: #fff; transform: scale(1.04); }

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}

/* ===================================================================== hero */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 7rem var(--gutter) 7.5rem;
  isolation: isolate;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(50% 45% at 50% 46%, rgba(104, 64, 244, 0.26), transparent 70%),
    radial-gradient(40% 30% at 50% 100%, rgba(104, 64, 244, 0.14), transparent 70%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(transparent 70%, var(--void)),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(10, 7, 20, 0.85));
}

.hero-bloom { position: absolute; inset: 0; z-index: -1; }
.hero-bloom canvas { display: block; }

.hero-copy { text-align: center; display: grid; justify-items: center; }

.hero-mark {
  position: relative;
  width: clamp(17rem, 58vw, 46rem);
  line-height: 0;
}
.hero-mark img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 60px rgba(104, 64, 244, 0.55));
}
/* the live flower sits exactly in the "o" of the wordmark */
.mark-o {
  position: absolute;
  left: 32.909%;
  top: 29.254%;
  width: 20.364%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.mark-o svg {
  width: 76.8%;
  height: 76.8%;
  fill: var(--violet);
  transition: transform 1.2s var(--spring);
  animation: spin 48s linear infinite;
}
.hero-mark:hover .mark-o svg { transform: rotate(120deg) scale(1.06); }
@keyframes spin { to { rotate: 360deg; } }

.hero-sub {
  margin-top: 1.8rem;
  font-family: var(--mono);
  font-size: clamp(0.9rem, 1.3vw, 1.1rem);
  color: var(--lilac);
  min-height: 1.6em;
}
.hero-sub .prompt { color: var(--violet-hi); }
.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--lilac);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2rem; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.35s var(--spring), background 0.2s, border-color 0.2s, box-shadow 0.3s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 12px 40px -10px rgba(104, 64, 244, 0.9);
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:hover { background: var(--violet-hi); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset, 0 16px 50px -10px rgba(138, 102, 255, 1); }
.btn-ghost {
  border: 1px solid var(--line-strong);
  background: rgba(10, 7, 20, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: var(--lilac); }

/* hud along the bottom of the hero */
.hero-hud {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(1.25rem, 4vh, 2.25rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  pointer-events: none;
}
.hero-hud i {
  display: inline-block;
  width: 0.3rem;
  height: 0.3rem;
  margin: 0 0.7rem 0.15rem;
  border-radius: 50%;
  background: var(--violet-hi);
  vertical-align: middle;
}
.hud-l, .hud-r { flex: 1; }
.hud-r { text-align: right; }
.hud-scroll { display: grid; justify-items: center; gap: 0.6rem; }
.hud-scroll b {
  display: block;
  width: 1px;
  height: 2.6rem;
  background: linear-gradient(var(--lilac), transparent);
  transform-origin: top;
  animation: drip 2.2s var(--ease) infinite;
}
@keyframes drip {
  0% { transform: scaleY(0); opacity: 1; }
  60% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}
@media (max-width: 640px) {
  .hero-hud { font-size: 0.62rem; }
  .hud-l .hud-x { display: none; }
  .hud-l i, .hud-r i { margin-inline: 0.4rem; }
  .hud-scroll { display: none; }
}

.hero-hint {
  position: absolute;
  top: 50%;
  right: var(--gutter);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  writing-mode: vertical-rl;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 1s 2s;
}
.is-ready .hero-hint { opacity: 1; }
@media (hover: none), (max-width: 760px) { .hero-hint { display: none; } }

/* load sequence: the wordmark blooms out of its "o" */
.hero-mark img {
  clip-path: inset(-30% -10% 100% -10%);
  transform: translateY(35%);
  transition: clip-path 1.2s var(--ease) 0.05s, transform 1.2s var(--ease) 0.05s;
}
.is-ready .hero-mark img { clip-path: inset(-30% -10% -30% -10%); transform: none; }
.mark-o {
  transform: translateY(35%) scale(0.4) rotate(-90deg);
  opacity: 0;
  transition: transform 1.3s var(--ease) 0.15s, opacity 0.6s 0.25s;
}
.is-ready .mark-o { transform: none; opacity: 1; }
.hero-sub, .hero-actions, .hero-hud {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.is-ready .hero-sub, .is-ready .hero-actions, .is-ready .hero-hud { opacity: 1; transform: none; }
.is-ready .hero-sub { transition-delay: 0.7s; }
.is-ready .hero-actions { transition-delay: 0.85s; }
.is-ready .hero-hud { transition-delay: 1.1s; }

/* ==================================================================== strip */

.strip {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding-block: 1.1rem;
  background: var(--void-2);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.strip-track { display: flex; width: max-content; animation: strip 50s linear infinite; }
.strip:hover .strip-track { animation-play-state: paused; }
.strip-track > div { display: flex; align-items: center; flex: none; }
.strip span {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3.6vw, 2.8rem);
  letter-spacing: -0.03em;
  color: transparent;
  -webkit-text-stroke: 1.2px rgba(194, 177, 255, 0.45);
  padding-inline: 1.6rem;
  line-height: 1;
  transition: color 0.3s;
}
.strip span:hover { color: var(--lilac); }
.strip i { display: grid; width: 1.6rem; color: var(--violet); --flower-core: var(--void-2); }
.strip i svg { width: 100%; height: auto; }
@keyframes strip { to { transform: translateX(-50%); } }

/* ================================================================== sections */

section.wrap { padding-block: clamp(4.5rem, 9vw, 7.5rem); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.1rem;
}
.eyebrow span { color: var(--violet-hi); }
.eyebrow::after { content: ""; width: 3rem; height: 1px; background: var(--line-strong); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.section-head h2, .about h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 7.5vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}
/* split-letter heading reveal (see main.js) */
.split .w {
  display: inline-block;
  white-space: nowrap;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  /* only the bottom edge masks: letters rise up from behind it */
  clip-path: inset(-0.6em -0.3em 0 -0.3em);
}
.split .c {
  display: inline-block;
  transform: translateY(115%) rotate(7deg);
  transform-origin: 0 100%;
  color: var(--violet-hi);
  transition:
    transform 0.95s var(--ease) calc(var(--ci) * 32ms),
    color 0.9s ease calc(var(--ci) * 32ms + 350ms);
}
.split.is-in .c { transform: none; color: inherit; }
.split .w:last-child .c:last-child { padding-right: 0.02em; }

.eyebrow::after { transform: scaleX(0); transform-origin: left; transition: transform 1s var(--ease) 0.2s; }
.eyebrow.is-in::after, .no-split .eyebrow::after { transform: none; }
.count {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0;
  color: var(--faint);
  vertical-align: top;
  margin-left: 0.3rem;
}

.text-link {
  color: var(--lilac);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(194, 177, 255, 0.35);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}
.text-link:hover { color: var(--ink); border-color: var(--ink); }

/* ==================================================================== about */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}
.about-lead {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.2vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  max-width: 24em;
}
.about-body { margin-top: 1.4rem; color: var(--muted); max-width: 36rem; line-height: 1.7; }

.term {
  border-radius: 1rem;
  background: linear-gradient(180deg, #151028, #0d0a19);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 80px -40px rgba(104, 64, 244, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transform: perspective(1200px) rotateY(-6deg) rotateX(3deg);
  transition: transform 0.8s var(--ease);
}
.term:hover { transform: perspective(1200px) rotateY(0) rotateX(0); }
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(194, 177, 255, 0.03);
}
.term-bar i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: rgba(194, 177, 255, 0.16); }
.term-bar i:first-child { background: var(--violet); }
.term-bar span { margin-left: 0.6rem; }
.term-body {
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
  line-height: 1.85;
  padding: 1.25rem 1.4rem 1.6rem;
  min-height: 25em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.t-p { color: var(--violet-hi); }
.t-c { color: var(--ink); }
.t-o { color: var(--muted); }
.t-cur {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  vertical-align: -0.2em;
  background: var(--lilac);
  animation: blink 1s steps(1) infinite;
}

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
  .term { transform: none; }
  .term-body { min-height: 0; }
}

/* =============================================================== placements */

/* stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line-strong);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 1.4rem clamp(0.75rem, 2vw, 1.5rem);
  border-left: 1px solid var(--line);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.stat:first-child { border-left: 0; padding-left: 0; }
.stats.is-in .stat { opacity: 1; transform: none; }
.stats.is-in .stat:nth-child(2) { transition-delay: 0.08s; }
.stats.is-in .stat:nth-child(3) { transition-delay: 0.16s; }
.stats.is-in .stat:nth-child(4) { transition-delay: 0.24s; }
.stat dd {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, var(--lilac));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat dd small { font-size: 0.42em; letter-spacing: -0.02em; color: var(--lilac); -webkit-text-fill-color: var(--lilac); }
.stat dt { font-size: 0.86rem; color: var(--muted); }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* medal cards */
.medals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr));
  gap: clamp(0.8rem, 1.6vw, 1.25rem);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.medal {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg; --hyp: 0;
  --tier: var(--lilac);
  --tier-dk: #6e62a8;
  display: block;
  perspective: 900px;
  text-decoration: none;
  color: inherit;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i) * 90ms);
}
.medals.is-in .medal { opacity: 1; transform: none; }
.medal.t-gold { --tier: var(--gold); --tier-dk: #a87a22; }
.medal.t-silver { --tier: var(--silver); --tier-dk: #7d7896; }
.medal.t-bronze { --tier: var(--bronze); --tier-dk: #8d4a20; }

.medal-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.1rem 1.1rem 1.4rem;
  border-radius: 1.1rem;
  border: 1px solid color-mix(in srgb, var(--tier) 35%, transparent);
  background:
    radial-gradient(90% 55% at 50% 0%, color-mix(in srgb, var(--tier) 22%, transparent), transparent 70%),
    linear-gradient(180deg, #1a1433, var(--void-2) 70%);
  overflow: hidden;
  isolation: isolate;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.7s var(--spring), box-shadow 0.4s, border-color 0.3s;
}
.medal.is-active .medal-inner {
  transition: transform 0.08s linear, box-shadow 0.4s, border-color 0.3s;
  border-color: color-mix(in srgb, var(--tier) 70%, transparent);
  box-shadow: 0 30px 60px -28px color-mix(in srgb, var(--tier) 70%, transparent);
}
.medal.is-active .pc-holo { opacity: calc(0.25 + var(--hyp) * 0.4); }
.medal.is-active .pc-glare { opacity: 0.8; }
.t-gold .pc-holo { opacity: 0.12; }

.medal-top {
  align-self: stretch;
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tier);
}
.medal-go svg { width: 1rem; height: 1rem; color: var(--faint); transition: transform 0.3s var(--ease), color 0.2s; }
a.medal:hover .medal-go svg { color: var(--tier); transform: translate(3px, -3px); }

.medal-disc {
  position: relative;
  width: clamp(6rem, 9vw, 7.5rem);
  aspect-ratio: 1;
  margin: 1.2rem 0 1rem;
}
.medal-ribbon {
  position: absolute;
  left: 50%;
  bottom: 62%;
  width: 46%;
  height: 70%;
  translate: -50% 0;
  z-index: -1;
  background:
    linear-gradient(90deg, var(--violet) 0 50%, var(--violet-hi) 50% 100%);
  clip-path: polygon(0 0, 38% 0, 50% 100%, 62% 0, 100% 0, 72% 100%, 28% 100%);
  opacity: 0.85;
}
.medal-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(70% 70% at 32% 28%, rgba(255, 255, 255, 0.85), transparent 45%),
    conic-gradient(from 210deg, var(--tier), var(--tier-dk), var(--tier), var(--tier-dk), var(--tier));
  box-shadow:
    inset 0 0 0 0.35rem color-mix(in srgb, var(--tier-dk) 70%, transparent),
    inset 0 0 0 0.45rem rgba(255, 255, 255, 0.35),
    0 14px 40px -10px color-mix(in srgb, var(--tier) 60%, transparent);
  color: color-mix(in srgb, var(--tier-dk) 85%, #000);
  --flower-core: color-mix(in srgb, var(--tier) 80%, #fff);
  transition: transform 1.2s var(--spring);
}
.medal-face svg { width: 62%; height: auto; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5)); }
.medal:hover .medal-face { transform: rotate(60deg); }

.medal-rank {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 5.5vw, 4.4rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: var(--tier);
  text-shadow: 0 10px 40px color-mix(in srgb, var(--tier) 35%, transparent);
}
.medal-rank sup { font-size: 0.32em; letter-spacing: 0; vertical-align: 1.9em; margin-left: 0.08em; }
.medal-event {
  margin-top: 0.8rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.medal-meta { margin-top: 0.3rem; font-size: 0.84rem; color: var(--muted); }
.medal-pct {
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--tier);
  border: 1px solid color-mix(in srgb, var(--tier) 40%, transparent);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.t-gold .medal-inner::after {
  /* slow shine across the winner */
  content: "";
  position: absolute;
  inset: -50%;
  z-index: -1;
  background: linear-gradient(115deg, transparent 45%, rgba(245, 207, 122, 0.12) 50%, transparent 55%);
  animation: shine 5s var(--ease) infinite;
}
@keyframes shine { 0% { transform: translateX(-40%); } 60%, 100% { transform: translateX(40%); } }

@media (max-width: 640px) {
  .medals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .medal-inner { padding: 0.8rem 0.6rem 1rem; }
  .medal-top { font-size: 0.58rem; letter-spacing: 0.1em; }
  .medal-disc { width: 4.6rem; margin: 0.8rem 0 0.7rem; }
  .medal-rank { font-size: 2.5rem; }
  .medal-event { font-size: 0.88rem; margin-top: 0.6rem; }
  .medal-meta { font-size: 0.74rem; }
  .medal-pct { margin-top: 0.6rem; font-size: 0.62rem; }
}

/* ledger */
.ledger { border-top: 1px solid var(--line-strong); counter-reset: lg; }
.lg-row {
  position: relative;
  display: grid;
  grid-template-columns: clamp(4.5rem, 9vw, 7rem) minmax(0, 1fr) 8rem 6.5rem 1.6rem;
  gap: 1.25rem;
  align-items: center;
  padding: 1rem 1rem 1rem 0.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), background 0.3s;
  transition-delay: calc(var(--i) * 60ms), calc(var(--i) * 60ms), 0s;
}
.ledger.is-in .lg-row { opacity: 1; transform: none; }
.lg-row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(104, 64, 244, 0.22), transparent 75%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
a.lg-row:hover::before { transform: scaleX(1); }

.lg-rank {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1.2px rgba(194, 177, 255, 0.5);
  transition: color 0.35s, -webkit-text-stroke-color 0.35s;
}
.lg-rank::before { content: "#"; font-size: 0.45em; vertical-align: 0.9em; margin-right: 0.08em; -webkit-text-stroke: 0; color: var(--violet-hi); }
a.lg-row:hover .lg-rank { color: var(--lilac); -webkit-text-stroke-color: var(--lilac); }

.lg-main { display: grid; gap: 0.1rem; }
.lg-event { font-weight: 600; font-size: 1.08rem; line-height: 1.3; }
.lg-note { font-size: 0.86rem; color: var(--faint); }
.lg-field { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
.lg-pct { justify-self: start; }
.lg-pct:not(:empty) {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--lilac);
  background: rgba(104, 64, 244, 0.16);
  border: 1px solid rgba(138, 102, 255, 0.35);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.lg-go svg { width: 1.1rem; height: 1.1rem; color: var(--faint); transition: transform 0.3s var(--ease), color 0.2s; }
a.lg-row:hover .lg-go svg { color: var(--lilac); transform: translate(3px, -3px); }

@media (max-width: 720px) {
  .lg-row {
    grid-template-columns: 3.6rem minmax(0, 1fr) 1.2rem;
    grid-template-areas: "rank main go" "rank meta go";
    gap: 0.15rem 0.9rem;
    padding-right: 0.25rem;
  }
  .lg-rank { grid-area: rank; font-size: 2rem; }
  .lg-main { grid-area: main; }
  .lg-go { grid-area: go; }
  .lg-field, .lg-pct { grid-area: meta; }
  .lg-field { font-size: 0.74rem; }
  .lg-pct { justify-self: end; }
  .lg-event { font-size: 0.98rem; }
}

/* ================================================================== players */

.filters { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: -1.5rem 0 2.5rem; }
.chip {
  appearance: none;
  font-size: 0.88rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.3s var(--spring);
}
.chip span { font-family: var(--mono); font-size: 0.75em; color: var(--faint); margin-left: 0.4rem; }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip:active { transform: scale(0.94); }
.chip[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); color: #fff; }
.chip[aria-pressed="true"] span { color: rgba(255, 255, 255, 0.7); }

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
  gap: clamp(1rem, 1.6vw, 1.5rem);
}

/* --- the card ------------------------------------------------------------ */
.pc {
  --mx: 50%;
  --my: 50%;
  --rx: 0deg;
  --ry: 0deg;
  --hyp: 0;
  --d: 0ms;
  perspective: 900px;
  min-height: 25rem;
}
.pc[hidden] { display: none; }

.pc-inner {
  position: relative;
  height: 100%;
  border-radius: 1.1rem;
  overflow: hidden;
  background: var(--void-2);
  border: 1px solid var(--line-strong);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.7s var(--spring), box-shadow 0.4s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}
.pc.is-active .pc-inner {
  transition: transform 0.08s linear, box-shadow 0.4s, border-color 0.3s;
  box-shadow: 0 30px 60px -25px rgba(104, 64, 244, 0.75);
  border-color: rgba(194, 177, 255, 0.5);
}

.pc.is-captain .pc-inner {
  border-color: rgba(245, 207, 122, 0.45);
  background: linear-gradient(180deg, #1f1840, var(--void-2) 60%);
}

/* art window */
.pc-art {
  position: relative;
  flex: none;
  height: 10.5rem;
  margin: 0.55rem 0.55rem 0;
  border-radius: 0.7rem;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(90% 90% at 50% 20%, hsl(var(--h) 85% 62% / 0.55), transparent 70%),
    linear-gradient(160deg, hsl(var(--h) 60% 30%), hsl(calc(var(--h) + 20) 55% 12%));
}
.pc-pattern {
  position: absolute;
  inset: -15%;
  color: rgba(255, 255, 255, 0.07);
  --flower-core: transparent;
  display: grid;
  place-items: center;
}
.pc-pattern svg { width: 120%; height: auto; transform: rotate(calc(var(--h) * 1deg)); }

.pc-avatar {
  position: relative;
  width: 6.6rem;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  background: rgba(10, 7, 20, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 0 7px rgba(255, 255, 255, 0.12), 0 18px 40px -10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  transform: translateZ(40px);
}
.pc-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pc-type, .pc-role {
  position: absolute;
  top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
}
.pc-type { left: 0.55rem; background: rgba(10, 7, 20, 0.55); color: var(--lilac); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pc-role { right: 0.55rem; background: var(--gold); color: #2a1d05; font-weight: 500; }

/* body */
.pc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.95rem 1rem 1rem;
  min-height: 0;
}
.pc-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.pc-focus { font-size: 0.86rem; color: var(--muted); margin-top: 0.15rem; }

.pc-skills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.75rem; }
.pc-skills li {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--lilac);
  border: 1px solid rgba(138, 102, 255, 0.3);
  background: rgba(104, 64, 244, 0.12);
  padding: 0.18rem 0.45rem;
  border-radius: 0.35rem;
}

.pc-quote {
  margin-top: auto;
  padding-top: 0.8rem;
  font-style: italic;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink);
  opacity: 0.85;
}
.pc-quote::before { content: "“"; color: var(--violet-hi); font-style: normal; margin-right: 0.1em; }
.pc-quote::after { content: "”"; color: var(--violet-hi); font-style: normal; margin-left: 0.05em; }

.pc-links { display: flex; gap: 0.25rem; margin-top: 0.7rem; }
.pc-quote + .pc-links { margin-top: 0.6rem; }
.pc-skills + .pc-links { margin-top: auto; padding-top: 0.7rem; }
.pc-links a {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.55rem;
  color: var(--muted);
  background: rgba(194, 177, 255, 0.06);
  transition: color 0.2s, background 0.2s;
  position: relative;
  z-index: 3;
}
.pc-links a:hover { color: #fff; background: var(--violet); }
.pc-links svg { width: 1rem; height: 1rem; }

/* card back (players without a profile yet) */
.pc-back {
  position: relative;
  flex: 1;
  margin: 0.55rem;
  border-radius: 0.7rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem;
  background:
    repeating-linear-gradient(45deg, rgba(194, 177, 255, 0.05) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(-45deg, rgba(194, 177, 255, 0.05) 0 1px, transparent 1px 12px),
    radial-gradient(80% 60% at 50% 40%, hsl(var(--h) 80% 45% / 0.45), transparent 70%),
    linear-gradient(180deg, #1a1236, #0d0a19);
  border: 1px solid rgba(194, 177, 255, 0.14);
  text-align: center;
}
.pc-back-flower {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 62%;
  transform: translate(-50%, -50%);
  color: rgba(138, 102, 255, 0.55);
  --flower-core: rgba(255, 255, 255, 0.85);
  filter: drop-shadow(0 0 30px rgba(104, 64, 244, 0.6));
  transition: transform 1s var(--ease);
}
.pc-back-flower svg { width: 100%; height: auto; }
.pc.is-active .pc-back-flower { transform: translate(-50%, -50%) rotate(30deg) scale(1.05); }

/* if an avatar gets uploaded for a back-card player, it sits in the flower */
.pc-back-avatar {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
  display: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85);
}
.pc-back-avatar.has-img { display: block; }
.pc-back-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pc-back .pc-name { position: relative; font-size: 1.05rem; }
.pc-back-mark { position: relative; font-family: var(--mono); font-size: 0.7rem; color: var(--faint); margin-top: 0.2rem; }

/* holo foil + glare */
.pc-holo, .pc-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 2;
}
.pc-holo {
  opacity: 0;
  mix-blend-mode: color-dodge;
  background:
    repeating-linear-gradient(
      110deg,
      hsl(330 90% 70%) 0%,
      hsl(190 90% 65%) 7%,
      hsl(60 95% 70%) 14%,
      hsl(265 90% 72%) 21%,
      hsl(330 90% 70%) 28%
    );
  background-size: 400% 400%;
  background-position: var(--mx) var(--my);
  filter: brightness(0.55) contrast(1.6) saturate(1.2);
  transition: opacity 0.4s;
}
.pc-glare {
  opacity: 0;
  mix-blend-mode: overlay;
  background: radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.15) 30%, transparent 65%);
  transition: opacity 0.4s;
}
.pc.is-active .pc-holo { opacity: calc(0.35 + var(--hyp) * 0.45); }
.pc.is-active .pc-glare { opacity: 0.9; }
.pc.is-captain .pc-holo { opacity: 0.22; }
.pc.is-captain.is-active .pc-holo { opacity: calc(0.5 + var(--hyp) * 0.4); }

/* deal-in */
.deck.is-waiting .pc { opacity: 0; transform: translateY(40px) rotate(-3deg) scale(0.96); }
.deck.is-in .pc, .pc.is-dealt {
  animation: deal 0.8s var(--ease) both;
  animation-delay: var(--d);
}
@keyframes deal {
  from { opacity: 0; transform: translateY(40px) rotate(-3deg) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* card footer strip */
.pc-foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed rgba(194, 177, 255, 0.14);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.pc-skills + .pc-foot, .pc-focus + .pc-foot, .pc-name + .pc-foot { margin-top: auto; }
.pc-foot i { margin-left: auto; width: 0.9rem; color: hsl(var(--h) 80% 70% / 0.7); --flower-core: var(--void-2); transition: transform 0.8s var(--ease); }
.pc-foot svg { width: 100%; height: auto; display: block; }
.pc.is-active .pc-foot i { transform: rotate(120deg); }

@media (max-width: 560px) {
  .pc { min-height: 0; }
  .pc-foot { margin-top: 1rem !important; }
}

/* card number, bottom-left of the art window */
.pc-no {
  position: absolute;
  left: 0.6rem;
  bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

/* ===================================================================== outro */

.outro {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-top: 1px solid var(--line);
  padding-block: clamp(5rem, 12vw, 9rem);
  background: radial-gradient(60% 80% at 85% 50%, rgba(104, 64, 244, 0.18), transparent 70%);
}
.outro-flower {
  --spin: 0deg;
  position: absolute;
  z-index: -1;
  right: -12vw;
  top: 50%;
  width: clamp(22rem, 52vw, 44rem);
  translate: 0 -50%;
  rotate: var(--spin);
  color: rgba(104, 64, 244, 0.16);
}
.outro-flower svg { width: 100%; height: auto; fill: currentColor; }
.outro-line {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}
.ol-accent { color: var(--violet-hi); }
.outro-actions { justify-content: flex-start; margin-top: 2.4rem; }

/* ==================================================================== footer */

.footer { border-top: 1px solid var(--line); padding: 1.6rem 0 calc(1.6rem + env(safe-area-inset-bottom, 0px)); }
.footer-inner { display: flex; align-items: center; gap: 1.25rem; }
.footer-logo { height: 1.1rem; width: auto; opacity: 0.8; }
.footer-copy { font-size: 0.85rem; color: var(--faint); }
.footer-social { display: flex; gap: 0.25rem; margin-left: auto; }
.footer-social a {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.footer-social a:hover { color: #fff; background: var(--violet); }
.footer-social svg { width: 1.05rem; height: 1.05rem; }

/* ============================================================ reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-mark img { clip-path: none; transform: none; }
  .mark-o { transform: none; opacity: 1; }
  .eyebrow::after { transform: none; }
  .hero-sub, .hero-actions, .hero-hud, .stat, .medal, .lg-row { opacity: 1; transform: none; }
  .pc-inner, .medal-inner, .term { transform: none !important; }
}
