/* ==========================================================
   EUREKA90 - 90s Retro Warm Theme Stylesheet
   Designed for Cozy Nostalgia, Mobile & PC Responsiveness,
   and Middle-aged / Senior Player Accessibility
   ========================================================== */

:root {
  /* Warm Color Palette */
  --retro-bg-dark: #201109;
  --retro-bg-panel: #2C180E;
  --retro-bg-card: #3A2013;
  --retro-border: #854D27;
  --retro-border-glow: #F4A261;
  --retro-primary: #FFB703;
  --retro-secondary: #E76F51;
  --retro-accent: #D62828;
  --retro-green: #57CC99;
  --retro-cream: #FFF4D0;
  --retro-cream-muted: #D8C3A5;
  --retro-wood: #5A2E17;
  --retro-shadow: rgba(14, 7, 3, 0.7);

  /* Font Scaling Variables (User-adjustable for seniors) */
  --base-font-size: 16px;
  --title-font-size: 2rem;
  --card-font-size: 1.1rem;
}

/* Base HTML & Font Scaling (Senior Accessibility) */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  transition: font-size 0.2s ease;
}

html.font-small {
  font-size: 14px !important;
}

html.font-medium {
  font-size: 16px !important;
}

html.font-large {
  font-size: 20px !important;
}

html.font-xlarge {
  font-size: 24px !important;
}

body {
  background-color: var(--retro-bg-dark);
  background-image: url('../assets/images/pattern-warm.svg');
  background-repeat: repeat;
  color: var(--retro-cream);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  transition: background 0.3s ease;
}

/* CRT Scanline Overlay (Toggleable) */
.scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  opacity: 0.4;
  display: block;
}
body.scanlines-off .scanline-overlay {
  display: none;
}

/* Warm Ambient Glow */
.cozy-glow {
  box-shadow: 0 4px 20px rgba(247, 127, 0, 0.25);
}

/* Senior Accessibility Top Banner */
.senior-bar {
  background: #381A0B;
  border-bottom: 2px solid var(--retro-border);
  padding: 6px 0;
  font-size: 0.95rem;
}

.senior-bar .btn-access {
  background: #4E2713;
  color: var(--retro-cream);
  border: 1px solid var(--retro-border);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.9rem;
  margin: 0 2px;
  transition: all 0.2s;
}

.senior-bar .btn-access:hover,
.senior-bar .btn-access.active {
  background: var(--retro-primary);
  color: #24130A;
  border-color: #FFF;
}

/* Main Header & Navbar */
.eureka-navbar {
  background: linear-gradient(180deg, #3E2112 0%, #29140B 100%);
  border-bottom: 4px solid var(--retro-secondary);
  box-shadow: 0 6px 16px var(--retro-shadow);
  padding: 12px 0;
}

.brand-logo-img {
  max-height: 64px;
  width: auto;
  filter: drop-shadow(2px 3px 4px rgba(0,0,0,0.8));
}

.nav-link-retro {
  color: var(--retro-cream) !important;
  font-weight: 700;
  font-size: 1.15rem;
  padding: 8px 16px !important;
  border-radius: 8px;
  margin: 0 4px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link-retro:hover,
.nav-link-retro.active {
  background-color: var(--retro-wood);
  color: var(--retro-primary) !important;
  border: 1px solid var(--retro-primary);
  transform: translateY(-2px);
}

/* Retro Hero Banner */
.hero-section {
  padding: 30px 0 20px 0;
}

.hero-box {
  background: linear-gradient(135deg, #3A2013 0%, #27140B 100%);
  border: 3px solid var(--retro-border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 8px 24px var(--retro-shadow);
  position: relative;
  overflow: hidden;
}

.hero-box::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 6px;
  background: linear-gradient(90deg, #E63946, #F77F00, #FFB703, #57CC99, #48CAE4);
}

.hero-title {
  color: var(--retro-primary);
  font-weight: 900;
  text-shadow: 2px 2px 0px #000;
}

.hero-subtitle {
  color: var(--retro-cream-muted);
  font-size: 1.25rem;
}

.wellness-badge {
  background: #502A16;
  border: 2px dashed var(--retro-primary);
  border-radius: 12px;
  padding: 14px 18px;
  display: inline-block;
  color: #FFF3B0;
  font-weight: bold;
}

/* Category Filter Tabs */
.filter-btn-group .btn-filter {
  background: #3B1F11;
  color: var(--retro-cream);
  border: 2px solid var(--retro-border);
  font-weight: 700;
  padding: 8px 20px;
  margin: 4px;
  border-radius: 24px;
  font-size: 1.05rem;
  transition: all 0.25s;
}

.filter-btn-group .btn-filter:hover,
.filter-btn-group .btn-filter.active {
  background: var(--retro-secondary);
  color: #FFFFFF;
  border-color: var(--retro-primary);
  box-shadow: 0 0 12px rgba(231, 111, 81, 0.6);
}

/* Game Card Components */
.game-card-col {
  margin-bottom: 28px;
}

.game-card {
  background: linear-gradient(180deg, #3A2013 0%, #2A150B 100%);
  border: 3px solid var(--retro-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 16px var(--retro-shadow);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--retro-primary);
  box-shadow: 0 12px 28px rgba(255, 183, 3, 0.3);
}

.game-card-img-wrap {
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--retro-border);
  background: #1A0D07;
  aspect-ratio: 16 / 9.5;
}

.game-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.game-card:hover .game-card-img-wrap img {
  transform: scale(1.05);
}

.game-tag-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(214, 40, 40, 0.9);
  color: #FFF;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #FFD166;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

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

.game-card-title {
  color: var(--retro-primary);
  font-weight: 900;
  font-size: 1.45rem;
  margin-bottom: 8px;
}

.game-card-desc {
  color: var(--retro-cream-muted);
  font-size: 1.05rem;
  margin-bottom: 16px;
  flex: 1;
}

.game-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  font-size: 0.95rem;
  color: #E9D8A6;
}

.game-features li {
  margin-bottom: 4px;
}

.btn-play-game {
  background: linear-gradient(180deg, #F77F00 0%, #D62828 100%);
  color: #FFF !important;
  font-weight: 900;
  font-size: 1.25rem;
  padding: 12px 24px;
  border-radius: 12px;
  border: 2px solid #FFE49E;
  box-shadow: 0 4px 12px rgba(214, 40, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-play-game:hover {
  background: linear-gradient(180deg, #FFB703 0%, #E76F51 100%);
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(255, 183, 3, 0.6);
}

/* ==========================================================
   Game Arena Modal & Responsive Play Screen
   ========================================================== */
.game-modal-content {
  background: #251209;
  border: 4px solid var(--retro-primary);
  border-radius: 20px;
  color: var(--retro-cream);
  box-shadow: 0 0 35px rgba(255, 183, 3, 0.4);
}

.game-modal-header {
  background: #391C0E;
  border-bottom: 3px solid var(--retro-border);
  padding: 14px 20px;
}

.game-modal-title {
  color: var(--retro-primary);
  font-weight: 900;
  font-size: 1.5rem;
}

.game-viewport-wrapper {
  background: #140803;
  border: 4px solid #5A2E17;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 480px;
  position: relative;
  overflow: hidden;
}

/* Canvas styling generated by Phaser */
#phaser-game-container canvas {
  max-width: 100% !important;
  max-height: 70vh !important;
  height: auto !important;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.9);
  display: block;
  margin: 0 auto;
}

/* Virtual Arcade Controller (For Mobile & Touch Accessibility) */
.virtual-controller {
  background: #2C180E;
  border: 2px solid var(--retro-border);
  border-radius: 14px;
  padding: 14px 10px;
  margin-top: 14px;
}

.vpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 8px;
  max-width: 210px;
  margin: 0 auto;
}

.vpad-btn {
  background: linear-gradient(180deg, #532A15 0%, #35190B 100%);
  color: #FFE8A3;
  border: 2px solid #854D27;
  border-radius: 10px;
  padding: 14px 0;
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
  user-select: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.1s, transform 0.1s;
  box-shadow: 0 3px 6px rgba(0,0,0,0.6);
}

.vpad-btn:active,
.vpad-btn.active {
  background: var(--retro-primary);
  color: #1A0D07;
  transform: translateY(2px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.vpad-action-col {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.vpad-action-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #FFE49E;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  box-shadow: 0 4px 10px rgba(0,0,0,0.7);
  transition: transform 0.1s, filter 0.1s;
}

.btn-action-a {
  background: linear-gradient(180deg, #E63946 0%, #9D0208 100%);
  color: #FFF;
}

.btn-action-b {
  background: linear-gradient(180deg, #FFB703 0%, #D48B00 100%);
  color: #24130A;
}

.vpad-action-btn:active,
.vpad-action-btn.active {
  transform: scale(0.92);
  filter: brightness(1.2);
}

/* Senior Friendly Controls Helper Guide */
.control-guide-box {
  background: #381D10;
  border: 2px solid var(--retro-border);
  border-radius: 12px;
  padding: 14px;
}

.key-badge {
  background: #201007;
  color: #FFD166;
  border: 2px solid #854D27;
  border-radius: 6px;
  padding: 3px 8px;
  font-family: monospace;
  font-weight: 900;
  font-size: 1rem;
  box-shadow: 0 2px 0 #000;
  display: inline-block;
  margin: 0 2px;
}

/* ==========================================================
   Memory Wall / Nostalgic Guestbook (玩家回憶錄)
   ========================================================== */
.memory-wall-box {
  background: #2D180E;
  border: 3px solid var(--retro-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 18px var(--retro-shadow);
}

.memory-post {
  background: #3E2113;
  border-left: 4px solid var(--retro-primary);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.memory-author {
  color: var(--retro-primary);
  font-weight: bold;
  font-size: 1.05rem;
}

.memory-time {
  color: #C2AB90;
  font-size: 0.85rem;
}

.memory-content {
  color: var(--retro-cream);
  margin-top: 4px;
  font-size: 1rem;
}

/* Footer */
.eureka-footer {
  background: #180B05;
  border-top: 4px solid var(--retro-border);
  color: var(--retro-cream-muted);
  padding: 36px 0 20px 0;
  margin-top: 50px;
}

.eureka-footer a {
  color: var(--retro-primary);
  text-decoration: none;
}

.eureka-footer a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .brand-logo-img {
    max-height: 48px;
  }
  .hero-box {
    padding: 16px;
  }
  .game-card-title {
    font-size: 1.3rem;
  }
  .game-viewport-wrapper {
    min-height: 380px;
    padding: 6px;
  }
  .vpad-action-btn {
    width: 62px;
    height: 62px;
    font-size: 1.1rem;
  }
}
