/* ============================================================
   1. CSS Custom Properties
   ============================================================ */

:root {
  --bg-deep:    #0f0f1a;
  --bg-card:    rgba(255, 255, 255, 0.06);
  --accent:     #ff6d5a;
  --accent-alt: #ff914d;
  --text:       #e8e8f0;
  --text-muted: #7a7a9a;
  --green:      #4caf88;
  --red:        #ff6d5a;
}

/* ============================================================
   2. Reset / Base
   ============================================================ */

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

/* ============================================================
   3. Body + Background
   ============================================================ */

body {
  background-color: var(--bg-deep);
  background-image: radial-gradient(ellipse at top, #1a1a2e 0%, #0f0f1a 70%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  padding: 1.5rem;
  gap: 1.25rem;
}

/* ============================================================
   4. Game Title (outside card)
   ============================================================ */

.game-title {
  font-family: 'Forum', Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  color: #fff;
  text-align: center;
}

.game-instructions {
  font-family: 'Forum', Georgia, serif;
  font-size: 1.5rem;
  color: #fff;
  text-align: center;
  max-width: min(480px, 90vw);
  line-height: 1.4;
}

@media (min-width: 481px) {
  .game-title {
    font-size: 3rem;
  }
  .game-instructions {
    font-size: 2rem;
  }
}

/* ============================================================
   5. Frosted Glass Card
   CRITICAL: both -webkit-backdrop-filter AND backdrop-filter required (UI-02)
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  width: min(480px, 90vw);
  -webkit-backdrop-filter: blur(12px);  /* Safari — required per UI-02 */
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ============================================================
   6. Status Subtitle
   ============================================================ */

#status {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================================================
   7. Clue List and Clue Rows
   ============================================================ */

#clues {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.clue-row {
  border-left: 3px solid var(--accent);
  padding: 0.35rem 0 0.35rem 0.75rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.clue-op {
  color: var(--accent);
}

/* ============================================================
   8. Input Row — inline desktop, stacked mobile
   ============================================================ */

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#guess {
  flex: 1;
  padding: 0.75rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

#guess:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 109, 90, 0.25);
}

#guess:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#submit {
  padding: 0.75rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

#submit:hover:not(:disabled) {
  background: var(--accent-alt);
}

#submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .input-row {
    flex-direction: column;
  }
  .input-row input,
  .input-row button {
    width: 100%;
  }
}

/* ============================================================
   9. Feedback Message
   ============================================================ */

.feedback {
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 1.4rem;
}

.feedback--correct {
  color: var(--green);
}

.feedback--incorrect {
  color: var(--red);
}

/* ============================================================
   10. Guess History
   ============================================================ */

#history-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#history {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.history-item {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.15rem 0;
}

/* ============================================================
   11. Puzzle Label
   ============================================================ */

.puzzle-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ============================================================
   12. Save Row (score cookie checkbox)
   ============================================================ */

.save-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: -0.25rem;
}

.save-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--accent);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.save-toggle[aria-checked="true"] {
  color: var(--green);
}

.save-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

/* ============================================================
   13. Stats
   ============================================================ */

.stats {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
}

.stats-heading {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.stats-grid {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.stats-val {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.stats-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stats-last-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.stats-bubbles {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.stats-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 109, 90, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ============================================================
   14. Next Puzzle
   ============================================================ */

.next-puzzle {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 0.25rem;
}

/* ============================================================
   15. Site Footer
   ============================================================ */

.site-footer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Forum', Georgia, serif;
  font-size: 0.8rem;
  color: #fff;
  text-align: center;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.footer-link:hover {
  color: var(--accent-alt);
  border-color: var(--accent-alt);
}

@keyframes heart-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}

.footer-heart {
  flex-shrink: 0;
  animation: heart-bounce 1.6s ease-in-out infinite;
  transform-origin: center;
}
