/* ============================================================
   PIXEL 8-BIT RETRO THEME — homepage only
   Chunky pixel borders, NES/Game Boy palette, monospace type.
   ============================================================ */

:root {
  --px: 4px;                 /* base pixel unit for stepped borders */
  --ink: #0f1a12;             /* near-black green-ink */
  --bg: #1c2b1a;               /* deep olive background */
  --bg-alt: #24371f;
  --panel: #2f4a26;            /* card panel green */
  --panel-lt: #3d5c30;
  --line: #0f1a12;
  --green: #6ab04c;            /* NES green */
  --green-lt: #9ed36f;
  --yellow: #f7d51d;           /* coin yellow */
  --red: #e6473d;              /* Game Boy red */
  --blue: #3aa0d1;
  --white: #eef7e6;
  --shadow-col: #0a120a;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: "Courier New", "Consolas", "Lucida Console", monospace;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}

body { padding-bottom: 24px; }

img { image-rendering: pixelated; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* pixel-step border mixin via box-shadow rings */
.pixel-border {
  box-shadow:
    inset 0 0 0 var(--px) var(--line),
    0 var(--px) 0 0 var(--line),
    var(--px) 0 0 0 var(--line),
    0 calc(var(--px) * -1) 0 0 var(--line),
    calc(var(--px) * -1) 0 0 0 var(--line);
}

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: var(--px) solid var(--line);
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-logo {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--shadow-col);
}
.topbar-search-btn {
  background: var(--yellow);
  color: var(--ink);
  border: none;
  box-shadow: 3px 3px 0 var(--shadow-col);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-search-btn:active { box-shadow: 1px 1px 0 var(--shadow-col); transform: translate(2px, 2px); }

/* ---------- Category Tabs ---------- */
.cat-tabs {
  background: var(--bg-alt);
  border-bottom: var(--px) solid var(--line);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs-inner { display: inline-flex; gap: 8px; padding: 10px 12px; }
.cat-tab {
  flex: none;
  background: var(--panel);
  color: var(--white);
  border: none;
  box-shadow: 2px 2px 0 var(--shadow-col);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.cat-tab.active {
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--shadow-col), inset 0 0 0 2px var(--ink);
}

/* ---------- Search Bar ---------- */
.search-bar-wrap {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border-bottom: var(--px) solid var(--line);
}
.search-input {
  flex: 1;
  background: var(--ink);
  color: var(--green-lt);
  border: 2px solid var(--line);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.4);
  padding: 9px 10px;
  font-family: inherit;
  font-size: 13px;
}
.search-input::placeholder { color: #4a6b3f; }
.search-cancel {
  background: var(--red);
  color: var(--white);
  border: none;
  box-shadow: 2px 2px 0 var(--shadow-col);
  padding: 0 14px;
  font-weight: 700;
}

/* ---------- Loading ---------- */
.loading-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 16px;
}
.loading-ring {
  width: 28px;
  height: 28px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--shadow-col);
  animation: pixel-spin 1s steps(4) infinite;
}
@keyframes pixel-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading-txt { color: var(--green-lt); font-weight: 700; letter-spacing: 2px; }
.blinker { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Section header ---------- */
.sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 8px;
}
.sec-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--yellow);
  text-shadow: 1px 1px 0 var(--shadow-col);
  text-transform: uppercase;
}
.sec-more, .sec-cnt {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--green-lt);
  border: none;
  padding: 4px 8px;
  box-shadow: 2px 2px 0 var(--shadow-col);
}

/* ============ Cartridge Hero ============ */
.hero-sec { padding: 12px; }
.cart-hero {
  position: relative;
  display: block;
  background: var(--panel);
  border: var(--px) solid var(--line);
  box-shadow: 6px 6px 0 var(--shadow-col);
  padding: 14px 12px 16px;
}
.cart-hero-notch {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 14px;
  background: var(--bg);
  border: var(--px) solid var(--line);
  border-top: none;
}
.cart-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-top: 6px;
}
.cart-hero-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--yellow);
  letter-spacing: 1px;
}
.cart-hero-cat {
  font-size: 11px;
  background: var(--ink);
  color: var(--green-lt);
  padding: 3px 6px;
}
.cart-hero-body { display: flex; gap: 12px; align-items: center; }
.cart-hero-img {
  flex: none;
  width: 96px;
  height: 96px;
  background: var(--ink);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  overflow: hidden;
}
.cart-hero-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-hero-info { flex: 1; min-width: 0; }
.cart-hero-title {
  font-size: 16px;
  margin: 0 0 6px;
  color: var(--white);
  text-shadow: 2px 2px 0 var(--shadow-col);
  line-height: 1.2;
}
.cart-hero-desc { font-size: 11px; color: var(--green-lt); margin: 0 0 10px; line-height: 1.4; }
.cart-hero-cta {
  display: inline-block;
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  box-shadow: 2px 2px 0 var(--shadow-col);
  animation: cta-pulse 1.4s steps(2) infinite;
}
@keyframes cta-pulse { 50% { opacity: 0.55; } }

/* ============ Hot Cartridges grid ============ */
.cart-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 6px 12px 4px;
}
.cart-item {
  position: relative;
  background: var(--panel-lt);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cart-item-tab {
  position: absolute;
  top: -6px;
  left: -6px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border: 2px solid var(--line);
}
.cart-item-img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--ink);
  border: 2px solid var(--line);
  overflow: hidden;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-nm {
  font-size: 10px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 1.2;
}

/* ============ High Score Table ============ */
.score-table { padding: 6px 12px 4px; }
.score-hdr, .score-row {
  display: grid;
  grid-template-columns: 34px 1fr 70px;
  gap: 8px;
  align-items: center;
}
.score-hdr {
  font-size: 10px;
  font-weight: 700;
  color: var(--yellow);
  padding: 0 8px 6px;
  border-bottom: 2px dashed var(--panel-lt);
}
.score-col-rank, .score-col-nm, .score-col-bar { letter-spacing: 1px; }
.score-col-bar { text-align: right; }

/* generic section wrapper spacing (sections that only need sec-hd + inner grid) */
.hot-sec, .score-sec, .dlg-sec, .channel-sec, .map-sec, .inv-sec,
.quest-sec, .combo-sec, .dungeon-sec, .boss-sec, .shop-sec, .coin-sec {
  display: block;
}
.score-row {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--shadow-col);
  padding: 8px;
  margin-bottom: 8px;
}
.score-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--yellow);
}
.score-nm { font-size: 12px; font-weight: 700; color: var(--white); min-width: 0; }
.score-desc {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--green-lt);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.score-bar-wrap {
  height: 10px;
  background: var(--ink);
  border: 2px solid var(--line);
}
.score-bar { display: block; height: 100%; background: var(--green); }

/* ============ Dialogue box feed ============ */
.dlg-list { padding: 6px 12px 4px; display: flex; flex-direction: column; gap: 10px; }
.dlg-box { display: flex; gap: 10px; align-items: flex-start; }
.dlg-face {
  flex: none;
  width: 48px;
  height: 48px;
  background: var(--ink);
  border: 3px solid var(--line);
  box-shadow: 2px 2px 0 var(--shadow-col);
  overflow: hidden;
}
.dlg-face img { width: 100%; height: 100%; object-fit: cover; }
.dlg-bubble {
  flex: 1;
  min-width: 0;
  background: var(--white);
  color: var(--ink);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  padding: 8px 10px;
  position: relative;
}
.dlg-bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 12px;
  width: 0; height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--line);
}
.dlg-name { display: block; font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.dlg-tag { font-style: normal; font-size: 9px; color: var(--red); }
.dlg-text { font-size: 11px; margin: 0; line-height: 1.35; }

/* ============ Save slot grid ============ */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 6px 12px 4px;
}
.slot-card {
  background: var(--bg-alt);
  border: 3px solid var(--line);
  box-shadow: 2px 2px 0 var(--shadow-col);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.slot-lbl { font-size: 8px; color: var(--blue); font-weight: 700; }
.slot-img { width: 100%; aspect-ratio: 1; background: var(--ink); border: 2px solid var(--line); overflow: hidden; }
.slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot-nm { font-size: 9px; color: var(--white); text-align: center; line-height: 1.2; }

/* ============ World map stepping stones (Action) ============ */
.map-row {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: 10px 14px 16px;
  gap: 2px;
  scrollbar-width: none;
}
.map-row::-webkit-scrollbar { display: none; }
.map-node {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 78px;
}
.map-node-img {
  width: 60px;
  height: 60px;
  background: var(--green);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  overflow: hidden;
}
.map-node-img img { width: 100%; height: 100%; object-fit: cover; }
.map-node-nm { font-size: 9px; text-align: center; color: var(--white); line-height: 1.2; }
.map-path { flex: none; color: var(--green); font-weight: 700; padding-bottom: 22px; }

/* ============ Inventory grid (Puzzle) ============ */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 6px 12px 4px;
}
.inv-slot {
  background: var(--panel);
  border: 3px double var(--line);
  box-shadow: 2px 2px 0 var(--shadow-col);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.inv-img { width: 100%; aspect-ratio: 1; background: var(--ink); border: 2px solid var(--line); overflow: hidden; }
.inv-img img { width: 100%; height: 100%; object-fit: cover; }
.inv-nm { font-size: 9px; color: var(--white); text-align: center; line-height: 1.2; }

/* ============ Quest log (Kids) ============ */
.quest-list { padding: 6px 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.quest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-alt);
  border: 2px dashed var(--green-lt);
  padding: 8px 10px;
}
.quest-check { color: var(--yellow); font-size: 14px; }
.quest-img { width: 38px; height: 38px; flex: none; background: var(--ink); border: 2px solid var(--line); overflow: hidden; }
.quest-img img { width: 100%; height: 100%; object-fit: cover; }
.quest-nm { flex: 1; font-size: 12px; color: var(--white); font-weight: 700; }
.quest-arrow { color: var(--red); font-weight: 700; }

/* ============ Combo meter row (Sports) ============ */
.combo-row { display: flex; gap: 10px; overflow-x: auto; padding: 6px 12px 12px; scrollbar-width: none; }
.combo-row::-webkit-scrollbar { display: none; }
.combo-card {
  flex: none;
  width: 88px;
  position: relative;
  background: var(--panel-lt);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.combo-num {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--red);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
}
.combo-img { width: 100%; aspect-ratio: 1; background: var(--ink); border: 2px solid var(--line); overflow: hidden; }
.combo-img img { width: 100%; height: 100%; object-fit: cover; }
.combo-nm { font-size: 9px; color: var(--white); text-align: center; line-height: 1.2; }

/* ============ Dungeon grid (Adventure) ============ */
.dungeon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 6px 12px 4px;
}
.dungeon-cell {
  position: relative;
  display: block;
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow-col);
  overflow: hidden;
}
.dungeon-img { aspect-ratio: 4/3; background: var(--ink); }
.dungeon-img img { width: 100%; height: 100%; object-fit: cover; }
.dungeon-nm {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--white);
  background: rgba(15,26,18,0.85);
  padding: 5px 6px;
}

/* ============ Boss banner (Racing) ============ */
.boss-banner {
  position: relative;
  display: block;
  margin: 6px 12px 4px;
  border: 4px solid var(--line);
  box-shadow: 5px 5px 0 var(--shadow-col);
  overflow: hidden;
}
.boss-banner img { width: 100%; height: 150px; object-fit: cover; display: block; }
.boss-ovl {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(10,18,10,0.92) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  gap: 3px;
}
.boss-badge {
  align-self: flex-start;
  background: var(--red);
  color: var(--white);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 6px;
}
.boss-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--white); text-shadow: 2px 2px 0 var(--shadow-col); }
.boss-desc { margin: 0; font-size: 10px; color: var(--green-lt); }
.boss-cta { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--yellow); }

/* ============ Item shop list (Girl) ============ */
.shop-list { padding: 6px 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--shadow-col);
  padding: 8px;
}
.shop-img { width: 44px; height: 44px; flex: none; background: var(--ink); border: 2px solid var(--line); overflow: hidden; }
.shop-img img { width: 100%; height: 100%; object-fit: cover; }
.shop-body { flex: 1; min-width: 0; }
.shop-nm { margin: 0 0 3px; font-size: 12px; font-weight: 700; color: var(--white); }
.shop-desc { margin: 0; font-size: 10px; color: var(--green-lt); }
.shop-price {
  flex: none;
  background: var(--yellow);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
}

/* ============ Coin row (Arcade) ============ */
.coin-row { display: flex; gap: 12px; padding: 6px 12px 12px; overflow-x: auto; scrollbar-width: none; }
.coin-row::-webkit-scrollbar { display: none; }
.coin-card {
  flex: none;
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.coin-card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
}
.coin-slot { font-size: 10px; font-weight: 700; color: var(--yellow); }

/* ============ All Games pixel grid ============ */
.all-sec { padding-bottom: 8px; }
.all-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 6px 12px;
}
.agcard, .gcard {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agcard-img, .gcard-img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--ink);
  border: 2px solid var(--line);
  overflow: hidden;
}
.agcard-img img, .gcard-img img { width: 100%; height: 100%; object-fit: cover; }
.agcard-nm, .gcard-nm {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 1.2;
}

.more-wrap, .loadmore-wrap { display: flex; justify-content: center; padding: 14px 12px 8px; }
.more-btn, .loadmore-btn {
  background: var(--green);
  color: var(--ink);
  border: none;
  box-shadow: 3px 3px 0 var(--shadow-col);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 10px 20px;
}
.more-btn:active, .loadmore-btn:active { box-shadow: 1px 1px 0 var(--shadow-col); transform: translate(2px,2px); }

/* ============ Filter / Search header + grid ============ */
.filter-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-alt);
  border-bottom: var(--px) solid var(--line);
}
.filter-back {
  background: var(--yellow);
  color: var(--ink);
  border: none;
  box-shadow: 2px 2px 0 var(--shadow-col);
  font-weight: 700;
  font-size: 11px;
  padding: 6px 10px;
}
.filter-title { flex: 1; font-size: 13px; font-weight: 700; color: var(--white); }
.filter-cnt { font-size: 11px; color: var(--green-lt); }

.grid-sec { padding: 4px 0 8px; }
.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 12px;
}
.empty-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--green-lt);
  font-size: 13px;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 22px 12px;
  font-size: 11px;
  color: var(--green-lt);
  border-top: var(--px) solid var(--line);
  margin-top: 10px;
}
.site-footer a { text-decoration: underline; }
.site-footer span { margin: 0 8px; }

/* ---------- Back to top ---------- */
.totop-btn {
  position: fixed;
  right: 14px;
  bottom: 18px;
  width: 40px;
  height: 40px;
  background: var(--red);
  color: var(--white);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow-col);
  font-size: 16px;
  font-weight: 700;
  z-index: 40;
}

/* ---------- Responsive: tablet / desktop ---------- */
@media (min-width: 640px) {
  .cart-grid { grid-template-columns: repeat(4, 1fr); }
  .slot-grid { grid-template-columns: repeat(6, 1fr); }
  .inv-grid { grid-template-columns: repeat(6, 1fr); }
  .dungeon-grid { grid-template-columns: repeat(4, 1fr); }
  .all-grid, .games-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 960px) {
  .cart-hero-img { width: 130px; height: 130px; }
  .cart-grid { grid-template-columns: repeat(6, 1fr); }
  .all-grid, .games-grid { grid-template-columns: repeat(7, 1fr); }
  .score-table, .dlg-list, .quest-list, .shop-list, .cart-grid, .slot-grid, .inv-grid, .dungeon-grid, .hero-sec, .all-grid, .games-grid, .map-row, .combo-row, .coin-row {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
  }
}

[v-cloak] { display: none; }
