@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  font-family: "Space Grotesk", sans-serif;
  background: #080b18;
  color: #f1f2fa;
  --muted: #8d92a9;
  --line: rgba(177, 190, 255, 0.15);
  --violet: #a77bff;
  --cyan: #66e6ef;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 8%, rgba(69, 67, 139, 0.2), transparent 55%),
    #080b18;
}

button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }

.app { width: min(1100px, calc(100% - 48px)); margin: 0 auto; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #f5f6ff; text-decoration: none; font-size: 14px; font-weight: 700; letter-spacing: .11em; }
.brand-mark { color: var(--cyan); font-size: 22px; }
.brand-light { color: #9298b0; font-weight: 500; }
.topbar-note, .footer, .eyebrow, .menu-stats > div > span, .controls-hint, .hud-score > span, .gravity-tag, .hud-button, .points-banner > span, .tree-note, .result-stats > div > span {
  font-family: "DM Mono", monospace;
  letter-spacing: .1em;
}
.topbar-note { display: flex; align-items: center; gap: 9px; color: #7e849e; font-size: 10px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.icon-button, .close-button { border: 1px solid var(--line); border-radius: 50%; background: rgba(17, 21, 41, .75); color: #dfe3ff; cursor: pointer; }
.icon-button { width: 36px; height: 36px; font-size: 17px; }
.icon-button.muted { color: #636982; }

.game-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  border: 1px solid rgba(154, 171, 255, .19);
  border-radius: 16px;
  background: #0c1021;
  box-shadow: 0 26px 100px rgba(0, 0, 0, .35), 0 0 60px rgba(90, 73, 187, .08);
  isolation: isolate;
}
#game { display: block; width: 100%; height: 100%; }
.screen { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; }
.screen[hidden], .hud[hidden] { display: none; }
.menu-screen { overflow: hidden; justify-items: start; padding: 7% 9%; background: linear-gradient(90deg, rgba(8, 11, 24, .94) 0%, rgba(8, 11, 24, .8) 42%, rgba(8, 11, 24, .08) 100%); }
.menu-content { position: relative; z-index: 1; max-width: 500px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #9da3bf; font-size: 10px; }
.eyebrow-line { width: 21px; height: 1px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
h1, h2, p { margin-top: 0; }
h1 { margin: 25px 0 14px; font-size: clamp(42px, 7.2vw, 82px); line-height: .9; letter-spacing: -.07em; font-weight: 700; }
h1 > span, .gameover-panel h2 > span { color: var(--cyan); }
.lead { max-width: 335px; color: #a8aec3; font-size: 14px; line-height: 1.6; }
.menu-actions { display: flex; gap: 10px; margin: 27px 0 32px; }
.button { min-height: 46px; padding: 0 19px; border: 1px solid transparent; border-radius: 7px; color: #f5f6ff; font-size: 11px; font-weight: 700; letter-spacing: .09em; cursor: pointer; transition: transform .15s, filter .15s, border-color .15s; }
.button:hover { transform: translateY(-2px); filter: brightness(1.12); }
.button span { margin-left: 12px; font-size: 15px; }
.button-primary { background: linear-gradient(105deg, #8267f4, #5d68e8); box-shadow: 0 7px 24px rgba(105, 92, 231, .22); }
.button-secondary { border-color: rgba(180, 189, 229, .25); background: rgba(16, 21, 42, .72); }
.menu-stats { display: flex; align-items: center; gap: 24px; }
.menu-stats > div:not(.stat-divider) { display: grid; gap: 4px; }
.menu-stats > div > span, .result-stats > div > span { color: #78809b; font-size: 9px; }
.menu-stats strong { font-size: 18px; font-weight: 600; }
.sparkle, .points-banner strong, .points-earned { color: #ffd783; }
.stat-divider { width: 1px; height: 29px; background: var(--line); }
.controls-hint { margin-top: 32px; color: #737b95; font-size: 9px; }
kbd { padding: 3px 5px; border: 1px solid rgba(168, 180, 231, .2); border-radius: 3px; color: #c3c9df; font: inherit; }
.controls-hint > span { padding: 0 6px; color: var(--cyan); }
.menu-orbit { position: absolute; right: -12%; top: 10%; width: 53%; aspect-ratio: 1; border: 1px solid rgba(111, 122, 238, .19); border-radius: 50%; transform: rotate(-25deg) scaleY(.56); }
.orbit-one::before, .orbit-two::before { position: absolute; content: ""; width: 9px; height: 9px; top: 10%; left: 17%; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 24px 8px rgba(102, 230, 239, .25); }
.orbit-two { right: -18%; top: 16%; width: 65%; opacity: .5; transform: rotate(30deg) scaleY(.56); }

.hud { position: absolute; inset: 20px 22px auto; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hud-score { display: grid; text-shadow: 0 2px 10px #080b18; }
.hud-score > span { color: #a9afc6; font-size: 9px; }
.hud-score strong { font-size: 36px; line-height: 1.05; }
.hud-right { display: flex; align-items: center; gap: 10px; }
.gravity-tag, .hud-button { padding: 8px 10px; border: 1px solid rgba(170, 182, 232, .22); border-radius: 5px; background: rgba(8, 11, 24, .55); color: #dbe0f7; font-size: 9px; }
.gravity-tag.up { border-color: rgba(102, 230, 239, .5); color: var(--cyan); }
.hud-button { pointer-events: auto; cursor: pointer; }

.skill-screen, .gameover-screen { padding: 18px; background: rgba(5, 7, 18, .77); backdrop-filter: blur(8px); }
.skill-screen { overflow: auto; align-items: center; }
.panel { width: min(680px, 100%); border: 1px solid rgba(172, 184, 239, .2); border-radius: 13px; background: linear-gradient(145deg, rgba(20, 25, 48, .98), rgba(12, 16, 34, .98)); box-shadow: 0 25px 70px rgba(0, 0, 0, .4); }
.skill-panel { width: min(920px, 100%); padding: 0 15px 11px; overflow: hidden; border-color: #7e612d; border-radius: 8px; background: linear-gradient(180deg, #28231a, #11141b 22%, #10131a); box-shadow: 0 25px 70px rgba(0, 0, 0, .55), 0 0 24px rgba(203, 164, 84, .1); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 25px; line-height: 1; letter-spacing: .04em; }
.skill-heading-copy .eyebrow { color: #554123; font-size: 0; }
.skill-heading-copy .eyebrow::after { content: "FLIGHT PROGRESSION"; color: #745d36; font-size: 8px; letter-spacing: .18em; }
.skill-emblem { display: grid; width: 58px; height: 58px; place-items: center; border: 3px double #a48849; border-radius: 50%; background: radial-gradient(circle, #dbca91 0 42%, #9a7835 43% 56%, #d7c37e 57% 66%, #504020 68%); color: #49391b; font-size: 28px; text-shadow: 0 1px #f5e5a9; }
.skill-panel > .panel-heading { min-height: 68px; margin: 0 -15px 12px; padding: 5px 12px; border-bottom: 2px solid #8d6b30; background: linear-gradient(180deg, #e1c47b, #9c7838 36%, #5e431e 52%, #bd9a50 95%, #edd790); color: #fff4d3; text-shadow: 0 2px 3px #38240f; }
.skill-panel > .panel-heading h2 { color: #fff6de; font-family: Georgia, serif; font-weight: 700; text-shadow: 0 2px 3px #38240f; }
.close-button { width: 27px; height: 27px; border-color: #775d31; background: #3c2d19; color: #f4dfaa; font-size: 20px; line-height: 1; }
.tree-map-wrap { position: relative; overflow: auto; border: 1px solid rgba(173, 142, 75, .45); background: #12151b; scrollbar-color: #897044 #17191c; scrollbar-width: thin; }
.shop-nav { display: flex; gap: 5px; margin: 0 0 8px; border-bottom: 1px solid rgba(219, 192, 128, .28); }
.shop-tab { padding: 7px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0; background: transparent; color: #988966; font: 9px "DM Mono", monospace; letter-spacing: .08em; cursor: pointer; }
.shop-tab[aria-selected="true"] { border-color: rgba(219, 192, 128, .4); background: rgba(213, 181, 113, .1); color: #f0d894; }
.points-banner { display: flex; align-items: center; gap: 10px; width: fit-content; margin: 4px 8px 5px auto; padding: 5px 9px; border: 1px solid rgba(222, 192, 124, .32); border-radius: 3px; background: rgba(25, 22, 17, .75); }
.points-banner > span { color: #c7b88e; font-size: 8px; }
.points-banner strong { color: #f1d98e; font-size: 12px; }
.tree-map { position: relative; width: 100%; min-width: 760px; aspect-ratio: 1000 / 420; overflow: hidden; background: radial-gradient(ellipse at 55% 54%, rgba(106, 92, 58, .2), transparent 58%), repeating-linear-gradient(0deg, transparent 0 38px, rgba(202, 190, 150, .025) 39px 40px), linear-gradient(180deg, rgba(14, 18, 24, .9), rgba(25, 29, 27, .82)), repeating-linear-gradient(90deg, #32372e 0 3px, #292d27 4px 8px); }
.tree-map::before, .tree-map::after { position: absolute; inset: 6% 18%; border: 1px solid rgba(194, 169, 103, .07); border-radius: 50%; content: ""; transform: scaleY(.66); pointer-events: none; }
.tree-map::after { inset: 14% 25%; }
.tree-connectors, .tree-labels { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tree-connectors { z-index: 1; }
.tree-labels { z-index: 2; }
.tree-edge { fill: none; stroke: rgba(185, 159, 99, .38); stroke-width: 3; stroke-linejoin: round; }
.tree-edge.available { stroke: #e6cc83; filter: drop-shadow(0 0 3px rgba(240, 206, 121, .6)); }
.tree-skill-label { position: absolute; min-width: 76px; padding: 2px 5px; transform: translate(-50%, -50%); border-bottom: 1px solid rgba(219, 193, 131, .4); color: #d3c49d; font: 7px "DM Mono", monospace; text-align: center; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.tree-node { position: absolute; z-index: 3; display: grid; width: 46px; height: 48px; place-items: center; padding: 0; transform: translate(-50%, -50%); border: 2px ridge #7d6843; border-radius: 5px; background: linear-gradient(135deg, #5a5140, #272a2b 48%, #4d4638); color: #c9c5b6; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(9, 11, 13, .7), 0 2px 5px #050608; }
.tree-node:disabled { cursor: default; }
.tree-node-icon { color: #999587; font-size: 20px; filter: grayscale(.85); text-shadow: 0 1px 2px #000; }
.tree-node-rank { position: absolute; right: -4px; bottom: -7px; display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid #78623b; border-radius: 50%; background: #211e19; color: #c9b987; font: 9px "DM Mono", monospace; }
.tree-node-cost { position: absolute; left: 50%; bottom: -15px; color: #e4ce8d; font: 8px "DM Mono", monospace; white-space: nowrap; transform: translateX(-50%); text-shadow: 0 1px 3px #000; }
.tree-node.locked { opacity: .68; }
.tree-node.available { border-color: #ab8a4c; box-shadow: inset 0 0 0 2px rgba(9, 11, 13, .6), 0 0 8px rgba(217, 182, 107, .2); }
.tree-node.available .tree-node-icon { color: #e5d6ae; filter: none; }
.tree-node.purchased { border-color: #e1bd69; background: linear-gradient(145deg, #e4cc85, #80643a 30%, #4e4936 65%, #b89650); box-shadow: inset 0 0 0 2px rgba(39, 28, 13, .7), 0 0 8px rgba(232, 199, 119, .28); }
.tree-node.purchased .tree-node-icon { color: #fff0b6; filter: none; }
.tree-node.purchased .tree-node-rank { border-color: #d2b767; background: #44371f; color: #fff0b6; }
.tree-node:not(:disabled):hover { z-index: 3; transform: translate(-50%, -50%) scale(1.08); filter: brightness(1.2); }
.tree-note { margin: 9px 2px 0; color: #aa9d7b; font-size: 8px; }
.cosmetics-grid { max-height: min(370px, 53vh); overflow-y: auto; padding: 4px 5px 8px; scrollbar-color: #897044 #17191c; scrollbar-width: thin; }
.cosmetic-section-title { margin: 12px 0 7px; color: #d9c38a; font: 9px "DM Mono", monospace; letter-spacing: .14em; }
.cosmetic-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.cosmetic-card { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 8px; min-height: 61px; padding: 7px; border: 1px solid rgba(195, 171, 112, .24); border-radius: 5px; background: rgba(20, 23, 27, .88); }
.cosmetic-card.selected { border-color: rgba(232, 200, 119, .75); background: rgba(133, 105, 49, .15); }
.cosmetic-preview { display: grid; width: 44px; height: 42px; place-items: center; border: 1px solid rgba(208, 186, 133, .15); border-radius: 4px; background: rgba(5, 7, 11, .7); }
.skin-preview { position: relative; display: block; width: 31px; height: 23px; border-radius: 50%; background: var(--skin-body); box-shadow: inset 0 4px 0 rgba(255,255,255,.22), 0 0 10px color-mix(in srgb, var(--skin-body), transparent 50%); transform: rotate(-8deg); }
.skin-preview::before { position: absolute; top: 4px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: white; content: ""; }
.skin-preview::after { position: absolute; top: 9px; right: -6px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 8px solid var(--skin-beak); content: ""; }
.skin-preview i { position: absolute; bottom: 1px; left: 4px; width: 17px; height: 9px; border-radius: 50%; background: var(--skin-wing); box-shadow: 5px -7px 0 -2px var(--skin-belly); }
.effect-preview { color: #e7d59d; font-size: 14px; text-shadow: 0 0 10px #d5b45e; }
.effect-preview.embers { color: #ff925a; text-shadow: 0 0 10px #ff5c38; }
.effect-preview.confetti { color: #b1a0ff; text-shadow: 0 0 9px #72e0cb; }
.effect-preview.nova { color: #73e8ef; text-shadow: 0 0 10px #a982ff; }
.cosmetic-info h4 { margin: 0 0 3px; color: #e8dfc7; font-size: 10px; }
.cosmetic-info p { margin: 0; color: #a79c80; font-size: 8px; line-height: 1.3; }
.cosmetic-button { min-width: 66px; padding: 6px 7px; border: 1px solid rgba(209, 178, 107, .4); border-radius: 3px; background: rgba(123, 93, 42, .2); color: #ead69a; font: 8px "DM Mono", monospace; cursor: pointer; }
.cosmetic-button:disabled { border-color: rgba(172, 162, 135, .17); color: #756f60; cursor: default; }
.cosmetic-button:not(:disabled):hover { border-color: #f0d48b; background: rgba(173, 132, 57, .32); }
.gameover-panel { width: min(390px, 100%); padding: 30px; }
.gameover-panel h2 { margin-top: 20px; font-size: 47px; line-height: .94; }
.gameover-panel h2 > span { color: #a77bff; }
.result-stats { display: flex; gap: 45px; margin: 24px 0 18px; }
.result-stats > div { display: grid; gap: 3px; }
.result-stats strong { font-size: 25px; }
.points-earned { padding: 10px 0 18px; color: #ffd783; font-size: 11px; }
.points-earned b { font-size: 14px; }
.full-button { width: 100%; }
.text-button { display: block; margin: 15px auto 0; border: 0; background: transparent; color: #aeb4ca; font-size: 10px; letter-spacing: .08em; cursor: pointer; }
.text-button span { margin-left: 5px; color: var(--cyan); }
.toast { position: absolute; z-index: 4; top: 20%; left: 50%; padding: 9px 13px; border: 1px solid rgba(102, 230, 239, .25); border-radius: 5px; background: rgba(10, 15, 32, .9); color: var(--cyan); font: 10px "DM Mono", monospace; letter-spacing: .08em; opacity: 0; transform: translate(-50%, -6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.footer { height: 48px; display: flex; align-items: center; justify-content: space-between; color: #60677f; font-size: 9px; }

@media (max-width: 680px) {
  .app { width: min(100% - 24px, 560px); }
  .topbar { height: 58px; }
  .topbar-note { display: none; }
  .game-shell { min-height: 510px; aspect-ratio: auto; }
  #game { position: absolute; inset: 0; }
  .menu-screen { padding: 26px 24px; background: linear-gradient(90deg, rgba(8, 11, 24, .94), rgba(8, 11, 24, .6)); }
  .menu-content { max-width: 100%; }
  h1 { font-size: clamp(52px, 16vw, 76px); }
  .menu-orbit { right: -58%; top: 14%; width: 95%; opacity: .7; }
  .orbit-two { right: -68%; }
  .menu-actions { flex-wrap: wrap; margin: 22px 0 25px; }
  .button { min-height: 43px; padding: 0 14px; }
  .controls-hint { font-size: 8px; }
  .skill-screen, .gameover-screen { padding: 10px; }
  .skill-panel { padding: 0 8px 9px; }
  .skill-panel > .panel-heading { min-height: 59px; margin: 0 -8px 8px; }
  .skill-emblem { width: 45px; height: 45px; font-size: 22px; }
  .panel-heading h2 { font-size: 20px; }
  .points-banner { padding: 4px 6px; }
  .points-banner > span { font-size: 7px; }
  .shop-tab { padding: 7px 8px; font-size: 8px; }
  .tree-map { min-width: 760px; }
  .tree-node { width: 40px; height: 43px; }
  .tree-node-icon { font-size: 17px; }
  .cosmetic-list { grid-template-columns: 1fr; }
  .cosmetic-card { grid-template-columns: 42px 1fr auto; gap: 6px; }
  .tree-note { font-size: 8px; }
  .gameover-panel { padding: 24px; }
  .footer { font-size: 8px; }
}

@media (max-width: 380px) {
  .game-shell { min-height: 480px; }
}
