/* WorldSchool University — Shared Design System */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

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

:root {
  --purple: #667eea;
  --purple-dark: #764ba2;
  --green: #69DB7C;
  --green-dark: #51cf66;
  --red: #FF6B6B;
  --yellow: #FFD93D;
  --orange: #FFA94D;
  --blue: #4DABF7;
  --pink: #F783AC;
  --white: #ffffff;
  --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-radius: 30px;
  --btn-radius: 20px;
  --font: 'Nunito', 'SF Pro Rounded', sans-serif;
  --shadow: 0 10px 40px rgba(0,0,0,0.15);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.2);
}

html, body {
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Typography */
h1 {
  color: white;
  font-size: 2.5em;
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

h2 {
  color: white;
  font-size: 1.8em;
  font-weight: 800;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.subtitle {
  color: rgba(255,255,255,0.8);
  font-size: 1.1em;
  font-weight: 600;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--btn-radius);
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.2em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
  padding: 16px 40px;
  color: white;
}

.btn:hover { transform: scale(1.05); }
.btn:active { transform: scale(0.95); }

.btn-primary { background: linear-gradient(135deg, #69DB7C, #51cf66); }
.btn-secondary { background: linear-gradient(135deg, #667eea, #764ba2); }
.btn-danger { background: linear-gradient(135deg, #FF6B6B, #fa5252); }

.btn-large {
  font-size: 1.6em;
  padding: 20px 60px;
  border-radius: 30px;
}

/* Round action buttons */
.circle-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  font-size: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}

.circle-btn:hover { transform: scale(1.1); }
.circle-btn:active { transform: scale(0.9); }

/* Universal game counter — centered top, clear of back/music buttons */
.game-counter {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 50;
}

.game-counter-title {
  color: white;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.1em;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.game-counter-value {
  color: white;
  font-family: var(--font);
  font-weight: 900;
  font-size: 1.6em;
  background: rgba(0,0,0,0.5);
  padding: 8px 20px;
  border-radius: 20px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  margin-top: 4px;
}

@media (max-width: 500px) {
  .game-counter-value { font-size: 1.3em; padding: 6px 16px; }
  .game-counter-title { font-size: 0.95em; }
}

/* Lives display — placed in #ws-lives-slot if present, else fixed top-left */
.ws-lives {
  display: flex;
  gap: 4px;
  z-index: 50;
  justify-content: center;
  margin-top: 6px;
}

/* When appended to body directly (no slot), fix it */
body > .ws-lives {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0;
}

.ws-heart {
  font-size: 36px;
  transition: transform 0.3s;
}

.ws-heart.lost {
  transform: scale(0.8);
  filter: grayscale(1);
}

/* Streak display */
.ws-streak {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  font-family: var(--font);
  font-weight: 900;
  font-size: 1.3em;
  padding: 6px 18px;
  border-radius: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-streak span {
  color: var(--yellow);
}

/* Score bar */
.score-bar {
  display: flex;
  gap: 24px;
  color: white;
  font-size: 1.2em;
  font-weight: 700;
  padding: 10px 0;
}

/* Music toggle (games — hidden on homepage via override) */
.music-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  z-index: 100;
}

.music-btn:hover { background: rgba(255,255,255,0.35); }
.music-btn:active { transform: scale(0.9); }

/* Back button */
.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  z-index: 100;
}

.back-btn:hover { background: rgba(255,255,255,0.35); }
.back-btn:active { transform: scale(0.9); }

/* Confetti canvas overlay */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(105, 219, 124, 0.4); }
  50% { box-shadow: 0 0 40px rgba(105, 219, 124, 0.8); }
}

@keyframes starBounce {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.anim-fadeIn { animation: fadeIn 0.5s ease; }
.anim-pop { animation: pop 0.4s ease; }
.anim-shake { animation: shake 0.5s ease; }
.anim-pulse { animation: pulse 2s ease infinite; }
.anim-float { animation: float 3s ease infinite; }

/* Game instruction overlay */
.instruction-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.instruction-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 40px;
  max-width: 400px;
  text-align: center;
}

.instruction-card h2 {
  color: #333;
  margin-bottom: 12px;
}

.instruction-card p {
  color: #666;
  font-size: 1.2em;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Restart overlay */
.restart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.restart-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 40px;
  max-width: 400px;
  text-align: center;
}

.restart-card .emoji { font-size: 60px; margin-bottom: 16px; }
.restart-card h2 { color: #333; margin-bottom: 8px; }
.restart-card p { color: #888; font-size: 1.1em; margin-bottom: 24px; }

/* Completion overlay */
.complete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.complete-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 40px;
  max-width: 420px;
  text-align: center;
}

.complete-card .emoji { font-size: 80px; margin-bottom: 16px; }
.complete-card h2 { color: #333; margin-bottom: 8px; font-size: 2em; }
.complete-card p { color: #666; font-size: 1.2em; margin-bottom: 24px; }

/* Mobile */
@media (max-width: 500px) {
  h1 { font-size: 1.8em; }
  h2 { font-size: 1.4em; }
  .card { padding: 20px; border-radius: 24px; }
  .btn { padding: 14px 30px; font-size: 1.1em; }
  .btn-large { font-size: 1.3em; padding: 16px 40px; }
  .back-btn { top: 12px; left: 12px; width: 44px; height: 44px; font-size: 20px; }
}
