:root {
  --bg: #f6efe3;
  --panel: #fffaf1;
  --ink: #4a3627;
  --accent: #b3572f;
  --accent-2: #8a6f57;
  --gold: #d9a521;
}

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

/* nav entre les chiens */
.dogs-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.dogs-nav a {
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.95rem;
  font-weight: bold;
  box-shadow: 0 3px 0 #d8c8a8;
}
.dogs-nav a.active {
  background: var(--accent);
  color: #fff;
}
.dogs-nav .tag {
  font-weight: normal;
  font-style: italic;
  font-size: 0.8rem;
  opacity: 0.75;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
}

header { text-align: center; margin: 8px 0 14px; }

h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  letter-spacing: 0.04em;
  color: var(--accent);
  text-shadow: 2px 2px 0 #e8d9bf;
}

.subtitle { font-style: italic; color: var(--accent-2); }

main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 980px;
}

.game-column { flex: 1 1 420px; max-width: 560px; }

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 8px;
}

#mute-btn {
  background: none;
  border: 2px solid var(--accent-2);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 8px;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  background: #efe4cd;
  box-shadow: 0 6px 0 #d8c8a8;
  touch-action: none;
}

canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(246, 239, 227, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 18px;
}

.hidden { display: none; }

.round-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  object-fit: cover;
}

.round-photo.sad { filter: grayscale(40%); border-color: var(--accent-2); }

.overlay h2 { color: var(--accent); font-size: 1.5rem; }
.hint { font-size: 0.85rem; color: var(--accent-2); font-style: italic; }
.final-score { font-size: 1.2rem; }

.big-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1.05rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #7e3c1f;
  transition: transform 0.05s;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7e3c1f; }

.small-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.submit-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

#name-input {
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid var(--accent-2);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 160px;
}

.board-column {
  flex: 0 1 300px;
  width: 100%;
  max-width: 320px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 0 #d8c8a8;
}

.board-column h2 {
  font-size: 1.15rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 12px;
}

#leaderboard { list-style: none; }
#leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px dashed #d8c8a8;
  font-size: 0.98rem;
}
#leaderboard li:first-child { font-weight: bold; font-size: 1.1rem; }
#leaderboard li .rank { color: var(--accent-2); margin-right: 8px; }
#leaderboard li.loading { justify-content: center; font-style: italic; color: var(--accent-2); border: none; }

.board-note {
  margin-top: 12px;
  text-align: center;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--accent-2);
}

@media (max-width: 720px) {
  body { padding: 8px; }
  header { margin: 4px 0 8px; }
  main { flex-direction: column; align-items: center; gap: 14px; }

  /* le canvas tient dans l'écran sans scroller */
  .game-column {
    max-width: min(100%, calc(100dvh - 210px));
    min-width: min(100%, 300px);
  }
  .board-column { max-width: 560px; }

  .hud { font-size: 0.95rem; }
  .round-photo { width: 90px; height: 90px; }
  .overlay { gap: 9px; padding: 12px; }
  .overlay h2 { font-size: 1.25rem; }
  .overlay p { font-size: 0.92rem; }
  .big-btn { padding: 11px 16px; font-size: 1rem; }
}

/* confort tactile global */
body {
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.canvas-wrap, .overlay, button { user-select: none; -webkit-user-select: none; }

/* iPhone : encoches */
@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}
