/* redox.cool v2 restyle: flat red field, die-cut stickers, neobrutal hover.
   Tokens copied verbatim from red0xx-web app/globals.css. */

:root {
  --paper: #FAF7F2; --paper-2: #F1ECE4;
  --ink: #111111;   --ink-2: #3A3A3A;  --ink-dim: rgba(17,17,17,.55);
  --red-900: #6E0B0F; --red-700: #B3141C; --red-600: #C4161F; --red-500: #E01E2C;
  --red-300: #F26B74; --red-100: #FBE7E8;
  --logo-red: #E64949;
  --cut: #FFFFFF;
  --cut-w: 6px;
  --nb-shadow-color: #ffffff;
  --nb-x: 4px; --nb-y: 4px;
  --nb-shadow: var(--nb-x) var(--nb-y) 0 0 var(--nb-shadow-color);
  --rot-1: -3deg; --rot-2: 2deg; --rot-3: -1.5deg; --rot-4: 4deg;
  --page: var(--red-600);
  --page-text: #ffffff;
  --panel: var(--paper);
  --panel-text: var(--ink);
  --rail: var(--red-700);
  --rail-line: rgba(255,255,255,.16);
  --on-red: #ffffff;
  --on-red-dim: rgba(255,255,255,.72);
  --on-red-faint: rgba(255,255,255,.45);
  --footer-bg: var(--red-900);
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px;
  --radius: 0.875rem;
}

@font-face {
  font-family: 'Archivo';
  src: url('/static/fonts/archivo-ui-v1.woff2') format('woff2');
  font-weight: 700 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-ui-v1.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/geist-count-v1.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body {
  min-height: 100vh;
  background: var(--page);
  color: var(--page-text);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1 { font: inherit; }
a { text-decoration: none; }
img { display: block; }

/* ── Sticker system ── */
.sticker {
  position: relative;
  background: var(--cut);
  color: var(--ink);
  border: var(--cut-w) solid var(--cut);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* ── Bars ── */
.bar {
  position: fixed; left: 0; width: 100%; z-index: 50;
  display: flex; align-items: center;
  background: var(--red-700);
}
.top {
  top: 0;
  justify-content: center;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--rail-line);
}
.top h1 {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: #fff;
}
.avatar {
  position: absolute; left: 1rem; top: 50%; margin-top: -18px;
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  border: 3px solid #fff;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 0 0 0 #fff;
  transition: translate .18s ease, box-shadow .18s ease;
}
.avatar:hover {
  translate: -4px -4px;
  box-shadow: 4px 4px 0 0 #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.bottom {
  bottom: 0;
  flex-direction: column;
  gap: .4rem;
  padding: .7rem 1rem .8rem;
  background: var(--footer-bg);
}

/* ── HELLO name tag ── */
.hero { position: relative; height: 100vh; }
.tag {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  rotate: var(--rot-1);
  width: min(520px, 92vw);
  border-radius: 28px;
  z-index: 2;
}
.tag__head {
  background: var(--red-700);
  border-radius: 22px 22px 0 0;
  text-align: center;
  padding: 1.1rem 1.25rem .7rem;
}
.tag__hello {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: clamp(40px, 9vw, 72px);
  line-height: .85;
  letter-spacing: -0.03em;
  color: #fff;
}
.tag__body {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem;
}
.tag__strip { background: var(--red-700); height: 10px; }

/* ── Buttons ── */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 120px; height: 120px;
  padding: .9rem;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  transition: translate .18s ease, box-shadow .18s ease;
}
/* gifs carry ~20% transparent margin, scale it off */
.btn img { width: 100%; height: 100%; object-fit: contain; scale: 1.5; transition: transform .3s ease; will-change: transform; }
.btn[data-click="github"] { rotate: var(--rot-2); }
.btn[data-click="discord"] { rotate: var(--rot-3); }
.btn:hover, .btn:focus-visible {
  translate: -3px -3px;
  box-shadow: 5px 5px 0 #190306;
}
.btn:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Train line + runner ── */
.trainline {
  position: absolute;
  left: 0; right: 0;
  top: 34vh;
  height: 148px; /* station height; GROUND_Y=120 sits on the rail */
  z-index: 1;
  pointer-events: none;
  overflow-x: clip;
  overflow-y: visible;
  --train-w: 1000px; /* wheels land at 84/96 * (1000*96/700) = 120px = GROUND_Y */
}
.trainline__rail {
  bottom: auto;
  top: calc(var(--train-w) * 84 / 700);
}
.trainline__train {
  width: var(--train-w);
  margin: 0 auto;
  will-change: transform;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.35));
}
.trainline__train img {
  width: 100%; height: auto;
  animation: train-idle 4.5s ease-in-out infinite;
}
@keyframes train-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ── Train runner (game) ── */
.runner {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.runner--touch {
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.runner__canvas {
  position: absolute;
  top: -120px;
  left: 0;
  width: 100%;
  height: calc(100% + 120px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}
.runner.running .runner__canvas { opacity: 1; }
.runner.running .runner__hint { display: none; }
.runner__score {
  position: absolute;
  right: 10px;
  top: 8px;
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--red-700);
  background: var(--cut);
  padding: 3px 12px 4px;
  border-radius: var(--r-xs);
  box-shadow: 0 3px 0 var(--red-900);
  display: none;
}
.runner.running .runner__score { display: block; }
.runner__best { color: var(--red-500); margin-left: 8px; }
.runner__hint {
  position: absolute;
  right: 10px;
  top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--on-red);
  pointer-events: none;
}
.runner__key {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--red-700);
  background: var(--cut);
  padding: 3px 14px 4px;
  border-radius: var(--r-xs);
  box-shadow: 0 3px 0 var(--red-900);
  animation: runner-press 2.4s ease-in-out infinite;
}
@keyframes runner-press {
  0%, 80%, 100% { translate: 0 0; box-shadow: 0 3px 0 var(--red-900); }
  88% { translate: 0 3px; box-shadow: 0 0 0 var(--red-900); }
}

.track {
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  pointer-events: none;
}
.track::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0; right: 0; top: 0;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.34);
}
.track::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; top: 1px;
  height: 7px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='7'%3E%3Cg fill='white' fill-opacity='.22'%3E%3Crect x='27' y='0' width='2' height='7'/%3E%3Crect x='23' y='3' width='10' height='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 7px;
  background-repeat: space no-repeat;
}

/* ── Decals ── */
.decal {
  position: absolute;
  z-index: 3;
  --decal-h-max: min(150px, 17vw);
}
.decal--tag { left: 4%; bottom: 12%; }
.decal--rats { right: 5%; top: 56%; }
.gallery-decal {
  display: block;
  width: min(var(--decal-w,160px), 26vw, var(--decal-h-max,150px) * var(--decal-ar,1));
  height: auto;
  transform: rotate(var(--decal-rot, 0deg));
  transform-origin: 50% 60%;
  transition: translate .18s ease, filter .18s ease;
}
.gallery-decal--rectangular { background: var(--cut); }
.decal:hover .gallery-decal {
  translate: -3px -3px;
  filter: drop-shadow(5px 5px 0 #190306);
}
.decal--tag .gallery-decal { --decal-w: 220px; --decal-ar: 1.358; --decal-rot: var(--rot-3); }
.decal--rats .gallery-decal { --decal-w: 165px; --decal-ar: 1; --decal-rot: var(--rot-1); }

/* ── Footer handle + view counter ── */
.handle { position: relative; padding-inline: 1rem; }
.rail-name__handle {
  display: inline-block;
  white-space: nowrap;
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--on-red);
  transition: text-shadow .18s ease, translate .18s ease;
}
.rail-name__handle:hover {
  translate: -4px -4px;
  text-shadow:
    1px 1px 0 var(--logo-red),
    2px 2px 0 var(--logo-red),
    3px 3px 0 var(--logo-red),
    4px 4px 0 var(--logo-red);
}

.views {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .7rem;
  border: 2px solid #fff;
  border-radius: var(--r-sm);
  background: transparent;
  color: #fff;
  font-family: 'Geist Mono', monospace;
  font-size: .875rem;
  transition: translate .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}
.views__icon {
  width: 16px; height: 16px;
  background: currentColor;
  -webkit-mask: url('/static/icons/eye-v1.png') center / contain no-repeat;
  mask: url('/static/icons/eye-v1.png') center / contain no-repeat;
}
.views:hover, .views:focus-visible {
  translate: -3px -3px;
  box-shadow: 5px 5px 0 #fff;
  background: #fff;
  color: var(--red-700);
  border-color: var(--red-900);
}

/* button sparkle trail */
.star { position: absolute; display: block; pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
  /* tag spans the full width here, so run the game above it, not behind it */
  .trainline { top: max(64px, calc(50vh - 280px)); }
  .tag { width: 92vw; }
  .tag__body { gap: 1rem; padding: 1.25rem 1rem; }
  .btn { width: 84px; height: 84px; padding: .55rem; }
}
@media (max-width: 560px) {
  .decal { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .trainline__train img { animation: none; }
  .runner__key { animation: none; }
  .btn, .views, .rail-name__handle, .gallery-decal, .avatar { transition: none; }
}
