* { box-sizing: border-box; }
html { background: #040b07; }
body { margin: 0; background: #040b07; color: #f0f7f2; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.fly-page { min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 50% -10%, #17442b 0, transparent 34rem), linear-gradient(180deg, #07100b, #030806); }
.fly-header { display: flex; align-items: center; justify-content: space-between; width: min(1180px, calc(100% - 36px)); min-height: 68px; margin: auto; border-bottom: 1px solid #ffffff12; }
.game-brand { display: flex; align-items: center; gap: 12px; }
.wing-logo { display: grid; place-items: center; width: 46px; height: 46px; overflow: hidden; border: 2px solid #d6ff6a; border-radius: 50%; background: #102218; box-shadow: 0 10px 40px #71eb7840; transform: rotate(-4deg); }
.wing-logo img { width: 100%; height: 115%; object-fit: cover; object-position: center 35%; }
.game-brand h1 { margin: 0; font-size: 19px; font-weight: 950; letter-spacing: -.03em; }
.game-brand p { margin: 1px 0 0; color: #78e79e; font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.fly-header > a { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid #a96cff2e; border-radius: 12px; color: #a7b7ad; background: #8d42ef0b; font-size: 12px; text-decoration: none; }
.fly-header > a svg { width: 17px; height: 17px; color: #b477ff; }
.fly-header > a b { color: #d2b2ff; }

.fly-layout { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 12px; width: min(1180px, calc(100% - 36px)); margin: 12px auto 0; }
.arcade-shell, .leaderboard { border: 1px solid #ffffff13; border-radius: 24px; background: #08140ddf; box-shadow: 0 28px 80px #0008; }
.arcade-shell { min-width: 0; overflow: hidden; }
.hud-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr .8fr; gap: 1px; min-height: 58px; border-bottom: 1px solid #ffffff10; background: #ffffff08; }
.hud-row > div { display: grid; align-content: center; padding: 9px 17px; border-right: 1px solid #ffffff0e; }
.hud-row span { color: #62786a; font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.hud-row b { margin-top: 3px; font-size: 15px; }

.track-line { position: relative; padding: 13px 20px 13px; background: #050d09; }
.track-line > div { display: flex; justify-content: space-between; margin-bottom: 7px; color: #64796b; font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.track-line .progress { height: 5px; overflow: hidden; border-radius: 99px; background: #ffffff10; }
.track-line .progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5ee997, #dfff67); }
.track-line .hero-mark { position: absolute; bottom: -1px; width: 25px; height: 25px; overflow: hidden; border: 2px solid #cfff6a; border-radius: 50%; font-style: normal; transition: left .2s linear; filter: drop-shadow(0 0 7px #aaff72); left: calc(0% - 13px); }
.track-line .hero-mark img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; }

.canvas-wrap { position: relative; height: clamp(400px, calc(100vh - 238px), 535px); min-height: 400px; overflow: hidden; background: #06110b; touch-action: none; user-select: none; }
.canvas-wrap canvas { display: block; width: 100%; height: 100%; cursor: pointer; }
.game-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow-y: auto; padding: 22px; text-align: center; background: radial-gradient(circle at center, #0d2e1ddb, #030806f7 72%); backdrop-filter: blur(4px); }
.game-overlay h2 { margin: 7px 0 10px; font-size: clamp(30px, 4vw, 52px); line-height: .97; letter-spacing: -.055em; }
.game-overlay h2 em { color: #9af064; font-style: normal; }
.game-overlay > p { max-width: 580px; margin: 0 0 17px; color: #91a398; font-size: 14px; line-height: 1.55; }
.overline { color: #73e99b; font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.mascot-preview { width: 82px; height: 82px; margin-bottom: 9px; overflow: hidden; border: 2px solid #baff7357; border-radius: 50%; box-shadow: 0 0 38px #69df8434; }
.mascot-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }

.welcome-overlay form { display: grid; grid-template-columns: minmax(220px, 330px) auto; gap: 8px; }
.nick-input { height: 50px; border: 1px solid #82ef9450; border-radius: 14px; background: #ffffff0a; color: #f0f7f2; font-size: 16px; padding: 0 14px; outline: none; }
.nick-input::placeholder { color: #6d8376; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 18px; border: 0; border-radius: 14px; color: #071108; background: linear-gradient(135deg, #7ef29d, #ddff67); font-weight: 900; box-shadow: 0 12px 38px #72e9832a; cursor: pointer; }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.welcome-overlay small { margin-top: 11px; color: #5d7164; font-size: 11px; }

.ready-overlay > svg { width: 58px; height: 58px; margin-bottom: 13px; padding: 12px; border-radius: 18px; color: #99f36f; background: #6fea8b16; }
.controls { display: flex; gap: 9px; margin-bottom: 15px; }
.controls span { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid #ffffff15; border-radius: 11px; color: #b6c5bc; background: #ffffff07; font-size: 12px; }
.controls svg { width: 16px; height: 16px; color: #8eed6e; }

.result-overlay > svg { width: 70px; height: 70px; margin-bottom: 14px; padding: 15px; border-radius: 22px; }
.result-overlay.crash > svg { color: #ff6d66; background: #ff504616; }
.result-overlay.victory > svg { color: #eaff65; background: #dfff6518; }
.result-overlay.victory h2 { color: #dfff68; }
.result-overlay.victory > img { width: min(370px, 75vw); height: 150px; margin: -5px 0 5px; object-fit: contain; filter: drop-shadow(0 22px 25px #000); }

.checkpoint-pop { position: absolute; z-index: 4; top: 50%; left: 50%; display: grid; justify-items: center; width: min(430px, calc(100% - 36px)); padding: 17px 22px; transform: translate(-50%, -50%); border: 2px solid #ddff6a7b; border-radius: 22px; color: #efffd3; background: #092014ed; box-shadow: 0 0 70px #8aec6738; animation: checkpoint-in .35s ease-out; }
.checkpoint-pop span { color: #80e99e; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.checkpoint-pop b { margin-top: 4px; font-size: 37px; letter-spacing: -.04em; }
.checkpoint-pop img { width: 220px; height: 76px; object-fit: contain; }
.zhiguli-mark { font-size: 60px; filter: hue-rotate(75deg); }
@keyframes checkpoint-in { from { opacity: 0; transform: translate(-50%,-44%) scale(.88); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

.game-foot { display: flex; justify-content: space-between; gap: 12px; min-height: 46px; padding: 13px 18px; border-top: 1px solid #ffffff0e; color: #6e8376; background: #07110b; font-size: 11px; }
.game-foot span { display: flex; align-items: center; gap: 6px; }
.game-foot svg { width: 14px; height: 14px; color: #78dd96; }
.game-foot b { color: #b5c8bb; }

.leaderboard { align-self: start; overflow: hidden; }
.board-head { display: flex; justify-content: space-between; align-items: center; padding: 21px 20px 8px; }
.board-head span { color: #71e89a; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.board-head h2 { margin: 3px 0 0; font-size: 23px; letter-spacing: -.03em; }
.board-head > svg { width: 26px; height: 26px; color: #dfff67; }
.leaderboard > p { margin: 0; padding: 0 20px 16px; color: #718579; font-size: 11px; line-height: 1.5; }
.leader-list { border-top: 1px solid #ffffff0d; border-bottom: 1px solid #ffffff0d; }
.leader-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 9px; align-items: center; min-height: 58px; padding: 7px 15px; border-bottom: 1px solid #ffffff09; }
.leader-row:last-child { border-bottom: 0; }
.leader-row.is-you { background: #6de6910f; box-shadow: inset 3px 0 #8af06b; }
.rank { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; color: #718579; background: #ffffff08; font-size: 11px; font-weight: 900; }
.rank svg { width: 16px; height: 16px; }
.rank-1 { color: #162008; background: linear-gradient(135deg, #ffdd58, #dfff65); }
.rank-2 { color: #142018; background: #c5d4cd; }
.rank-3 { color: #291a0e; background: #d9955d; }
.leader-row > div:nth-child(2) { display: grid; min-width: 0; }
.leader-row b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.leader-row small { color: #5f7366; font-size: 9px; }
.leader-row strong { color: #9aed78; font-size: 12px; }
.board-empty { display: grid; justify-items: center; padding: 34px; color: #607469; }
.board-empty svg { width: 28px; height: 28px; margin-bottom: 9px; }
.board-empty b { color: #9aad9f; font-size: 13px; }
.board-empty span { font-size: 10px; }
.board-rules { padding: 18px 20px 21px; }
.board-rules h3 { margin: 0 0 10px; color: #9caf9f; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.board-rules ol { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.board-rules li { display: flex; align-items: center; gap: 9px; }
.board-rules i { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #7ee79c25; border-radius: 9px; color: #79e69b; background: #6de9910b; font-size: 10px; font-style: normal; font-weight: 900; }
.board-rules li span { display: grid; }
.board-rules b { font-size: 11px; }
.board-rules small { color: #5d7164; font-size: 9px; }

.fly-footer { display: flex; align-items: center; justify-content: space-between; width: min(1180px, calc(100% - 36px)); min-height: 54px; margin: 5px auto 0; color: #4d6155; font-size: 10px; }
.fly-footer a { display: flex; align-items: center; gap: 6px; color: #895eb6; text-decoration: none; }
.fly-footer svg { width: 14px; height: 14px; }

.toast { position: fixed; z-index: 40; top: 18px; left: 50%; transform: translateX(-50%); max-width: min(420px, calc(100% - 24px)); padding: 11px 16px; border: 1px solid #ff6d6655; border-radius: 12px; color: #ffe7e5; background: #2a1210f0; box-shadow: 0 16px 40px #0008; font-size: 13px; font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }

@media (max-width: 1050px) {
  .fly-layout { grid-template-columns: 1fr; }
  .leaderboard { width: 100%; }
  .leader-list { display: grid; grid-template-columns: repeat(2, 1fr); }
  .leader-row:nth-child(odd) { border-right: 1px solid #ffffff09; }
  .board-rules ol { grid-template-columns: repeat(3, 1fr); }
  .canvas-wrap { height: min(58vh, 520px); }
}
@media (max-width: 680px) {
  .fly-header { width: calc(100% - 20px); min-height: 61px; }
  .game-brand h1 { font-size: 16px; }
  .game-brand p { font-size: 9px; }
  .wing-logo { width: 39px; height: 39px; border-radius: 50%; }
  .fly-header > a { padding: 8px; font-size: 0; }
  .fly-header > a b { font-size: 11px; }
  .fly-layout { width: calc(100% - 12px); margin-top: 7px; gap: 8px; }
  .arcade-shell, .leaderboard { border-radius: 17px; }
  .hud-row { grid-template-columns: 1fr 1fr; }
  .hud-row > div { padding: 8px 9px; }
  .hud-row span { font-size: 8px; }
  .hud-row b { font-size: 11px; }
  .track-line { padding: 11px 10px 12px; }
  .track-line > div { font-size: 7px; }
  .canvas-wrap { height: 55vh; min-height: 370px; max-height: 500px; }
  .game-overlay { justify-content: safe center; padding: 15px; }
  .game-overlay h2 { font-size: clamp(30px, 10vw, 36px); }
  .game-overlay > p { margin-bottom: 13px; font-size: 12px; line-height: 1.45; }
  .mascot-preview { width: 70px; height: 70px; margin-bottom: 7px; }
  .welcome-overlay form { grid-template-columns: 1fr; width: min(320px, 100%); }
  .welcome-overlay .nick-input, .welcome-overlay .btn { width: 100%; height: 44px; }
  .controls { flex-wrap: wrap; justify-content: center; }
  .game-foot { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; font-size: 9px; }
  .game-foot span:first-child { grid-column: 1 / -1; }
  .game-foot span:last-child { justify-content: end; }
  .checkpoint-pop b { font-size: 30px; }
  .leader-list { grid-template-columns: 1fr; }
  .leader-row:nth-child(odd) { border-right: 0; }
  .board-rules ol { grid-template-columns: 1fr; }
  .fly-footer { display: grid; justify-items: center; gap: 6px; width: calc(100% - 20px); padding: 16px 0; text-align: center; }
}
@media (max-height: 700px) and (min-width: 681px) {
  .canvas-wrap { height: 390px; min-height: 390px; }
}
