:root {
  --bg: #2e3323;
  --panel: #3a4029;
  --ink: #e8e0c8;
  --accent: #b8a24a;
  --accent-2: #8a9160;
  --cell: #55603a;
  --cell-open: #c9bd97;
  --danger: #a03d2a;
}

* { 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 #1c2014;
}
.dogs-nav a.active { background: var(--accent); color: #2e3323; }
.dogs-nav .tag { font-weight: normal; font-style: italic; font-size: 0.8rem; opacity: 0.75; }

body {
  background: var(--bg);
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 12px, transparent 12px 24px);
  color: var(--ink);
  font-family: 'Courier New', Courier, monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
}

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

h1 {
  font-family: 'Arial Black', Arial, sans-serif;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  letter-spacing: 0.12em;
  color: var(--accent);
  text-shadow: 2px 2px 0 #1c2014;
}

.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: 540px; }

.myssa-status {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
  box-shadow: 0 4px 0 #1c2014;
}
.myssa-status img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
}
.myssa-status img.panique { animation: tremble 0.35s; }
.myssa-status p { font-size: 0.85rem; color: var(--accent-2); font-style: italic; }
@keyframes tremble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-3deg); }
  75% { transform: translateX(3px) rotate(3deg); }
}

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

.hud button {
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--accent-2);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 10px;
}
#mode-btn.marquer { background: var(--accent); color: #2e3323; border-color: var(--accent); }

.grid-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  background: #454e2e;
  box-shadow: 0 6px 0 #1c2014;
  touch-action: manipulation;
}

#grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cell);
  border: 1px solid #454e2e;
  font-size: clamp(0.8rem, 3.2vw, 1.15rem);
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
.cell:nth-child(odd) { background: #5d6840; }
.cell.open {
  background: var(--cell-open);
  color: #2e3323;
  cursor: default;
}
.cell.mine {
  background: var(--danger) url('assets/putin.png') center / 90% no-repeat;
  border-radius: 50% / 8%;
}
.cell.boom { box-shadow: inset 0 0 0 3px #ffd24a; animation: tremble 0.4s 2; }
.cell.zelensky {
  background: var(--cell-open) url('assets/zelensky.png') center / 92% no-repeat;
  box-shadow: inset 0 0 0 3px #ffd24a;
}
.cell.flag { cursor: pointer; }
.cell.n1 { color: #2c5d8a; } .cell.n2 { color: #3a7a3a; }
.cell.n3 { color: #a03d2a; } .cell.n4 { color: #5a3a8a; }
.cell.n5 { color: #8a5a2c; } .cell.n6 { color: #2c8a8a; }
.cell.n7 { color: #333; }    .cell.n8 { color: #666; }

.grid-wrap.shake { animation: shake 0.5s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(6px, -3px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(4px, 2px); }
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(46, 51, 35, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 18px;
}

.hidden { display: none; }

.round-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  object-fit: cover;
}
.round-photo.shocked { animation: tremble 0.5s 2; border-color: var(--danger); }

.overlay h2 { color: var(--accent); font-size: 1.5rem; font-family: 'Arial Black', Arial, sans-serif; letter-spacing: 0.08em; }
.hint { font-size: 0.82rem; color: var(--accent-2); font-style: italic; }
.final-score { font-size: 1.15rem; }

.big-btn {
  background: var(--accent);
  color: #2e3323;
  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 #6e6128;
  transition: transform 0.05s;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #6e6128; }

.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: var(--panel);
  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 #1c2014;
}

.board-column h2 {
  font-size: 1.1rem;
  font-family: 'Arial Black', Arial, sans-serif;
  letter-spacing: 0.06em;
  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 #55603a;
  font-size: 0.95rem;
}
#leaderboard li:first-child { font-weight: bold; font-size: 1.08rem; }
#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.78rem;
  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; }
  .game-column { max-width: 100%; }
  .board-column { max-width: 540px; }
  .round-photo { width: 85px; height: 85px; }
  .overlay { gap: 9px; padding: 12px; }
  .overlay h2 { font-size: 1.2rem; }
  .overlay p { font-size: 0.9rem; }
  .big-btn { padding: 11px 16px; font-size: 1rem; }
}

body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
.grid-wrap, .overlay, button { user-select: none; -webkit-user-select: none; }

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