/* ============================================================
   High Score Edition — edition-high-score.css
   Full arcade cabinet fantasy: Press Start 2P, CRT bezel,
   scanlines, phosphor green on pure black.
   ============================================================ */

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

:root {
  --hs-black:   #000000;
  --hs-green:   #33ff33;
  --hs-white:   #ffffff;
  --hs-red:     #ff2222;
  --hs-cyan:    #00ccff;
  --hs-yellow:  #ffff00;
  --hs-orange:  #ff8800;
  --hs-magenta: #ff00ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--hs-black);
  color: var(--hs-green);
  font-family: 'Press Start 2P', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Scanline overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.45) 2px,
    rgba(0, 0, 0, 0.45) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Starfield ── */
#hs-starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.hs-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--hs-white);
}

/* ── Pixel rain canvas ── */
#hs-rain-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
}

/* ── CRT bezel wrapper ── */
#hs-bezel {
  position: relative;
  z-index: 10;
  max-width: 1400px;
  margin: 0 auto;
  border: 6px solid #111;
  border-radius: 12px;
  box-shadow:
    0 0 0 2px #222,
    0 0 0 4px #111,
    inset 0 0 80px rgba(51, 255, 51, 0.03),
    0 0 40px rgba(51, 255, 51, 0.08),
    0 0 80px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  min-height: 100vh;
}

/* ── Boot sequence overlay ── */
#hs-boot {
  position: fixed;
  inset: 0;
  background: var(--hs-black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  gap: 20px;
}
.hs-boot-line {
  font-size: 10px;
  color: var(--hs-green);
  opacity: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Header strip ── */
#hs-header {
  position: relative;
  background: var(--hs-black);
  min-height: 220px;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  border-bottom: 2px solid var(--hs-green);
}

/* Mystery ship — absolute at top of header */
#hs-mystery-ship {
  position: absolute;
  top: 4px;
  left: -60px;
  z-index: 20;
}

.hs-title {
  font-size: clamp(18px, 4vw, 48px);
  color: var(--hs-white);
  text-shadow: 0 0 12px var(--hs-green);
  text-align: center;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin-top: 8px;
}
.hs-subtitle {
  font-size: clamp(10px, 2vw, 24px);
  color: var(--hs-yellow);
  text-shadow: 0 0 8px var(--hs-yellow);
  margin-top: 8px;
  letter-spacing: 0.05em;
}

/* Live score counter */
#hs-score-counter {
  font-size: clamp(14px, 2.5vw, 28px);
  color: var(--hs-white);
  letter-spacing: 0.1em;
  margin-top: 8px;
}

/* Alien formation */
#hs-aliens {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.hs-alien-row {
  display: flex;
  gap: 16px;
}
.hs-alien {
  display: inline-block;
  width: 33px;
  height: 24px;
}
.hs-alien svg {
  width: 100%;
  height: 100%;
}

/* Player ship */
#hs-player-ship {
  margin-top: 8px;
}

/* ── Main content ── */
#hs-main {
  padding: 24px 8px 40px;
  background: var(--hs-black);
  min-height: 60vh;
}

/* Table wrapper — horizontal scroll on mobile */
.hs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Score table */
.hs-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  table-layout: fixed;
}
.hs-table thead tr {
  border-bottom: 2px solid var(--hs-cyan);
}
.hs-table thead th {
  font-size: 8px;
  color: var(--hs-cyan);
  padding: 8px 6px;
  text-align: left;
  letter-spacing: 0.1em;
  white-space: nowrap;
  font-weight: 400;
}
.hs-table colgroup .col-rank    { width: 60px; }
.hs-table colgroup .col-score   { width: 90px; }
.hs-table colgroup .col-init    { width: 60px; }
.hs-table colgroup .col-name    { width: auto; }
.hs-table colgroup .col-cat     { width: 110px; }
.hs-table colgroup .col-arrow   { width: 80px; }

/* Table rows */
.hs-row {
  display: table-row;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px solid rgba(51, 255, 51, 0.15);
}
.hs-row:last-child { border-bottom: none; }

.hs-row td {
  padding: 10px 6px;
  font-size: 8px;
  vertical-align: middle;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Rank column */
.hs-col-rank {
  color: var(--hs-green);
  font-size: 10px !important;
  width: 60px;
}
.hs-col-rank.rank-1 { color: #ffdd00; }
.hs-col-rank.rank-2 { color: #c0c0c0; }
.hs-col-rank.rank-3 { color: #cd7f32; }

/* Score column */
.hs-col-score {
  color: var(--hs-white);
  letter-spacing: 0.08em;
  font-size: 9px !important;
}
.hs-score-digit {
  display: inline-block;
}

/* Initials column */
.hs-col-init {
  font-size: 10px !important;
  font-weight: 700;
}

/* Site name */
.hs-col-name {
  color: var(--hs-white);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* with table-layout:fixed, overflow:hidden works */
}

/* Category badge */
.hs-col-cat {
  color: var(--hs-cyan);
  font-size: 7px !important;
  letter-spacing: 0.1em;
}

/* Arrow indicator */
.hs-col-arrow {
  color: var(--hs-green);
  letter-spacing: -0.1em;
  font-size: 9px !important;
}
.hs-arrow-blink {
  display: inline;
}

/* NEW badge */
.hs-new-badge {
  color: var(--hs-red);
  font-size: 6px !important;
  margin-left: 4px;
  white-space: nowrap;
}

/* Laser beam */
.hs-laser {
  position: fixed;
  height: 2px;
  background: var(--hs-red);
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
  z-index: 8000;
  top: 0;
  left: 0;
}

/* ── Detail drawer ── */
.hs-drawer {
  display: none;
  overflow: hidden;
  background: rgba(0, 20, 0, 0.95);
  border: 1px solid var(--hs-green);
  border-top: none;
  padding: 0;
}
.hs-drawer.open {
  display: table-row;
}
.hs-drawer-inner {
  padding: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.hs-drawer-img {
  width: 160px;
  height: 90px;
  object-fit: cover;
  border: 1px solid var(--hs-green);
  flex-shrink: 0;
  background: #001400;
}
.hs-drawer-info {
  flex: 1;
  min-width: 180px;
}
.hs-drawer-desc {
  font-size: 7px;
  color: var(--hs-green);
  line-height: 1.8;
  margin-bottom: 10px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.hs-drawer-pages {
  list-style: none;
}
.hs-drawer-pages li {
  margin-bottom: 4px;
}
.hs-drawer-pages a {
  font-size: 7px;
  color: var(--hs-cyan);
  text-decoration: none;
}
.hs-drawer-pages a:hover { text-decoration: underline; }
.hs-drawer-close {
  display: block;
  margin-top: 10px;
  font-size: 7px;
  color: var(--hs-yellow);
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Press Start 2P', monospace;
  text-align: right;
  width: 100%;
  padding: 0;
}
.hs-drawer-close:hover { color: var(--hs-white); }

/* ── Wave dividers ── */
.hs-wave-div {
  display: table-row;
}
.hs-wave-div-cell {
  padding: 24px 8px;
  text-align: center;
}
.hs-wave-box {
  display: inline-block;
  border: 2px solid var(--hs-green);
  padding: 12px 20px;
  position: relative;
}
.hs-wave-box-text {
  font-size: 8px;
  color: var(--hs-green);
  line-height: 2;
  letter-spacing: 0.08em;
}
.hs-wave-box-bonus {
  font-size: 7px;
  color: var(--hs-yellow);
  letter-spacing: 0.1em;
}
/* Corner pixel explosions */
.hs-wave-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--hs-yellow);
  opacity: 0;
}
.hs-wave-corner.tl { top: -4px; left: -4px; }
.hs-wave-corner.tr { top: -4px; right: -4px; }
.hs-wave-corner.bl { bottom: -4px; left: -4px; }
.hs-wave-corner.br { bottom: -4px; right: -4px; }

/* ── Footer HUD ── */
#hs-footer {
  background: var(--hs-black);
  border-top: 2px solid var(--hs-cyan);
  padding: 20px 16px 24px;
  font-size: 8px;
}
.hs-footer-scores {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 8px;
}
.hs-footer-player {
  text-align: left;
  flex: 1;
}
.hs-footer-player.p2 { text-align: right; }
.hs-footer-player-label { color: var(--hs-yellow); }
.hs-footer-player-score {
  color: var(--hs-white);
  display: block;
  margin-top: 4px;
  font-size: 10px;
}
.hs-footer-center {
  text-align: center;
  flex: 2;
}
.hs-footer-brand {
  color: var(--hs-green);
  font-size: 9px;
  letter-spacing: 0.05em;
}

/* Lives row */
.hs-lives {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
}

/* Footer buttons */
.hs-footer-btns {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 8px;
}
.hs-footer-btn {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--hs-cyan);
  border: 1px solid var(--hs-cyan);
  padding: 6px 10px;
  text-decoration: none;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.hs-footer-btn:hover {
  background: rgba(0, 204, 255, 0.1);
  color: var(--hs-white);
}

/* ── Section wave header rows ── */
.hs-wave-header {
  display: table-row;
}
.hs-wave-header-cell {
  padding: 20px 6px 8px;
  font-size: 10px;
  color: var(--hs-yellow);
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(51, 255, 51, 0.3);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  #hs-boot { display: none !important; }
  .hs-arrow-blink, .hs-new-badge { opacity: 1 !important; animation: none !important; }
}

/* ── Responsive: mobile 375px ── */
@media (max-width: 767px) {
  #hs-bezel {
    border-radius: 0;
    border-left: none;
    border-right: none;
    max-width: 100%;
  }
  .hs-title { font-size: 16px; }
  .hs-subtitle { font-size: 10px; }
  #hs-score-counter { font-size: 12px; }
  .hs-table-wrap {
    margin: 0 -8px;
    padding: 0 8px;
  }
  .hs-col-cat { display: none; }
  .hs-col-arrow { width: 50px; }
  #hs-footer .hs-footer-brand { font-size: 7px; }
  .hs-footer-btn { font-size: 6px; padding: 5px 7px; }
}
