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

:root {
  --dirt:    #6b4226;
  --dirt2:   #825335;
  --grass:   #5d9e32;
  --grass2:  #4a8027;
  --stone:   #808080;
  --stone2:  #696969;
  --wood:    #8B6914;
  --diamond: #4fd0e0;
  --gold:    #c8a951;
  --iron:    #c9b8a0;
  --sol:     #9945ff;
  --sol2:    #7c35d6;
  --sky:     #87ceeb;
  --night:   #0d1b2a;
  --text:    #fff;
  --shadow:  #000;
}

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

body {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  line-height: 1.8;
  background-color: var(--night);
  background-image:
    /* stars */
    radial-gradient(1px 1px at 10% 15%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 5%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 20%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 8%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 18%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 30%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 35%, #fff 0%, transparent 100%),
    /* gradient sky-to-night */
    linear-gradient(to bottom, #1a3a5c 0%, #0d1b2a 40%, #0d1b2a 100%);
  color: var(--text);
  min-height: 100vh;
}

/* ===== PIXEL BORDER MIXIN ===== */
.pixel-box {
  border: 4px solid #000;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,0.5), inset 4px 4px 0 rgba(255,255,255,0.15);
  image-rendering: pixelated;
}

/* ===== NAVBAR ===== */
.nav {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 0 20px;
  background: var(--dirt);
  border-bottom: 8px solid var(--grass);
  box-shadow: 0 4px 0 var(--grass2), 0 8px 0 rgba(0,0,0,0.5);
  position: sticky; top: 0; z-index: 100;
}
.nav .logo {
  font-size: 14px; color: var(--gold); letter-spacing: 1px;
  text-shadow: 3px 3px 0 #6b4d1a, -1px -1px 0 #000;
  padding: 12px 0;
}
.nav a {
  color: #fff; text-decoration: none; font-size: 8px; padding: 12px 4px;
  text-shadow: 2px 2px 0 #000;
}
.nav a:hover { color: var(--gold); }
.nav .spacer { flex: 1; }

/* ===== BUTTONS ===== */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: var(--grass);
  color: #fff;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000, inset 0 0 0 2px rgba(255,255,255,0.15);
  text-shadow: 2px 2px 0 #000;
  image-rendering: pixelated;
  transition: transform 0.05s;
}
.btn:hover  { filter: brightness(1.2); transform: translate(-1px,-1px); box-shadow: 4px 4px 0 #000; }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }
.btn.secondary { background: var(--stone2); }
.btn.gold      { background: var(--wood); color: var(--gold); }
.btn.sol       { background: var(--sol2); }

/* ===== CARDS / PANELS ===== */
.card {
  background: var(--stone2);
  border: 4px solid #000;
  box-shadow: 4px 4px 0 #000, inset 0 0 0 2px rgba(255,255,255,0.08);
  padding: 20px;
  margin: 12px 0;
}
.card h3 { color: var(--gold); text-shadow: 2px 2px 0 #000; margin-bottom: 10px; font-size: 10px; }
.card p  { color: #ddd; font-size: 8px; line-height: 2; }

/* ===== GROUND STRIP (decorative pixel terrain) ===== */
.ground {
  width: 100%;
  height: 48px;
  background:
    repeating-linear-gradient(90deg,
      var(--grass) 0px, var(--grass) 16px,
      var(--grass2) 16px, var(--grass2) 32px);
  border-top: 4px solid #000;
  border-bottom: 4px solid #000;
  position: relative;
  overflow: hidden;
}
.ground::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; top: 16px;
  background: repeating-linear-gradient(90deg,
    var(--dirt) 0px, var(--dirt) 16px,
    var(--dirt2) 16px, var(--dirt2) 32px);
  border-top: 4px solid #000;
}

/* ===== HERO ===== */
.hero { text-align: center; padding: 60px 20px 30px; }
.hero h1 {
  font-size: 28px; line-height: 1.4; margin-bottom: 20px;
  color: var(--gold);
  text-shadow: 4px 4px 0 #6b4d1a, 6px 6px 0 #000;
}
@media(max-width:600px){ .hero h1 { font-size: 18px; } }
.hero p { font-size: 9px; color: #ccc; max-width: 560px; margin: 0 auto 28px; line-height: 2.2; }

/* ===== WRAP ===== */
.wrap { max-width: 960px; margin: 0 auto; padding: 30px 16px; }

/* ===== GRID ===== */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* ===== TABLE ===== */
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 12px; text-align: left;
  background: var(--dirt); color: var(--gold);
  font-size: 8px; border-bottom: 4px solid #000;
  text-shadow: 2px 2px 0 #000;
}
td {
  padding: 10px 12px; font-size: 8px; border-bottom: 2px solid #000;
  background: rgba(0,0,0,0.2);
}
tr:nth-child(even) td { background: rgba(255,255,255,0.04); }
.rank-1 td { color: var(--gold); background: rgba(255,215,0,0.08) !important; }
.rank-2 td { color: #c0c0c0; }
.rank-3 td { color: #cd7f32; }

/* ===== PRIZE POOL DISPLAY ===== */
.pool {
  font-size: 28px; color: var(--diamond);
  text-shadow: 3px 3px 0 #006677, 5px 5px 0 #000;
  margin: 12px 0;
}

/* ===== SHOP ITEMS ===== */
.shop-item { text-align: center; }
.shop-item .icon { font-size: 40px; display: block; margin-bottom: 8px; image-rendering: auto; }
.shop-item h3 { font-size: 8px; color: var(--gold); text-shadow: 2px 2px 0 #000; margin-bottom: 8px; }
.shop-item .price { font-size: 12px; color: var(--diamond); text-shadow: 2px 2px 0 #000; margin: 8px 0; }
.shop-item p { font-size: 7px; color: #aaa; margin-bottom: 12px; }
.owned { opacity: 0.45; pointer-events: none; }

/* ===== PIXEL BLOCK TILES (decorative) ===== */
.blocks-row {
  display: flex; gap: 0; margin: 24px 0;
  border: 4px solid #000;
  overflow: hidden;
}
.block-tile {
  flex: 1; height: 48px;
  border-right: 2px solid rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ===== PASS BANNER ===== */
#pass-banner {
  background: var(--dirt2);
  border: 4px solid #000;
  box-shadow: 4px 4px 0 #000;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
#pass-banner .msg { flex: 1; font-size: 7px; color: #ddd; line-height: 2.2; }
#pass-banner.active { background: #1a3d1a; border-color: var(--grass); }

/* ===== MODAL ===== */
#modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.85); z-index: 999;
  align-items: center; justify-content: center;
}
#modal .modal-inner {
  max-width: 420px; width: 90%;
  background: var(--stone2);
  border: 4px solid #000;
  box-shadow: 6px 6px 0 #000;
  padding: 28px; text-align: center; position: relative;
}
#modal h2 { font-size: 14px; color: var(--gold); text-shadow: 3px 3px 0 #000; margin: 12px 0; }
#modal p  { font-size: 8px; color: #ccc; line-height: 2.2; margin-bottom: 10px; }
.modal-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: #fff; font-size: 16px; cursor: pointer;
  font-family: 'Press Start 2P', monospace;
}

/* ===== GAME CONTAINER ===== */
#game-container { display: flex; justify-content: center; margin: 0; }
#game-container canvas { border: 4px solid #000; box-shadow: 6px 6px 0 #000; }

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 12px; color: var(--gold);
  text-shadow: 3px 3px 0 #6b4d1a, 4px 4px 0 #000;
  margin-bottom: 16px; margin-top: 8px;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--dirt);
  border-top: 4px solid #000;
  box-shadow: 0 -3px 0 var(--grass2);
  padding: 20px 16px 24px;
  text-align: center;
  font-family: sans-serif;
}
.footer-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 24px;
  margin-bottom: 10px;
}
.footer-links a {
  color: #bbb; text-decoration: none; font-size: 13px;
}
.footer-links a:hover { color: var(--gold); }
.footer-copy { font-size: 12px; color: #777; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 12px; background: var(--dirt); }
::-webkit-scrollbar-thumb { background: var(--stone); border: 2px solid #000; }
