/* ============================================================
   BackRub: a 'stock rubber' for the world wide web
   1996 aesthetic: default-looking HTML, Times, blue links.
   ============================================================ */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: #ffffff;
  color: #000000;
  font-family: "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.45;
}

a { color: #0000ee; }
a:visited { color: #551a8b; }

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

h2 {
  font-size: 22px;
  margin: 28px 0 8px;
}

hr {
  border: 0;
  border-top: 2px groove #d6d3ce;
  margin: 22px 0;
}

.small  { font-size: 13px; }
.center { text-align: center; }
.mono   { font-family: "Courier New", Courier, monospace; }

/* ---------- banner ---------- */

.banner {
  display: block;
  margin: 6px auto 18px;
  max-width: 100%;
  height: auto;
}

.lede { margin: 0 0 20px; }

.gnav { margin: 4px 0 0; font-size: 16px; }
.gnav a { margin: 0 9px; }

/* faint CRT glass over the live page; you are inside the monitor now */
#crt-pov {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transition: opacity 1.8s ease;
  background:
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .10) 100%),
    repeating-linear-gradient(0deg,
      rgba(0, 0, 0, .035) 0px, rgba(0, 0, 0, .035) 1px,
      transparent 1px, transparent 3px);
}
body.inside-crt #crt-pov { opacity: 1; }

/* ---------- 1996 form widgets ---------- */

.searchform { text-align: center; margin: 18px 0 6px; }

.searchform input[type="text"] {
  font: 16px "Courier New", Courier, monospace;
  padding: 4px 6px;
  width: min(440px, 92%);
  background: #fff;
  border: 2px solid;
  border-color: #7a7a7a #d9d6cf #d9d6cf #7a7a7a;
  border-radius: 0;
}

.searchform input[type="submit"],
.searchform button,
.ca-line button {
  font: 13px Verdana, Geneva, sans-serif;
  color: #000;
  background: #d6d3ce;
  border: 2px solid;
  border-color: #ffffff #7a7a7a #7a7a7a #ffffff;
  padding: 4px 12px;
  margin: 8px 4px 0;
  cursor: pointer;
  border-radius: 0;
}

.searchform input[type="submit"]:active,
.searchform button:active,
.ca-line button:active {
  border-color: #7a7a7a #ffffff #ffffff #7a7a7a;
}

.ca-line button[disabled] { color: #8a8a8a; cursor: default; }


.new-blink {
  color: #ff0000;
  font-weight: bold;
  font-size: 13px;
  animation: blinker 1.06s steps(1) infinite;
}
@keyframes blinker { 50% { opacity: 0; } }

.results {
  max-width: 560px;
  margin: 14px auto 0;
  padding: 10px 14px;
  border: 1px solid #999;
  background: #fffff4;
  font-size: 15px;
}

/* ---------- index + tables ---------- */

ul.idx { line-height: 1.9; }

.pegtable {
  border-collapse: collapse;
  font-size: 15px;
  margin: 8px 0;
}
.pegtable th { background: #efefef; text-align: left; }
.pegtable td, .pegtable th { border: 1px solid #000; }

pre.chart {
  font-size: 13px;
  line-height: 1.35;
  color: #007700;
  overflow-x: auto;
  margin: 10px 0 2px;
}

/* ---------- game ---------- */

.game-shell {
  max-width: 646px;
  margin: 14px auto;
  background: #d6d3ce;
  border: 2px solid;
  border-color: #ffffff #7a7a7a #7a7a7a #ffffff;
  padding: 3px;
}

.game-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #000080;
  color: #fff;
  font: bold 12px Verdana, Geneva, sans-serif;
  padding: 3px 7px;
  margin-bottom: 3px;
}
.game-title-x { font-weight: bold; opacity: .85; }

#runner-canvas {
  display: block;
  width: 100%;
  background: #ffffff;
  image-rendering: pixelated;
  outline: none;
  touch-action: manipulation;
}

.game-caption {
  font: 11px Verdana, Geneva, sans-serif;
  text-align: center;
  padding: 4px 2px 2px;
}

/* ---------- footer ---------- */

.credits { margin-bottom: 4px; }
.credits-list { margin-top: 0; }

.counter-line { margin-top: 26px; }
.counter {
  background: #000;
  color: #33ff33;
  font-family: "Courier New", monospace;
  font-size: 15px;
  letter-spacing: 3px;
  padding: 3px 8px;
  border: 2px solid;
  border-color: #7a7a7a #ffffff #ffffff #7a7a7a;
}

.footer-line { line-height: 1.8; }

/* ============================================================
   INTRO: scroll-scrubbed zoom (400vh runway, sticky viewport)
   ============================================================ */

#intro { height: 400vh; height: 400dvh; background: #000; }

.intro-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#scrub-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.intro-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font: bold 14px "Courier New", monospace;
  letter-spacing: 4px;
  text-shadow: 0 0 8px #000, 0 0 3px #000;
  animation: blinker 1.2s steps(1) infinite;
  pointer-events: none;
}

#skip-intro {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 4;
  color: #99ff99;
  font: 12px "Courier New", monospace;
}

/* ---------- the live site, inside the monitor glass ---------- */

#screen-clip {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #fdfdf6;
  visibility: hidden;
  opacity: 0;
  transform: scale(.984);
  pointer-events: none;
  box-shadow: inset 0 0 46px rgba(0, 0, 0, .28);
}
/* enter fades in like the CRT rendering its page; exit is an instant snap
   back to the scrubbed video (no transition on the base state) */
#screen-clip.active {
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity .45s ease-out, transform .45s ease-out;
}

/* mobile handoff: the page grows out of the glass to fill the viewport */
#screen-clip.expanding {
  z-index: 5;
  transition:
    opacity .45s ease-out,
    left .6s cubic-bezier(.33, 0, .15, 1),
    top .6s cubic-bezier(.33, 0, .15, 1),
    width .6s cubic-bezier(.33, 0, .15, 1),
    height .6s cubic-bezier(.33, 0, .15, 1),
    border-radius .6s cubic-bezier(.33, 0, .15, 1);
}
#scrub-canvas.push-through {
  transition: transform .6s cubic-bezier(.33, 0, .15, 1), opacity .6s ease;
  transform: scale(2.35);
  opacity: .5;
}

/* CRT glass: vignette hugging the edges, scanlines, one soft reflection streak */
#screen-clip::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .035) 12%, transparent 22%),
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .22) 100%),
    repeating-linear-gradient(0deg,
      rgba(0, 0, 0, .05) 0px, rgba(0, 0, 0, .05) 1px,
      transparent 1px, transparent 3px);
}

#screen-clip.bare #fake-chrome { display: none; }

#fake-chrome {
  flex: 0 0 auto;
  background: #d6d3ce;
  border-bottom: 1px solid #7a7a7a;
  padding: 2px;
  /* indent past the CRT corner radius so the title isn't clipped */
  padding-left: calc(var(--glass-r, 12px) * .6);
  padding-right: calc(var(--glass-r, 12px) * .6);
}
.fc-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #000080, #1660c8);
  color: #fff;
  font: bold 11px Verdana, Geneva, sans-serif;
  padding: 3px 6px;
}
.fc-btns { letter-spacing: 1px; opacity: .9; }
.fc-addr {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 11px Verdana, Geneva, sans-serif;
  padding: 3px 4px 1px;
}
.fc-url {
  flex: 1;
  background: #fff;
  border: 1px solid;
  border-color: #7a7a7a #fff #fff #7a7a7a;
  padding: 2px 6px;
  font: 12px "Courier New", monospace;
}

#screen-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;   /* chaining up = zoom back out of the CRT */
  background: #fff;
}
#screen-scroll .page { padding-top: 10px; }

#crt-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}
#crt-flash.zap { animation: crtzap .5s steps(3, end) both; }
@keyframes crtzap {
  0%   { opacity: 0; }
  20%  { opacity: .95; }
  38%  { opacity: .15; }
  60%  { opacity: .75; }
  100% { opacity: 0; }
}

/* intro is an enhancement: gone without JS, gone for reduced motion */
html.no-js #intro { display: none; }
@media (prefers-reduced-motion: reduce) { #intro { display: none; } }

/* ============================================================
   OFFLINE TAKEOVER
   ============================================================ */

#offline-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 99;
  overflow: auto;
}

.offline-inner {
  max-width: 680px;
  margin: 9vh auto 0;
  padding: 0 14px 30px;
  text-align: center;
}

.offline-h { font-size: 30px; margin-bottom: 4px; }

#offline-game-slot .game-shell { margin-top: 18px; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .searchform input[type="text"] { width: 100%; }
  .pegtable { font-size: 13px; }
  .offline-h { font-size: 24px; }
  #intro { height: 300vh; }
}
