/* ============================================================
   ATARI HIGH SCORES — PUBLIC RETRO ARCADE THEME
   1983 Atari 2600 era CRT aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ---- Custom Properties ------------------------------------ */
:root {
  --bg:            #000000;
  --bg-card:       #0c0c18;
  --bg-alt:        #080810;
  --orange:        #ff6600;
  --orange-dim:    #7a3100;
  --cyan:          #00eeff;
  --yellow:        #ffff00;
  --magenta:       #ff00bb;
  --green:         #00ff41;
  --gold:          #ffd700;
  --silver:        #c0c0c0;
  --bronze:        #cd7f32;
  --white:         #ffffff;

  --glow-orange:   0 0 6px #ff6600, 0 0 18px rgba(255,102,0,.5);
  --glow-cyan:     0 0 6px #00eeff, 0 0 18px rgba(0,238,255,.5);
  --glow-yellow:   0 0 6px #ffff00, 0 0 18px rgba(255,255,0,.5);
  --glow-magenta:  0 0 6px #ff00bb, 0 0 18px rgba(255,0,187,.5);
  --glow-gold:     0 0 6px #ffd700, 0 0 18px rgba(255,215,0,.5);

  --font-pixel: 'Press Start 2P', monospace;
  --font-mono:  'Courier New', Courier, monospace;
}

/* ---- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 18px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--orange);
  font-family: var(--font-pixel);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* ---- CRT Scanlines --------------------------------------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.09) 2px,
    rgba(0,0,0,.09) 4px
  );
  pointer-events: none;
  z-index: 9997;
}

/* ---- CRT Vignette ---------------------------------------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.7) 100%);
  pointer-events: none;
  z-index: 9998;
}

/* ---- Layout ---------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Site Header ----------------------------------------- */
.site-header {
  text-align: center;
  padding: 36px 20px 28px;
  background: linear-gradient(180deg, #0a0012 0%, var(--bg) 100%);
  border-bottom: 2px solid var(--orange);
  box-shadow: 0 2px 24px rgba(255,102,0,.3);
  position: relative;
}

.site-header__eyebrow {
  display: block;
  font-size: .45rem;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: .6em;
  margin-bottom: 14px;
}

.site-title {
  font-size: clamp(1rem, 4.5vw, 2.6rem);
  color: var(--orange);
  text-shadow: var(--glow-orange);
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.35;
  animation: glow-pulse 3s ease-in-out infinite;
}

.site-subtitle {
  margin-top: 12px;
  font-size: .48rem;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: .3em;
}

/* ---- Ticker/Marquee -------------------------------------- */
.ticker-wrap {
  overflow: hidden;
  background: var(--orange);
  color: #000;
  padding: 5px 0;
  border-top: 2px solid var(--yellow);
  border-bottom: 2px solid var(--yellow);
  font-size: .45rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ticker-content {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: ticker 35s linear infinite;
}

@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ---- Section Header -------------------------------------- */
.section-header {
  text-align: center;
  padding: 40px 20px 28px;
}

.section-title {
  display: inline-block;
  font-size: clamp(.55rem, 1.8vw, .85rem);
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  letter-spacing: .25em;
  text-transform: uppercase;
}

.section-title::before { content: '\25C4 '; }
.section-title::after  { content: ' \25BA'; }

/* ---- Games Grid ------------------------------------------ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding-bottom: 20px;
}

/* ---- Game Card ------------------------------------------- */
.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid rgba(255,102,0,.28);
  box-shadow: none;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--cyan);
  box-shadow: 0 0 28px rgba(0,238,255,.45), 0 10px 20px rgba(0,0,0,.6);
}

.game-card:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.game-card__artwork {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #090915;
  overflow: hidden;
}

.game-card__artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
  transition: transform .3s ease;
}

.game-card:hover .game-card__artwork img {
  transform: scale(1.06);
}

.game-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: .4rem;
  color: var(--orange-dim);
  text-align: center;
  padding: 16px;
  letter-spacing: .1em;
}

.game-card__placeholder-icon {
  font-size: 2.5rem;
  opacity: .25;
  line-height: 1;
}

.game-card__body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255,102,0,.25);
}

.game-card__name {
  font-size: .58rem;
  color: var(--orange);
  text-shadow: var(--glow-orange);
  text-transform: uppercase;
  line-height: 1.7;
}

.game-card__meta {
  font-size: .38rem;
  color: var(--cyan);
  letter-spacing: .1em;
}

.game-card__top3 {
  list-style: none;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.game-card__top3-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: .38rem;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,102,0,.1);
}

.game-card__top3-row:last-child { border-bottom: none; }

.game-card__top3-rank-1 .game-card__top3-player { color: var(--gold); }
.game-card__top3-rank-2 .game-card__top3-player { color: var(--silver); }
.game-card__top3-rank-3 .game-card__top3-player { color: var(--bronze); }

.game-card__top3-player {
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: .05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.game-card__top3-score {
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.game-card__top3-rank-1 .game-card__top3-score {
  text-shadow: var(--glow-gold);
  color: var(--gold);
}

.game-card__cta {
  margin-top: auto;
  display: block;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--orange);
  color: var(--orange);
  font-family: var(--font-pixel);
  font-size: .42rem;
  text-align: center;
  text-decoration: none;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background .12s, color .12s;
}

.game-card__cta:hover {
  background: var(--orange);
  color: #000;
}

/* ---- Game Hero (leaderboard page) ----------------------- */
.game-hero {
  padding: 36px 20px;
  border-bottom: 1px solid rgba(255,102,0,.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.game-hero__back {
  align-self: flex-start;
  display: inline-block;
  font-size: .48rem;
  color: var(--cyan);
  text-decoration: none;
  text-shadow: var(--glow-cyan);
  letter-spacing: .1em;
  margin-bottom: 4px;
}

.game-hero__back::before { content: '\25C4 '; }

.game-hero__back:hover {
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
}

.game-hero__artwork {
  width: min(340px, 90%);
  border: 3px solid var(--cyan);
  box-shadow: 0 0 24px rgba(0,238,255,.4);
  overflow: hidden;
  line-height: 0;
}

.game-hero__artwork img {
  width: 100%;
  height: auto;
  display: block;
}

.game-hero__artwork-placeholder {
  aspect-ratio: 4 / 3;
  background: #090915;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .5rem;
  color: var(--orange-dim);
  letter-spacing: .1em;
}

.game-hero__title {
  font-size: clamp(.75rem, 3vw, 1.4rem);
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.game-hero__description {
  max-width: 600px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: rgba(255,102,0,.7);
  line-height: 1.7;
}

/* ---- Leaderboard ----------------------------------------- */
.leaderboard-section {
  padding: 40px 20px 60px;
  max-width: 920px;
  margin: 0 auto;
}

.leaderboard-heading {
  text-align: center;
  font-size: clamp(.55rem, 2vw, .75rem);
  color: var(--magenta);
  text-shadow: var(--glow-magenta);
  letter-spacing: .3em;
  margin-bottom: 30px;
  text-transform: uppercase;
}

.leaderboard-heading::before,
.leaderboard-heading::after {
  content: ' \2605\2605\2605 ';
}

/* Wrapper clips overflow on small screens */
.table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .48rem;
  min-width: 480px;
}

.leaderboard-table thead th {
  padding: 12px 16px;
  text-align: left;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  border-bottom: 2px solid var(--cyan);
  text-transform: uppercase;
  letter-spacing: .15em;
  white-space: nowrap;
}

.leaderboard-table thead th.col-score,
.leaderboard-table tbody td.col-score { text-align: right; }

.leaderboard-table tbody tr {
  border-bottom: 1px solid rgba(255,102,0,.12);
  transition: background .1s;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255,102,0,.06);
}

.leaderboard-table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
}

/* Rank column */
.col-rank { white-space: nowrap; font-size: .52rem; }

tr.rank-gold   .col-rank { color: var(--gold);   text-shadow: var(--glow-gold);   }
tr.rank-silver .col-rank { color: var(--silver); text-shadow: 0 0 6px var(--silver); }
tr.rank-bronze .col-rank { color: var(--bronze); text-shadow: 0 0 6px var(--bronze); }

tr.rank-gold   { background: rgba(255,215,0,.04);  }
tr.rank-silver { background: rgba(192,192,192,.04); }
tr.rank-bronze { background: rgba(205,127,50,.04);  }

/* Player name */
.col-player {
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Score */
.col-score {
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  font-size: .55rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

tr.rank-gold .col-score {
  color: var(--gold);
  text-shadow: var(--glow-gold);
  font-size: .62rem;
}

/* Date */
.col-date {
  color: var(--orange-dim);
  font-size: .38rem;
  letter-spacing: .06em;
  white-space: nowrap;
}

/* ---- Empty / No games ------------------------------------ */
.empty-state {
  text-align: center;
  padding: 70px 20px;
}

.empty-state__msg {
  display: inline-block;
  font-size: .6rem;
  color: var(--orange-dim);
  letter-spacing: .2em;
  animation: blink 1.2s step-end infinite;
}

/* ---- Insert Coin ----------------------------------------- */
.insert-coin {
  text-align: center;
  padding: 24px 20px;
  font-size: .58rem;
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  animation: blink 1s step-end infinite;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* ---- Footer ---------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 28px 20px;
  border-top: 1px solid rgba(255,102,0,.25);
  font-size: .38rem;
  color: var(--orange-dim);
  letter-spacing: .15em;
}

.site-footer a {
  color: var(--cyan);
  text-decoration: none;
}

.site-footer a:hover {
  text-shadow: var(--glow-cyan);
}

/* ---- Animations ------------------------------------------ */
@keyframes blink {
  0%,  49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 6px var(--orange), 0 0 18px rgba(255,102,0,.4); }
  50%       { text-shadow: 0 0 12px var(--orange), 0 0 40px rgba(255,102,0,.75), 0 0 70px rgba(255,102,0,.3); }
}

/* ---- Responsive ------------------------------------------ */
@media (max-width: 640px) {
  .games-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  /* Hide date column on mobile leaderboard */
  .leaderboard-table thead th.col-date,
  .leaderboard-table tbody td.col-date {
    display: none;
  }

  .site-title {
    font-size: 1rem;
  }
}
