/* Grammar Fix-It - School Notebook Theme Gaming Styles */

/* ========== CSS Variables ========== */
:root {
  /* Notebook Colors */
  --paper-white: #fffef2;
  --paper-lines: #e0ded4;
  --ink-blue: #1e3a8a;
  --red-pen: #dc2626;
  --green-pen: #059669;
  --pencil-gray: #64748b;
  --eraser-pink: #fca5a5;

  /* UI Colors */
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --text-dark: #1e293b;

  /* Shadows & Effects */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* ========== Base Styles ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#game-container {
  width: 100%;
  max-width: 1000px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
}

/* Remove lined paper effect for modern look */
#game-container::before {
  display: none;
}

#game-area {
  position: relative;
  z-index: 1;
  padding: 50px;
  min-height: 600px;
  background: white;
}

/* ========== Welcome Screen ========== */
.welcome-screen {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px;
}

.game-icon {
  font-size: 120px;
  margin-bottom: 30px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-20px) rotate(3deg);
  }
}

.game-title {
  font-size: 3.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  font-weight: 800;
  letter-spacing: -1px;
}

.game-description {
  font-size: 1.2rem;
  color: var(--pencil-gray);
  margin-bottom: 30px;
}

.difficulty-info {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.age-badge,
.time-badge,
.category-badge {
  padding: 8px 18px;
  background: white;
  border: 2px solid var(--ink-blue);
  border-radius: 20px;
  font-weight: 600;
  color: var(--ink-blue);
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.skills-list {
  margin-bottom: 30px;
}

.skills-list h3 {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin-bottom: 15px;
}

.skills-grid {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.skill-badge {
  padding: 6px 14px;
  background: var(--ink-blue);
  color: white;
  border-radius: 15px;
  font-size: 0.85rem;
  font-weight: 500;
}

.game-instructions {
  background: white;
  border: 3px solid var(--ink-blue);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.game-instructions h3 {
  font-size: 1.2rem;
  color: var(--ink-blue);
  margin-bottom: 15px;
}

.game-instructions ol {
  margin-left: 20px;
  line-height: 1.8;
}

.game-instructions li {
  margin-bottom: 8px;
  color: var(--text-dark);
}

.start-game-btn {
  padding: 20px 60px;
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.start-game-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

.start-game-btn:hover::before {
  left: 100%;
}

.start-game-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

/* ========== Game Screen ========== */
.game-screen {
  max-width: 800px;
  margin: 0 auto;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding: 20px;
  background: white;
  border: 3px solid var(--ink-blue);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}

.progress-info {
  display: flex;
  gap: 30px;
  align-items: center;
}

.sentence-counter {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink-blue);
}

.score-display {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-pen);
}

.streak-badge {
  padding: 10px 20px;
  background: var(--warning);
  color: white;
  border-radius: 25px;
  font-weight: 700;
  font-size: 1.1rem;
  animation: pulse 1s ease infinite;
}

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

/* ========== Sentence Display ========== */
.sentence-container {
  position: relative;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border: none;
  border-radius: 24px;
  padding: 60px 50px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sentence-display {
  font-size: 2rem;
  line-height: 2.8;
  color: var(--text-dark);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.word {
  display: inline-block;
  padding: 5px 8px;
  margin: 0 3px;
  border-radius: 6px;
  transition: all 0.3s;
}

.word.has-error {
  background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%);
  border-bottom: 4px solid var(--red-pen);
  cursor: pointer;
  position: relative;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.word.has-error:hover {
  background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.3);
}

.word.has-error:focus {
  outline: 3px solid var(--ink-blue);
  outline-offset: 2px;
}

.word.corrected {
  background: linear-gradient(135deg, #d1fae5 0%, #6ee7b7 100%);
  border-bottom: 4px solid var(--green-pen);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.word.correct-flash {
  animation: correctFlash 0.6s ease;
}

@keyframes correctFlash {
  0%,
  100% {
    background: rgba(5, 150, 105, 0.15);
  }
  50% {
    background: rgba(5, 150, 105, 0.5);
  }
}

.word.wrong-flash {
  animation: wrongFlash 0.6s ease;
}

@keyframes wrongFlash {
  0%,
  100% {
    background: rgba(220, 38, 38, 0.1);
  }
  50% {
    background: rgba(220, 38, 38, 0.4);
  }
}

/* ========== Suggestions Popover ========== */
.suggestions-popover {
  position: absolute;
  background: white;
  border: none;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  z-index: 100;
  animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  min-width: 200px;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.popover-header {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-blue);
  margin-bottom: 12px;
  text-align: center;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-btn {
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #f5f7fa 0%, #e3e8ef 100%);
  color: var(--text-dark);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.suggestion-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateX(8px) scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ========== Action Buttons ========== */
.action-buttons {
  text-align: center;
  margin-bottom: 30px;
}

.validate-btn {
  padding: 20px 60px;
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
  transition: all 0.3s;
}

.validate-btn:hover:not(:disabled) {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(16, 185, 129, 0.5);
}

.validate-btn:disabled {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

/* ========== Feedback Area ========== */
.feedback-area {
  background: white;
  border: 4px solid var(--ink-blue);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 20px;
  animation: slideDown 0.4s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-area.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.feedback-area.wrong {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.05);
}

.feedback-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  text-align: center;
}

.feedback-success h3,
.feedback-error h3 {
  font-size: 1.8rem;
  color: var(--ink-blue);
  margin-bottom: 20px;
  text-align: center;
}

.points-earned {
  font-size: 2rem;
  font-weight: 700;
  color: var(--success);
  text-align: center;
  margin-bottom: 30px;
}

.explanations {
  margin-bottom: 25px;
}

.explanation-item,
.wrong-item {
  background: white;
  border-left: 4px solid var(--ink-blue);
  padding: 15px 20px;
  margin-bottom: 15px;
  border-radius: 8px;
}

.wrong-item {
  border-left-color: var(--error);
}

.explanation-item strong,
.wrong-item strong {
  display: block;
  font-size: 1.1rem;
  color: var(--ink-blue);
  margin-bottom: 8px;
}

.explanation-item p,
.wrong-item p {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.6;
}

.next-btn {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--ink-blue);
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s;
}

.next-btn:hover {
  background: #2563eb;
  transform: scale(1.02);
}

/* ========== Hint Section ========== */
.hint-section {
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
}

.hint-text {
  font-size: 1rem;
  color: var(--pencil-gray);
  font-style: italic;
}

/* ========== Results Screen ========== */
.results-screen {
  text-align: center;
  padding: 40px 20px;
}

.results-icon {
  font-size: 120px;
  margin-bottom: 30px;
  animation: bounce 1s ease;
}

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

.results-screen h2 {
  font-size: 2.5rem;
  color: var(--ink-blue);
  margin-bottom: 40px;
}

.final-score-display {
  background: white;
  border: 4px solid var(--success);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-md);
}

.score-label {
  font-size: 1.2rem;
  color: var(--pencil-gray);
  margin-bottom: 10px;
}

.score-value {
  font-size: 4rem;
  font-weight: 700;
  color: var(--success);
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  border: 3px solid var(--ink-blue);
  border-radius: 15px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 2.5rem;
}

.stat-info {
  text-align: left;
  flex: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--pencil-gray);
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink-blue);
}

.encouragement {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 40px;
  padding: 20px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 15px;
}

.results-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.play-again-btn,
.exit-btn {
  padding: 18px 45px;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s;
}

.play-again-btn {
  background: var(--ink-blue);
  color: white;
}

.play-again-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.exit-btn {
  background: var(--pencil-gray);
  color: white;
}

.exit-btn:hover {
  background: var(--text-dark);
}

/* ========== Utility Classes ========== */
.hidden {
  display: none !important;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
  #game-area {
    padding: 20px;
  }

  .game-title {
    font-size: 2rem;
  }

  .sentence-display {
    font-size: 1.4rem;
    line-height: 2;
  }

  .word {
    padding: 3px 5px;
    margin: 0 2px;
  }

  .sentence-container {
    padding: 30px 20px;
  }

  .game-header {
    flex-direction: column;
    gap: 15px;
  }

  .progress-info {
    flex-direction: column;
    gap: 10px;
  }

  .results-stats {
    grid-template-columns: 1fr;
  }

  .results-actions {
    flex-direction: column;
  }

  .play-again-btn,
  .exit-btn {
    width: 100%;
  }
}
