/* ============================================================
   ROOT / RESET
============================================================= */
:root {
  --ps2-blue-deep: #050a24;
  --ps2-blue: #0d1a4b;
  --ps2-blue-panel: rgba(10, 20, 70, 0.82);
  --ps2-cyan: #6fe8ff;
  --ps2-cyan-dim: #2c6f8a;
  --ps2-silver: #dce6f2;
  --ps2-gold: #ffd76b;
  --font-display: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;
}

* { box-sizing: border-box; }

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #181825;
}

.hidden { display: none !important; }

/* Generic full-viewport layer */
.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* ============================================================
   LAYER 1 — BOOT PROMPT
============================================================= */
.blink-text {
  font-family: var(--font-display);
  font-size: clamp(10px, 2vw, 16px);
  color: var(--ps2-silver);
  animation: blink 1.4s steps(1) infinite;
  letter-spacing: 1px;
}

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

/* ============================================================
   LAYER 2 — BOOT VIDEO
============================================================= */
#boot-video-wrap {
  background: #000;
  flex-direction: column;
}

#boot-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: fadeIn 0.6s ease-in;
}

.skip-hint {
  position: absolute;
  bottom: 24px;
  right: 28px;
  font-family: var(--font-display);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Crossfade-to-white flash used when the video hands off to the game */
.flash-white {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}
.flash-white.active {
  animation: flashOut 0.7s ease-out forwards;
}
@keyframes flashOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================================
   LAYER 3 — GAME CANVAS
============================================================= */
#game-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background-color: #11111b; /* Outer letterbox dark area */
}

#game-canvas {
  width: 512px;
  height: 384px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.interact-prompt {
  position: absolute;
  font-family: var(--font-display);
  font-size: 10px;
  color: #000;
  background: var(--ps2-gold);
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
  box-shadow: 0 2px 0 rgba(0,0,0,0.35);
  animation: bob 1.1s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { margin-top: 0px; }
  50%      { margin-top: -4px; }
}

#hud {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(255,255,255,0.4);
}

/* ============================================================
   LAYER 4 — PS2 MEMORY CARD MODAL
============================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 4, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: overlayIn 0.15s ease-out;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.memcard-window {
  width: min(90vw, 640px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--ps2-blue-panel);
  border: 2px solid var(--ps2-cyan);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.6),
    0 0 30px rgba(111, 232, 255, 0.35),
    inset 0 0 40px rgba(111, 232, 255, 0.06);
  backdrop-filter: blur(3px);
  animation: windowPop 0.18s ease-out;
}
@keyframes windowPop {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.memcard-titlebar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--ps2-cyan-dim);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ps2-cyan);
  text-shadow: 0 0 6px rgba(111,232,255,0.6);
}

.memcard-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 20px;
  line-height: 1.4;
}

.memcard-panel { display: none; }
.memcard-panel.active { display: block; animation: panelIn 0.15s ease-out; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.memcard-list {
  list-style: none;
  margin: 0 0 14px 0;
  padding: 0;
}
.memcard-list li {
  padding: 8px 12px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.memcard-list li:hover,
.memcard-list li.selected {
  border-color: var(--ps2-cyan);
  background: rgba(111, 232, 255, 0.08);
  color: var(--ps2-cyan);
}
.memcard-list li .lock-icon { opacity: 0.5; font-size: 16px; }

.memcard-detail {
  border-top: 1px dashed var(--ps2-cyan-dim);
  padding-top: 12px;
  min-height: 70px;
}
.placeholder-text { color: rgba(220,230,242,0.5); }

.bio-columns {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.portrait-placeholder {
  width: 96px;
  height: 96px;
  flex: none;
  border: 2px dashed var(--ps2-cyan-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--ps2-cyan-dim);
  border-radius: 4px;
}
.bio-text h3 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ps2-gold);
  margin: 0 0 10px 0;
}
.bio-text h4 {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--ps2-cyan);
  margin: 14px 0 8px 0;
}
.skill-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.skill-tags li {
  border: 1px solid var(--ps2-cyan-dim);
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 16px;
}

.memcard-footer {
  display: flex;
  gap: 24px;
  padding: 10px 16px;
  border-top: 1px solid var(--ps2-cyan-dim);
  font-family: var(--font-display);
  font-size: 10px;
}
.btn-hint { display: flex; align-items: center; gap: 6px; color: rgba(220,230,242,0.75); }
.btn-x, .btn-o {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  font-size: 9px;
}
.btn-x { background: #3a6bd6; color: #fff; }
.btn-o { background: #d64545; color: #fff; }

/* Scrollbar theming to keep the retro feel */
.memcard-body::-webkit-scrollbar { width: 8px; }
.memcard-body::-webkit-scrollbar-thumb {
  background: var(--ps2-cyan-dim);
  border-radius: 4px;
}

/* ============================================================
   RESPONSIVE TWEAKS
============================================================= */
@media (max-width: 600px) {
  .memcard-body { font-size: 16px; }
  .bio-columns { flex-direction: column; align-items: center; text-align: center; }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .blink-text, .interact-prompt, .memcard-window, .modal-overlay { animation: none !important; }
}
