@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=DM+Sans:wght@300;400;500&display=swap');

/* ============================================================
   EMUEASY — GLOBAL STYLES
   ============================================================ */
:root {
  --bg0: #080808;
  --bg1: #0f0f0f;
  --bg2: #151515;
  --bg3: #1c1c1c;
  --bg4: #242424;
  --accent: #8B5CF6;
  --accent-dim: #6d46d4;
  --accent-glow: rgba(139,92,246,0.22);
  --accent-subtle: rgba(139,92,246,0.08);
  --accent-border: rgba(139,92,246,0.3);
  --text1: #ffffff;
  --text2: #b9b9b9;
  --text3: #636363;
  --border: #1e1e1e;
  --border2: #2a2a2a;
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.08);
  --red-border: rgba(239,68,68,0.25);
  --green: #22c55e;
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --nav-h: 54px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg0);
  color: var(--text1);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- NAV ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--nav-h);
  background: rgba(8,8,8,0.96);
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-decoration: none;
}

.logo-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text1);
  letter-spacing: 0.04em;
}
.logo-text span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 13px;
  color: var(--text3);
  transition: color 0.15s;
  cursor: pointer;
}
.nav-link:hover { color: var(--text1); }

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.15s;
  background: none;
  border: none;
}
.back-btn:hover { color: var(--text1); }
.back-btn:hover svg path { stroke: var(--text1); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  padding: 0.72rem 1.25rem;
  transition: background 0.15s, opacity 0.15s;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 0.5px solid var(--border2); }
.btn-secondary:hover { background: var(--bg4); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- CARDS ---- */
.card {
  background: var(--bg2);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg);
}

/* ---- SECTION TITLE ---- */
.sec-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-title::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* ---- TAGS ---- */
.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  background: var(--bg3);
  border: 0.5px solid var(--border2);
  color: var(--text3);
}

.badge-accent {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 0.5px solid var(--accent-border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-red {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--red-bg);
  color: var(--red);
  border: 0.5px solid var(--red-border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- INFO BOX ---- */
.info-box {
  background: var(--bg2);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.65;
}
.info-box strong { color: var(--text2); font-weight: 500; }
.info-box.accent { border-color: var(--accent-border); background: var(--accent-subtle); }
.info-box.warn { border-color: var(--red-border); background: var(--red-bg); }

/* ---- MODERN POPUP ---- */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.popup-overlay.open { display: flex; }

.popup {
  background: var(--bg2);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 390px;
  overflow: hidden;
  animation: popUp 0.25s ease;
}

@keyframes popUp {
  from { transform: scale(0.92) translateY(16px); opacity: 0; }
  to   { transform: scale(1) translateY(0);       opacity: 1; }
}

.popup-banner {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--bg3);
  display: block;
}
.popup-banner-fallback {
  width: 100%;
  height: 110px;
  background: linear-gradient(135deg, #1a0f2e, #0a0a14);
}

.popup-body { padding: 1.25rem; }

.popup-icon {
  width: 40px;
  height: 40px;
  background: var(--red-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.popup-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.popup-desc {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.buy-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border2);
  background: var(--bg3);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s;
}
.buy-link:hover { border-color: var(--accent); }
.buy-label { font-size: 13px; font-weight: 500; color: var(--text1); }
.buy-sub   { font-size: 11px; color: var(--text3); }
.buy-arrow { color: var(--accent); font-size: 14px; }

.popup-dismiss {
  width: 100%;
  background: none;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  font-size: 13px;
  color: var(--text3);
  cursor: pointer;
  margin-top: 0.25rem;
  transition: color 0.15s;
  font-family: inherit;
}
.popup-dismiss:hover { color: var(--text2); }

/* ---- SKELETON ---- */
.skel {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- FADE IN ---- */
.fade-in {
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
  height: 2px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ---- GAME GRID ---- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.game-card {
  background: var(--bg2);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 0.5px solid var(--border);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.game-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}
.game-card.modern:hover {
  border-color: var(--red);
  box-shadow: 0 0 18px rgba(239,68,68,0.2);
}

.card-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--bg3);
  display: block;
}

.card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-body { padding: 7px 8px 9px; }

.card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.card-console { font-size: 10px; color: var(--text3); }

.card-emu {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent-subtle);
  color: var(--accent);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.card-emu-modern {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--red-bg);
  color: var(--red);
  white-space: nowrap;
}

.card-emu {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent-subtle);
  color: var(--accent);
  letter-spacing: 0.03em;
}

.card-emu-modern {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--red-bg);
  color: var(--red);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
}
.game-card:hover .card-overlay { opacity: 1; }

.overlay-btn {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 5px;
  padding: 5px 0;
  text-align: center;
  font-family: inherit;
  width: 100%;
}
.game-card.modern .overlay-btn { background: var(--red); }

/* ---- TABS ---- */
.tabs-wrap { padding: 0 1.5rem; margin-bottom: 1.25rem; }

.tabs-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  border: 0.5px solid var(--border2);
  background: var(--bg2);
  color: var(--text3);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text1); }
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tab-divider {
  width: 0.5px;
  height: 20px;
  background: var(--border2);
  flex-shrink: 0;
  margin: 0 4px;
}

/* ---- SIMILAR ROW ---- */
.similar-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.similar-row::-webkit-scrollbar { display: none; }

.sim-card {
  flex-shrink: 0;
  width: 90px;
  cursor: pointer;
}

.sim-thumb {
  width: 90px;
  height: 120px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg3);
  border: 0.5px solid var(--border);
  transition: border-color 0.15s;
}
.sim-card:hover .sim-thumb { border-color: var(--accent); }

.sim-name {
  font-size: 11px;
  color: var(--text2);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- LOGO SVG ---- */
.logo-svg { width: 28px; height: 28px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .nav { padding: 0 1rem; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ---- SIMILAR GAMES GRID ---- */
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: .5rem;
}
.sim-card-g {
  background: var(--bg2);
  border: .5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s;
}
.sim-card-g:hover { border-color: var(--accent); }
.sim-thumb-g {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--bg3);
  display: block;
}
.sim-body-g { padding: 6px 7px 8px; }
.sim-name-g {
  font-size: 11px;
  font-weight: 500;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-console-g { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ---- FULLSCREEN MODERN POPUP ---- */
.fs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.93);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  padding: 1rem;
  overflow-y: auto;
}
.fs-overlay.open { display: flex; }
.fs-popup {
  background: var(--bg1);
  border: .5px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  animation: fsPopUp .3s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes fsPopUp {
  from { transform: scale(.88) translateY(24px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}
.fs-popup-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
  display: block;
}
.fs-popup-body { padding: 1.4rem; }
.fs-popup-icon {
  width: 46px; height: 46px;
  background: var(--red-bg);
  border: .5px solid var(--red-border);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .85rem;
}
.fs-popup-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--text1);
}
.fs-popup-desc {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.65;
  margin-bottom: 1rem;
}
.fs-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  font-weight: 600;
  margin-bottom: .6rem;
}
.fs-popup-close {
  width: 100%;
  background: none;
  border: .5px solid var(--border2);
  border-radius: 9px;
  padding: .6rem;
  font-size: 13px;
  color: var(--text3);
  cursor: pointer;
  font-family: inherit;
  margin-top: .5rem;
  transition: color .15s;
}
.fs-popup-close:hover { color: var(--text2); }

/* ---- DEAL TRACKER ---- */
.deal-loading {
  font-size: 12px; color: var(--text3);
  padding: .4rem 0;
  display: flex; align-items: center; gap: 8px;
}
.deal-spinner {
  width: 14px; height: 14px;
  border: 1.5px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.deal-rating {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 6px;
  margin-bottom: .6rem;
}
.deal-history { font-size: 11px; color: var(--text3); margin-bottom: .65rem; }
.deal-history strong { color: var(--green); }
.deal-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem .75rem; border-radius: 8px;
  border: .5px solid var(--border2); background: var(--bg2);
  margin-bottom: .4rem; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.deal-row:hover { border-color: var(--accent); background: var(--bg3); }
.deal-left { display: flex; align-items: center; gap: 8px; }
.deal-store-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.deal-store-name { font-size: 12px; font-weight: 500; color: var(--text1); }
.deal-right { display: flex; align-items: center; gap: 6px; }
.deal-price { font-size: 13px; font-weight: 700; color: var(--green); }
.deal-original { font-size: 11px; color: var(--text3); text-decoration: line-through; }
.deal-pct {
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px;
  background: rgba(34,197,94,.12); color: var(--green);
}

/* ---- STORE LINKS (popup) ---- */
.store-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .8rem; border-radius: 8px;
  border: .5px solid var(--border2); background: var(--bg2);
  text-decoration: none; margin-bottom: .4rem;
  transition: border-color .15s, background .15s;
}
.store-link:hover { border-color: var(--accent); background: var(--bg3); }
.store-link-left { display: flex; align-items: center; gap: 9px; }
.store-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.store-name { font-size: 12px; font-weight: 500; color: var(--text1); }
.store-desc { font-size: 11px; color: var(--text3); margin-top: 1px; }
.store-arrow { color: var(--accent); font-size: 13px; }

/* ---- CARD EMU BADGE ---- */
.card-emu {
  font-size: 9px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px;
  background: var(--accent-subtle); color: var(--accent);
  letter-spacing: .03em; white-space: nowrap;
}
.card-emu-modern {
  font-size: 9px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px;
  background: var(--red-bg); color: var(--red);
  white-space: nowrap;
}
.modern-x-badge {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; background: var(--red);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
