/* Goosie Fly — UI styles. © 2026 ANGEL TECH CORPORATION INDUSTRIES L.L.C. All rights reserved. ANGEL TECH™
 * One committed look: flight-instrument panels (deep teal) over a cartoon sky. Golden corn = points and main actions.
 */
:root {
  --ink: #0b2233;
  --panel: rgba(11, 36, 52, 0.93);
  --panel-2: #123a50;
  --line: #2f6b80;
  --text: #f2f7fa;
  --muted: #a9c3cf;
  --corn: #ffc93c;
  --corn-deep: #e0a51c;
  --corn-ink: #2a1d00;
  --leaf: #59d27a;
  --leaf-ink: #0d2a18;
  --alarm: #ff5d5d;
  --display: "Titan One", "Arial Black", system-ui, sans-serif;
  --body: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text); font-family: var(--body); font-size: 16px;
  overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--display); font-size: 1rem; letter-spacing: 0.02em; color: var(--text);
  background: var(--panel-2); border: 2px solid var(--line); border-radius: 14px; padding: 0.6em 1.1em;
  cursor: pointer; transition: transform 0.08s ease, background 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); }
.btn:focus-visible, .seg:focus-visible, .chip:focus-visible, .buy:focus-visible, #touch button:focus-visible { outline: 3px solid var(--corn); outline-offset: 2px; }
.btn.primary { background: var(--corn); color: var(--corn-ink); border-color: var(--corn-deep); box-shadow: 0 4px 0 var(--corn-deep); }
.btn.primary:active { box-shadow: 0 1px 0 var(--corn-deep); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 1.35rem; padding: 0.55em 1.6em; }
.btn.small { font-size: 0.85rem; padding: 0.45em 0.9em; }
.btn.danger { border-color: var(--alarm); color: #ffd0d0; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
.eyebrow { font-family: var(--display); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--corn); }
h2 { font-family: var(--display); font-weight: 400; margin: 0.15em 0 0.3em; font-size: 1.6rem; line-height: 1.1; text-wrap: balance; }

.title { display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; text-align: center; background: linear-gradient(180deg, rgba(5, 25, 40, 0.15), rgba(5, 25, 40, 0.55)); }
.title-wrap { display: grid; justify-items: center; gap: 0.6rem; }
.logo { margin: 0; font-family: var(--display); font-weight: 400; line-height: 0.82; display: grid; justify-items: center; transform: rotate(-4deg); }
.logo span { display: block; color: var(--corn); -webkit-text-stroke: 3px #2a1d00; paint-order: stroke fill; text-shadow: 0 6px 0 #2a1d00, 0 14px 30px rgba(0, 0, 0, 0.35); }
.logo .l1 { font-size: clamp(3.4rem, 13vw, 7.5rem); }
.logo .l2 { font-size: clamp(4.4rem, 17vw, 9.5rem); color: #fff; margin-left: 1.2em; }
.tag { max-width: 34ch; margin: 0.4rem 0 0.6rem; font-size: 1.1rem; font-weight: 600; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.menu { display: grid; gap: 0.6rem; justify-items: center; }
.menu-row { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.owner { font-size: 0.8rem; color: #e8f2f7; opacity: 0.9; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); padding-top: 0.5rem; }
.owner a { color: inherit; text-underline-offset: 2px; }

/* ---------- hangar ---------- */
.hangar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); grid-template-rows: auto 1fr auto; gap: 14px; pointer-events: none; }
.hangar > * { pointer-events: auto; }
.leg-card { grid-column: 1; grid-row: 1; align-self: start; max-width: 460px; background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.leg-card .goal { margin: 0; font-family: var(--display); font-size: 1.05rem; color: #fff; }
.leg-card .note { margin: 0.3em 0 0; color: var(--muted); font-size: 0.98rem; line-height: 1.3; }
.leg-card .best { margin: 0.35em 0 0; font-size: 0.9rem; color: var(--leaf); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-family: var(--display); font-size: 0.8rem; min-width: 34px; padding: 0.35em 0.6em; border-radius: 10px; border: 2px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.chip.done { border-color: var(--leaf); color: var(--leaf); }
.chip.on { background: var(--corn); color: var(--corn-ink); border-color: var(--corn-deep); }
.shop { grid-column: 2; grid-row: 1 / 4; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--line); border-radius: 18px; overflow: hidden; }
.shop-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 2px solid var(--line); }
.wallet { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 1.4rem; color: var(--corn); font-variant-numeric: tabular-nums; }
.wallet small { font-family: var(--body); font-size: 0.85rem; color: var(--muted); }
.mode { display: flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg { font-family: var(--display); font-size: 0.8rem; padding: 0.4em 0.8em; background: transparent; color: var(--muted); border: 0; cursor: pointer; }
.seg.on { background: var(--leaf); color: var(--leaf-ink); }
.grid { overflow-y: auto; padding: 10px; display: grid; gap: 8px; align-content: start; -webkit-overflow-scrolling: touch; }
.upg { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); }
.upg canvas { width: 52px; height: 52px; border-radius: 12px; background: rgba(95, 180, 240, 0.16); }
.upg .info { min-width: 0; }
.upg .name { font-family: var(--display); font-size: 0.98rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.upg .pips { display: inline-flex; gap: 3px; }
.upg .pips i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); display: inline-block; }
.upg .pips i.on { background: var(--corn); }
.upg .desc { font-size: 0.86rem; color: var(--muted); line-height: 1.25; }
.upg .stat { font-size: 0.86rem; font-weight: 700; color: #dff3ff; font-variant-numeric: tabular-nums; }
.buy { font-family: var(--display); font-size: 0.92rem; min-width: 86px; padding: 0.5em 0.7em; border-radius: 12px; cursor: pointer; background: var(--corn); color: var(--corn-ink); border: 2px solid var(--corn-deep); font-variant-numeric: tabular-nums; }
.buy:disabled { cursor: default; background: transparent; color: var(--muted); border-color: rgba(255, 255, 255, 0.15); }
.buy.max { color: var(--leaf); border-color: var(--leaf); }
.upg.big { border-color: rgba(255, 201, 60, 0.35); background: rgba(255, 201, 60, 0.07); }
.hangar-actions { grid-column: 1; grid-row: 3; align-self: end; display: flex; gap: 10px; align-items: center; }

@media (max-width: 860px), (max-height: 520px) and (max-width: 1100px) {
  .hangar { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; }
  .leg-card { grid-column: 1; grid-row: 1; max-width: none; padding: 10px 14px; }
  .leg-card h2 { font-size: 1.25rem; }
  .leg-card .note { display: none; }
  .shop { grid-column: 1; grid-row: 2; }
  .hangar-actions { grid-column: 1; grid-row: 3; justify-content: space-between; }
  .hangar-actions .btn.big { flex: 1; }
}
@media (max-height: 520px) and (min-width: 600px) {
  .hangar { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); grid-template-rows: auto 1fr auto; }
  .leg-card { grid-column: 1; grid-row: 1; }
  .shop { grid-column: 2; grid-row: 1 / 4; }
  .hangar-actions { grid-column: 1; grid-row: 3; }
  .chips { margin-top: 6px; }
}

/* ---------- modal cards ---------- */
.modal { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; background: rgba(4, 16, 26, 0.55); overflow-y: auto; }
.card { width: min(520px, 100%); background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 18px 20px; display: grid; gap: 10px; }
.card.pause { width: min(340px, 100%); text-align: center; }
.results table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.results td { padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.results td:nth-child(2) { color: var(--muted); text-align: right; }
.results td:last-child { text-align: right; font-family: var(--display); color: var(--corn); width: 6.5em; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-size: 1.15rem; }
.total b { font-size: 1.8rem; color: var(--corn); font-weight: 400; }
.banner { font-family: var(--display); background: var(--leaf); color: var(--leaf-ink); border-radius: 14px; padding: 10px 14px; line-height: 1.25; }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; line-height: 1.35; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.9rem; color: var(--muted); }
kbd { font-family: var(--display); font-size: 0.75rem; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-right: 3px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.hud-top { position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 200px)); }
.legbar { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; background: rgba(8, 26, 38, 0.72); border-radius: 14px; padding: 6px 12px; }
.legname { font-family: var(--display); font-size: 0.85rem; color: var(--corn); white-space: nowrap; }
.legbar .goal { font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--corn), var(--leaf)); border-radius: 6px; }
.hud-left { position: absolute; top: calc(10px + var(--safe-t)); left: calc(12px + var(--safe-l)); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55); }
.hud-left .big { font-family: var(--display); font-size: 2rem; line-height: 1; }
.hud-left .big small { font-size: 0.9rem; margin-left: 3px; }
.hud-left .sub { font-weight: 700; font-size: 0.92rem; }
.hud-right { position: absolute; top: calc(10px + var(--safe-t)); right: calc(56px + var(--safe-r)); display: grid; justify-items: end; gap: 4px; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55); }
.pts { display: flex; align-items: center; gap: 5px; font-family: var(--display); font-size: 1.3rem; color: var(--corn); }
.hearts { font-size: 1.15rem; letter-spacing: 1px; color: var(--alarm); }
.hearts .off { color: rgba(255, 255, 255, 0.25); }
.stam { display: flex; gap: 3px; align-items: center; font-weight: 800; font-size: 0.85rem; }
.stam i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); display: inline-block; }
.stam i.on { background: #fff1c9; }
.fuel { position: relative; width: 110px; height: 14px; border-radius: 8px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.fuel i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #ff6a3d, #ffb347); }
.fuel span { position: absolute; inset: 0; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.1em; display: grid; place-items: center; color: #fff; }
.ammo { font-weight: 800; font-size: 0.95rem; display: flex; gap: 10px; }
.fuel.o2 i { background: linear-gradient(90deg, #4fb3ff, #a8e6ff); }
.fuel.o2.low i { background: linear-gradient(90deg, #ff5d5d, #ff9a7a); }
.power { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 220px; }
.power span { font-family: var(--display); font-size: 0.72rem; padding: 2px 7px; border-radius: 8px; color: #2a1d00; background: var(--corn); text-shadow: none; }
.power span.mag { background: #ff8a8a; }
.power span.shield { background: #fff1a8; }
.icon-btn { pointer-events: auto; position: absolute; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); width: 40px; height: 40px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(8, 26, 38, 0.6); color: #fff; font-size: 0.9rem; cursor: pointer; }
.corn { width: 14px; height: 20px; display: inline-block; border-radius: 50% / 45%; background: radial-gradient(circle at 35% 30%, #fff1b0 0 18%, transparent 20%), repeating-linear-gradient(0deg, #ffcf3d 0 3px, #f2b51f 3px 4px); box-shadow: -3px 5px 0 -2px #5aa43a, 3px 5px 0 -2px #5aa43a; }

/* ---------- toasts ---------- */
#toasts { position: absolute; top: calc(58px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.toast { font-family: var(--display); font-size: 0.95rem; text-align: center; padding: 7px 14px; border-radius: 12px; background: rgba(8, 26, 38, 0.85); color: #fff; animation: pop 0.25s ease-out; transition: opacity 0.4s ease; max-width: 100%; }
.toast.good, .toast.flock { background: var(--leaf); color: var(--leaf-ink); }
.toast.danger { background: #b8322c; }
.toast.big { background: var(--corn); color: var(--corn-ink); font-size: 1.3rem; padding: 10px 20px; }
.toast.out { opacity: 0; }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- touch controls ---------- */
#touch { position: absolute; inset: 0; pointer-events: none; }
#touch button { pointer-events: auto; touch-action: none; font-family: var(--display); color: #fff; border: 2px solid rgba(255, 255, 255, 0.45); background: rgba(8, 26, 38, 0.45); border-radius: 50%; cursor: pointer; }
#touch button.held { background: rgba(255, 201, 60, 0.55); border-color: var(--corn); }
.pad { position: absolute; bottom: calc(14px + var(--safe-b)); display: grid; gap: 10px; }
.pad-left { left: calc(14px + var(--safe-l)); }
.pad-left button { width: 66px; height: 66px; font-size: 1.5rem; }
.pad-right { right: calc(14px + var(--safe-r)); justify-items: end; }
.pad-right .row { display: flex; gap: 10px; align-items: end; }
.pad-right .row.small button { width: 52px; height: 52px; font-size: 1.4rem; }
.pad-right .flap { width: 70px; height: 70px; font-size: 0.85rem; }
.pad-right .boost { width: 84px; height: 84px; font-size: 0.9rem; background: rgba(255, 106, 61, 0.45); }
#touch .join { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); border-radius: 16px; width: auto; height: auto; padding: 12px 18px; background: var(--leaf); color: var(--leaf-ink); border-color: #2f9a50; animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.07); } }
@media (max-width: 560px) {
  .hud-top { top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(58px + var(--safe-r)); width: auto; transform: none; }
  .legbar { padding: 6px 10px; gap: 6px; }
  .hud-left { top: calc(58px + var(--safe-t)); }
  .hud-right { top: calc(58px + var(--safe-t)); right: calc(12px + var(--safe-r)); }
  #toasts { top: calc(176px + var(--safe-t)); }
  .hud-left .big { font-size: 1.6rem; }
  .pad-left button { width: 58px; height: 58px; }
  .pad-right .boost { width: 74px; height: 74px; }
  .pad-right .flap { width: 62px; height: 62px; }
}
/* ---------- results: online + reward ---------- */
.res-actions { display: flex; gap: 10px; flex-wrap: wrap-reverse; }
.res-actions .btn { flex: 1 1 120px; }
.res-actions .btn.big { flex: 1 1 220px; }
.btn.reward { background: var(--leaf); color: var(--leaf-ink); border-color: #2f9a50; box-shadow: 0 4px 0 #2f9a50; }
.online-box { display: grid; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.rank-line { margin: 0; font-weight: 700; line-height: 1.35; }
.rank-line b { color: var(--corn); font-family: var(--display); font-weight: 400; }
.name-form { display: grid; gap: 6px; }
.name-form label { font-weight: 700; }
.name-row { display: flex; flex-wrap: wrap; gap: 8px; }
.name-row input { flex: 1 1 150px; width: 100%; min-width: 0; font: inherit; font-weight: 700; color: var(--text); background: var(--ink); border: 2px solid var(--line); border-radius: 12px; padding: 0.45em 0.7em; -webkit-user-select: text; user-select: text; }
.name-row input:focus-visible { outline: 3px solid var(--corn); outline-offset: 1px; }
.hint { margin: 0; font-size: 0.82rem; color: var(--muted); }
.err { margin: 0; min-height: 1.2em; color: #ffb0b0; font-weight: 700; font-size: 0.88rem; }
.err:empty { min-height: 0; }

/* ---------- high scores ---------- */
.board { width: min(560px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px - var(--safe-t) - var(--safe-b)); grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.board-head h2 { margin: 0; }
.close-btn { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 2px solid var(--line); background: transparent; color: var(--text); font-size: 1rem; cursor: pointer; }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tab { font-family: var(--display); font-size: 0.9rem; padding: 0.5em 0.3em; border-radius: 12px; border: 2px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.tab.on { background: var(--corn); color: var(--corn-ink); border-color: var(--corn-deep); }
.period { display: inline-flex; justify-self: start; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.board-status { margin: 0; color: var(--muted); font-size: 0.92rem; }
.board-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 96px; display: grid; gap: 4px; align-content: start; }
.board-list li { display: grid; grid-template-columns: 3em minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); font-variant-numeric: tabular-nums; }
.board-list li.you { background: rgba(255, 201, 60, 0.16); box-shadow: inset 0 0 0 2px rgba(255, 201, 60, 0.55); }
.board-list li.gap { background: none; padding: 0; justify-content: center; color: var(--muted); grid-template-columns: 1fr; text-align: center; }
.board-list .rk { font-family: var(--display); color: var(--muted); }
.board-list li.top .rk { color: var(--corn); }
.board-list .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.board-list .nm small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.board-list .val { font-family: var(--display); }
.pilot-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .toast, #touch .join { animation: none; }
  .btn { transition: none; }
}
