/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink); border-bottom: 3px solid #000;
}
.hud-left { flex: 1; min-width: 0; }
.hud-tour { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-name { font-family: var(--font-title); font-size: 20px; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-flags { font-family: var(--font-title); font-size: 20px; background: var(--ochre); color: var(--ink); border: 3px solid #000; border-radius: 12px; padding: 3px 10px; box-shadow: 0 3px 0 #000; }
.hud-flags span { font-size: 14px; }
.flag-ico { color: var(--terra); font-size: 18px !important; }
.hud-menu { background: var(--night-2); color: var(--paper); border: 3px solid #000; border-radius: 12px; width: 42px; height: 40px; font-size: 20px; cursor: pointer; }

.mission {
  margin: 12px 16px 0; padding: 12px 14px;
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink);
  display: flex; gap: 12px; align-items: center; font-size: 15px;
  max-width: 480px; margin-left: auto; margin-right: auto;
}
@media (max-width: 512px) { .mission { margin-left: 16px; margin-right: 16px; } }
.mission .m-ico { font-size: 28px; line-height: 1; }
.mission b { font-family: var(--font-title); font-weight: 400; font-size: 17px; letter-spacing: .3px; }

/* ---------- Mapa ---------- */
.map-wrap { max-width: 480px; margin: 14px auto 0; padding: 0 0 120px; }
.map-svg { display: block; width: 100%; height: auto; }
.m-node { cursor: pointer; outline: none; }
.m-node:focus-visible circle { stroke: var(--ochre); }
.m-num { font-family: var(--font-title); font-size: 30px; }
.m-label { font-family: var(--font-title); font-size: 15px; fill: #fff7e8; letter-spacing: .3px; }
.m-reward { font-family: var(--font-body); font-weight: 600; font-size: 12.5px; fill: #ffe08a; paint-order: stroke; stroke: #1b1530; stroke-width: 4px; stroke-linejoin: round; }
.m-landmark { font-family: var(--font-title); font-size: 12px; fill: #fff7e8; paint-order: stroke; stroke: #1b1530; stroke-width: 4px; letter-spacing: .5px; }
.m-bubble-t { font-family: var(--font-title); font-size: 14px; fill: #1b1530; }
.m-initial { font-family: var(--font-title); font-size: 13px; fill: #1b1530; }
.m-node.locked text, .m-node.locked .m-reward { opacity: .8; }

.m-pulse { transform-origin: center; transform-box: fill-box; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.m-bubble { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.m-player { animation: hop 1s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-7px); } }
.m-flag-cloth { transform-origin: left center; transform-box: fill-box; animation: wave 2.2s ease-in-out infinite; }
@keyframes wave { 50% { transform: skewY(-6deg) scaleX(.92); } }
.m-flame { transform-box: fill-box; transform-origin: bottom center; animation: flicker .5s ease-in-out infinite alternate; }
@keyframes flicker { to { transform: scale(1.12, .9); } }
.m-twinkle { animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---------- Barra inferior ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(18,13,43,.97) 70%, rgba(18,13,43,0));
}
.dock-qr { min-width: 170px; font-size: 24px; }
.dock-side { background: transparent; border: 0; color: var(--paper); font: 600 12px var(--font-body); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; width: 64px; }
.dock-side span { font-size: 24px; }
.qr-ico { width: 22px; height: 22px; background:
  linear-gradient(var(--ink),var(--ink)) 0 0/8px 8px no-repeat, linear-gradient(var(--ink),var(--ink)) 100% 0/8px 8px no-repeat,
  linear-gradient(var(--ink),var(--ink)) 0 100%/8px 8px no-repeat, linear-gradient(var(--ink),var(--ink)) 70% 70%/5px 5px no-repeat; }

/* ---------- Pase QR ---------- */
.pass { text-align: center; }
.pass h2 { font-size: 28px; color: var(--ink); }
.qr-box { background: #fff; border: 4px solid var(--ink); border-radius: 18px; padding: 12px; margin: 10px auto 12px; width: min(300px, 100%); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.qr-box img { width: 100%; height: 100%; image-rendering: pixelated; }
.timer { height: 10px; background: #e9dcc0; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; margin: 0 auto 10px; width: min(300px, 100%); }
.timer i { display: block; height: 100%; background: var(--ok); width: 100%; transform-origin: left; }
.manual-code { font-family: var(--font-title); font-size: 32px; letter-spacing: 6px; color: var(--ink); }
.pass .who { font-weight: 700; font-size: 18px; }

/* ---------- Título de conquista (tarjeta del bar) ---------- */
.deed { background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 7px 0 var(--ink); overflow: hidden; }
.deed-head { background: var(--c); border-bottom: 4px solid var(--ink); padding: 16px 18px 14px; text-align: center; color: #fff; }
.deed-k { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; opacity: .95; text-shadow: 1px 1px 0 rgba(0,0,0,.35); }
.deed-name { font-family: var(--font-title); font-size: 30px; line-height: 1.05; text-shadow: 2px 2px 0 var(--ink); margin-top: 4px; }
.deed-body { padding: 16px 18px 18px; }
.deed-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 2px dashed #d9c9a5; }
.deed-row:last-of-type { border-bottom: 0; }
.deed-row .i { font-size: 22px; width: 28px; text-align: center; }
.deed-row .k { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #6b6280; font-weight: 600; }
.deed-row .v { font-weight: 600; }
.pill { display: inline-block; font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--ink); }
.pill.done { background: var(--ok); }
.pill.next { background: var(--ochre); }
.pill.locked { background: #d6cfe8; }
.deed-desc { margin: 12px 0 4px; color: #4a425e; font-size: 15px; }

/* ---------- Celebración ---------- */
.celebrate { text-align: center; position: relative; overflow: hidden; }
.celebrate .big-flag { font-size: 80px; line-height: 1; animation: pop .6s cubic-bezier(.2,1.6,.4,1); }
.celebrate h2 { font-size: 32px; color: var(--ochre); text-shadow: 2px 2px 0 var(--ink); }
@keyframes pop { from { transform: scale(0) rotate(-30deg); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 600; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border: 2px solid var(--ink); animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Ranking ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 2px solid var(--night-3); }
.rank-list .pos { font-family: var(--font-title); font-size: 22px; width: 34px; text-align: center; }
.rank-list .nm { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .fl { font-family: var(--font-title); color: var(--ochre); }
.menu-list { display: grid; gap: 10px; margin-top: 10px; }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin-bottom: 8px; }
