/* ============================================================
   Medi Response Games — Apple-minimal Theme
   White + Black + Blue (#1A73E8)
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #FFFFFF;
  --bg-soft: #F5F5F7;
  --bg-card: #FFFFFF;
  --ink: #1D1D1F;
  --text: #1D1D1F;
  --text-2: #424245;
  --text-3: #6E6E73;
  --text-4: #86868B;
  --line: #D2D2D7;
  --line-soft: #E5E5EA;
  --accent: #1A73E8;
  --accent-dark: #1557B0;
  --accent-soft: #E8F0FE;
  --accent-glow: rgba(26, 115, 232, 0.18);
  --green: #34C759;
  --red: #FF3B30;
  --gold: #FFD60A;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 28px;
  --r-full: 980px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.10);
  --shadow-blue: 0 8px 28px rgba(26, 115, 232, .30);

  --max-width: 1200px;
  --letter-tight: -0.04em;
  --letter-snug: -0.025em;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; height: auto; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============================================================
   Container
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container { padding: 0 40px; }
}

/* ============================================================
   Header / Nav
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: var(--letter-snug);
  font-size: 18px;
  color: var(--ink);
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.04em;
  box-shadow: 0 4px 12px rgba(26,115,232,.35);
}

.logo-text { font-weight: 700; }
.logo-text .accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-full);
  transition: background .15s, color .15s;
}

.nav-link:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 640px) {
  .nav-link span { display: none; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  padding: clamp(60px, 10vw, 120px) 0 clamp(40px, 6vw, 80px);
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: var(--letter-tight);
  color: var(--ink);
  margin-bottom: 20px;
}

.hero h1 .accent { color: var(--accent); }

.hero .tagline {
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.5;
  color: var(--text-3);
  max-width: 580px;
  margin: 0 auto 32px;
}

.hero-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
}

/* ============================================================
   Section heads
   ============================================================ */
.section {
  padding: clamp(40px, 6vw, 64px) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: var(--letter-tight);
  color: var(--ink);
}

.section-head .see-all {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.section-head .see-all:hover { text-decoration: underline; }

/* ============================================================
   Category Filter Tabs
   ============================================================ */
.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  padding: 10px 18px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.filter-tab:hover {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.filter-tab.active {
  background: var(--ink);
  color: white;
}

/* ============================================================
   Games Grid
   ============================================================ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 540px) { .games-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .games-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .games-grid { grid-template-columns: repeat(5, 1fr); } }

.game-card {
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.game-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, var(--accent-soft) 0%, #F0F4FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  overflow: hidden;
}

.game-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.05));
  pointer-events: none;
}

.game-card:hover .game-thumb {
  transform: scale(1.02);
}

.game-info {
  padding: 14px;
}

.game-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta {
  font-size: 12px;
  color: var(--text-4);
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   Game Play Page
   ============================================================ */
.game-page-hero {
  padding: 24px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 24px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-soft);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .15s;
}

.back-btn:hover { background: var(--line-soft); }

.game-page-title h1 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: var(--letter-snug);
}

.game-page-title .meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.game-stage {
  position: relative;
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 420px;
}

.game-stage canvas {
  max-width: 100%;
  border-radius: var(--r);
  background: var(--bg-soft);
}

.game-stage iframe {
  width: 100%;
  height: 600px;
  border: 0;
  border-radius: var(--r);
}

@media (max-width: 640px) {
  .game-stage iframe { height: 450px; }
}

/* ============================================================
   Game UI primitives (used inside games)
   ============================================================ */
.game-board {
  display: grid;
  gap: 8px;
  background: var(--bg-soft);
  padding: 12px;
  border-radius: var(--r-lg);
  margin: 16px auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-full);
  transition: transform .12s, background .15s, color .15s;
  border: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(26,115,232,.25);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(26,115,232,.35);
}

.btn-secondary {
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover { background: white; border-color: var(--text-4); }

.btn-large { height: 52px; padding: 0 32px; font-size: 16px; }

.score-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
}

.score-pill .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
}

.score-pill .value {
  color: var(--accent);
  font-weight: 800;
  font-size: 16px;
}

/* ============================================================
   Game over modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 31, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 1000;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: white;
  border-radius: var(--r-xl);
  padding: 40px 32px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  transform: scale(0.9);
  transition: transform .25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: var(--accent-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.modal h3 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: var(--letter-snug);
  margin-bottom: 8px;
}

.modal p {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 24px;
}

.modal .score-big {
  font-size: 48px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: var(--letter-tight);
  line-height: 1;
  margin-bottom: 8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

/* ============================================================
   About text section
   ============================================================ */
.prose-section {
  max-width: 720px;
  margin: 0 auto;
}

.prose-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--ink);
}

.prose-section p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 14px;
}

/* ============================================================
   AdSense ad slot (auto-ads, no placeholder text)
   ============================================================ */
.adsbygoogle {
  display: block;
}

.ad-slot {
  margin: 24px 0;
  display: flex;
  justify-content: center;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--bg-soft);
  padding: 48px 0 32px;
  margin-top: 64px;
  border-top: 1px solid var(--line-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 32px;
}

@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .footer-brand { grid-column: span 2; }
}

.footer-brand .logo { margin-bottom: 14px; }

.footer-about {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-2);
  padding: 5px 0;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--text-4);
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero h1, .hero .tagline, .hero-badges, .eyebrow {
  animation: fadeUp .6s ease both;
}

.hero .eyebrow { animation-delay: 0s; }
.hero h1 { animation-delay: 0.05s; }
.hero .tagline { animation-delay: 0.12s; }
.hero-badges { animation-delay: 0.18s; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media print {
  .header, .footer, .ad-slot { display: none; }
}
