:root {
  color-scheme: light;
  --flight-paper: #fffaf6;
  --flight-ink: #483e3a;
  --flight-muted: #75615f;
  --flight-line: #edd9d7;
  --flight-accent: #a43759;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { height: var(--game-content-height); background: var(--flight-paper); color: var(--flight-ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--flight-accent); outline-offset: -3px; }
button:disabled { cursor: default; opacity: .5; }
[hidden] { display: none !important; }
.flight-game { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: var(--game-content-height); overflow: hidden; }
.flight-hud { min-height: 62px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 8px max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left)); background: #fffaf6; border-bottom: 1px solid var(--flight-line); }
.fuel-group { display: flex; gap: 12px; align-items: center; font-weight: 700; }
.fuel-group > div { display: flex; flex-direction: column; gap: 2px; }
.fuel-group span { font-size: 11px; font-weight: 500; color: var(--flight-muted); }
progress { appearance: none; -webkit-appearance: none; display: block; width: clamp(90px, 16vw, 270px); height: 15px; border: 1px solid #d8bdbb; border-radius: 999px; overflow: hidden; background: #f5e8e6; }
progress::-webkit-progress-bar { background: #f5e8e6; }
progress::-webkit-progress-value { border-radius: 999px; background: #75c5e3; }
progress::-moz-progress-bar { border-radius: 999px; background: #75c5e3; }
progress.is-low::-webkit-progress-value { background: #d68c55; }
progress.is-low::-moz-progress-bar { background: #d68c55; }
.star-counter { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 21px; white-space: nowrap; }
.star-counter img { width: 31px; height: 31px; object-fit: contain; }
.hud-actions { display: flex; justify-content: flex-end; gap: 8px; }
.hud-actions button { min-height: 38px; padding: 5px 12px; background: #fff6f4; border: 1px solid var(--flight-line); border-radius: 999px; color: var(--flight-muted); font-size: 13px; white-space: nowrap; }
.hud-actions button:hover { background: #f8e8e3; }
.flight-scene { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #b6dff0; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.scene-message { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 28px); width: max-content; margin: 0; padding: 7px 16px; border: 1px solid rgba(237, 217, 215, .8); border-radius: 999px; background: rgba(255, 250, 246, .94); color: #674a42; font-size: 14px; pointer-events: none; text-align: center; }
.scene-message:empty { display: none; }
.route-status { position: absolute; top: 12px; left: 14px; margin: 0; padding: 5px 11px; max-width: calc(100% - 28px); border-radius: 12px; background: rgba(255, 250, 246, .95); color: var(--flight-ink); font-size: 13px; pointer-events: none; }
.flight-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; min-height: 176px; padding: 10px max(32px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left)); border-top: 1px solid var(--flight-line); background: #fffaf6; user-select: none; -webkit-user-select: none; }
.direction-pad { display: grid; grid-template-columns: repeat(3, 46px); gap: 4px; justify-self: start; }
.pad-center { display: grid; place-items: center; color: var(--flight-muted); font-size: 12px; }
.drive-button { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0; border: 1px solid #dfb8b1; border-radius: 13px; background: #fff6ef; color: #72514b; font-size: 26px; font-weight: 650; touch-action: none; box-shadow: 0 2px 0 #f1ded7; }
.drive-button.is-held { background: #f8ddd5; transform: translateY(2px); box-shadow: none; }
.drive-button:disabled { opacity: .65; }
.middle-controls { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
.speed-controls { display: flex; flex: none; flex-direction: column; gap: 10px; }
.speed-button { width: 64px; font-size: 16px; }
.jet-control { justify-self: end; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.jet-button { width: clamp(80px, 10vw, 112px); height: clamp(80px, 10vw, 112px); border-radius: 50%; background: var(--flight-accent); border: 3px solid #d78796; color: #fffaf6; font-size: 28px; box-shadow: 0 3px 0 #efd1d0; }
.jet-button.is-held { background: #7d243f; }
.jet-control > span { font-size: 12px; color: var(--flight-muted); }
.keyboard-hint { position: absolute; left: calc(100% + 20px); width: min(320px, calc(50vw - 174px)); margin: 0; font-size: 17px; color: var(--flight-muted); text-align: center; }
.keyboard-hint small { display: block; margin-top: 7px; font-size: 12px; line-height: 1.8; color: var(--flight-muted); }
kbd { font: inherit; font-size: .9em; }
.flight-dialog { width: min(440px, calc(100% - 28px)); max-height: calc(100% - 24px); padding: 26px; border: 1px solid #e3c7c1; border-radius: 22px; background: #fffaf6; color: var(--flight-ink); box-shadow: 0 16px 60px rgba(79, 57, 42, .16); overflow: auto; }
.flight-dialog::backdrop { background: rgba(239, 233, 220, .22); }
.dialog-eyebrow { margin: 0 0 8px; color: #927067; font-size: 12px; letter-spacing: .1em; }
.flight-dialog h1 { margin: 0 0 12px; font-size: 27px; line-height: 1.3; }
.flight-dialog > p:not(.dialog-eyebrow) { color: var(--flight-muted); }
.flight-dialog #dialogDescription { font-size: 15px; line-height: 1.85; white-space: pre-line; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.dialog-actions button { flex: 1; min-height: 44px; padding: 9px 18px; border-radius: 999px; font-weight: 650; white-space: nowrap; }
.primary-button { background: var(--flight-accent); color: white; border: 1px solid var(--flight-accent); }
.primary-button:hover { background: #8e2b49; }
.secondary-button { background: white; border: 1px solid var(--flight-line); }
.flight-dialog .dialog-note { margin: 15px 0 0; font-size: 12px; }
.best-record { font-size: 13px; padding-top: 12px; border-top: 1px solid var(--flight-line); }
.result-details { padding: 8px 0; font-size: 14px; line-height: 1.9; }
.result-details p { margin: 0; }
.result-rating { color: var(--flight-accent); font-size: 23px; font-weight: 750; }
.level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.level-card { min-width: 0; padding: 0; overflow: hidden; text-align: left; border: 1px solid var(--flight-line); border-radius: 13px; background: #fff; }
.level-card[aria-current="true"] { border: 2px solid var(--flight-accent); }
.level-card img { display: block; width: 100%; height: 66px; object-fit: cover; }
.level-card strong, .level-card small { display: block; padding: 0 10px; }
.level-card strong { margin-top: 6px; font-size: 14px; }
.level-card small { margin: 3px 0 9px; color: var(--flight-muted); font-size: 12px; }
.noscript-note { position: fixed; top: 20%; left: 10%; right: 10%; padding: 20px; background: white; }
@media (max-width: 740px) {
  .flight-hud { gap: 8px; padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .fuel-group { gap: 6px; font-size: 14px; }
  .star-counter { gap: 5px; font-size: 17px; }
  .star-counter img { width: 24px; height: 24px; }
  .hud-actions { gap: 4px; }
  .hud-actions button { padding: 5px 8px; font-size: 12px; }
  .flight-controls { gap: 8px; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .keyboard-hint { left: calc(100% + 10px); font-size: 10px; }
  .keyboard-hint small { margin-top: 4px; font-size: 10px; line-height: 1.45; }
  .speed-button { width: 54px; }
}
@media (max-width: 500px) and (orientation: portrait) {
  .flight-hud { grid-template-columns: minmax(0, 1fr) auto; min-height: 86px; row-gap: 3px; }
  .star-counter { grid-column: 2; grid-row: 1; }
  .hud-actions { grid-column: 2; grid-row: 2; }
  .fuel-group { grid-row: 1 / 3; }
  progress { width: clamp(92px, 28vw, 150px); }
  .flight-controls { grid-template-columns: 146px minmax(0, 1fr) 80px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .keyboard-hint { display: none; }
  .speed-button { width: 44px; font-size: 14px; }
  .jet-button { width: 80px; height: 80px; font-size: 22px; }
  .fuel-group { display: block; }
  .fuel-group label { font-size: 12px; }
  .fuel-group span { font-size: 10px; }
  .route-status { top: 10px; left: 10px; font-size: 12px; }
  .scene-message { font-size: 12px; padding: 6px 10px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .flight-hud { min-height: 42px; padding-block: 3px; }
  .fuel-group span { font-size: 10px; }
  .hud-actions button { min-height: 36px; padding-block: 2px; }
  .flight-controls { min-height: 148px; padding-block: 4px max(4px, env(safe-area-inset-bottom)); }
  .direction-pad { grid-template-columns: repeat(3, 44px); gap: 2px; }
  .drive-button { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
  .speed-button { width: 64px; font-size: 15px; }
  .jet-button { width: 66px; height: 66px; border-radius: 50%; font-size: 21px; }
  .keyboard-hint { font-size: 12px; }
  .keyboard-hint small { margin-top: 2px; font-size: 10px; }
  .flight-dialog { padding: 18px 22px; }
  .flight-dialog h1 { font-size: 23px; margin-bottom: 5px; }
  .flight-dialog #dialogDescription { font-size: 13px; margin-block: 8px; line-height: 1.65; }
  .dialog-actions { margin-top: 12px; }
  .flight-dialog .dialog-note { margin-top: 10px; }
  .level-card img { height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .drive-button.is-held { transform: none; }
}
