.ff-map {
  position:relative; overflow:hidden; aspect-ratio:1.56; width:100%; isolation:isolate; border:1px solid #b4e3cf66;
  border-radius:8px; background:linear-gradient(155deg,#3e6d65,#213b53);
}
.ff-map::before {
  content:""; position:absolute; inset:0; opacity:.45; background:
    repeating-linear-gradient(0deg,#bee9d300 0 14px,#bee9d344 14px 15px),
    repeating-linear-gradient(90deg,#bee9d300 0 14px,#bee9d344 14px 15px);
}
.ff-north { position:absolute; top:3px; left:5px; color:#e8ffed; font-size:9px; font-weight:800; }
.ff-wind-field { position:absolute; border:1px dashed #f1dfaaad; background:repeating-linear-gradient(145deg,#f3d7a649 0 2px,transparent 2px 5px); }
.ff-map :is(.ff-tree,.ff-swarm,.ff-player,.ff-perch) { translate:-50% -50%; position:absolute; }
.ff-map [data-color="amber"] { --cluster:#ffdc87; }
.ff-map [data-color="mint"] { --cluster:#93efd7; }
.ff-tree { width:13px; height:13px; border:2px solid var(--cluster); border-radius:7px 7px 4px 4px; box-shadow:0 0 0 1px #1c3b42; }
.ff-tree[data-settled] { background:var(--cluster); box-shadow:0 0 9px var(--cluster); }
.ff-perch { width:7px; height:7px; border-radius:1px; border:1px solid #f7f2bc; background:#3b4d55; }
.ff-perch[data-occupied="amber"] { background:#ffdc87; }
.ff-perch[data-occupied="mint"] { background:#93efd7; }
.ff-swarm {
  width:7px; height:7px; border-radius:50%; background:var(--cluster); border:1px solid #f9ffdc;
  box-shadow:0 0 5px var(--cluster);
}
.ff-swarm[data-color="mint"] { border-radius:1px; rotate:45deg; }
.ff-swarm[data-status="parked"] { opacity:.58; }
.ff-player { z-index:1; width:6px; height:6px; border:1px solid #183c51; border-radius:50%; background:#fff; box-shadow:0 0 0 1px #fff8; }
.ff-brief { display:grid; grid-template-columns:minmax(128px,.87fr) minmax(0,1.13fr); gap:14px; align-items:center; }
.ff-brief figure { margin:0; }
.ff-brief figcaption { font-size:11px; font-weight:750; color:#4c5e67; margin-top:5px; }
.ff-brief ol { margin:0; padding-inline-start:19px; display:grid; gap:6px; font-size:12px; line-height:1.35; color:#455363; }
.ff-brief li strong { display:block; color:#314d60; font-weight:900; }
.dialog-content .ff-best { margin:7px 0 0; }
#festival-fireflies-hud {
  --weather:#a5f1d1; position:absolute; z-index:2; top:max(75px,calc(var(--top) + 56px)); right:max(14px,var(--safe-right));
  width:clamp(130px,17vw,186px); padding:6px; background:#183449ed; color:#f3f9e4;
  border:1px solid #9eead39e; border-radius:12px; box-shadow:0 3px 0 #15243695; pointer-events:auto;
}
#festival-fireflies-hud[hidden] { display:none; }
#festival-fireflies-hud[data-wind="upcoming"] { --weather:#ffdf91; }
#festival-fireflies-hud[data-wind="gust"] { --weather:#ffb489; }
#festival-fireflies-hud[data-wind="gust"] .ff-wind-field { background:repeating-linear-gradient(145deg,#ffb583bc 0 3px,transparent 3px 5px); }
.ff-hud-head,.ff-hud-foot { display:flex; align-items:center; justify-content:space-between; gap:4px; font-size:11px; font-weight:850; }
.ff-weather { color:var(--weather); white-space:nowrap; }
.ff-wind-meter { height:3px; margin:4px 0 5px; border-radius:2px; background:#0e293f; overflow:hidden; }
.ff-wind-meter i { display:block; height:100%; background:var(--weather); transform-origin:left; }
.ff-light { display:inline-flex; align-items:center; gap:4px; }
.ff-light i { width:8px; height:8px; border-radius:50%; border:1px solid #fff6d1; background:#476071; }
[data-light="amber"] .ff-light i { background:#ffdc87; }
[data-light="mint"] .ff-light i { background:#93efd7; border-radius:1px; rotate:45deg; }
.ff-hud-foot { margin-top:5px; }
#festival-fireflies-hud button { margin-top:4px; width:100%; min-height:44px; color:#17354a; background:#dcf3d2; border:1px solid #8fc9b2; border-radius:7px; font-weight:850; }
#app[data-firefly-stage] .festival-stamps { display:none; }
.ff-result { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.ff-result div { padding:9px; border:1px solid #b1d2bd; border-radius:8px; background:#ecf9e7; }
.ff-result dd { margin:3px 0 0; color:#284943; font-size:22px; font-weight:900; }
@media (orientation:landscape) and (max-height:445px) {
  #festival-fireflies-hud { width:130px; right:var(--phone-right,14px); top:calc(var(--top) + 52px); }
  .ff-brief .ff-map { aspect-ratio:1.66; }
  #dialog[data-kind="fireflies-guide"] .dialog-content { padding-block:10px; }
  #dialog[data-kind="fireflies-guide"] .dialog-actions { margin-top:8px; }
  #app[data-firefly-stage] .festival-prompt { bottom:calc(var(--bottom) + 51px); }
}
@media (orientation:portrait) and (max-width:520px) {
  #festival-fireflies-hud { width:116px; right:max(10px,var(--safe-right)); top:max(77px,calc(var(--top) + 57px)); padding:5px; }
  #app[data-firefly-stage] .festival-overlay {
    left:max(10px,var(--safe-left)); width:calc(100vw - 149px - var(--safe-left) - var(--safe-right)); transform:none;
  }
  .ff-brief { grid-template-columns:1fr; }
  .ff-brief figure { width:min(220px,100%); margin-inline:auto; }
}

.ff-wind-field,.ff-passage { z-index:1; }
.ff-passage { position:absolute; border-left:2px solid #ccdfbe; border-right:2px solid #ccdfbe; background:linear-gradient(0deg, transparent 44%,#cbe0b98c 45% 54%,transparent 55%); }
.ff-shelter { position:absolute; z-index:2; border-block:1.5px solid #d7ffe1; background:repeating-linear-gradient(90deg,#86ce9cdf 0 3px,#4a836ef0 3px 5px); box-shadow:0 0 0 .6px #315f58; }
.ff-tethers { position:absolute; inset:0; width:100%; height:100%; z-index:3; pointer-events:none; }
.ff-tethers line { display:none; stroke:var(--cluster); stroke-width:1.2px; stroke-dasharray:2 2; vector-effect:non-scaling-stroke; }
.ff-tethers line[data-follow] { display:inline; }
.ff-map :is(.ff-tree,.ff-perch,.ff-swarm,.ff-north) { z-index:4; }
.ff-map .ff-player { z-index:5; }
.ff-map .ff-player[data-near-swarm] { background:transparent; width:13px; height:13px; border:1.4px solid #fff; box-shadow:0 0 0 .7px #153e48; }
.ff-tree[data-color="mint"] { border-radius:2px 5px; rotate:45deg; }
.ff-tree[data-goal] { outline:1px dashed #fff6d1; outline-offset:2px; }
.ff-perch::before,.ff-perch::after { position:absolute; width:4px; height:3px; bottom:-5px; border-radius:1px; }
.ff-perch[data-checkpoint-amber]::before { content:''; background:#ffdc87; left:-1px; }
.ff-perch[data-checkpoint-mint]::after { content:''; background:#93efd7; right:-1px; }
.ff-brief figcaption { display:flex; align-items:center; flex-wrap:wrap; gap:4px; }
.ff-key-wind,.ff-key-pass { display:inline-block; width:13px; height:8px; border:1px solid #8a8059; background:repeating-linear-gradient(135deg,#b29768 0 2px,#eadfbd 2px 4px); }
.ff-key-pass { margin-left:6px; height:6px; background:#e1e7cc; border:0; border-inline:2px solid #567767; }

#festival-fireflies-hud { width:clamp(198px,22vw,226px); pointer-events:none; }
.ff-hud-head { font-size:12px; line-height:1.2; }
.ff-hud-head b { color:#f4e9bd; font-variant-numeric:tabular-nums; }
.ff-weather { font-variant-numeric:tabular-nums; }
.ff-hud-body { display:grid; grid-template-columns:minmax(0,1fr) minmax(87px,.94fr); gap:6px; align-items:center; }
.ff-hud-body .ff-map { aspect-ratio:1.25; }
.ff-hud-side,.ff-swarm-list { min-width:0; display:grid; gap:3px; }
.ff-swarm-status { display:flex; align-items:center; justify-content:space-between; gap:2px; white-space:nowrap; font-size:10px; line-height:1.25; }
.ff-swarm-status strong { color:#ffdc87; font-size:11px; }
.ff-swarm-status[data-color="mint"] strong { color:#a2f5ce; }
.ff-swarm-status[data-risk="covered"] span { color:#c6ffcd; }
.ff-swarm-status[data-risk="exposed"] span { color:#ffcd9d; }
#festival-fireflies-hud .ff-hud-side button {
  display:grid; align-content:center; justify-items:center; gap:2px; min-height:44px; margin:1px 0 0; padding:2px 4px;
  pointer-events:auto; touch-action:manipulation; line-height:1.1;
}
#festival-fireflies-hud .ff-light-button { color:#203e43; background:#cde5cf; border-color:#9fc6ad; }
.ff-light-button .ff-light { font-weight:850; font-size:13px; }
.ff-light-button .ff-light i { outline:1px solid #4b6260; }
.ff-light-button small { color:#35524c; font-size:10px; }
.ff-light-button kbd { display:inline-block; font:800 9px/1 ui-monospace,monospace; border:1px solid #829b86; border-radius:2px; padding:1px 2px; }
.ff-journeys { display:flex; gap:5px 11px; align-items:center; flex-wrap:wrap; margin-top:7px; }
.ff-journey { display:inline-flex; gap:4px; align-items:center; color:#39574e; font-size:12px; }
.ff-journey i { width:8px; height:8px; border-radius:50%; background:#dab263; border:1px solid #9d7c43; }
.ff-journey[data-color="mint"] i { background:#8acfb8; border-color:#457a6f; border-radius:1px; rotate:45deg; }
@media (pointer:coarse) { .ff-light-button kbd { display:none; } }
@media (orientation:landscape) and (max-height:445px) {
  #festival-fireflies-hud { width:201px; top:calc(var(--top) + 52px); padding:5px; }
  .ff-hud-body { grid-template-columns:92px minmax(0,1fr); gap:5px; }
  .ff-hud-body .ff-map { aspect-ratio:1.25; }
  .ff-wind-meter { margin:3px 0 4px; }
  .ff-hud-side,.ff-swarm-list { gap:2px; }
}
@media (orientation:portrait) and (max-width:520px) {
  #festival-fireflies-hud { width:125px; }
  .ff-hud-head { font-size:10px; }
  .ff-hud-body { grid-template-columns:minmax(0,1fr); gap:4px; }
  .ff-hud-body .ff-map { aspect-ratio:1.5; }
}
