@font-face { font-family: 'Fredoka'; src: url(fonts/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
:root {
  --sky: #2f6fb6; --sky2: #5aa0e4; --butter: #f6c945; --butter2: #ffe08a; --ink: #13233a; --ink2: #3c4d66; --mut: #7d8aa0;
  --card: #ffffff; --bg: #eaf3fc; --red: #e2463b; --green: #2e9e5b;
  --font: 'Fredoka', ui-rounded, -apple-system, system-ui, 'Segoe UI', sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); font-family: var(--font); color: var(--ink); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; border: 0; cursor: pointer; touch-action: manipulation; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- home ---------- */
.screen { position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(16px + var(--st)) 18px calc(28px + var(--sb));
  background: linear-gradient(180deg, rgba(47,111,182,.92) 0%, rgba(90,160,228,.88) 38%, rgba(234,243,252,.97) 75%); }
.home-top { display: flex; align-items: center; justify-content: space-between; max-width: 520px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 40px; font-weight: 700; color: #fff; letter-spacing: -.01em; text-shadow: 0 2px 10px rgba(0,0,0,.15); }
.pat { width: 36px; height: 26px; border-radius: 7px; background: linear-gradient(160deg, var(--butter2), var(--butter)); box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.18); transform: rotate(-8deg); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; background: rgba(255,255,255,.18); color: #fff; display: flex; align-items: center; justify-content: center; }
.tag { color: rgba(255,255,255,.9); font-size: 18px; margin: 2px auto 18px; max-width: 520px; }
.card { background: var(--card); border-radius: 22px; padding: 18px; margin: 0 auto 14px; max-width: 520px; box-shadow: 0 10px 30px rgba(19,35,58,.14); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--sky); }
.d-apt { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 0; }
.d-apt b { font-size: 46px; line-height: 1; letter-spacing: .02em; }
.d-apt span { font-size: 26px; font-weight: 600; color: var(--ink2); background: #eef4fb; border-radius: 10px; padding: 2px 10px; }
.d-name { color: var(--ink2); font-size: 16px; margin: 4px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { background: #eef4fb; color: var(--ink2); border-radius: 12px; padding: 5px 10px; font-size: 14px; font-weight: 500; }
.chip.warn { background: #fff1d6; color: #8a5a00; }
.d-best { font-size: 15px; color: var(--ink2); margin-bottom: 12px; min-height: 20px; }
.d-best b { color: var(--ink); }
.muted { color: var(--mut); margin: 6px 0 12px; font-size: 15px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 16px; font-size: 18px; font-weight: 600; background: var(--sky); color: #fff; box-shadow: 0 4px 0 #1f538f; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #1f538f; }
.btn.big { height: 58px; font-size: 20px; background: var(--butter); color: var(--ink); box-shadow: 0 4px 0 #c99a1e; }
.btn.big:active { box-shadow: 0 2px 0 #c99a1e; }
.btn.soft { background: #eef4fb; color: var(--sky); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--mut); box-shadow: none; height: 44px; }
.btn:disabled { opacity: .45; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 520px; margin: 0 auto; }
.stat { background: rgba(255,255,255,.75); border-radius: 16px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--ink2); }
.foot { text-align: center; color: var(--mut); font-size: 13px; margin: 18px 0 0; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(10,20,40,.35); padding: 0 0 var(--sb); animation: fade .2s ease; }
@media (min-width: 640px) { .overlay { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
.panel { width: min(520px, 100%); background: var(--card); border-radius: 26px 26px 0 0; padding: 22px 20px calc(18px + var(--sb)); max-height: 92vh; overflow-y: auto; animation: rise .28s cubic-bezier(.2,.85,.25,1); }
@media (min-width: 640px) { .panel { border-radius: 26px; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.panel.small { text-align: center; }
.panel.tall { min-height: 70vh; }
.panel h2 { margin: 2px 0 12px; font-size: 28px; }
.panel .btn { margin-top: 10px; }
.b-rows, .r-rows { border-radius: 16px; background: #f4f8fd; padding: 4px 14px; margin: 8px 0 12px; }
.b-row, .r-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 16px; }
.b-row + .b-row, .r-row + .r-row { border-top: 1px solid #e3ebf5; }
.b-row span, .r-row span { color: var(--ink2); }
.b-row b, .r-row b { text-align: right; }
.r-row b.good { color: var(--green); } .r-row b.bad { color: var(--red); }
.howto { font-size: 15px; color: var(--ink2); line-height: 1.45; display: grid; gap: 6px; margin: 4px 2px 6px; }
.rating { text-align: center; font-size: 54px; font-weight: 700; line-height: 1.05; margin-top: 4px; }
.rating.butter { color: #e0a812; text-shadow: 0 3px 0 rgba(224,168,18,.18); }
.rating.crash { color: var(--red); font-size: 34px; }
.fpm { text-align: center; font-size: 22px; color: var(--ink2); margin-top: 2px; }
.stars { text-align: center; font-size: 34px; letter-spacing: 6px; margin: 4px 0; color: #e0a812; }
.stars .off { color: #d8e0ea; }
.r-score { text-align: center; font-size: 15px; color: var(--mut); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* free flight picker */
.search { width: 100%; height: 46px; border-radius: 14px; border: 2px solid #e3ebf5; padding: 0 14px; font: inherit; font-size: 17px; outline: none; margin: 4px 0 8px; }
.search:focus { border-color: var(--sky); }
.list { max-height: 34vh; overflow-y: auto; border-radius: 14px; background: #f4f8fd; }
.opt { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: none; font-size: 16px; color: var(--ink); }
.opt + .opt { border-top: 1px solid #e3ebf5; }
.opt b { min-width: 46px; }
.opt span { flex: 1; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt.on { background: #e1eefb; }
.opt .lock, .seg .lock { color: var(--mut); font-size: 13px; }
.lbl { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); margin: 14px 2px 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-height: 40px; padding: 0 12px; border-radius: 12px; background: #eef4fb; color: var(--ink2); font-size: 15px; font-weight: 500; }
.seg button.on { background: var(--sky); color: #fff; }
.seg button.locked { opacity: .55; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; }
.x { width: 40px; height: 40px; border-radius: 20px; background: #eef4fb; color: var(--ink2); display: flex; align-items: center; justify-content: center; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; font-size: 17px; }
.toggle + .toggle { border-top: 1px solid #e3ebf5; }
.sw { width: 51px; height: 31px; border-radius: 16px; background: #cfd8e3; position: relative; transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.sw.on { background: var(--green); } .sw.on::after { transform: translateX(20px); }
.pro-perks { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 8px; font-size: 16px; }
.pro-perks li::before { content: "✓  "; color: var(--green); font-weight: 700; }
.fine { font-size: 12px; color: var(--mut); text-align: center; margin-top: 10px; line-height: 1.4; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.hud-top { position: absolute; top: calc(10px + var(--st)); left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-rw { font-size: 20px; font-weight: 700; background: rgba(0,0,0,.28); border-radius: 12px; padding: 5px 11px; }
.hud-wind { display: flex; align-items: center; gap: 5px; font-size: 15px; background: rgba(0,0,0,.28); border-radius: 12px; padding: 5px 10px; }
.hud-wind svg { width: 18px; height: 18px; transition: transform .3s; }
.hud-btn { pointer-events: auto; width: 42px; height: 42px; border-radius: 21px; background: rgba(0,0,0,.3); color: #fff; display: flex; align-items: center; justify-content: center; }
.hud-l, .hud-r { position: absolute; top: calc(70px + var(--st)); background: rgba(0,0,0,.26); border-radius: 14px; padding: 6px 12px; text-align: center; min-width: 76px; }
.hud-l { left: 12px; } .hud-r { right: 12px; }
.hv { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hv.sm { font-size: 18px; margin-top: 4px; }
.hv.good { color: #8dffb0; } .hv.bad { color: #ff9f96; }
.hk { font-size: 11px; opacity: .85; letter-spacing: .06em; }
.callout { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 46px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.callout.show { opacity: 1; }
.hint { position: absolute; left: 50%; bottom: calc(110px + var(--sb)); transform: translateX(-50%); width: max-content; max-width: 86%; text-align: center; font-size: 17px; font-weight: 600; background: rgba(0,0,0,.4); border-radius: 14px; padding: 9px 14px; }
.stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: rgba(255,255,255,.08); }
.knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
#ctl { position: fixed; inset: 0; z-index: 4; touch-action: none; }

.toast { position: fixed; left: 50%; bottom: calc(26px + var(--sb)); transform: translate(-50%, 20px); z-index: 40; background: var(--ink); color: #fff; border-radius: 14px; padding: 11px 16px; font-size: 15px; opacity: 0; transition: .25s; pointer-events: none; max-width: 90%; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
