@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600&family=Source+Code+Pro:wght@600&display=swap');

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

body {
  font-family: 'Inter', sans-serif;
  background-color: #FAF8F5;
  color: #1A1A1A;
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Header --- */

header {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: 700px;
  margin: 0 auto;
}

header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

header .subtitle {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: #666;
  margin-bottom: 1rem;
}

header .intro {
  font-size: 0.95rem;
  color: #555;
  max-width: 520px;
  margin: 0 auto;
}

#score-display {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #C4A35A;
  min-height: 1.4em;
}

/* --- Grid --- */

#clue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  align-items: start;
}

/* --- Card --- */

.clue-card {
  background: #fff;
  border-radius: 8px;
  border-top: 3px solid #C4A35A;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.clue-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem 0;
}

.card-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #C4A35A;
}

.difficulty-badge {
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: #999;
}

.card-body {
  padding: 0.75rem 1.25rem 1.25rem;
}

/* --- Clue Text --- */

.clue-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-style: italic;
  color: #1A1A1A;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* --- State Visibility --- */

.guess-area,
.result-area,
.answer-area,
.explanation-area {
  display: none;
}

.clue-card[data-state="clue"] .guess-area {
  display: flex;
}

.clue-card[data-state="result"] .result-area {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

.clue-card[data-state="answer"] .result-area {
  display: block;
}
.clue-card[data-state="answer"] .answer-area {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

.clue-card[data-state="explanation"] .result-area {
  display: block;
}
.clue-card[data-state="explanation"] .answer-area {
  display: block;
}
.clue-card[data-state="explanation"] .explanation-area {
  display: block;
  animation: fadeSlideIn 0.35s ease;
}

/* --- Guess Input --- */

.guess-area {
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.guess-input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  border: 2px solid #e0dcd6;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #FDFCFB;
}

.guess-input:focus {
  border-color: #C4A35A;
  box-shadow: 0 0 0 3px rgba(196, 163, 90, 0.15);
}

.guess-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.guess-input.shake {
  animation: shake 0.4s ease;
}

.guess-buttons {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* --- Buttons --- */

.btn {
  padding: 0.6rem 1.2rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.btn:hover {
  transform: scale(1.02);
}

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

.btn-submit {
  background: #1A1A1A;
  color: #fff;
  white-space: nowrap;
}

.btn-submit:hover {
  background: #333;
}

.btn-skip {
  background: transparent;
  color: #999;
  border: 2px solid #e0dcd6;
  white-space: nowrap;
  padding: 0.6rem 0.9rem;
}

.btn-skip:hover {
  color: #666;
  border-color: #ccc;
  background: rgba(0,0,0,0.02);
}

.btn-reveal {
  background: #C4A35A;
  color: #fff;
  margin-top: 0.75rem;
}

.btn-reveal:hover {
  background: #b3923e;
}

.btn-explain {
  background: transparent;
  color: #C4A35A;
  border: 2px solid #C4A35A;
  margin-top: 0.75rem;
}

.btn-explain:hover {
  background: rgba(196, 163, 90, 0.08);
}

/* --- Result --- */

.result-message {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
}

.result-message.correct {
  color: #2D7A4F;
}

.result-message.wrong {
  color: #C0392B;
}

.result-message.skipped {
  color: #999;
  font-style: italic;
}

/* --- Answer --- */

.answer-area {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.answer-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 0.25rem;
}

.answer-text {
  font-family: 'Source Code Pro', monospace;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: #1A1A1A;
}

/* --- Explanation --- */

.explanation-area {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.explanation-text {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.misdirection-tag {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: #F0ECE4;
  color: #666;
  border-radius: 100px;
}

/* --- Finale --- */

.finale {
  max-width: 560px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.finale.hidden {
  display: none;
}

.finale.visible {
  opacity: 1;
  transform: translateY(0);
}

.finale-inner {
  background: #fff;
  border-radius: 12px;
  border-top: 4px solid #C4A35A;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 2.5rem 2rem;
  text-align: center;
}

.finale-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.finale-score {
  font-size: 1.1rem;
  font-weight: 600;
  color: #C4A35A;
  margin-bottom: 0.75rem;
}

.finale-message {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.btn-restart {
  background: #1A1A1A;
  color: #fff;
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
}

.btn-restart:hover {
  background: #333;
}

/* --- Flash Effects --- */

.clue-card.flash-correct {
  animation: flashGreen 0.6s ease;
}

.clue-card.flash-wrong {
  animation: flashRed 0.6s ease;
}

/* --- Animations --- */

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flashGreen {
  0% { background: #fff; }
  15% { background: rgba(45, 122, 79, 0.08); }
  100% { background: #fff; }
}

@keyframes flashRed {
  0% { background: #fff; }
  15% { background: rgba(192, 57, 43, 0.08); }
  100% { background: #fff; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* --- Footer --- */

footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  font-size: 0.8rem;
  color: #999;
}

footer a {
  color: #C4A35A;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  header h1 {
    font-size: 2.2rem;
  }

  #clue-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 0 1rem 2rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 2rem 1rem 1.5rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .card-body {
    padding: 0.5rem 1rem 1rem;
  }

  .guess-area {
    flex-direction: column;
  }

  .guess-buttons {
    width: 100%;
  }

  .btn-submit {
    flex: 1;
  }

  .btn-skip {
    flex-shrink: 0;
  }

  .clue-text {
    font-size: 1.05rem;
  }

  .finale-inner {
    padding: 2rem 1.25rem;
  }

  .finale-title {
    font-size: 1.6rem;
  }
}
