@font-face {
  font-family: 'PressStart2P';
  src: url('../assets/fonts/PressStart2P.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-dark: #0a080d;
  --panel-bg: rgba(18, 14, 22, 0.92);
  --crimson-primary: #dc1e2d;
  --crimson-glow: #ff2d3e;
  --crimson-dark: #780f18;
  --gold-accent: #f8c028;
  --cyan-accent: #48d8f8;
  --text-white: #ffffff;
  --text-dim: #b0b0b8;
  --border-radius: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: 'PressStart2P', monospace, sans-serif;
  background-color: var(--bg-dark);
  background-image: radial-gradient(circle at center, #18101a 0%, #08060a 100%);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* HEADER AJR GAMES */
header {
  background: linear-gradient(180deg, #1f1218 0%, #0e0a12 100%);
  border-bottom: 3px solid var(--crimson-primary);
  box-shadow: 0 4px 20px rgba(220, 30, 45, 0.35);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 48px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(220, 30, 45, 0.6));
}

.brand-subtitle {
  font-size: 10px;
  color: var(--gold-accent);
  letter-spacing: 1px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
}

.status-badge {
  background: rgba(220, 30, 45, 0.2);
  border: 1px solid var(--crimson-primary);
  color: #ff808b;
  padding: 6px 12px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #2ed573;
  border-radius: 50%;
  box-shadow: 0 0 8px #2ed573;
}

/* MAIN CONTAINER */
main {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* SYSTEM SELECTOR TABS */
.systems-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.system-tab {
  background: var(--panel-bg);
  border: 2px solid #2a1f2c;
  color: var(--text-dim);
  padding: 10px 18px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 3px;
}

.system-tab:hover {
  border-color: var(--crimson-glow);
  color: var(--text-white);
  transform: translateY(-2px);
}

.system-tab.active {
  background: var(--crimson-primary);
  border-color: var(--crimson-glow);
  color: var(--text-white);
  box-shadow: 0 0 14px rgba(220, 30, 45, 0.6);
}

.system-tab img {
  height: 20px;
  image-rendering: pixelated;
}

/* GAMES GRID VIEW */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--panel-bg);
  border: 2px solid #2a1e28;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.game-card:hover {
  border-color: var(--crimson-glow);
  box-shadow: 0 0 16px rgba(220, 30, 45, 0.5);
  transform: translateY(-4px);
}

.game-card-cover {
  width: 100%;
  height: 160px;
  background: #140d18;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid var(--crimson-dark);
  position: relative;
}

.game-card-cover img {
  max-height: 120px;
  max-width: 80%;
  object-fit: contain;
  image-rendering: pixelated;
}

.game-system-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--crimson-primary);
  color: var(--gold-accent);
  font-size: 8px;
  padding: 4px 6px;
}

.game-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.game-card-title {
  font-size: 12px;
  color: var(--text-white);
  line-height: 1.4;
}

.game-card-meta {
  font-size: 9px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.game-card-desc {
  font-size: 9px;
  color: #9d9aa3;
  line-height: 1.5;
  margin-top: 4px;
}

.btn-play {
  margin-top: auto;
  background: var(--crimson-primary);
  border: none;
  color: white;
  padding: 10px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-play:hover {
  background: var(--crimson-glow);
}

/* EMULATOR VIEW (OVERLAY FULLSCREEN) */
#emulator-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 500;
  flex-direction: column;
}

.emu-topbar {
  background: #140d18;
  border-bottom: 2px solid var(--crimson-primary);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.emu-controls-bar {
  display: flex;
  gap: 12px;
}

.emu-btn {
  background: #2a1b24;
  border: 1px solid var(--crimson-primary);
  color: white;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 9px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.emu-btn:hover {
  background: var(--crimson-primary);
}

.emu-btn.btn-ai {
  background: linear-gradient(135deg, #780f18 0%, #dc1e2d 100%);
  border-color: var(--gold-accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(220, 30, 45, 0.7);
  animation: pulse-ai 2s infinite;
}

@keyframes pulse-ai {
  0% { box-shadow: 0 0 6px rgba(220, 30, 45, 0.6); }
  50% { box-shadow: 0 0 16px rgba(248, 192, 40, 0.8); }
  100% { box-shadow: 0 0 6px rgba(220, 30, 45, 0.6); }
}

.emu-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000;
}

#emu-canvas-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* AI MODAL OVERLAY PIXEL ART */
#ai-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 600;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ai-card {
  width: 90%;
  max-width: 820px;
  background: #0e0a12;
  border: 4px solid var(--crimson-primary);
  box-shadow: 0 0 30px rgba(220, 30, 45, 0.8);
  border-radius: 4px;
  overflow: hidden;
  animation: card-appear 0.25s ease-out;
}

@keyframes card-appear {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ai-card-header {
  background: var(--crimson-primary);
  color: white;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.ai-card-body {
  padding: 24px;
  font-size: 12px;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #e0e0e0;
}

.ai-card-body .ai-situation {
  color: var(--cyan-accent);
  font-size: 12px;
}

.ai-card-body .ai-tips-header {
  color: #ff5a6e;
  font-size: 13px;
  margin-top: 6px;
}

.ai-card-body .ai-text {
  text-align: justify;
  text-justify: inter-word;
  color: #ffffff;
  line-height: 1.9;
}

.ai-card-footer {
  background: #18101a;
  padding: 12px 20px;
  border-top: 2px solid #2a1e28;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #ffb4be;
}

/* FOOTER */
footer {
  background: #0e0a12;
  border-top: 2px solid #2a1e28;
  padding: 16px;
  text-align: center;
  font-size: 9px;
  color: var(--text-dim);
  margin-top: auto;
}

footer a {
  color: var(--gold-accent);
  text-decoration: none;
}
