/* ==========================================================================
   CogniTest Game Engine & Neuropsychological Hub Stylesheet (games.css)
   Executive Modern Dark-Slate Design, Mobile Touch-Optimized & E-E-A-T Editorial
   ========================================================================== */

:root {
  --game-bg-stage: #090e1c;
  --game-bg-card: #0f172a;
  --game-bg-inner: #162036;
  --game-border: #1e293b;
  --game-border-bright: #334155;
  --game-text-white: #f8fafc;
  --game-text-muted: #94a3b8;
  --game-accent-blue: #3b82f6;
  --game-accent-cyan: #06b6d4;
  --game-accent-emerald: #10b981;
  --game-accent-amber: #f59e0b;
  --game-accent-rose: #f43f5e;
  --game-accent-purple: #8b5cf6;
}

/* ==========================================================================
   Game Main Layout Container
   ========================================================================== */
.game-detail-container {
  max-width: 1040px;
  margin: 30px auto 60px;
  padding: 0 20px;
}

/* Breadcrumbs */
.game-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.game-breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
.game-breadcrumbs a:hover {
  text-decoration: underline;
}
.game-breadcrumbs span.sep {
  opacity: 0.5;
}

/* Header Info */
.game-page-header {
  margin-bottom: 24px;
}
.game-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.game-page-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.game-domain-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.game-page-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 800px;
  line-height: 1.5;
}

/* ==========================================================================
   CogniGame Card & Arena (Stage)
   ========================================================================== */
.cogni-game-card {
  background: var(--game-bg-card);
  border: 1px solid var(--game-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
}

/* HUD Top Bar */
.game-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--game-border);
  font-size: 0.9rem;
}
.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.record-badge {
  color: var(--game-text-muted);
  font-size: 0.85rem;
}
.record-badge strong {
  color: #fbbf24;
}
.streak-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}
.sound-toggle-btn {
  background: var(--game-bg-inner);
  border: 1px solid var(--game-border);
  color: var(--game-text-white);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sound-toggle-btn:hover {
  background: var(--game-border-bright);
}

/* Stage Area Wrapper */
.game-stage-wrapper {
  position: relative;
  min-height: 440px;
  background: var(--game-bg-stage);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Overlays (Start, Countdown, Results) */
.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
  backdrop-filter: blur(6px);
  background: rgba(9, 14, 28, 0.96);
  text-align: center;
}

/* Start Overlay */
.start-content {
  max-width: 560px;
}
.game-icon-glow {
  font-size: 3.2rem;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 16px rgba(59, 130, 246, 0.5));
}
.game-start-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--game-text-white);
  margin-bottom: 10px;
}
.game-start-desc {
  font-size: 0.98rem;
  color: var(--game-text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.game-rules-box {
  background: var(--game-bg-inner);
  border: 1px solid var(--game-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  margin-bottom: 24px;
}
.game-rules-box h4 {
  color: var(--game-text-white);
  font-size: 0.9rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rules-list {
  list-style: none;
  font-size: 0.88rem;
  color: var(--game-text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rules-list li strong {
  color: var(--game-accent-cyan);
}
.btn-play-game {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-play-game:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.55);
}

/* Countdown Overlay */
.countdown-badge {
  font-size: 5.5rem;
  font-weight: 900;
  color: var(--game-accent-cyan);
  font-family: monospace;
  text-shadow: 0 0 30px rgba(6, 182, 212, 0.6);
}
.countdown-sub {
  font-size: 1.2rem;
  color: var(--game-text-muted);
  margin-top: 10px;
}
.pulse-num {
  animation: pulseNumAnim 0.7s ease-out;
}
.pulse-go {
  animation: pulseGoAnim 0.8s ease-out;
  color: #10b981;
}
@keyframes pulseNumAnim {
  0% { transform: scale(1.4); opacity: 0; }
  50% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}
@keyframes pulseGoAnim {
  0% { transform: scale(1.6); opacity: 0; }
  40% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Active Game Viewport */
.active-game-viewport {
  width: 100%;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Bottom HUD */
.game-status-hud {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 12px 20px;
  background: #090e1c;
  border-top: 1px solid var(--game-border);
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hud-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--game-text-muted);
  letter-spacing: 0.06em;
}
.hud-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--game-text-white);
  font-family: monospace;
}
.hud-accent {
  color: var(--game-accent-cyan);
}

/* ==========================================================================
   Results Overlay & Modal Styling
   ========================================================================== */
.results-card-inner {
  max-width: 600px;
  width: 100%;
  background: var(--game-bg-card);
  border: 1px solid var(--game-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.result-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.result-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--game-text-white);
  margin-bottom: 6px;
}
.result-sub {
  font-size: 0.92rem;
  color: var(--game-text-muted);
  margin-bottom: 20px;
}
.result-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.score-dial-box, .percentile-highlight-box {
  background: var(--game-bg-inner);
  border: 1px solid var(--game-border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-number {
  font-size: 2.5rem;
  font-weight: 900;
  color: #38bdf8;
  font-family: monospace;
  line-height: 1;
}
.score-max {
  font-size: 0.8rem;
  color: var(--game-text-muted);
  margin-top: 4px;
}
.rank-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 8px;
}
.pct-sup {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--game-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.pct-val {
  font-size: 1.8rem;
  color: #10b981;
  font-weight: 800;
}
.pct-caption {
  font-size: 0.82rem;
  color: var(--game-text-muted);
  margin-top: 6px;
  line-height: 1.35;
}
.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--game-bg-inner);
  border: 1px solid var(--game-border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.m-label {
  display: block;
  font-size: 0.75rem;
  color: var(--game-text-muted);
  margin-bottom: 4px;
}
.m-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--game-text-white);
}
.m-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--game-text-muted);
}
.share-cta-section {
  border-top: 1px solid var(--game-border);
  padding-top: 16px;
  margin-bottom: 20px;
}
.share-title {
  font-size: 0.88rem;
  color: var(--game-text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.share-buttons-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-share-social {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-whatsapp {
  background: #15803d;
  color: #ffffff;
}
.btn-whatsapp:hover {
  background: #20ba5a;
}
.btn-telegram {
  background: #0369a1;
  color: #ffffff;
}
.btn-telegram:hover {
  background: #0077b5;
}
.btn-copy {
  background: var(--game-bg-inner);
  border: 1px solid var(--game-border-bright);
  color: var(--game-text-white);
}
.btn-copy:hover {
  background: var(--game-border-bright);
}
.result-actions-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-replay {
  background: var(--primary);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-replay:hover {
  background: var(--primary-hover);
}
.btn-browse-games {
  background: transparent;
  border: 1px solid var(--game-border-bright);
  color: var(--game-text-white);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.btn-browse-games:hover {
  background: var(--game-bg-inner);
}

/* ==========================================================================
   Editorial & Scientific Guide (700+ Words Section)
   ========================================================================== */
.game-editorial-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-card);
}
.editorial-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.editorial-prose {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-muted);
}
.editorial-prose p {
  margin-bottom: 18px;
}
.editorial-prose h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 28px 0 12px;
}
.editorial-callout {
  background: var(--bg-subtle);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 22px;
  margin: 24px 0;
}
.callout-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.editorial-callout p {
  margin-bottom: 0;
  font-size: 0.94rem;
}
.editorial-callout.concorsi {
  border-left-color: #f59e0b;
}
.editorial-callout.concorsi .callout-title {
  color: #d97706;
}

/* FAQ Accordion Section */
.game-faq-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-card);
}
.faq-section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 20px;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: var(--bg-main);
}
.faq-question {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.faq-answer {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Related Games Grid */
.related-games-section {
  margin-bottom: 50px;
}
.related-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 18px;
}
.related-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.related-game-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}
.related-game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}
.rg-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}
.rg-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.rg-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  flex-grow: 1;
}
.rg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .game-detail-container {
    padding: 0 14px;
    margin-top: 16px;
  }
  .game-page-title {
    font-size: 1.6rem;
  }
  .result-main-grid {
    grid-template-columns: 1fr;
  }
  .game-editorial-section, .game-faq-section {
    padding: 24px 18px;
  }
  .game-stage-wrapper {
    min-height: 380px;
  }
  .results-card-inner {
    padding: 20px 16px;
  }
}

/* Text on editorial surfaces uses dark ink; gameplay keeps its dedicated palette. */
.game-domain-pill, .hub-card-tag, .rg-meta span, .editorial-callout .callout-title {
  color: #334155 !important;
}
.domain-badge { color: #e2e8f0 !important; background: #1e293b !important; }
.editorial-prose td[style*="color"], .game-editorial-section td[style*="color"] { color: #334155 !important; }
.game-editorial-section { overflow-wrap: anywhere; }
.game-detail-container > *, .game-editorial-section > * { min-width: 0; max-width: 100%; }
#radarHolder svg { overflow: visible; }
#radarHolder svg text { font-size: 12px; fill: #334155; }
@media (max-width: 640px) {
  .game-detail-container { width: 100%; min-width: 0; }
  .game-editorial-section { padding: 22px 16px; }
  .game-page-title, .game-page-subtitle, .faq-section-title { overflow-wrap: anywhere; }
  .game-editorial-section table { width: 100%; }
}
