/* game4.css */

/* ----------------------------------------
   1. VARIABLES & GLOBAL RESET
---------------------------------------- */
:root {
  /* Colors */
  --accent:            #FF9800;
  --accent-dark:       #F57C00;
  --bg-start:          #B3E5FC;  /* light sky */
  --bg-end:            #E1F5FE;  /* lighter sky */
  --white:             #FFFFFF;
  --text-dark:         #333;

  /* Font */
  --font-playful:      'Comic Neue', 'Comic Sans MS', cursive, sans-serif;

  /* Shadows & transitions */
  --shadow-light:      0 2px 6px rgba(0,0,0,0.1);
  --shadow-medium:     0 4px 10px rgba(0,0,0,0.15);
  --transition:        0.3s ease-in-out;
}

/* ----------------------------------------
   2. LAYOUT RESET & FLEX CONTAINER
---------------------------------------- */
html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end)) fixed no-repeat;
  font-family: var(--font-playful);
  color: var(--text-dark);
  user-select: none;
  overflow-x: hidden;
}

main {
  flex: 1;
}

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

/* Utility: visually hidden */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------
   3. HEADER & NAVIGATION
---------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  background: var(--bg-end);
  box-shadow: var(--shadow-medium);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  z-index: 100;
}

.logo {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-dark);
}

.site-nav .nav-list {
  display: flex;
  list-style: none;
}

.site-nav a {
  margin-left: 1rem;
  padding: 0.4rem 0.8rem;
  color: var(--text-dark);
  text-decoration: none;
  border-radius: 0.4rem;
  transition: background var(--transition), transform var(--transition);
}

.site-nav a:hover,
.site-nav a:focus {
  background: rgba(255,152,0,0.2);
  transform: translateY(-2px);
  outline: none;
}

/* ----------------------------------------
   4. INFO SECTION
---------------------------------------- */
.game-info {
  text-align: center;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
  animation: fadeIn 1s ease forwards;
}

.game-info .score {
  font-size: 2.2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--accent-dark);
  animation: pulse 1s ease-in-out infinite;
}

.game-info .instructions {
  font-size: 1.2rem;
  animation: fadeIn 1s ease forwards;
}

/* ----------------------------------------
   5. GAME CONTAINER
---------------------------------------- */
.game-container {
  max-width: 90vw;
  width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--white);
  border: 4px solid var(--accent);
  border-radius: 0.8rem;
  box-shadow: var(--shadow-medium);
  text-align: center;
  animation: bgGradient 10s ease infinite;
  background-size: 200% 200%;
}

/* ----------------------------------------
   6. SENTENCE DISPLAY
---------------------------------------- */
.sentence-display {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #F1F8E9;
  border: 2px dashed #8BC34A;
  border-radius: 0.8rem;
  min-height: 60px;
  animation: slideInFromTop 0.8s ease forwards;
}

/* ----------------------------------------
   7. INPUT & RESET BUTTON
---------------------------------------- */
.input-group {
  margin-bottom: 1.5rem;
}

#typingInput {
  width: 90%;
  font-size: 1.4rem;
  padding: 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.8rem;
  outline: none;
  transition: box-shadow var(--transition), border-color var(--transition);
}

#typingInput:focus {
  box-shadow: 0 0 10px rgba(255,152,0,0.7);
  border-color: var(--accent-dark);
}

#resetBtn {
  font-size: 1.1rem;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 0.8rem;
  cursor: pointer;
  transition: background var(--transition), transform 0.2s ease;
}

#resetBtn:hover,
#resetBtn:focus {
  background: var(--accent-dark);
  transform: scale(1.05);
  outline: none;
}

/* ----------------------------------------
   8. CONFETTI CANVAS
---------------------------------------- */
#confettiCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1000;
}

/* ----------------------------------------
   9. LETTER FEEDBACK & ANIMATIONS
---------------------------------------- */
.letter {
  display: inline-block;
  white-space: pre;
  transition: transform 0.6s ease, opacity 0.6s ease, border-bottom 0.3s ease;
}

.letter.correct   { border-bottom: 2px solid green; }
.letter.incorrect { border-bottom: 2px solid red; }

.shake {
  animation: shake 0.5s;
}

/* ----------------------------------------
   5. FOOTER
---------------------------------------- */
footer {
  text-align: center;
  padding: 1rem 2rem;
  background: var(--bg-info);
  color: var(--text-dark);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* ----------------------------------------
   10. KEYFRAMES
---------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.1); }
}
@keyframes slideInFromTop {
  from { transform: translateY(-40px); opacity: 0; }
  to   { transform: translateY(0);       opacity: 1; }
}
@keyframes bgGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-5px); }
  40%,80%  { transform: translateX(5px); }
}

/* ----------------------------------------
   11. RESPONSIVE TWEAKS
---------------------------------------- */
@media (max-width: 600px) {
  .site-header { flex-direction: column; padding: 1rem; }
  .site-nav .nav-list { flex-direction: column; margin-top: 0.5rem; }
  .site-nav a { margin: 0.5rem 0 0; }
  .game-info .score { font-size: 1.8rem; }
  .game-info .instructions { font-size: 1rem; }
  .sentence-display { font-size: 1.4rem; }
  #typingInput { font-size: 1.2rem; }
  #resetBtn { font-size: 1rem; }
}