/* ============================================================
   Flutter Flight — game-only styles (linked from games/butterfly.html)
   Uses site tokens from styles.css
   ============================================================ */

.bf-game {
  position: relative;
  overflow: visible;
  padding-bottom: 20px;
}

.bf-help {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
}

.bf-game kbd {
  display: inline-block;
  padding: 0 5px;
  font-family: 'VT323', monospace;
  font-size: 0.95em;
  line-height: 1.2;
  color: var(--text-dark);
  background: var(--bg-window-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 1px 1px 0 var(--shadow);
}

/* ---- HUD ---- */
.bf-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin-bottom: 7px;
}

.bf-stat {
  min-width: 88px;
  min-height: 48px;
  padding: 6px 12px;
  text-align: center;
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--shadow);
}

.bf-stat-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
}

.bf-stat-value {
  color: var(--text-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.bf-status {
  min-height: 20px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
}

/* ---- stage: framed canvas that keeps a 2:3 aspect and fits the viewport ---- */
.bf-stage-shell {
  width: 100%;
  /* never wider than 400px, and short enough that the whole canvas fits on screen */
  max-width: min(400px, calc((100vh - 48px) * 2 / 3));
  margin: 0 auto 13px;
  padding: 6px 6px 8px;
  overflow: visible;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.92) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 86%, rgba(255, 255, 255, 0.75) 0 2px, transparent 3px),
    linear-gradient(145deg, rgba(255, 214, 234, 0.82), rgba(203, 182, 240, 0.74));
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.75), 3px 3px 0 var(--shadow);
}

@supports (height: 100svh) {
  .bf-stage-shell { max-width: min(400px, calc((100svh - 48px) * 2 / 3)); }
}

.bf-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 2px solid var(--border);
  background: linear-gradient(180deg, #e7dcff 0%, #ffe1f0 100%);
  overflow: hidden;
}

.bf-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.bf-canvas:focus-visible {
  box-shadow: inset 0 0 0 3px var(--pink-deep);
}

/* ---- game-over card over the stage ---- */
.bf-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  background: rgba(243, 238, 252, 0.62);
  animation: bf-fade-in 220ms ease-out;
}

.bf-overlay[hidden] {
  display: none !important;
}

.bf-overlay-inner {
  width: 100%;
  max-width: 320px;
  margin: auto;
  padding: 18px 14px 14px;
  text-align: center;
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  animation: bf-card-pop 260ms ease-out;
}

.bf-overlay-title {
  margin: 0 0 10px;
  color: var(--text-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.bf-overlay-msg {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.3;
}

.bf-overlay-new {
  margin: 0 0 6px;
  color: var(--pink-deep);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}

.bf-overlay-new[hidden] {
  display: none;
}

.bf-overlay-inner .lb-prompt {
  margin-top: 8px;
}

.bf-overlay-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

@keyframes bf-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bf-card-pop {
  0%   { transform: scale(0.85); opacity: 0; }
  70%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

.bf-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

.bf-actions .btn[disabled] {
  opacity: 0.55;
  cursor: url("../assets/cursor-pink.png?v=3") 13 6, auto;
}

.bf-back-btn {
  display: inline-block;
  text-decoration: none;
  font-size: 8px !important;
}

.bf-keys {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 560px) {
  .bf-help { font-size: 17px; }
  .bf-stage-shell { padding: 4px 4px 6px; }
}

@media (max-width: 380px) {
  .bf-game { padding-left: 7px; padding-right: 7px; }
  .bf-help { font-size: 16px; }
  .bf-keys { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .bf-overlay,
  .bf-overlay-inner {
    animation: none !important;
  }
}

/* Site chrome otherwise clips the stage shadow + name prompt */
.os-body.bf-game {
  overflow: visible;
  padding-bottom: 20px;
}
