/* Wing Dash. Everything is prefixed wd- and sized from the stage box, never from the window. */
.wd { display: flex; flex-direction: column; min-width: 0; color: #dfe9ff; }
.wd [hidden] { display: none !important; }

.wd-stage {
  position: relative; width: 100%; height: min(78vh, 680px); min-height: 360px; overflow: hidden;
  background: #04060f; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none;
}
@media (max-width: 600px) { .wd-stage { height: auto; aspect-ratio: 4 / 5; max-height: 76vh; min-height: 0; } }
.wd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- heads-up display ---------- */
.wd-hud { position: absolute; inset: 0 0 auto 0; height: 0; pointer-events: none; z-index: 2; }
.wd-hud-side { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.wd-chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px;
  border: 1px solid #1c2b4a; background: rgba(8, 13, 30, 0.78); color: #dfe9ff; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
}
.wd-chip-streak { border-color: rgba(255, 209, 102, 0.7); color: #ffd166; }
.wd-chip-streak.is-pop { animation: wd-pop 0.32s ease-out; }
.wd-score {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%); font-size: clamp(38px, 9vw, 58px); font-weight: 800; line-height: 1; color: #fff;
  font-variant-numeric: tabular-nums; text-shadow: 0 3px 0 rgba(4, 6, 15, 0.55), 0 0 22px rgba(4, 6, 15, 0.6);
}
.wd-score.is-pop { animation: wd-pop 0.22s ease-out; }
.wd-score.is-gold { color: #ffd166; }
@keyframes wd-pop { 0% { scale: 1; } 40% { scale: 1.22; } 100% { scale: 1; } }

.wd-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 8px; z-index: 6; }
.wd-tool {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 12px; border: 1px solid #1c2b4a;
  background: rgba(11, 19, 40, 0.8); color: #dfe9ff; cursor: pointer; touch-action: manipulation;
}
.wd-tool:hover { border-color: #55d6ff; color: #fff; }
.wd-tool:focus-visible, .wd .wd-btn:focus-visible, .wd-skin:focus-visible { outline: 2px solid #55d6ff; outline-offset: 2px; }
.wd-tool .wd-ico-off { display: none; }
.wd-tool[aria-pressed="true"] .wd-ico-on { display: none; }
.wd-tool[aria-pressed="true"] .wd-ico-off { display: block; }
.wd-tool[aria-pressed="true"] { color: #8aa3c4; }

.wd-toast {
  position: absolute; left: 50%; top: 21%; transform: translate(-50%, 6px); max-width: calc(100% - 28px); padding: 7px 14px; border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.55); background: rgba(8, 13, 30, 0.82); color: #ffe9b0; font-size: 14px; font-weight: 700; text-align: center;
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none; z-index: 3;
}
.wd-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.wd-toast.is-biome { border-color: rgba(85, 214, 255, 0.55); color: #dff6ff; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }
.wd-nudge {
  position: absolute; left: 50%; top: 66%; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; background: rgba(8, 13, 30, 0.8);
  border: 1px solid #1c2b4a; color: #fff; font-size: 15px; font-weight: 700; white-space: nowrap; pointer-events: none; z-index: 3; animation: wd-nudge 0.9s ease-in-out infinite;
}
@keyframes wd-nudge { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
.wd-count {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: clamp(64px, 18vw, 110px); font-weight: 800; line-height: 1; color: #fff;
  text-shadow: 0 4px 0 rgba(4, 6, 15, 0.55), 0 0 30px rgba(4, 6, 15, 0.7); pointer-events: none; z-index: 3; font-variant-numeric: tabular-nums;
}

/* ---------- panels ---------- */
.wd-overlay {
  position: absolute; inset: 0; display: flex; padding: 12px; z-index: 4; overflow: auto; cursor: pointer; touch-action: pan-y;
  background: radial-gradient(ellipse at 50% 45%, rgba(4, 6, 15, 0.42), rgba(4, 6, 15, 0.8));
}
.wd-overlay.is-title { background: radial-gradient(ellipse at 50% 45%, rgba(4, 6, 15, 0.2), rgba(4, 6, 15, 0.62)); }
.wd-panel {
  display: flex; flex-direction: column; gap: 10px; width: min(100%, 340px); margin: auto; padding: 20px 18px 16px; text-align: center; cursor: default;
  border: 1px solid #1c2b4a; border-radius: 18px; background: rgba(8, 13, 30, 0.88); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: wd-in 0.22s ease-out;
}
@keyframes wd-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.wd-panel p, .wd-panel h2 { margin: 0; }
.wd-logo {
  font-size: clamp(32px, 9vw, 42px); font-weight: 800; line-height: 1.05; letter-spacing: -0.01em;
  background: linear-gradient(92deg, #ffd166 5%, #ff7eb6 55%, #55d6ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wd-tag, .wd-sub { color: #8aa3c4; font-size: 14px; line-height: 1.35; text-wrap: balance; }
.wd-h { font-size: 24px; font-weight: 800; color: #fff; }
.wd .wd-btn { cursor: pointer; touch-action: manipulation; font-family: inherit; min-height: 42px; }
.wd-big { width: 100%; min-height: 50px; font-size: 18px; }
.wd-wide { width: 100%; }
.wd-quiet { color: #8aa3c4; }
.wd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wd-daily { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 8px; padding-bottom: 8px; }
.wd-daily-top { font-weight: 700; color: #dfe9ff; }
.wd-daily-sub { font-size: 12px; font-weight: 600; color: #8aa3c4; }
.wd-dailyline { font-size: 12.5px; color: #8aa3c4; min-height: 0; }
.wd-dailyline:empty, .wd-dailyline:has(> span:empty) { display: none; }
.wd-bestline { font-size: 13px; color: #8aa3c4; }
.wd-bestline b { color: #ffd166; }

.wd-panel-over { position: relative; }
.wd-panel-how { width: min(100%, 420px); text-align: left; }
.wd-panel-how .wd-h { text-align: center; }
.wd-howlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.wd-howlist li { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; font-size: 13.5px; line-height: 1.35; color: #c4d3ee; }
.wd-howlist b { color: #fff; }
.wd-how-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid #1c2b4a; background: #0b1328; }
.wd-how-ico svg { display: block; }
.wd-keys { font-size: 12px; color: #8aa3c4; text-align: center; }

.wd-panel-wings { width: min(100%, 372px); }
.wd-skins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wd-skin {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 7px; border-radius: 12px; border: 1px solid #1c2b4a;
  background: #0b1328; color: #dfe9ff; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; min-height: 76px; touch-action: manipulation;
}
.wd-skin canvas { width: 60px; height: 46px; display: block; }
.wd-skin.is-locked { color: #6f85a6; }
.wd-skin.is-locked canvas { opacity: 0.3; filter: grayscale(1); }
.wd-skin.is-locked::after {
  content: ""; position: absolute; left: 50%; top: 20px; width: 16px; height: 13px; margin-left: -8px; border-radius: 3px; background: #8aa3c4;
  box-shadow: 0 -8px 0 -4px #0b1328, 0 -8px 0 -1.5px #8aa3c4;
}
.wd-skin.is-picked { border-color: #ffd166; box-shadow: inset 0 0 0 1px #ffd166; }
.wd-skin-info { min-height: 34px; font-size: 13px; line-height: 1.3; color: #8aa3c4; }
.wd-skin-info b { color: #fff; }

.wd-over-kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #8aa3c4; }
.wd-over-main { display: flex; align-items: center; justify-content: center; gap: 14px; }
.wd-over-num { display: flex; flex-direction: column; align-items: center; }
.wd-over-score { font-size: 60px; font-weight: 800; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.wd-over-best { font-size: 13px; font-weight: 700; color: #8aa3c4; margin-top: 3px; }
.wd-medal {
  position: relative; flex: none; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; color: rgba(20, 12, 0, 0.8);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.28), inset 0 -8px 12px rgba(0, 0, 0, 0.22), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.wd-medal.is-bronze { background: radial-gradient(circle at 35% 30%, #f3c08e, #c47a3c 70%); }
.wd-medal.is-silver { background: radial-gradient(circle at 35% 30%, #ffffff, #a9b8cf 70%); }
.wd-medal.is-gold { background: radial-gradient(circle at 35% 30%, #fff3b8, #f0b429 70%); }
.wd-medal.is-prism { background: conic-gradient(from 30deg, #ff7eb6, #ffd166, #7dffb0, #55d6ff, #b79cff, #ff7eb6); color: rgba(10, 10, 30, 0.85); }
.wd-medal.is-new { animation: wd-medal 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes wd-medal { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.wd-newbest { font-size: 15px; font-weight: 800; color: #ffd166; letter-spacing: 0.04em; }
.wd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
.wd-stats div { padding: 6px 4px; border-radius: 10px; border: 1px solid #1c2b4a; background: #0b1328; }
.wd-stats dt { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #8aa3c4; }
.wd-stats dd { margin: 1px 0 0; font-size: 17px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.wd-next { font-size: 13px; color: #8aa3c4; }
.wd-unlock { font-size: 13.5px; font-weight: 700; color: #7dffb0; }
.wd-unlock button { margin-left: 6px; padding: 3px 10px; min-height: 28px; border-radius: 999px; border: 1px solid #7dffb0; background: transparent; color: #7dffb0; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.wd-again-hint { font-size: 12px; color: #6f85a6; }

.wd-help { margin: 8px 2px 0; font-size: 13px; color: #8aa3c4; text-align: center; }
.wd-hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .wd-hint-kb { display: none !important; }
  .wd-hint-touch { display: inline; }
}
.wd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* short stages (a phone on its side): tighten the panels so nothing needs a scroll */
.wd-stage.is-short .wd-panel { gap: 7px; padding: 12px 16px 12px; }
.wd-stage.is-short .wd-tag, .wd-stage.is-short .wd-again-hint, .wd-stage.is-short .wd-keys, .wd-stage.is-short .wd-sub { display: none; }
.wd-stage.is-short .wd-logo { font-size: 30px; }
.wd-stage.is-short .wd-big { min-height: 44px; font-size: 16px; }
.wd-stage.is-short .wd-btn { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
.wd-stage.is-short .wd-over-score { font-size: 44px; }
.wd-stage.is-short .wd-medal { width: 50px; height: 50px; font-size: 8.5px; }
.wd-stage.is-short .wd-stats div { padding: 3px 4px; }
.wd-stage.is-short .wd-stats dd { font-size: 15px; }
.wd-stage.is-short .wd-howlist { gap: 5px; }
.wd-stage.is-short .wd-howlist li { font-size: 12.5px; grid-template-columns: 30px 1fr; }
.wd-stage.is-short .wd-how-ico { width: 30px; height: 30px; }
.wd-stage.is-short .wd-panel-how, .wd-stage.is-short .wd-panel-over { width: min(100%, 520px); }
.wd-stage.is-short .wd-skin { min-height: 64px; padding: 3px 2px 4px; }
.wd-stage.is-short .wd-skin canvas { width: 52px; height: 40px; }
.wd-stage.is-short .wd-toast { top: 16%; }

/* full screen: the stage takes the whole frame */
.stage.is-immersive .stage-body > .wd { flex: 1 1 auto; min-height: 0; }
.stage.is-immersive .wd-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; }
.stage.is-immersive .wd-help { display: none; }

@media (prefers-reduced-motion: reduce) {
  .wd-panel, .wd-medal.is-new, .wd-score.is-pop, .wd-chip-streak.is-pop, .wd-nudge { animation: none; }
  .wd-toast { transition: opacity 0.2s linear; transform: translate(-50%, 0); }
}
