:root {
  --bg: #070A12;
  --panel: rgba(12, 16, 28, 0.85);
  --text: #E9F2FF;
  --muted: #A9B7D0;
  --line: rgba(120, 170, 255, 0.25);
  --glow: rgba(120, 170, 255, 0.55);
  --accent: #7BFCFF;
  --accent2: #FF4FD8;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --max: 1060px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

/* 
body {
  background: radial-gradient(1000px 500px at 30% -10%, rgba(123, 252, 255, 0.22), transparent 60%),
    radial-gradient(900px 480px at 85% 0%, rgba(255, 79, 216, 0.12), transparent 55%),
    linear-gradient(180deg, #050712 0%, #050712 40%, #03040A 100%);
  overflow-x: hidden;
  background: url('/assets/images/the-grid.jpg') no-repeat top center fixed;
} 
*/

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);

  background:
    /* Fade mask above the grid */
    linear-gradient(to top,
      rgba(13, 0, 56, 0.98) 0%,
      rgba(13, 0, 56, 0.90) 18%,
      rgba(13, 0, 56, 0.70) 38%,
      rgba(13, 0, 56, 0.00) 65%),

    /* The Grid (sticks to viewport bottom) */
    url("/assets/images/the-grid.jpg"),

    /* Existing Tron glow layers */
    radial-gradient(1000px 500px at 30% -10%, rgba(123, 252, 255, 0.22), transparent 60%),
    radial-gradient(900px 480px at 85% 0%, rgba(255, 79, 216, 0.12), transparent 55%),
    linear-gradient(180deg, #050712 0%, #0d0038 40%, #03040A 100%);

  background-repeat: no-repeat;
  background-position:
    bottom center,
    bottom center,
    top left,
    top right,
    top center;

  background-size:
    100% 520px,
    /* fade mask */
    100% 520px,
    /* grid height */
    auto,
    auto,
    cover;

  /* 👇 THIS is the key */
  background-attachment:
    fixed,
    /* fade */
    fixed,
    /* grid */
    scroll,
    scroll,
    scroll;

  overflow-x: hidden;
}

/* Keep all links white / themed, even after visit */
a,
a:visited {
  color: var(--text);
  text-decoration: none;
}

/* Buttons should never change color after visit */
.btn,
.btn:visited {
  color: var(--text);
}

/* If you have accent links, keep them consistent */
a:hover,
a:focus {
  color: var(--accent);
}

/* Optional: external links can still glow on hover */
a[target="_blank"]:hover {
  text-shadow: 0 0 10px rgba(123, 252, 255, 0.35);
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #001018;
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 999;
}

.skip:focus {
  left: 12px;
  top: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(7, 10, 18, 0.70);
  border-bottom: 1px solid var(--line);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
}

.brand__mark {
  color: var(--accent);
  text-shadow: 0 0 24px var(--glow);
}

.brand__name {
  letter-spacing: 0.5px;
}

.brand__sub {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  margin-left: 14px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.nav a:hover {
  border-color: var(--line);
  background: rgba(123, 252, 255, 0.06);
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 16px 60px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px var(--shadow);
  padding: 18px;
  margin-top: 18px;
  position: relative;
}

.panel:before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(123, 252, 255, 0.18), rgba(255, 79, 216, 0.08), rgba(123, 252, 255, 0.12));
  filter: blur(22px);
  z-index: -1;
  opacity: 0.55;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 18px;
}

@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }
}

.tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

.lede {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 58ch;
}

.glow {
  text-shadow: 0 0 34px rgba(123, 252, 255, 0.25);
}

.ctaRow {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-family: var(--mono);
  letter-spacing: 1px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(123, 252, 255, 0.05);
}

.btn:hover {
  background: rgba(123, 252, 255, 0.10);
}

.btn.primary {
  border-color: rgba(123, 252, 255, 0.45);
  background: rgba(123, 252, 255, 0.12);
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.scoreboard {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.scoreboard__title {
  font-family: var(--mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.scoreboard__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.scoreboard__list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dashed rgba(120, 170, 255, 0.22);
  padding-bottom: 10px;
}

.scoreboard__list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.scoreboard__list .k {
  font-family: var(--mono);
  color: var(--text);
  min-width: 14ch;
}

.scoreboard__list .v {
  color: var(--muted);
  text-align: right;
}

.panel__head {
  margin-bottom: 12px;
}

.panel__sub {
  margin: 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.55;
}

.card__links a {
  font-family: var(--mono);
  color: var(--accent);
  text-decoration: none;
  margin-right: 12px;
}

.card__links a:hover {
  text-decoration: underline;
}

.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px) {
  .twoCol {
    grid-template-columns: 1fr;
  }
}

.bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.footer {
  margin-top: 22px;
  padding: 10px 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 12px;
}

.footer a:hover {
  color: var(--text);
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
}

.link:hover {
  text-decoration: underline;
}

.cartridgeGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .cartridgeGrid {
    grid-template-columns: 1fr;
  }
}

.cartridge {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.cartridge:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(123, 252, 255, 0.08) 40%, transparent 70%);
  transform: translateX(-60%);
  opacity: 0.7;
  pointer-events: none;
}

.cartridge:hover:before {
  transform: translateX(60%);
  transition: transform 650ms ease;
}

.cartridge__top {
  margin-bottom: 10px;
}

.cartridge__title {
  margin: 6px 0 4px;
  font-family: var(--mono);
}

.cartridge__meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.cartridge__badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  color: #001018;
  background: rgba(123, 252, 255, 0.9);
}

.cartridge__badge.alt {
  background: rgba(255, 79, 216, 0.85);
  color: #120012;
}

.cartridge__desc {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.cartridge__links a {
  font-family: var(--mono);
  color: var(--accent);
  text-decoration: none;
  margin-right: 12px;
}

.cartridge__links a:hover {
  text-decoration: underline;
}

/* Respect accessibility preferences */
@media (prefers-reduced-motion: reduce) {
  .coinPop {
    display: none !important;
  }
}

/* Coin pop particle */
.coinPop {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;

  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--accent);

  text-shadow:
    0 0 12px rgba(123, 252, 255, 0.45),
    0 0 26px rgba(123, 252, 255, 0.25);
  opacity: 0;
  animation: coinPop 520ms ease-out forwards;
}

.coinPop--alt {
  color: var(--accent2);
  text-shadow:
    0 0 12px rgba(255, 79, 216, 0.40),
    0 0 26px rgba(255, 79, 216, 0.20);
}

@keyframes coinPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 28px)) scale(1.25);
  }
}

/* Amiga-style Guru Meditation banner */
.guru {
  margin-top: 18px;
  border-radius: 12px;
  border: 2px solid rgba(255, 60, 60, 0.95);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25) inset;
  position: relative;
  overflow: hidden;
}

.guru__inner {
  padding: 14px 16px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

.guru__title {
  color: rgba(255, 220, 220, 0.95);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.guru__code {
  color: rgba(255, 60, 60, 0.95);
  font-size: 14px;
  text-shadow: 0 0 14px rgba(255, 60, 60, 0.30);
}

/* flashing red outline like AmigaOS */
.guru {
  animation: guruFlash 1.1s steps(2, end) infinite;
}

/* subtle scanline vibe (optional but very on-brand) */
.guru:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(to bottom,
      rgba(255, 60, 60, 0.06) 0px,
      rgba(255, 60, 60, 0.06) 1px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0) 6px);
  opacity: 0.35;
  pointer-events: none;
}

/* flashing border + slight fill pulse */
@keyframes guruFlash {
  0% {
    border-color: rgba(255, 60, 60, 0.95);
    box-shadow:
      0 0 0 2px rgba(0, 0, 0, 0.25) inset,
      0 0 0 0 rgba(255, 60, 60, 0.00);
  }

  100% {
    border-color: rgba(255, 60, 60, 0.35);
    box-shadow:
      0 0 0 2px rgba(0, 0, 0, 0.25) inset,
      0 0 24px 0 rgba(255, 60, 60, 0.22);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .guru {
    animation: none;
  }
}