:root {
  --ink: #090a0a;
  --ink-raised: #111110;
  --paper: #ebe7dc;
  --muted: #8d8981;
  --faint: #4a4945;
  --line: rgba(235, 231, 220, 0.14);
  --red: #e13b33;
  --red-deep: #7c1f1c;
  --gold: #bea260;
  --green: #79bf8c;
  --mono: 'DM Mono', monospace;
  --serif: 'Libre Caslon Display', Georgia, serif;
  --header-height: 86px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  color-scheme: dark;
}

body {
  min-width: 320px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 48%, rgba(80, 29, 23, 0.2), transparent 30%),
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px), var(--ink);
  background-size:
    auto,
    54px 54px,
    54px 54px,
    auto;
  color: var(--paper);
  font-family: var(--mono);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('/assets/saint-relics.png?v=15');
  background-size: cover;
  background-position: center;
  opacity: 0.055;
  filter: grayscale(1) contrast(1.25);
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.032;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.012) 4px);
}

.topbar {
  height: var(--header-height);
  padding: 0 clamp(24px, 3vw, 58px);
  border-top: 1px solid rgba(190, 162, 96, 0.65);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
  background: rgba(9, 10, 10, 0.74);
  backdrop-filter: blur(12px);
}

main {
  width: 100%;
  height: calc(100dvh - var(--header-height));
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--paper);
  text-decoration: none;
  font: 400 22px var(--serif);
}

.brand em {
  color: var(--red);
}

.brand-mark {
  width: 31px;
  height: 39px;
  border: 1px solid var(--gold);
  border-radius: 16px 16px 3px 3px;
  position: relative;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark i,
.brand-mark b {
  content: '';
  position: absolute;
  background: var(--gold);
}

.brand-mark::before {
  width: 1px;
  height: 24px;
  left: 14px;
  top: 7px;
}

.brand-mark::after {
  width: 14px;
  height: 1px;
  left: 8px;
  top: 15px;
}

.brand-mark i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  left: 12px;
  top: -5px;
}

.brand-mark b {
  width: 8px;
  height: 1px;
  left: 12px;
  bottom: 7px;
  transform: rotate(45deg);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.8vw, 46px);
}

.topbar nav a,
.topbar nav button {
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--faint);
  background: none;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  transition: 180ms ease;
}

.topbar nav a:hover,
.topbar nav button:hover {
  border-color: var(--red);
  color: var(--paper);
}

.topbar nav span {
  color: var(--red);
}

.selector {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(320px, 34vw, 610px) minmax(0, 1fr);
  align-items: stretch;
}

.copy-panel {
  padding: clamp(70px, 9vh, 110px) clamp(28px, 3.5vw, 70px) 60px;
  position: relative;
  z-index: 6;
  background: linear-gradient(90deg, rgba(9, 10, 10, 0.96) 60%, rgba(9, 10, 10, 0));
}

.eyebrow,
.app-code,
.selection-readout > span,
.next-readout > span {
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.16em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.eyebrow span {
  width: 20px;
  height: 1px;
  background: var(--red);
}

.app-code {
  min-height: 13px;
  margin: 34px 0 0;
  color: var(--red);
  transition: 250ms ease;
}

h1 {
  margin: 20px 0 28px;
  font: 400 clamp(68px, 6.8vw, 126px) / 0.78 var(--serif);
  letter-spacing: -0.055em;
}

h1 i {
  color: var(--red);
  font-weight: 400;
}

.description {
  max-width: 470px;
  min-height: 76px;
  margin: 0;
  color: #aaa49a;
  font: 400 clamp(17px, 1.3vw, 24px) / 1.45 var(--serif);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.copy-panel.changing .description,
.copy-panel.changing .app-code {
  opacity: 0;
  transform: translateY(8px);
}

.actions {
  display: flex;
  gap: 14px;
  margin-top: 40px;
}

.primary-action,
.secondary-action {
  min-height: 58px;
  padding: 0 25px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  color: var(--paper);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.11em;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.primary-action {
  min-width: 228px;
  border-color: var(--red);
  background: linear-gradient(120deg, #c92d27, var(--red));
  box-shadow: 0 12px 38px rgba(225, 59, 51, 0.14);
}

.secondary-action {
  background: rgba(14, 14, 13, 0.75);
}

.primary-action:hover,
.secondary-action:hover {
  transform: translateY(-2px);
  border-color: var(--paper);
}

.next-readout {
  width: min(100%, 390px);
  margin-top: 40px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  background: rgba(12, 12, 11, 0.66);
}

.next-readout > span {
  color: var(--red);
}

.next-readout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.next-readout strong {
  color: var(--paper);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mini-orbit {
  grid-column: 1 / -1;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 19px;
  position: relative;
}

.mini-orbit::before {
  content: '';
  position: absolute;
  left: 30px;
  right: 0;
  top: 14px;
  height: 1px;
  background: linear-gradient(90deg, var(--red), var(--line));
}

.mini-orbit i {
  width: 32px;
  height: 32px;
  border: 4px solid var(--red);
  border-top-color: var(--line);
  border-radius: 50%;
}

.mini-orbit b {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
  position: relative;
}

.arena {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  perspective: 1500px;
  isolation: isolate;
}

.arena::before {
  content: '';
  position: absolute;
  inset: 4% 0 0;
  z-index: -3;
  background:
    radial-gradient(ellipse at 47% 55%, rgba(79, 44, 31, 0.42), transparent 35%),
    radial-gradient(ellipse at 52% 70%, rgba(225, 59, 51, 0.09), transparent 35%);
}

.arena::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 2%;
  bottom: 4%;
  height: 28%;
  z-index: -2;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.8) 72%);
  transform: rotateX(60deg);
}

.orbit {
  position: absolute;
  left: 4%;
  right: -8%;
  bottom: 5%;
  height: 45%;
  border: 1px solid rgba(225, 59, 51, 0.7);
  border-radius: 50%;
  transform: rotateX(65deg);
  box-shadow:
    0 0 14px rgba(225, 59, 51, 0.18),
    inset 0 0 18px rgba(225, 59, 51, 0.08);
  transition: transform 900ms cubic-bezier(0.2, 0.78, 0.18, 1);
}

.orbit-back {
  clip-path: inset(0 0 50% 0);
  opacity: 0.28;
}

.orbit-front {
  clip-path: inset(50% 0 0 0);
  z-index: 4;
}

.arena.rotating .orbit {
  transform: rotateX(65deg) rotateZ(180deg);
}

.orbit-arrow {
  position: absolute;
  bottom: 11%;
  z-index: 7;
  color: var(--red);
  font: 300 47px var(--serif);
  text-shadow: 0 0 14px var(--red);
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(225, 59, 51, 0.22);
  border-radius: 50%;
  background: rgba(9, 10, 10, 0.58);
  line-height: 40px;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.orbit-arrow:hover,
.orbit-arrow:focus-visible {
  border-color: var(--red);
  background: rgba(225, 59, 51, 0.1);
  transform: scale(1.08);
}

.arrow-left {
  left: 6%;
}

.arrow-right {
  right: 4%;
}

.focus-bracket {
  position: absolute;
  width: 260px;
  height: 480px;
  left: 42%;
  top: 10%;
  z-index: 6;
  pointer-events: none;
  transition:
    opacity 250ms ease,
    transform 900ms cubic-bezier(0.2, 0.78, 0.18, 1);
}

.focus-bracket i {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--red);
  border-style: solid;
  opacity: 0.85;
}

.focus-bracket i:nth-child(1) {
  left: 0;
  top: 0;
  border-width: 1px 0 0 1px;
}

.focus-bracket i:nth-child(2) {
  right: 0;
  top: 0;
  border-width: 1px 1px 0 0;
}

.focus-bracket i:nth-child(3) {
  right: 0;
  bottom: 0;
  border-width: 0 1px 1px 0;
}

.focus-bracket i:nth-child(4) {
  left: 0;
  bottom: 0;
  border-width: 0 0 1px 1px;
}

.arena.rotating .focus-bracket {
  opacity: 0;
  transform: scale(0.88);
}

.hero-card {
  width: 320px;
  height: 640px;
  padding: 0;
  border: 0;
  outline: 0;
  position: absolute;
  left: 50%;
  bottom: 6%;
  z-index: 2;
  background: transparent;
  color: var(--paper);
  transform-origin: 50% 100%;
  transition:
    transform 900ms cubic-bezier(0.2, 0.78, 0.18, 1),
    opacity 520ms ease,
    filter 520ms ease;
}

.hero-card:focus-visible {
  filter: drop-shadow(0 0 12px var(--gold));
}

.hero-card[data-position='center'] {
  z-index: 5;
  transform: translateX(-50%) translateZ(110px) scale(1.05);
  opacity: 1;
  filter: brightness(1.15) saturate(1.05);
}

.hero-card[data-position='left'] {
  z-index: 3;
  transform: translateX(-156%) translateY(36px) translateZ(-80px) scale(0.74);
  opacity: 0.72;
  filter: brightness(0.67) saturate(0.7);
}

.hero-card[data-position='right'] {
  z-index: 2;
  transform: translateX(54%) translateY(46px) translateZ(-110px) scale(0.7);
  opacity: 0.48;
  filter: grayscale(0.8) brightness(0.5);
}

.hero-card[data-position='far-right'] {
  z-index: 1;
  transform: translateX(135%) translateY(70px) translateZ(-180px) scale(0.57);
  opacity: 0.25;
  filter: grayscale(1) brightness(0.42);
}

.hero-card[data-position='far-left'] {
  z-index: 1;
  transform: translateX(-236%) translateY(70px) translateZ(-180px) scale(0.57);
  opacity: 0.2;
  filter: grayscale(1) brightness(0.4);
}

.hero-figure {
  position: absolute;
  left: 50%;
  bottom: 108px;
  width: 320px;
  height: 530px;
  transform: translateX(-50%);
  --figure-turn: 0deg;
  --pointer-x: 0deg;
  --pointer-y: 0deg;
  transform: translateX(-50%) rotateX(var(--pointer-y)) rotateY(calc(var(--figure-turn) + var(--pointer-x)));
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  filter: contrast(1.03) drop-shadow(0 26px 22px rgba(0, 0, 0, 0.72));
  mask-image: linear-gradient(to bottom, #000 0 84%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0 84%, transparent 100%);
  transform-style: preserve-3d;
  transition: transform 900ms cubic-bezier(0.2, 0.78, 0.18, 1), filter 420ms ease;
  will-change: transform;
}

.figure-relayer {
  background-image: url('/assets/saint-relayer-collectible.png?v=19');
}

.figure-builder {
  background-image: url('/assets/saint-builder-collectible.png?v=19');
}

.figure-clips {
  background-image: url('/assets/saint-clips-collectible.png?v=19');
}

.figure-teams {
  background-image: url('/assets/saint-teams-collectible.png?v=19');
}

.hero-card[data-position='left'] .hero-figure {
  --figure-turn: 16deg;
}

.hero-card[data-position='right'] .hero-figure {
  --figure-turn: -17deg;
}

.hero-card[data-position='far-right'] .hero-figure {
  --figure-turn: -28deg;
}

.hero-card[data-position='far-left'] .hero-figure {
  --figure-turn: 28deg;
}

.arena.rotating .hero-card.selected .hero-figure {
  animation: collectible-turn 900ms cubic-bezier(0.2, 0.78, 0.18, 1);
}

@keyframes collectible-turn {
  0% { transform: translateX(-50%) rotateY(0deg) scale(1); }
  38% { transform: translateX(-50%) rotateY(20deg) scale(0.95); }
  72% { transform: translateX(-50%) rotateY(-9deg) scale(1.025); }
  100% { transform: translateX(-50%) rotateY(0deg) scale(1); }
}

.platform {
  width: 310px;
  height: 118px;
  padding: 18px 22px 13px;
  border: 1px solid #383633;
  border-radius: 50% 50% 12px 12px / 38% 38% 12px 12px;
  position: absolute;
  left: 5px;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(90deg, transparent, rgba(225, 59, 51, 0.17), transparent) top/70% 2px no-repeat,
    linear-gradient(#292725, #111110 48%, #080808);
  box-shadow:
    inset 0 16px 20px rgba(255, 255, 255, 0.025),
    0 22px 30px rgba(0, 0, 0, 0.7);
  text-align: center;
  text-transform: uppercase;
  transition:
    border-color 300ms ease,
    box-shadow 300ms ease;
}

.selected .platform {
  border-color: rgba(225, 59, 51, 0.75);
  box-shadow:
    inset 0 16px 20px rgba(255, 255, 255, 0.035),
    inset 0 -3px 13px rgba(225, 59, 51, 0.18),
    0 18px 30px rgba(0, 0, 0, 0.7),
    0 0 22px rgba(225, 59, 51, 0.14);
}

.platform small {
  color: var(--muted);
  font-size: 9px;
}

.platform strong {
  margin: 7px 0;
  font-size: 16px;
  letter-spacing: 0.17em;
}

.platform em {
  color: var(--muted);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.16em;
}

.lock-mark {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(235, 231, 220, 0.48);
  position: absolute;
  left: 50%;
  top: 43%;
  z-index: 5;
  display: grid;
  place-items: center;
  color: var(--paper);
  font-size: 25px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: rgba(8, 8, 8, 0.62);
}

.lock-mark::before {
  content: '⌾';
  transform: rotate(-45deg);
}

.lock-mark {
  font-size: 0;
}

.hero-card.shake {
  animation: locked-shake 380ms ease;
}

@keyframes locked-shake {
  20% {
    margin-left: -9px;
  }
  40% {
    margin-left: 7px;
  }
  60% {
    margin-left: -5px;
  }
  80% {
    margin-left: 3px;
  }
}

.toast {
  position: absolute;
  right: 5%;
  top: 15%;
  z-index: 10;
  padding: 14px 18px;
  border-left: 2px solid var(--red);
  background: rgba(14, 13, 12, 0.92);
  color: var(--paper);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0;
  transform: translateX(12px);
  transition: 220ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 1180px) {
  .selector {
    grid-template-columns: clamp(320px, 38vw, 420px) minmax(0, 1fr);
  }

  .copy-panel {
    padding-left: 35px;
    padding-right: 15px;
  }

  h1 {
    font-size: 78px;
  }

  .hero-card[data-position='far-right'] {
    opacity: 0;
  }
}

@media (max-width: 860px) {
  :root {
    --header-height: 72px;
  }

  .topbar {
    height: var(--header-height);
  }

  .topbar nav a:first-child,
  .topbar nav button {
    display: none;
  }

  .selector {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .copy-panel {
    flex: 0 0 47%;
    padding: 54px 22px 20px;
    background: linear-gradient(rgba(9, 10, 10, 0.92), rgba(9, 10, 10, 0));
  }

  h1 {
    font-size: clamp(68px, 20vw, 95px);
  }

  .description {
    min-height: 55px;
  }

  .next-readout {
    display: none;
  }

  .actions {
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .arena {
    flex: 1;
    min-height: 0;
    height: auto;
    margin-top: 0;
  }

  .hero-card {
    bottom: 8%;
  }

  .hero-card[data-position='center'] {
    transform: translateX(-50%) scale(0.88);
  }

  .hero-card[data-position='left'] {
    transform: translateX(-133%) translateY(45px) scale(0.58);
  }

  .hero-card[data-position='right'] {
    transform: translateX(33%) translateY(45px) scale(0.58);
  }

  .hero-card[data-position='far-right'],
  .hero-card[data-position='far-left'] {
    opacity: 0;
  }

  .focus-bracket {
    left: calc(50% - 130px);
    top: 8%;
  }
}

@media (max-height: 760px) and (min-width: 861px) {
  .copy-panel {
    padding-top: 48px;
  }

  h1 {
    font-size: clamp(62px, 6vw, 92px);
  }

  .description {
    min-height: 58px;
    font-size: 18px;
  }

  .actions,
  .next-readout {
    margin-top: 25px;
  }

  .hero-card {
    bottom: 1%;
    transform-origin: 50% 100%;
  }

  .hero-card[data-position='center'] {
    transform: translateX(-50%) translateZ(110px) scale(0.88);
  }

  .hero-card[data-position='left'] {
    transform: translateX(-156%) translateY(36px) translateZ(-80px) scale(0.66);
  }

  .hero-card[data-position='right'] {
    transform: translateX(54%) translateY(46px) translateZ(-110px) scale(0.62);
  }
}

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