/* Eva's & Max's Aeroplane – page layout, screens and buttons.
   Same family look as the other Eva's & Max's games (see ../BRAND.md):
   Fredoka, chunky rounded buttons with a solid bottom edge, the ink and
   toy-box colours below. The window view (#scene) is the top part, the cockpit (css/cockpit.css) the rest. */

@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/fredoka-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/fredoka-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/fredoka-latin-700-normal.woff2) format('woff2'); }

:root {
  --ink: #3d2c55;
  --ink-soft: #7d6c93;
  --paper: #fffaf2;
  --line: #efe3d2;
  --line-d: #e3d3bc;
  --green: #4cc76a;
  --green-d: #2f9a4c;
  --blue: #4dabf7;
  --blue-d: #2b84cc;
  --yellow: #ffd43b;
  --yellow-d: #dba600;
  --red: #ff6b6b;
  --red-d: #d14848;
  --orange: #ffa94d;
  --purple: #9775fa;
  /* this game's own accents */
  --plane: #4dabf7;
  --plane-d: #1c6fb8;
  --sky-top: #bfe6ff;
  --sky-bottom: #eaf7ff;
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Arial Rounded MT Bold', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 12px 34px rgba(61, 44, 85, 0.22);
  --edge: 14px;
  /* the window view fills the top --split of the screen; the cockpit starts
     --lift above it, so the instruments and the yoke float over the window */
  --split: 75%;
  --lift: min(10vh, 96px);
}
/* portrait screens need a taller cockpit to fit the controls */
@media (orientation: portrait) { :root { --split: 68%; } }
@media (orientation: portrait) and (max-width: 600px) { :root { --split: 62%; --lift: min(9vh, 80px); } }
@media (orientation: landscape) and (max-height: 520px) { :root { --split: 66%; --lift: 9vh; } }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%) fixed;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
}

#scene { position: fixed; left: 0; right: 0; top: 0; height: var(--split); overflow: hidden; }
#scene canvas { display: block; width: 100%; height: 100%; }
#cockpit { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--split) - var(--lift)); z-index: 6; }
/* nothing to pan or zoom in the game itself: no page pinch-zoom on iPad (see main.js) */
#scene, #cockpit { touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#ui > * { pointer-events: auto; }

button, a.btn { font-family: inherit; color: inherit; touch-action: manipulation; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 4px solid rgba(77, 171, 247, 0.7); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- chunky buttons (shared brand style) ---------- */

.btn {
  --b: #fff;
  --bd: var(--line-d);
  --fg: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  font-size: 21px;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%), var(--b);
  box-shadow: 0 6px 0 var(--bd), 0 12px 18px rgba(61, 44, 85, 0.16);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--bd), 0 4px 8px rgba(61, 44, 85, 0.16); }
.btn .ico { font-size: 0.95em; }
.btn-green { --b: var(--green); --bd: var(--green-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-blue { --b: var(--blue); --bd: var(--blue-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-red { --b: var(--red); --bd: var(--red-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-yellow { --b: var(--yellow); --bd: var(--yellow-d); --fg: #5a3d00; }
.btn-soft { --b: #fff; --bd: var(--line-d); --fg: var(--ink); }
.btn-big { min-height: 64px; font-size: 24px; border-radius: 20px; padding: 0 28px; }
.btn-huge { min-height: 72px; font-size: 29px; border-radius: 24px; box-shadow: 0 8px 0 var(--bd), 0 16px 24px rgba(61, 44, 85, 0.2); }
.btn-huge:active:not(:disabled) { transform: translateY(7px); }

.round-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  box-shadow: 0 4px 0 var(--line-d), 0 6px 14px rgba(61, 44, 85, 0.16);
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s, filter 0.2s;
}
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-d); }
.round-btn.off { opacity: 0.55; filter: grayscale(1); }
.round-btn.on { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d), 0 6px 14px rgba(61, 44, 85, 0.16); }

/* ---------- screens (overlays) ---------- */

.screen { position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s; }
.screen.in { opacity: 1; }
.screen.out { opacity: 0; pointer-events: none; }

/* ---------- title ---------- */

.title-screen { display: flex; align-items: stretch; padding: var(--edge); }
.title-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: 100%;
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateX(-30px);
  transition: transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.title-screen.in .title-card { transform: none; }
.title-home, .title-music { position: absolute; top: 36px; z-index: 2; }
.title-home { left: 16px; }
.title-music { right: 16px; }
.title-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 26px 6px; }
.title-hero { --kid-h: 132px; position: relative; padding: 0 calc(var(--kid-h) * 0.62); min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; min-height: calc(var(--kid-h) - 10px); } /* tall enough for the kids: the logo alone is shorter */
.logo { margin: 6px 0 0; text-align: center; line-height: 1; }
.logo-top { display: block; font-size: 40px; font-weight: 700; letter-spacing: 0.5px; }
.logo-top .ltr {
  display: inline-block;
  color: var(--c);
  transform: rotate(var(--tilt));
  text-shadow: 3px 0 #fff, -3px 0 #fff, 0 3px #fff, 0 -3px #fff, 2px 2px #fff, -2px -2px #fff, 2px -2px #fff, -2px 2px #fff, 0 7px 0 rgba(61, 44, 85, 0.22);
  animation: letterIn 0.6s cubic-bezier(0.2, 1.8, 0.4, 1) calc(var(--i) * 45ms + 150ms) both;
}
.logo-top .sp { display: inline-block; width: 0.3em; }
.logo-game { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 14px; margin-top: 2px; animation: gameIn 0.7s cubic-bezier(0.2, 1.8, 0.4, 1) 0.7s both; }
.logo-plane {
  display: inline-block;
  font-size: 58px;
  font-weight: 700;
  letter-spacing: 4px;
  text-shadow: 4px 0 var(--ink), -4px 0 var(--ink), 0 4px var(--ink), 0 -4px var(--ink), 3px 3px var(--ink), -3px -3px var(--ink), 3px -3px var(--ink), -3px 3px var(--ink), 0 9px 0 var(--ink), 3px 9px 0 var(--ink), -3px 9px 0 var(--ink);
}
.logo-plane { color: var(--blue); font-size: 52px; transform: rotate(-2deg); }
.tagline { margin: 14px 0 6px; text-align: center; font-size: 17px; color: var(--ink-soft); }
.section { display: flex; align-items: center; gap: 8px; margin: 14px 0 10px; font-size: 19px; }

.kid { position: absolute; bottom: -6px; width: calc(var(--kid-h) * 0.8); height: var(--kid-h); overflow: visible; animation: kidIn 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) 1s both; }
.kid-eva { left: -12px; }
.kid-max { right: -12px; animation-delay: 1.15s; }
.kid-shadow { fill: rgba(61, 44, 85, 0.16); animation: kidShadow 0.9s ease-in-out infinite alternate; }
.kid-body { animation: kidBob 0.9s ease-in-out infinite alternate; }
.kid-head { animation: kidTilt 1.8s ease-in-out infinite alternate; }
.kid-eyes { animation: kidBlink 4.2s infinite; }
.kid-pony { animation: kidPony 0.9s ease-in-out infinite alternate; }
.kid-eva .kid-wave { animation: kidWaveL 0.42s ease-in-out infinite alternate; }
.kid-max .kid-wave { animation: kidWaveR 0.42s ease-in-out -0.2s infinite alternate; }
.kid-max .kid-body, .kid-max .kid-shadow { animation-delay: -0.45s; }
.kid-max .kid-head { animation-delay: -0.9s; animation-direction: alternate-reverse; }
.kid-max .kid-eyes { animation-delay: 1.6s; }
@keyframes letterIn { from { opacity: 0; transform: translateY(-30px) rotate(var(--tilt)) scale(0.4); } to { opacity: 1; transform: rotate(var(--tilt)); } }
@keyframes gameIn { from { opacity: 0; transform: scale(0.3) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes kidIn { from { opacity: 0; transform: translateY(40px) scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes kidBob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes kidShadow { from { transform: scale(1); } to { transform: scale(0.86); } }
@keyframes kidTilt { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes kidWaveL { from { transform: rotate(-18deg); } to { transform: rotate(-46deg); } }
@keyframes kidWaveR { from { transform: rotate(18deg); } to { transform: rotate(46deg); } }
@keyframes kidPony { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }
@keyframes kidBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- this game's screens ---------- */

/* the title card's strip: little clouds on a blue sky */
.clouds-strip {
  height: 26px;
  flex: none;
  background:
    radial-gradient(circle at 14px 20px, #fff 9px, transparent 10px) 0 0 / 56px 26px repeat-x,
    radial-gradient(circle at 30px 16px, #fff 11px, transparent 12px) 0 0 / 56px 26px repeat-x,
    linear-gradient(180deg, #74c0fc, #a5d8ff);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}
.title-screen { justify-content: center; align-items: center; background: rgba(191, 230, 255, 0.55); }
.title-card { transform: translateY(30px); }
.how { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 14px 0 6px; font-size: 15px; color: var(--ink-soft); }
.how b { color: var(--ink); }
/* family mode: the family's pilots, with their names */
.crew { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 12px 0 0; }
.crew-kid { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 16px; color: var(--ink); }
.crew-kid .kid { position: static; width: 30px; height: 38px; animation: none; }
.crew-kid .kid * { animation: none; }
.title-actions { display: flex; gap: 12px; padding: 14px 22px 22px; border-top: 3px dashed var(--line); }
.title-actions .btn-huge { flex: 1; }

.landed-screen { display: flex; justify-content: center; align-items: center; padding: var(--edge); background: rgba(191, 230, 255, 0.5); }
.landed-card { width: min(480px, 100%); max-height: 100%; overflow: hidden auto; background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); text-align: center; transform: scale(0.85); transition: transform 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
.landed-screen.in .landed-card { transform: none; }
.landed-hero { --kid-h: 116px; position: relative; display: flex; justify-content: center; align-items: center; height: calc(var(--kid-h) + 16px); padding-top: 16px; }
.landed-hero .kid-eva { left: 22px; animation-delay: 0.2s; }
.landed-hero .kid-max { right: 22px; animation-delay: 0.35s; }
.landed-stars { font-size: 40px; animation: gameIn 0.7s cubic-bezier(0.2, 1.8, 0.4, 1) 0.5s both; }
.landed-title { margin: 10px 0 0; font-size: 34px; }
.landed-actions { display: flex; flex-direction: column; gap: 14px; padding: 16px 22px 24px; }

/* the in-flight buttons, top-left over the window */
.play-hud { position: absolute; top: max(12px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); display: flex; gap: 10px; z-index: 5; }
.play-hud .round-btn { width: 44px; height: 44px; font-size: 20px; opacity: 0.9; }

@media (max-width: 640px), (max-height: 520px) {
  .title-screen { padding: 10px; }
  .title-card { width: 100%; }
  .title-scroll { padding: 10px 16px 4px; }
  .title-hero { --kid-h: min(96px, 21vw); }
  .logo-top { font-size: 30px; }
  .logo-plane { font-size: 40px; }
  .title-home, .title-music { top: 32px; width: 42px; height: 42px; font-size: 19px; }
  .title-home { left: 8px; }
  .title-music { right: 8px; }
  .how { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .title-card { max-height: calc(100vh - 20px); }
  .title-hero { --kid-h: 80px; }
  .tagline { margin: 6px 0; font-size: 15px; }
  .title-actions { padding: 8px 16px 12px; }
  .landed-hero { --kid-h: 80px; }
  .landed-title { font-size: 26px; }
}
