/* =====================================================
   SPEND A TRILLION - MARS 8-BIT HOLOGRAPHIC THEME
   ===================================================== */

:root {
  --bg-deep:       #0d0500;
  --bg-mid:        #1a0a02;
  --bg-card:       #120800;
  --rust:          #8b2500;
  --rust-dark:     #5c1800;
  --dust:          #c4622d;
  --neon-blue:     #00e5ff;
  --neon-purple:   #bf00ff;
  --neon-green:    #39ff14;
  --neon-orange:   #ff6d00;
  --neon-pink:     #ff0090;
  --text-main:     #ffd6a5;
  --text-dim:      #7a4a2a;
  --text-bright:   #ffffff;
  --border:        #00e5ff;
  --border-dim:    #1a4a55;
  --shadow-blue:   0 0 8px #00e5ff88, 0 0 16px #00e5ff44;
  --shadow-purple: 0 0 8px #bf00ff88, 0 0 16px #bf00ff44;
  --shadow-green:  0 0 8px #39ff1488, 0 0 16px #39ff1444;
  --pixel-size: 3px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Press Start 2P', monospace;
  background: var(--bg-deep);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === SCANLINES OVERLAY === */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
}

/* === HUD HEADER === */
#hud {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-deep);
  border-bottom: var(--pixel-size) solid var(--neon-blue);
  box-shadow: var(--shadow-blue), 0 4px 32px rgba(0,0,0,0.9);
}

#hud-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 12px 20px;
}

#title-block { flex: 1 1 200px; }

#title-text {
  display: block;
  font-size: 12px;
  color: var(--neon-orange);
  text-shadow: 0 0 6px var(--neon-orange), 0 0 12px var(--neon-orange);
  letter-spacing: 1px;
  margin-top: 4px;
}

#balance-block, #spent-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#balance-display {
  font-size: 14px;
  color: var(--neon-green);
  text-shadow: var(--shadow-green);
  margin-top: 4px;
  transition: color 0.3s;
}

#balance-display.danger {
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink), 0 0 16px var(--neon-pink);
  animation: blink 0.5s step-end infinite;
}

#spent-display {
  font-size: 14px;
  color: var(--neon-purple);
  text-shadow: var(--shadow-purple);
  margin-top: 4px;
}

.hud-label {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hud-label.tiny { font-size: 6px; }

#toggle-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* === PIXEL TOGGLE SWITCH === */
.pixel-toggle {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 24px;
  cursor: pointer;
  margin-top: 6px;
}

.pixel-toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--rust-dark);
  border: 3px solid var(--text-dim);
  image-rendering: pixelated;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  transition: transform 0.15s steps(4, end), background 0.15s;
}

.pixel-toggle input:checked + .toggle-slider {
  background: #0a1a00;
  border-color: var(--neon-green);
  box-shadow: var(--shadow-green);
}

.pixel-toggle input:checked + .toggle-slider::before {
  transform: translateX(30px);
  background: var(--neon-green);
  box-shadow: var(--shadow-green);
}

#elon-ticker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: fadeIn 0.3s;
}

#elon-bonus-display {
  font-size: 9px;
  color: var(--neon-green);
  text-shadow: var(--shadow-green);
}

#elon-source {
  font-size: 5px;
  color: var(--text-dim);
  letter-spacing: 1px;
  opacity: 0.7;
}

#scanline-bar {
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--neon-purple) 0%,
    var(--neon-blue) 25%,
    var(--neon-green) 50%,
    var(--neon-orange) 75%,
    var(--neon-purple) 100%
  );
  background-size: 200% 100%;
  animation: scanMove 3s linear infinite;
}

@keyframes scanMove {
  0%   { background-position: 0% 0%; }
  100% { background-position: -200% 0%; }
}

/* === SHOP GRID === */
#shop {
  padding: 24px 16px;
  max-width: 1400px;
  margin: 0 auto;
}

#items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* === ITEM CARD === */
.item-card {
  background: var(--bg-card);
  border: 3px solid var(--border-dim);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  image-rendering: pixelated;
}

.item-card::before {
  content: '';
  position: absolute;
  inset: -3px;
  pointer-events: none;
  border: 3px solid transparent;
}

.item-card:hover {
  border-color: var(--neon-blue);
  box-shadow: var(--shadow-blue);
  z-index: 1;
}

/* pixel corner decorations */
.item-card::after {
  content: '';
  position: absolute;
  top: -3px; right: -3px;
  width: 12px; height: 12px;
  background: var(--neon-blue);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  opacity: 0;
  transition: opacity 0.2s;
}
.item-card:hover::after { opacity: 1; }

.card-icon {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-mid);
  border-bottom: 2px solid var(--border-dim);
  font-size: 52px;
  line-height: 1;
  image-rendering: pixelated;
  position: relative;
  overflow: hidden;
}

.card-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(0,0,0,0.12) 8px,
    rgba(0,0,0,0.12) 10px
  );
}

.card-body {
  padding: 10px;
}

.card-name {
  font-size: 9px;
  color: var(--text-bright);
  line-height: 1.8;
  min-height: 40px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.card-price {
  font-size: 10px;
  color: var(--neon-blue);
  text-shadow: var(--shadow-blue);
  margin-bottom: 10px;
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-qty {
  font-size: 11px;
  color: var(--neon-green);
  text-shadow: var(--shadow-green);
  min-width: 28px;
  text-align: center;
  flex: 1;
}

/* === PIXEL BUTTONS === */
.pixel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  cursor: pointer;
  border: none;
  padding: 6px 10px;
  position: relative;
  letter-spacing: 0.5px;
  transition: transform 0.05s, filter 0.1s;
  image-rendering: pixelated;
  user-select: none;
}

.pixel-btn:active { transform: translate(2px, 2px); }

.pixel-btn.buy {
  background: var(--neon-blue);
  color: var(--bg-deep);
  box-shadow:
    3px 3px 0 #005f6b,
    inset 0 1px 0 rgba(255,255,255,0.3);
}
.pixel-btn.buy:hover { filter: brightness(1.3); box-shadow: var(--shadow-blue), 3px 3px 0 #005f6b; }
.pixel-btn.buy:disabled { background: var(--text-dim); color: #222; box-shadow: none; cursor: not-allowed; filter: none; }

.pixel-btn.sell {
  background: var(--rust);
  color: var(--text-main);
  box-shadow:
    3px 3px 0 #3a0f00,
    inset 0 1px 0 rgba(255,255,255,0.15);
}
.pixel-btn.sell:hover { filter: brightness(1.3); }
.pixel-btn.sell:disabled { background: var(--rust-dark); color: #444; box-shadow: none; cursor: not-allowed; filter: none; }

.pixel-btn.reset {
  background: var(--neon-pink);
  color: #000;
  font-size: 7px;
  padding: 5px 8px;
  box-shadow: 3px 3px 0 #700040;
}
.pixel-btn.reset:hover { filter: brightness(1.2); }

/* === RECEIPT === */
#receipt-section {
  max-width: 900px;
  margin: 20px auto 40px;
  padding: 0 16px;
}

#receipt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-mid);
  border: 3px solid var(--neon-purple);
  border-bottom: none;
  padding: 8px 12px;
  box-shadow: var(--shadow-purple);
}

#receipt-header span {
  font-size: 9px;
  color: var(--neon-purple);
  text-shadow: var(--shadow-purple);
}

#receipt-console {
  background: #000;
  border: 3px solid var(--neon-purple);
  border-top: none;
  border-bottom: none;
  height: 200px;
  overflow-y: auto;
  padding: 10px;
  box-shadow: inset 0 0 20px rgba(191,0,255,0.1);
}

#receipt-console::-webkit-scrollbar { width: 6px; }
#receipt-console::-webkit-scrollbar-track { background: #000; }
#receipt-console::-webkit-scrollbar-thumb { background: var(--neon-purple); }

#receipt-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.receipt-line {
  font-size: 9px;
  color: var(--neon-green);
  line-height: 1.6;
  animation: typeIn 0.1s steps(20, end);
}

.receipt-line.dim { color: var(--text-dim); }
.receipt-line.sell { color: var(--dust); }
.receipt-line.system { color: var(--neon-blue); }

#receipt-total {
  background: var(--bg-mid);
  border: 3px solid var(--neon-purple);
  border-top: 2px solid var(--neon-purple);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-purple);
}

#receipt-total span:first-child { font-size: 8px; color: var(--text-dim); }

#receipt-total-amount {
  font-size: 12px;
  color: var(--neon-purple);
  text-shadow: var(--shadow-purple);
}

/* === UTILITIES === */
.hidden { display: none !important; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes typeIn {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

@keyframes purchaseFlash {
  0%   { background: rgba(0, 229, 255, 0.25); }
  100% { background: transparent; }
}

.card-flash { animation: purchaseFlash 0.35s ease-out; }

/* === ZERO STATE === */
#zero-state {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000; /* above scanlines (9999) */
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  text-align: center;
  padding: 20px;
}

#zero-state.show { display: flex; }

#zero-state h2 {
  font-size: 14px;
  color: var(--neon-pink);
  text-shadow: 0 0 12px var(--neon-pink), 0 0 40px var(--neon-pink);
  animation: blink 1s step-end infinite;
  line-height: 1.8;
}

#zero-state p {
  font-size: 8px;
  color: var(--text-main);
  line-height: 2.2;
}

.pixel-btn.new-game {
  background: var(--neon-green);
  color: var(--bg-deep);
  font-size: 8px;
  padding: 10px 20px;
  box-shadow: 4px 4px 0 #004400, var(--shadow-green);
}
.pixel-btn.new-game:hover { filter: brightness(1.2); }

#share-label {
  font-size: 6px;
  color: var(--text-dim);
  letter-spacing: 3px;
}

#share-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.pixel-btn.share-x {
  background: #000;
  color: #fff;
  box-shadow: 3px 3px 0 #333;
  border: 1px solid #444;
}
.pixel-btn.share-x:hover { filter: brightness(1.5); }

.pixel-btn.share-fb {
  background: #1877f2;
  color: #fff;
  box-shadow: 3px 3px 0 #0a4a9e;
}
.pixel-btn.share-fb:hover { filter: brightness(1.2); }

.pixel-btn.share-copy {
  background: var(--neon-purple);
  color: #fff;
  box-shadow: 3px 3px 0 #5a0077;
}
.pixel-btn.share-copy:hover { filter: brightness(1.2); }

/* === CATALOG TOGGLE (HUD) === */
#catalog-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

#catalog-toggle {
  display: flex;
  border: 2px solid var(--border-dim);
}

.catalog-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  cursor: pointer;
  border: none;
  border-right: 2px solid var(--border-dim);
  background: var(--bg-deep);
  color: var(--text-dim);
  padding: 7px 10px;
  letter-spacing: 0.5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.catalog-btn:last-child { border-right: none; }

.catalog-btn:hover:not(.mode-active) {
  color: var(--text-main);
  background: var(--bg-mid);
}

#mode-earth.mode-active {
  background: #001a00;
  color: var(--neon-green);
  text-shadow: var(--shadow-green);
  box-shadow: inset 0 0 10px rgba(57,255,20,0.2);
}

#mode-mars.mode-active {
  background: #1a0500;
  color: var(--neon-orange);
  text-shadow: 0 0 6px var(--neon-orange);
  box-shadow: inset 0 0 10px rgba(255,109,0,0.2);
}

/* === CATALOG PAGE HEADER === */
#catalog-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#catalog-title {
  font-size: 14px;
  letter-spacing: 2px;
  transition: color 0.25s, text-shadow 0.25s;
}

#catalog-sub {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 3px;
}

body.earth-mode #catalog-title {
  color: var(--neon-green);
  text-shadow: var(--shadow-green);
}

body.mars-mode #catalog-title {
  color: var(--neon-orange);
  text-shadow: 0 0 8px var(--neon-orange), 0 0 16px var(--neon-orange);
}

body.earth-mode #catalog-sub::after { content: ' :: TERRA FIRMA GOODS'; }
body.mars-mode  #catalog-sub::after { content: ' :: DEEP SPACE OPS'; }

/* === AD SLOTS === */

/* Body padding so content isn't hidden behind sticky banner */
body { padding-bottom: 90px; }

/* Neon micro-label shared by both slots */
.ad-slot-label {
  font-size: 5px;
  letter-spacing: 3px;
  color: var(--neon-orange);
  text-shadow: 0 0 6px var(--neon-orange);
  text-align: center;
  padding: 4px 0 2px;
  opacity: 0.8;
}

/* Container for the ins tag */
.ad-inner {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hint text shown when AdSense hasn't loaded (no real ad) */
.ad-hint {
  font-size: 5px;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 8px 8px;
  line-height: 2;
}

/* ── Grid inline ad card ── */
.ad-card {
  background: var(--bg-card);
  border: 3px solid var(--neon-orange) !important;
  box-shadow: 0 0 8px #ff6d0055, 0 0 16px #ff6d0022;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 200px;
}

.ad-card:hover {
  border-color: var(--neon-orange) !important;
  box-shadow: 0 0 12px #ff6d0088, 0 0 24px #ff6d0044 !important;
}

/* corner accent — orange instead of blue */
.ad-card::after {
  background: var(--neon-orange) !important;
  opacity: 1 !important;
}

.ad-card .ad-inner {
  flex: 1;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(255,109,0,0.04) 8px,
    rgba(255,109,0,0.04) 10px
  );
}

/* ── Sticky bottom banner ── */
#ad-anchor {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--bg-deep);
  border-top: 3px solid var(--neon-orange);
  box-shadow: 0 -4px 20px rgba(255,109,0,0.25), 0 -1px 0 var(--neon-orange);
  padding: 2px 0 4px;
}

#ad-anchor .ad-inner {
  max-width: 970px;
  margin: 0 auto;
  min-height: 60px;
}

/* ── Placeholder fill shown before real ads load ── */
.adsbygoogle {
  background: repeating-linear-gradient(
    90deg,
    rgba(255,109,0,0.03) 0px,
    rgba(255,109,0,0.03) 4px,
    transparent 4px,
    transparent 8px
  );
  min-height: 60px;
}

/* === FOOTER === */
#site-footer {
  text-align: center;
  padding: 20px 16px 12px;
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

#site-footer a {
  color: var(--neon-blue);
  text-decoration: none;
  text-shadow: 0 0 6px var(--neon-blue);
}

#site-footer a:hover { filter: brightness(1.4); }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  #hud-inner { gap: 8px 12px; padding: 8px 10px; }
  #balance-display, #spent-display { font-size: 10px; }
  #title-text { font-size: 9px; }
  #items-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
  .card-icon { height: 80px; font-size: 40px; }
  .card-name { font-size: 7px; }
}
