/* ===== Variables & base ===== */
:root {
  --bg: #fef9f0;
  --bg-card: #fff;
  --ink: #2d2a26;
  --ink-muted: #6b6560;
  --accent: #f34e66;
  --accent-soft: #fcd4da;
  --success: #4a9b6e;
  --success-soft: #c8e6d4;
  --error: #c75c5c;
  --error-soft: #f0d0d0;
  --border: #e8e0d8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(45, 42, 38, 0.08);
  --font: 'Nunito', sans-serif;
  --font-display: 'Patrick Hand', cursive;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header (home & game) ===== */
.site-header {
  text-align: center;
  padding: 1.5rem 1rem;
  background: #f3f3f3;
  border-bottom: 3px solid rgba(0, 0, 0, 0.1);
}

.app-title {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-logo {
  display: block;
  height: 6.25rem;
  width: auto;
  max-width: min(460px, 92vw);
  object-fit: contain;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: #04244a;
}

h2 {
  color: #04244a;
}

/* ===== Home: game cards ===== */
.home-main {
  flex: 1;
  padding: 2rem 1rem;
  max-width: 1024px;
  margin: 0 auto;
  width: 100%;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.game-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(45, 42, 38, 0.12);
  border-color: var(--accent);
}

.game-card__icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.game-card__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #04244a;
}

.game-card__desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.game-card--coming {
  opacity: 0.7;
  cursor: default;
  pointer-events: none;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
}

/* ===== Game page: layout ===== */
.game-page .site-header {
  padding: 1rem;
}

.game-page .app-logo {
  height: 4.75rem;
}

.game-main {
  flex: 1;
  padding: 1.5rem 1rem;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.back-link:hover {
  text-decoration: underline;
}

.game-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  margin: 0 0 1.25rem;
  color: #04244a;
  text-align: center;
  line-height: 1.2;
}

/* ===== Checkboxes (word types) ===== */
.filters-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  transition: opacity 0.2s;
}

.filters-section--playing,
.filters-area.filters-section--playing {
  display: none;
}

.filters-area {
  margin-bottom: 1.5rem;
}

.filters-area .filters-section {
  margin-bottom: 0;
}

.filters-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--ink);
}

.filter-select-all-wrap {
  margin-bottom: 0.75rem;
}

.filter-label--all {
  font-weight: 600;
  color: var(--accent);
}

.filter-label--all input {
  accent-color: var(--accent);
}

.filters-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink);
  user-select: none;
}

.filter-label input {
  width: 1.2em;
  height: 1.2em;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===== Instruction & sentence ===== */
.instruction {
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1rem;
  min-height: 1.5em;
  line-height: 1.3;
}

.instruction-class {
  font-weight: 700;
  color: var(--accent);
}

.filter-mode-wrap {
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-label--mode {
  font-weight: 600;
}

.filter-mode-hint {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.sentence-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.sentence-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em 0.5em;
  align-items: baseline;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1.6;
}

.word-token {
  display: inline-block;
  padding: 0.25em 0.4em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.word-token:hover {
  background: #dcecff;
}

.word-token--correct {
  background: var(--success-soft) !important;
  color: var(--ink);
  border-color: var(--success);
  cursor: default;
}

.word-token--done {
  background: var(--border) !important;
  color: var(--ink-muted);
  border-color: #ccc;
  cursor: default;
}

.word-token--wrong {
  background: var(--error-soft) !important;
  color: var(--ink);
  border-color: var(--error);
  animation: wrong-fade 2.5s ease forwards;
}

.word-token--punct {
  cursor: default !important;
}

.word-token--punct:hover {
  background: transparent !important;
}

.word-token-wrap {
  position: relative;
  display: inline;
}

.word-token-wrap .word-token {
  vertical-align: baseline;
}

.word-token__acronym {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 0.1em;
  font-size: 0.6em;
  font-weight: 600;
  color: var(--ink-muted);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

@keyframes wrong-fade {
  0%, 40% {
    background: var(--error-soft);
    border-color: var(--error);
  }
  100% {
    background: transparent;
    border-color: transparent;
  }
}

/* ===== Celebration (classe réussie) ===== */
.celebration {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1.75rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(45, 42, 38, 0.2);
  border: 3px solid var(--success);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.celebration.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: celebration-pop 1s ease forwards;
}

.celebration__thumb {
  font-size: 3rem;
  line-height: 1;
  animation: celebration-bounce 0.5s ease 0.15s both;
}

.celebration__text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--success);
  text-align: center;
}

@keyframes celebration-pop {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

@keyframes celebration-bounce {
  0% { transform: scale(0); }
  55% { transform: scale(1.15); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn--primary {
  background: #04244a;
  color: #fff;
  margin-top: 0.5rem;
}

.btn--primary:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(4, 36, 74, 0.4);
}

.btn--secondary {
  background: var(--border);
  color: var(--ink);
}

.btn--secondary:hover {
  background: #ddd;
}

.btn--secondary:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--secondary:disabled:hover {
  background: var(--border);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ===== Game state: no selection ===== */
.no-selection-msg {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-top: 1rem;
}

/* ===== Next phrase / end ===== */
.next-phrase {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
