/* =========================================================
   SOLOCOIN — $SOLO
   A lonely medieval warrior trapped inside an abandoned
   internet game server. Big type. Black space. One knight.
   ========================================================= */

:root {
  --bg: #050505;
  --surface: #0A0A0B;
  --text: #F0F0ED;
  --text-secondary: #A1A1A1;
  --text-muted: #66666A;
  --border: #242428;
  --accent: #91A7B8;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-hover: 220ms;
  --t-ui: 400ms;
  --t-reveal: 750ms;

  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Space Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --max-width: 1180px;

  --cursor-default: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22'><g stroke='%23F0F0ED' stroke-width='1'><line x1='11' y1='0' x2='11' y2='8'/><line x1='11' y1='14' x2='11' y2='22'/><line x1='0' y1='11' x2='8' y2='11'/><line x1='14' y1='11' x2='22' y2='11'/></g></svg>") 11 11, auto;
  --cursor-hover: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22'><g stroke='%23F0F0ED' stroke-width='1' fill='none'><rect x='2' y='2' width='18' height='18'/><line x1='11' y1='7' x2='11' y2='15'/><line x1='7' y1='11' x2='15' y2='11'/></g></svg>") 11 11, pointer;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: var(--cursor-default);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

a, button, .js-hoverable {
  cursor: var(--cursor-hover);
}

::selection {
  background: var(--text);
  color: var(--bg);
}

/* ---------------------------------------------------------
   Ambient texture: grain / scanlines / vignette
   --------------------------------------------------------- */

.fx-grain,
.fx-scanlines,
.fx-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
}

.fx-grain {
  opacity: 0.03;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

.fx-scanlines {
  opacity: 0.02;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.6) 0px,
    rgba(255, 255, 255, 0.6) 1px,
    transparent 1px,
    transparent 3px
  );
}

.fx-vignette {
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

/* ---------------------------------------------------------
   Intro sequence
   --------------------------------------------------------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 600ms var(--ease);
}

.intro.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.intro-line {
  display: block;
  min-height: 1.2em;
  white-space: pre;
}

.intro-cursor {
  display: inline-block;
  width: 8px;
  color: var(--text);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.skip-btn {
  position: absolute;
  bottom: 24px;
  right: 28px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: var(--cursor-hover);
  padding: 6px 8px;
  transition: color var(--t-hover) var(--ease);
}

.skip-btn:hover,
.skip-btn:focus-visible {
  color: var(--text-secondary);
}

/* ---------------------------------------------------------
   Top nav
   --------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: linear-gradient(to bottom, rgba(5,5,5,0.85), rgba(5,5,5,0));
}

.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-mark {
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--text);
  opacity: 0.9;
}

.topnav {
  display: flex;
  gap: 26px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
}

.topnav a {
  color: var(--text-secondary);
  opacity: 0.7;
  transition: opacity var(--t-hover) var(--ease);
}

.topnav a:hover,
.topnav a:focus-visible {
  opacity: 1;
}

@media (max-width: 720px) {
  .topnav { display: none; }
}

.sound-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 400;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 6px 8px;
  cursor: var(--cursor-hover);
  opacity: 0.6;
  transition: opacity var(--t-hover) var(--ease);
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  opacity: 1;
}

/* ---------------------------------------------------------
   Site fade-in after intro
   --------------------------------------------------------- */

.site {
  opacity: 0;
  transition: opacity 900ms var(--ease);
}

.site.is-visible {
  opacity: 1;
}

/* ---------------------------------------------------------
   Layout helpers
   --------------------------------------------------------- */

.chapter {
  min-height: 100svh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px;
  border-top: 1px solid var(--border);
}

.chapter-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chapter-label {
  position: absolute;
  top: 28px;
  left: 28px;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

/* scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--t-reveal) var(--ease), transform var(--t-reveal) var(--ease);
}

.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------------------------------------------------------
   Typography scale
   --------------------------------------------------------- */

.big-line {
  font-weight: 700;
  font-size: clamp(38px, 6vw, 92px);
  line-height: 1.08;
  letter-spacing: 0.01em;
  color: var(--text);
  margin: 0;
}

.mid-line {
  font-size: clamp(18px, 2.6vw, 26px);
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  margin: 0;
}

/* ---------------------------------------------------------
   Text buttons
   --------------------------------------------------------- */

.text-btn {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.1em;
  padding: 8px 2px;
  cursor: var(--cursor-hover);
  transition: border-color var(--t-hover) var(--ease), opacity var(--t-hover) var(--ease);
}

.text-btn:hover,
.text-btn:focus-visible {
  border-color: var(--text);
}

.text-btn:active {
  opacity: 0.7;
}

.text-link {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  opacity: 0.8;
  transition: opacity var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}

.text-link:hover,
.text-link:focus-visible {
  opacity: 1;
  color: var(--text);
}

/* ---------------------------------------------------------
   Flash overlay (shared)
   --------------------------------------------------------- */

.flash-overlay {
  position: fixed;
  inset: 0;
  background: #F0F0ED;
  opacity: 0;
  pointer-events: none;
  z-index: 9995;
}

.flash-overlay.is-flashing {
  animation: flash-pop 200ms ease-out;
}

@keyframes flash-pop {
  0% { opacity: 0.45; }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 24px 100px;
  position: relative;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  max-width: 760px;
}

.hero-logo {
  width: min(52vw, 640px);
  height: auto;
  display: block;
  filter: contrast(1.05);
}

.knight-wrap {
  position: relative;
  transition: transform 120ms linear;
  will-change: transform;
}

.knight-hero {
  height: clamp(240px, 26vw, 330px);
  width: auto;
  display: block;
  filter: grayscale(1) contrast(1.08);
  animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.knight-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(240,240,237,0.12) 48%, transparent 56%);
  background-size: 260% 260%;
  background-position: 120% 0%;
  mix-blend-mode: screen;
  opacity: 0;
}

.knight-wrap.is-sweeping .knight-sheen {
  animation: sheen-sweep 1.4s var(--ease);
}

@keyframes sheen-sweep {
  0% { background-position: 140% -20%; opacity: 0; }
  15% { opacity: 0.9; }
  60% { opacity: 0.4; }
  100% { background-position: -40% 60%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .knight-hero { animation: none; }
}

.hero-tagline {
  margin: 4px 0 0;
  font-size: clamp(16px, 2vw, 20px);
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.hero-statement {
  margin: 0;
  font-weight: 700;
  font-size: clamp(30px, 4.4vw, 46px);
  letter-spacing: 0.02em;
  color: var(--text);
}

.player-tag {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: cue-pulse 2.4s ease-in-out infinite;
}

@keyframes cue-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue { animation: none; opacity: 0.6; }
}

/* ---------------------------------------------------------
   01 / SOLO QUEUE — matchmaking
   --------------------------------------------------------- */

.mm-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.mm-hidden {
  display: none !important;
}

.mm-title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(26px, 4vw, 44px);
  letter-spacing: 0.02em;
  color: var(--text);
}

.mm-dots span {
  opacity: 0;
  animation: dot-fade 1.4s infinite;
  font-size: 20px;
}
.mm-dots span:nth-child(1) { animation-delay: 0s; }
.mm-dots span:nth-child(2) { animation-delay: 0.2s; }
.mm-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-fade {
  0%, 20% { opacity: 0; }
  40% { opacity: 1; }
  80%, 100% { opacity: 0; }
}

.mm-checklist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(90vw, 460px);
  margin-top: 4px;
}

.mm-check-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}

.mm-check-row.is-in {
  opacity: 1;
  transform: translateY(0);
}

.mm-check-label {
  white-space: nowrap;
}

.mm-check-leader {
  flex: 1;
  border-bottom: 1px dotted var(--border);
  margin-bottom: 5px;
}

.mm-check-value {
  color: var(--text-muted);
}

.mm-result-title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(40px, 6.5vw, 88px);
  letter-spacing: 0.01em;
  color: var(--text);
}

.mm-result-sub {
  margin: 0;
  font-size: clamp(16px, 2.2vw, 20px);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.mm-options {
  display: flex;
  gap: 28px;
  margin-top: 6px;
}

.mm-yes {
  font-size: 15px;
}

.mm-match-title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(34px, 5vw, 64px);
  color: var(--accent);
  letter-spacing: 0.02em;
}

.mm-you-title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(48px, 8vw, 120px);
  color: var(--text);
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------
   World without you
   --------------------------------------------------------- */

.world {
  overflow: hidden;
}

.world-field {
  position: absolute;
  inset: 0;
}

.world-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.world-label {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  opacity: 0.65;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.world-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.knight-medium {
  height: clamp(130px, 15vw, 190px);
  width: auto;
  filter: grayscale(1) contrast(1.08);
  opacity: 0.95;
}

.world-line-1 {
  margin: 4px 0 0;
}

.world-line-2 {
  font-size: clamp(16px, 2.2vw, 22px);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  margin: 0;
}

/* ---------------------------------------------------------
   Solo Code — scroll march
   --------------------------------------------------------- */

.code-track {
  position: relative;
  overflow: hidden;
}

.code-track-inner {
  position: relative;
}

.code-knight-layer {
  position: sticky;
  top: 0;
  height: 0;
  z-index: 2;
  pointer-events: none;
}

.code-knight {
  position: absolute;
  top: 46svh;
  left: 0;
  height: clamp(70px, 9vw, 110px);
  width: auto;
  filter: grayscale(1) contrast(1.08);
  opacity: 0.85;
  transform: translateX(0);
  will-change: transform;
}

.code-beat {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.code-beat-text {
  text-align: center;
  font-weight: 700;
  font-size: clamp(34px, 5.4vw, 84px);
  line-height: 1.12;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  max-width: 900px;
}

.code-beat-final .code-beat-text {
  color: var(--text);
  font-size: clamp(38px, 6vw, 92px);
}

/* ---------------------------------------------------------
   Party invite
   --------------------------------------------------------- */

.invite-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.invite-title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 36px);
  color: var(--text);
  letter-spacing: 0.02em;
}

.invite-sub {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.invite-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.invite-error {
  margin: 0;
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 36px);
  color: var(--text);
  letter-spacing: 0.02em;
}

.invite-timestamp {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.invite-return {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.is-glitching {
  animation: glitch-pop 260ms steps(2, end);
}

@keyframes glitch-pop {
  0% { transform: translate(0); filter: none; }
  30% { transform: translate(-2px, 1px); filter: contrast(1.4); }
  60% { transform: translate(2px, -1px); filter: contrast(0.8); }
  100% { transform: translate(0); filter: none; }
}

/* ---------------------------------------------------------
   Solo Stats — editorial rows
   --------------------------------------------------------- */

.stats-list {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
}

.stats-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 4px;
  border-bottom: 1px solid var(--border);
}

.stats-row:first-child {
  border-top: 1px solid var(--border);
}

.stats-label {
  font-size: clamp(14px, 2vw, 20px);
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: left;
}

.stats-value {
  font-weight: 700;
  font-size: clamp(34px, 6vw, 72px);
  color: var(--text);
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------
   Contract — final ritual
   --------------------------------------------------------- */

.contract-heading {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin: 0;
}

.contract-ticker {
  font-weight: 700;
  font-size: clamp(40px, 6vw, 68px);
  color: var(--text);
  letter-spacing: 0.02em;
  margin: 10px 0 26px;
}

.contract-address {
  font-size: clamp(13px, 1.6vw, 16px);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  word-break: break-all;
  max-width: 620px;
  margin: 0 0 34px;
}

.contract-copy-btn {
  font-size: 16px;
  margin-bottom: 40px;
}

.contract-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */

.footer {
  padding: 120px 24px 70px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
}

.footer-knight {
  height: 64px;
  width: auto;
  filter: grayscale(1) contrast(1.08);
  opacity: 0.55;
  margin: 0 auto 30px;
  display: block;
}

.footer-line {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.footer-final {
  margin: 18px 0 0;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--text);
  font-weight: 700;
}

/* ---------------------------------------------------------
   Toast (easter eggs)
   --------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 640px) {
  .chapter {
    padding: 100px 18px;
  }

  .hero {
    padding: 110px 18px 90px;
  }

  .hero-logo {
    width: 84vw;
  }

  .knight-hero {
    height: clamp(180px, 42vw, 240px);
  }

  .knight-medium {
    height: clamp(110px, 30vw, 150px);
  }

  .chapter-label {
    top: 20px;
    left: 18px;
  }

  .mm-checklist {
    width: 100%;
  }

  .mm-options {
    gap: 20px;
  }

  .stats-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 20px 4px;
  }

  .contract-links {
    flex-direction: column;
    gap: 16px;
  }

  .world-label {
    font-size: 9.5px;
  }
}
