:root {
  --ink: #3d2c6b; --soft: #7b6fa8; --accent: #7b2cbf; --pink: #ef476f; --gold: #ffd166; --ok: #2a9d8f;
  font-family: "Baloo 2", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 30% 0%, #f2ffe9, #d9f0ff 60%, #b9d8f2) fixed;
  overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.icon-btn {
  width: 44px; height: 44px; border: none; border-radius: 14px; background: #fff; font-size: 21px; flex: none;
  box-shadow: 0 3px 0 #b9cde0; display: grid; place-items: center; text-decoration: none; color: inherit;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9cde0; }
.icon-btn:disabled { opacity: .4; }
.btn { border: none; border-radius: 999px; padding: 10px 22px; background: #fff; font-weight: 800; font-size: 18px; box-shadow: 0 4px 0 #b9cde0; }
.btn.primary { background: linear-gradient(#5fd38d, #2a9d8f); color: #fff; box-shadow: 0 4px 0 #1d6f65; }
.btn.big { font-size: 22px; padding: 12px 30px; }

/* ---------- carte ---------- */
#map { height: 100dvh; overflow-y: auto; padding: 12px 16px 40px; }
.map-head { display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 0 auto 10px; }
.map-head h1 { flex: 1; margin: 0; font-size: clamp(22px, 5vw, 38px); color: #2d6a4f; }
.map-head h1 small { font-size: .45em; opacity: .6; }
.world { max-width: 760px; margin: 14px auto; background: rgba(255,255,255,.6); border-radius: 24px; padding: 10px 16px 18px; border-top: 6px solid var(--wc); }
.world h2 { margin: 4px 0 10px; font-size: 22px; }
.nodes { display: flex; flex-wrap: wrap; gap: 26px 18px; }
.node {
  position: relative; width: 84px; height: 84px; border-radius: 22px; border: none; margin-bottom: 18px;
  background: #fff; box-shadow: 0 5px 0 var(--wc); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.node .n { font-size: 28px; font-weight: 800; line-height: 1; }
.node .st { color: var(--gold); font-size: 16px; text-shadow: 0 1px 0 #b58900; }
.node .nm { position: absolute; top: 100%; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--soft); white-space: nowrap; }
.node.next { animation: bob 1.2s ease-in-out infinite; box-shadow: 0 5px 0 var(--wc), 0 0 0 5px rgba(255,209,102,.6); }
.node.locked { opacity: .5; cursor: default; }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* ---------- partie ---------- */
#play { height: 100dvh; display: flex; flex-direction: column; }
#hud { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 8px 8px 0; background: rgba(255,255,255,.8); border-radius: 22px; box-shadow: 0 4px 16px rgba(40,80,120,.12); }
#hud .info { flex: 1; min-width: 0; }
#hud .title { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud .moves { color: var(--soft); font-size: 15px; }
#hud .moves b { color: var(--ink); font-size: 20px; }
#hud .moves.over #hud-moves { color: var(--pink); }
#hud .fish { margin-left: 6px; }
#net { flex: none; }
#board { position: relative; flex: 1; min-height: 0; touch-action: none; }
.board-canvas { position: absolute; inset: 0; touch-action: none; }

#modal { position: fixed; inset: 0; background: rgba(20,40,60,.4); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-card { background: #fff; border-radius: 28px; padding: 22px 24px; max-width: 480px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(20,40,60,.35); animation: pop .35s; max-height: 92dvh; overflow-y: auto; }
.modal-card h2 { margin: 0 0 8px; font-size: 30px; color: #2d6a4f; }
.modal-card p { font-size: 17px; line-height: 1.4; }
.modal-card .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.stars { font-size: 60px; letter-spacing: 6px; }
.stars span { color: #dfe7ef; display: inline-block; }
.stars span.on { color: var(--gold); animation: starpop .5s both; text-shadow: 0 3px 0 #d4a017; }
@keyframes starpop { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

@media (max-width: 520px) {
  #hud { gap: 5px; padding: 6px; flex-wrap: wrap; }
  #hud .info { flex-basis: calc(100% - 50px); }
  .icon-btn { width: 40px; height: 40px; font-size: 19px; }
}
