/* Flight Mode — same toy-box look as Wildlife Battle */

:root {
  --ink: #33261f;
  --cream: #fff6e8;
  --sun: #ffc93c;
  --coral: #ff6b6b;
  --coral-deep: #e04848;
  --leaf: #6dbf67;
  --panel: rgba(255, 246, 232, 0.94);
  --shadow: 0 6px 0 rgba(51, 38, 31, 0.25);
  --font-display: 'Lilita One', 'Comic Sans MS', cursive;
  --font-body: 'Baloo 2', 'Comic Sans MS', cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  font-family: var(--font-body);
  background: #4f9ec4;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
@media (pointer: coarse) {
  html, body { overflow: visible; touch-action: pan-y; }
  body { height: auto; min-height: calc(100vh + 2px); }
  @supports (min-height: 100lvh) {
    body { min-height: calc(100lvh + 2px); }
  }
  #fm-hud { touch-action: none; }
}

#stage { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(8px, 1.8vh, 20px);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  z-index: 20; overflow-y: auto; touch-action: pan-y;
}

#fm-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 9vmin, 92px);
  line-height: 1; letter-spacing: 2px;
  color: var(--sun);
  -webkit-text-stroke: clamp(1.5px, 0.4vmin, 3.5px) var(--ink);
  text-shadow: 0 clamp(3px, 0.9vmin, 8px) 0 var(--ink);
}
#fm-title span { display: inline-block; animation: pop-in .6s cubic-bezier(.2,1.6,.4,1) backwards; }
#fm-title span:nth-child(odd) { color: #7ec8ff; }
#fm-title span:nth-child(3n) { color: var(--coral); }
#fm-title span:nth-child(1){animation-delay:.05s}#fm-title span:nth-child(2){animation-delay:.1s}
#fm-title span:nth-child(3){animation-delay:.15s}#fm-title span:nth-child(4){animation-delay:.2s}
#fm-title span:nth-child(5){animation-delay:.25s}#fm-title span:nth-child(6){animation-delay:.3s}
#fm-title span:nth-child(7){animation-delay:.4s}#fm-title span:nth-child(8){animation-delay:.45s}
#fm-title span:nth-child(9){animation-delay:.5s}#fm-title span:nth-child(10){animation-delay:.55s}
@keyframes pop-in { 0% { transform: translateY(-70px) scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }

.tagline {
  font-weight: 800; font-size: clamp(13px, 2.4vmin, 22px);
  color: var(--cream); text-shadow: 0 2px 0 rgba(51,38,31,.4);
}

.card-row { display: flex; gap: clamp(8px, 1.6vw, 20px); justify-content: center; flex-wrap: wrap; }
.char-card {
  font-family: var(--font-body);
  background: var(--panel); border: 4px solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow); padding: clamp(6px, 1.4vmin, 14px);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--ink); transition: transform .12s;
}
.char-card:active { transform: scale(.95); }
.char-card.selected {
  background: #fff; border-color: var(--coral-deep);
  box-shadow: 0 0 0 4px var(--coral), 0 5px 0 rgba(51,38,31,.25);
  transform: translateY(-4px);
}
.char-portrait { width: clamp(58px, 11vmin, 110px); height: clamp(58px, 11vmin, 110px); }
.char-name { font-family: var(--font-display); font-size: clamp(12px, 2.2vmin, 19px); }

.level-row { display: flex; gap: clamp(8px, 1.4vw, 16px); }
.level-btn {
  font-family: var(--font-body); font-weight: 800;
  background: var(--panel); border: 3.5px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(51,38,31,.25);
  padding: clamp(6px, 1.2vmin, 12px) clamp(12px, 2vw, 22px);
  cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.level-btn b { font-family: var(--font-display); font-size: clamp(13px, 2.4vmin, 20px); letter-spacing: 1px; }
.level-btn small { font-size: clamp(10px, 1.7vmin, 13px); opacity: .7; }
.level-btn.selected { background: #fff; box-shadow: 0 0 0 4px var(--sun), 0 4px 0 rgba(51,38,31,.25); }
.level-btn.locked { opacity: .5; filter: grayscale(.7); }

.big-btn {
  font-family: var(--font-display);
  font-size: clamp(19px, 3.4vmin, 32px); letter-spacing: 1.5px;
  color: var(--ink); background: linear-gradient(180deg, #ffd95e, var(--sun));
  border: 4px solid var(--ink); border-radius: 20px;
  padding: clamp(8px, 1.4vh, 15px) clamp(26px, 4.6vw, 50px);
  box-shadow: var(--shadow); cursor: pointer;
}
.big-btn.alt { background: linear-gradient(180deg, #8fd489, var(--leaf)); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(51,38,31,.25); }
.btn-column { display: flex; flex-direction: column; gap: 10px; align-items: center; }

.back-btn, .back-link {
  font-family: var(--font-body); font-weight: 800;
  font-size: clamp(12px, 2.2vmin, 18px);
  color: var(--cream); background: rgba(51,38,31,.35);
  border: 3px solid rgba(255,246,232,.6); border-radius: 999px;
  padding: 6px 18px; cursor: pointer; text-decoration: none;
}

/* ---------- HUD ---------- */
#fm-hud {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  display: flex; align-items: center; gap: 10px;
  z-index: 10; pointer-events: none;
}
.hud-pill {
  font-family: var(--font-display);
  font-size: clamp(16px, 3vmin, 26px);
  background: var(--panel); border: 3px solid var(--ink); border-radius: 999px;
  padding: 4px 16px; box-shadow: 0 4px 0 rgba(51,38,31,.25);
}
#hud-rings { margin-left: auto; }
#hud-btns { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: clamp(32px, 5.4vmin, 44px); height: clamp(32px, 5.4vmin, 44px);
  border-radius: 50%; border: 3px solid var(--ink);
  background: var(--panel); font-family: var(--font-display);
  font-size: clamp(14px, 2.5vmin, 20px); color: var(--ink);
  box-shadow: 0 3px 0 rgba(51,38,31,.25); cursor: pointer;
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }

#tap-hint {
  position: absolute; left: 50%; top: 58%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: clamp(20px, 4.4vmin, 40px);
  color: var(--cream); background: rgba(51,38,31,.75);
  border-radius: 999px; padding: .35em 1em;
  z-index: 12; pointer-events: none; white-space: nowrap;
  animation: hint-bob 1.2s ease-in-out infinite;
}
@keyframes hint-bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }

/* ---------- end screen ---------- */
.end-box {
  background: var(--panel); border: 4px solid var(--ink); border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vmin, 32px) clamp(24px, 4vmin, 48px);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
#end-stars { font-size: clamp(28px, 6vmin, 54px); letter-spacing: 4px; }
#end-stars .dim { opacity: .25; filter: grayscale(1); }
#end-title { font-family: var(--font-display); font-size: clamp(24px, 5vmin, 44px); }
#end-sub { font-weight: 800; font-size: clamp(13px, 2.4vmin, 20px); opacity: .8; }

#rotate-hint {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(51,38,31,.85); color: var(--cream);
  display: none; align-items: center; justify-content: center; text-align: center;
  font-family: var(--font-display); font-size: clamp(22px, 6vw, 40px);
  line-height: 1.5; padding: 30px; pointer-events: none;
}
@media (orientation: portrait) and (max-width: 620px) {
  #rotate-hint.armed { display: flex !important; }
}

/* ---------- short screens ---------- */
@media (max-height: 520px) {
  .screen { gap: 7px; }
  #fm-title { font-size: clamp(26px, 8vmin, 40px); }
  .tagline { font-size: 11px; }
  .char-portrait { width: 46px; height: 46px; }
  .char-name { font-size: 11px; }
  .char-card { padding: 5px 8px; border-width: 3px; }
  .level-btn { padding: 4px 12px; border-width: 2.5px; }
  .level-btn b { font-size: 12px; }
  .level-btn small { font-size: 9px; }
  .big-btn { font-size: 16px; padding: 6px 24px; border-width: 3px; }
  .back-btn, .back-link { font-size: 11px; padding: 4px 12px; }
  .hud-pill { font-size: 14px; padding: 2px 12px; border-width: 2.5px; }
  .icon-btn { width: 28px; height: 28px; font-size: 12px; border-width: 2.5px; }
  .end-box { padding: 10px 22px; gap: 5px; }
  #end-stars { font-size: 24px; }
  #end-title { font-size: 20px; }
  #end-sub { font-size: 11px; }
}
