@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/outfit-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/outfit-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/outfit-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/outfit-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/assets/fonts/outfit-800.woff2') format('woff2');
}

:root {
  --bg: #0f1220;
  --bg-alt: #171b2e;
  --surface: #1e2338;
  --border: #2c3350;
  --text: #f2f3f8;
  --text-muted: #b0b6d0;
  --accent: #5a8cf0;
  --accent-dark: #3d6bd0;
  --accent-light: #8fb2f7;
  --green: #4caf6d;
  --red: #e0566a;
  --radius: 14px;
  --max-width: 640px;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(255, 255, 255, 0.06);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-light), var(--accent-dark));
  border: 3px solid var(--bg);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a9c4fb, var(--accent));
}

::-webkit-scrollbar-corner {
  background: var(--bg);
}

.autocomplete-list,
.reveal-full-bio {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-light) rgba(255, 255, 255, 0.05);
}

.autocomplete-list::-webkit-scrollbar,
.reveal-full-bio::-webkit-scrollbar {
  width: 8px;
}

.autocomplete-list::-webkit-scrollbar-track,
.reveal-full-bio::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.autocomplete-list::-webkit-scrollbar-thumb,
.reveal-full-bio::-webkit-scrollbar-thumb {
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 999px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

h1, h2, h3, button, .badge, .category-card, .archive-num {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease, opacity 0.15s ease; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.site-header, .site-footer {
  width: 100%;
}
.header-inner, .footer-inner {
  width: 100%;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-sizing: border-box;
}
.header-inner {
  position: relative;
  justify-content: flex-start;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.icon-btn.copied { border-color: var(--green); color: var(--green); }

/* Mobile-first: nav collapses into a dropdown panel toggled by the hamburger button. */
.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  right: 20px;
  left: 20px;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 50;
}
.site-nav.open { display: flex; }
.site-nav a {
  padding: 10px 12px;
  border-radius: 8px;
}
.site-nav a:hover { background: var(--bg-alt); text-decoration: none; }

@media (min-width: 720px) {
  .nav-toggle { display: none; }
  .site-nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    align-items: center;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 0;
    margin-left: auto;
  }
  .site-nav a { padding: 0; border-radius: 0; margin-left: 16px; }
  .site-nav a:first-child { margin-left: 0; }
  .site-nav a:hover { background: none; }
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.site-header .brand:hover { text-decoration: none; }
.logo-mark {
  flex-shrink: 0;
  height: 46px;
  width: auto;
  animation: logoGlow 3.5s ease-in-out infinite;
}
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(90, 140, 240, 0)); }
  50% { filter: drop-shadow(0 0 7px rgba(90, 140, 240, 0.65)); }
}

/* --- Home page ambient background --- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.32;
}
.blob-a {
  width: 420px;
  height: 420px;
  background: var(--accent);
  top: -120px;
  left: -100px;
  animation: blobDriftA 19s ease-in-out infinite;
}
.blob-b {
  width: 380px;
  height: 380px;
  background: var(--green);
  bottom: -130px;
  right: -80px;
  animation: blobDriftB 23s ease-in-out infinite;
}
@keyframes blobDriftA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(70px, 50px) scale(1.15); }
}
@keyframes blobDriftB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, -40px) scale(1.1); }
}
.site-nav a, .site-footer nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.site-footer nav a { margin-left: 16px; }
.site-footer nav a:first-child { margin-left: 0; }

.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: 0;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 16px;
  border: none;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(90, 140, 240, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  animation: pwaPulse 2.6s ease-in-out infinite;
}
.pwa-install-btn .pwa-install-icon { font-size: 1rem; line-height: 1; }
.pwa-install-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(90, 140, 240, 0.45); }
.pwa-install-btn:active { transform: translateY(0) scale(0.97); box-shadow: 0 2px 6px rgba(90, 140, 240, 0.3); }
.pwa-install-btn:disabled { opacity: 0.55; cursor: default; animation: none; transform: none; }
@keyframes pwaPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(90, 140, 240, 0.35); }
  50% { box-shadow: 0 2px 18px rgba(90, 140, 240, 0.6); }
}
@media (min-width: 720px) {
  .pwa-install-btn { margin-left: 16px; margin-top: 0; }
}

.site-footer {
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-brand { flex-shrink: 0; opacity: 0.85; transition: opacity 0.15s ease; }
.footer-brand:hover { opacity: 1; }
.footer-logo { height: 34px; width: auto; display: block; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* --- Game --- */
.game {
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

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

.game .puzzle-head { animation: fadeInUp 0.5s ease both; }
.game .tile-grid { animation: fadeInUp 0.5s ease 0.07s both; }
.game .guess-form { animation: fadeInUp 0.5s ease 0.14s both; }
.game .giveup-row { animation: fadeInUp 0.5s ease 0.19s both; }
.game .feedback { animation: fadeInUp 0.5s ease 0.23s both; }
.game .stats-panel { animation: fadeInUp 0.5s ease 0.28s both; }

.replay-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.solo-cta-banner {
  max-width: var(--max-width);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(90, 140, 240, 0.14), rgba(90, 140, 240, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1.4), border-color 0.2s ease, box-shadow 0.2s ease;
}
.solo-cta-banner:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.solo-cta-icon { font-size: 1.15rem; flex-shrink: 0; }
.solo-cta-text { flex: 1; }
.solo-cta-arrow { font-weight: 700; color: var(--accent); flex-shrink: 0; }

.puzzle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-right: 6px;
  transition: transform 0.2s ease;
}
.badge-muted {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.hints-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.hint-pips { display: flex; gap: 2px; }
.hint-pip {
  font-size: 1.05rem;
  filter: grayscale(0);
  opacity: 1;
  transition: opacity 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}
.hint-pip.used {
  opacity: 0.28;
  filter: grayscale(1);
  transform: scale(0.85);
}
.hint-pip.paid-pip { filter: none; }

#js-buy-hint-btn {
  background: linear-gradient(135deg, #ffe08a, #f0a95a);
  color: #3a2a00;
}
#js-buy-hint-btn:hover { transform: translateY(-2px); }
#js-buy-hint-btn:disabled { opacity: 0.5; }
.hints-counter span { color: var(--text); font-weight: 700; }

.sound-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sound-toggle:hover { border-color: var(--accent); transform: scale(1.1) rotate(-6deg); }

.tile-grid {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  perspective: 900px;
}
.tile-grid.flash-active { animation: cameraFlashDim 0.06s ease-out; }
.tile-grid.flash-active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 10;
  opacity: 0;
  animation: cameraFlashWhite 0.06s ease-out;
  pointer-events: none;
}
@keyframes cameraFlashWhite {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes cameraFlashDim {
  0% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}
.tile-grid.pulse {
  animation: tilePulse 0.6s ease;
}

/* Hiding the portrait is now a purely cosmetic client-side blur, not a security boundary: the
   full real image is sent to the browser up front (see api/puzzle_image.php), and the blur
   amount is set inline by game.js/solo.js from the hints-used count (one step per indice
   clicked). A determined player could strip this filter via devtools and see the answer early -
   accepted tradeoff, not a bug. The max-blur default below is what's on screen before JS has
   even run its first fetch - without it the portrait would flash sharp for a moment on load,
   since an unset filter has nothing to transition away from. */
.portrait-blur {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-color: var(--surface);
  transform: scale(1.08); /* hides the soft edge the blur leaves around the frame */
  filter: blur(30px);
  transition: filter 0.6s ease;
}

.portrait-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  opacity: 1;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.portrait-lock.hidden {
  opacity: 0;
}

@keyframes tilePulse {
  0% { box-shadow: 0 0 0 0 rgba(90, 140, 240, 0.55); transform: scale(1); }
  40% { transform: scale(1.015); }
  100% { box-shadow: 0 0 0 18px rgba(90, 140, 240, 0); transform: scale(1); }
}

.hint-list { margin: 12px 0; }
.hint-item {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 6px 0;
  color: var(--text-muted);
  animation: hintSlideIn 0.35s ease both;
}
@keyframes hintSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.guess-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  /* Explicit stacking context: without this, the fadeInUp entrance animation on later
     siblings (giveup-row, feedback, stats-panel) leaves them with a lingering non-"none"
     transform even after finishing, which creates its own stacking context for each and
     makes them paint OVER the autocomplete dropdown below, regardless of its z-index. */
  position: relative;
  z-index: 10;
}

.autocomplete-wrap { position: relative; flex: 1 1 220px; }

#js-guess-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#js-guess-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90, 140, 240, 0.25);
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
}
.autocomplete-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.12s ease, padding-left 0.12s ease;
}
.autocomplete-list li:hover { padding-left: 14px; }
.autocomplete-list li:hover { background: var(--bg-alt); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1.4), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
button:active { transform: scale(0.95); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 55%, var(--accent-dark));
  color: #fff;
  box-shadow: 0 3px 10px rgba(90, 140, 240, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(90, 140, 240, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 6px rgba(90, 140, 240, 0.35);
}

#js-hint-btn, .btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  display: inline-block;
}
#js-hint-btn:hover, .btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
#js-hint-btn:active, .btn-secondary:active { transform: translateY(0) scale(0.97); }

.flash-btn {
  background: linear-gradient(135deg, #ffd76a, #f5a623 60%, #e08a00);
  color: #2a1c00;
  box-shadow: 0 3px 10px rgba(245, 166, 35, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.flash-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 166, 35, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.flash-btn:active { transform: translateY(0) scale(0.97); }
.flash-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.tile-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  z-index: 5;
}

#js-hint-btn.tile-action-btn,
#js-flash-btn.tile-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  font-size: 0.85rem;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

#js-hint-btn.tile-action-btn {
  background: rgba(15, 18, 32, 0.72);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}
#js-hint-btn.tile-action-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

@media (max-width: 520px) {
  .tile-action-label { display: none; }
  #js-hint-btn.tile-action-btn,
  #js-flash-btn.tile-action-btn { padding: 9px 11px; }
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.feedback {
  min-height: 1.4em;
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.feedback.wrong { color: var(--red); }
.feedback.correct { color: var(--green); font-weight: 700; }

.shake { animation: shake 0.45s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.reveal-card {
  position: relative;
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  animation: revealPop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.reward-popup {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffe08a, #f0a95a);
  color: #3a2a00;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(240, 169, 90, 0.5);
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}
.reward-popup.reward-float {
  animation: rewardFloat 2s ease forwards;
}
@keyframes rewardFloat {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.8); }
  15% { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.08); }
  70% { opacity: 1; transform: translateX(-50%) translateY(-26px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-44px) scale(0.95); }
}
@keyframes revealPop {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes revealImagePop {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.reveal-card img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 12px;
  border: 3px solid var(--accent);
  animation: revealImagePop 0.55s cubic-bezier(0.2, 0.8, 0.3, 1.2) 0.1s both;
}
.reveal-card.lost img { border-color: var(--red); }
.reveal-card.gave-up img { border-color: #f0a95a; }

.giveup-row {
  justify-content: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.giveup-row:not([hidden]) {
  display: flex;
}
.giveup-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
}
.giveup-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  transform: none;
}
.reveal-card h2 { margin: 0 0 4px; }
.reveal-card p { color: var(--text-muted); margin: 4px 0; }
.reveal-card .btn-secondary, .reveal-card .btn-primary {
  margin: 10px 6px 0;
}
.reveal-full-bio {
  text-align: left;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  max-height: 320px;
  overflow-y: auto;
}
.reveal-full-bio p { margin: 0 0 12px; color: inherit; }
.reveal-full-bio .wikipedia-link { font-size: 0.82rem; opacity: 0.8; }
.reveal-full-bio a { color: var(--accent); }
.reveal-anecdotes {
  text-align: left;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
}
.reveal-anecdotes h3 { margin: 0 0 8px; color: var(--text); font-size: 1rem; }
.reveal-anecdotes ul { margin: 0; padding-left: 20px; }
.reveal-anecdotes li { margin: 0 0 6px; }
.countdown-block { margin-top: 18px; }
.countdown { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.archive-teaser { margin-top: 14px; font-size: 0.9rem; }

.stats-panel {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 12px 6px;
  margin-top: 20px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 14px;
}
.stats-panel div { text-align: center; flex: 1 1 18%; min-width: 64px; }
.stats-panel span { display: block; font-size: 1.15rem; font-weight: 700; }
.stats-panel small { color: var(--text-muted); font-size: 0.72rem; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 12, 0.75);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay:not([hidden]) {
  display: flex;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  border: 1px solid var(--border);
}
.modal h2 { margin-top: 0; }

/* --- Portrait sheet --- */
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin: 16px 0; }
.portrait-header {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.portrait-thumb { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); }
.portrait-header h1 { margin: 0 0 6px; font-size: 1.5rem; }
.dates, .success-rate { color: var(--text-muted); margin: 2px 0; }
.difficulty-line { color: var(--text-muted); margin: 4px 0; }
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}
.difficulty-enfant { border-color: rgba(76, 175, 109, 0.5); color: #83d69b; }
.difficulty-facile { border-color: rgba(90, 140, 240, 0.55); color: var(--accent-light); }
.difficulty-normal { border-color: rgba(176, 182, 208, 0.35); color: var(--text-muted); }
.difficulty-difficile { border-color: rgba(224, 86, 106, 0.55); color: #f08a9a; }
.bio-content p { margin: 0 0 14px; }
.anecdotes ul { padding-left: 20px; }
.hints-recap ol { padding-left: 20px; color: var(--text-muted); }
.affiliate-block, .related-portraits { margin-top: 30px; }
.portrait-grid, .category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.portrait-card {
  text-align: center;
  color: var(--text);
  font-size: 0.85rem;
  display: block;
  transition: transform 0.15s ease;
}
.portrait-card:hover { transform: translateY(-3px); text-decoration: none; }
.portrait-card img {
  border-radius: 50%;
  margin: 0 auto 6px;
  object-fit: cover;
  transition: box-shadow 0.15s ease;
  border: 2px solid transparent;
}
.portrait-card:hover img { border-color: var(--accent); }
.source-link { color: var(--text-muted); margin-top: 20px; }
.ad-slot { min-height: 90px; margin-top: 30px; }

/* --- Archives / categories --- */
.month-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.month-links a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.month-links a:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.month-links a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.archive-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.archive-cell:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}
.archive-num { display: block; font-weight: 700; }
.archive-date { display: block; font-size: 0.78rem; color: var(--text-muted); }

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  text-decoration: none;
}
.category-card-icon { font-size: 1.8rem; }

.pagination { display: flex; gap: 6px; margin-top: 20px; }
.pagination a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pagination a:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.pagination a.active { background: var(--accent); color: #fff; }

.error-404 { text-align: center; padding: 60px 0; }
.error-404 h1 { font-size: 4rem; margin: 0; }

/* --- Static / legal pages --- */
.static-page { max-width: 720px; margin: 0 auto; }

/* --- FAQ --- */
.faq-page { max-width: 720px; margin: 0 auto; }
.faq-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 18px;
  transition: border-color 0.2s ease;
}
.faq-item[open] { border-color: var(--accent); }
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 0;
  list-style: none;
  position: relative;
  padding-right: 24px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 14px;
  color: var(--accent);
  font-size: 1.2rem;
  transition: transform 0.25s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { color: var(--text-muted); padding-bottom: 16px; margin: 0; }
.faq-more { margin-top: 20px; color: var(--text-muted); }
.static-page h2 { margin-top: 28px; font-size: 1.15rem; }
.static-page p { color: var(--text-muted); }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px;
  font-size: 0.88rem;
}
.legal-table th, .legal-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.legal-table th {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}
.legal-table td { color: var(--text-muted); }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
  max-width: 480px;
}
.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.contact-form .optional { font-weight: 400; opacity: 0.7; }
.contact-form input, .contact-form textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); }
.contact-form button { align-self: flex-start; }
.contact-form .honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form-success {
  background: rgba(76, 175, 109, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 20px;
}
.form-errors {
  background: rgba(224, 86, 106, 0.15);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 20px;
}
.form-errors ul { margin: 0; padding-left: 18px; }

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fc;
    --bg-alt: #ffffff;
    --surface: #ffffff;
    --border: #e1e4ee;
    --text: #1a1d2e;
    --text-muted: #5c6180;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.debug-panel {
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px dashed var(--red);
  border-radius: 10px;
  background: rgba(224, 86, 106, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--red);
}
.debug-panel button {
  background: var(--red);
  color: #fff;
  font-size: 0.8rem;
  padding: 6px 12px;
}

/* --- Solo mode --- */
.solo-select { max-width: 720px; margin: 0 auto; }
.solo-progress-summary { color: var(--text-muted); margin-top: 16px; text-align: center; }

.solo-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.solo-level-btn {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.solo-level-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.solo-level-btn.completed {
  background: linear-gradient(135deg, rgba(76, 175, 109, 0.25), rgba(76, 175, 109, 0.08));
  border-color: var(--green);
}
.solo-level-btn.completed .solo-level-number::after { content: ' ✓'; }
.solo-level-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.solo-next-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
