:root {
  --ps-bg: #0d0f14;
  --ps-panel: #161922;
  --ps-card: rgba(26, 31, 44, 0.75);
  --ps-card-border: rgba(255, 255, 255, 0.08);
  --ps-grey: #9aa0a6;
  --ps-silver: #c2c7d0;
  --ps-green: #10b981;  /* Triangle ▲ */
  --ps-red: #ef4444;    /* Circle ● */
  --ps-blue: #38bdf8;   /* Cross ✖ */
  --ps-pink: #f472b6;   /* Square ■ */
  --ps-gold: #fbbf24;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--ps-bg);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(244, 114, 182, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 60%);
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Background Grid Subtle */
.bg-scanlines {
  position: fixed;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
  z-index: 10;
  opacity: 0.6;
}

.wrapper {
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px 20px 60px;
  width: 100%;
  position: relative;
  z-index: 20;
}

/* Header */
.ps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.ps-logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ps-emblem {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.ps-title-box h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ps-title-box p {
  font-size: 12px;
  color: var(--ps-grey);
}

.ps-symbols-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sym-tri { color: var(--ps-green); font-weight: 900; }
.sym-cir { color: var(--ps-red); font-weight: 900; }
.sym-cro { color: var(--ps-blue); font-weight: 900; }
.sym-squ { color: var(--ps-pink); font-weight: 900; }

.ps-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-ps-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.btn-ps-action:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: translateY(-2px);
}

.btn-upload-rom {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  border: none;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}
.btn-upload-rom:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* Hero Nostalgia Banner */
.ps-hero {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 20px;
  padding: 22px 26px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(56, 189, 248, 0.05);
}

.ps-hero-left h2 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 6px;
  color: #ffffff;
}
.ps-hero-left h2 span {
  color: #38bdf8;
}
.ps-hero-left p {
  font-size: 13px;
  color: #cbd5e1;
  max-width: 650px;
  line-height: 1.5;
}

.ps-hero-stats {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hero-stat-item {
  text-align: center;
  min-width: 70px;
}
.hero-stat-val {
  font-size: 16px;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: #38bdf8;
}
.hero-stat-lbl {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Category Filter Bar */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.filter-btn.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(16, 185, 129, 0.2));
  border-color: #38bdf8;
  color: #38bdf8;
}

.search-box {
  position: relative;
  min-width: 240px;
}
.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px 8px 34px;
  font-size: 12.5px;
  color: #fff;
  outline: none;
  transition: all 0.2s;
}
.search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #64748b;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

.game-card {
  background: var(--ps-card);
  border: 1px solid var(--ps-card-border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  position: relative;
}
.game-card:hover {
  transform: translateY(-6px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.15);
}

.game-cover-box {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.game-card:hover .game-cover-img {
  transform: scale(1.05);
}

.ps1-case-overlay {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 40%);
}

.ps1-spine-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
}

.game-size-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(16, 185, 129, 0.85);
  color: #000;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.game-info-box {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.game-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}

.game-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 12px;
}
.game-genre {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}
.game-stars {
  color: #fbbf24;
}

.btn-play-game {
  background: linear-gradient(135deg, #00f2fe, #3861fb);
  border: none;
  color: #000;
  font-weight: 900;
  font-size: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 242, 254, 0.25);
}
.btn-play-game:hover {
  background: linear-gradient(135deg, #38bdf8, #00f2fe);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 242, 254, 0.4);
}

/* ========================================================================= */
/* 📺 MODAL EMULATOR PS1 DENGAN FULLSCREEN RESMI                             */
/* ========================================================================= */
.modal-emulator-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
  z-index: 9999;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.modal-emulator-backdrop.active {
  display: flex;
}

.emulator-window {
  width: 100%;
  max-width: 980px;
  height: 90vh;
  max-height: 720px;
  background: #000;
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 242, 254, 0.25);
  position: relative;
}

/* Header Window Emulator */
.emulator-topbar {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.topbar-game-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-game-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}
.topbar-badge {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-family: 'JetBrains Mono', monospace;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.topbar-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
}

.topbar-btn-fullscreen {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  font-weight: 800;
}
.topbar-btn-fullscreen:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
}

.topbar-btn-close {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.topbar-btn-close:hover {
  background: #ef4444;
  color: #fff;
}

/* Game Frame / Viewport */
.emulator-canvas-area {
  flex: 1;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#gameCanvasContainer {
  width: 100%;
  height: 100%;
  position: relative;
}

/* CRT Scanlines Overlay */
.crt-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
  z-index: 50;
  opacity: 0.5;
  display: none;
}
.crt-overlay.active {
  display: block;
}

/* Loading Splash Inside Emulator */
.emulator-loading-splash {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 60;
  padding: 20px;
  text-align: center;
}

.ps1-boot-emblem {
  font-size: 54px;
  margin-bottom: 16px;
  animation: pulseLogo 1.5s infinite alternate;
}
@keyframes pulseLogo {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 20px #00f2fe); }
}

.ps1-loading-bar-bg {
  width: 100%;
  max-width: 380px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
  margin: 14px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.ps1-loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f2fe, #3861fb);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* Floating Fullscreen Controls Bar */
.fullscreen-floating-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 6px 16px;
  border-radius: 99px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0.3;
  transition: opacity 0.2s;
}
.fullscreen-floating-bar:hover {
  opacity: 1;
}

/* Responsive Rules */
@media (max-width: 768px) {
  .emulator-window {
    height: 98vh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .modal-emulator-backdrop {
    padding: 0;
  }
}

/* ========================================================================== */
/* 🎮 KONTROL PAGINATION 20 GAME PER HALAMAN (DESKTOP & MOBILE MEWAH)         */
/* ========================================================================== */
.ps1-pagination-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 10px 0 20px;
}
.ps1-pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.ps1-page-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
}
.ps1-page-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
}
.ps1-page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(255, 255, 255, 0.06);
}
.ps1-page-btn.active {
  background: linear-gradient(135deg, #00f2fe, #3861fb);
  border-color: #38bdf8;
  color: #000;
  font-weight: 900;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.45);
}
.ps1-page-btn-nav {
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}
.ps1-page-btn-nav.btn-next-action {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}
.ps1-page-btn-nav.btn-next-action:hover:not(:disabled) {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}
.ps1-page-info-box {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 16px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
