:root {
  color-scheme: dark;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  color: #eff7d8;
  background: #101b17;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff3bc; outline-offset: 4px; }
button:disabled { opacity: .42; cursor: default; }
[hidden] { display: none !important; }
.game { position: relative; min-height: 520px; height: 100svh; overflow: hidden; isolation: isolate; }
.play-surface { position: absolute; inset: 0; }
canvas { position: absolute; width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; }
.hud { position: absolute; inset: 22px clamp(18px, 4vw, 64px) auto; display: grid; grid-template-columns: 1fr minmax(90px, 360px) 1fr; align-items: center; gap: 18px; }
.stage, .icon, .foot > span:first-child, .foot > span:last-child { background: #11231fe8; border: 1px solid #b6d8ab4f; box-shadow: 0 3px #0a1717a0; }
.stage { display: flex; align-items: center; gap: 10px; padding: 9px 13px; width: max-content; max-width: clamp(96px, 30vw, 245px); font-weight: 750; white-space: nowrap; }
#stage-name { overflow: hidden; text-overflow: ellipsis; }
.grass-icon { width: 15px; height: 15px; flex: none; background: linear-gradient(#b4e264 35%, #925d41 35%); box-shadow: inset -3px -3px #523b32, 0 0 0 1px #121b16; }
.progress { display: flex; gap: 10px; align-items: center; font: 750 14px ui-monospace, monospace; color: #fff; text-shadow: 0 1px 4px #14201a; }
.track { height: 10px; flex: 1; background: #102520cf; border: 1px solid #edf9dc92; padding: 2px; }
#fill { height: 100%; width: 0%; background: #d4f476; }
#percent { width: 4ch; text-align: right; }
.tools { display: flex; gap: 8px; justify-self: end; }
.icon { width: 42px; height: 40px; color: #eff7d8; font-weight: 850; font-size: 19px; }
.icon:not(:disabled):hover { background: #284033; }
.overlay { position: absolute; inset: 76px 0 57px; display: flex; align-items: center; pointer-events: none; padding: 0 clamp(24px, 9vw, 155px); }
.overlay::before { content: ""; position: absolute; z-index: -1; inset: -76px 0 -57px; background: linear-gradient(90deg, #0a1a18ee, #10251dae 37%, #10251d15 77%); }
.menu, .result { pointer-events: auto; width: min(100%, 620px); }
h1, h2, p { margin: 0; }
h1 { font-family: "Arial Black", Impact, system-ui, sans-serif; font-weight: 1000; font-size: clamp(42px, 8vw, 118px); line-height: .87; letter-spacing: -.045em; text-shadow: 0 .065em #64756b, 0 .12em #11241e, .035em .15em #081713; }
h1 span, h1 strong { display: block; }
h1 strong { color: #d4f478; font-size: 1.1em; text-shadow: 0 .065em #759637, 0 .12em #22361c, .035em .15em #081713; }
.intro { margin: clamp(20px, 4vh, 37px) 0 18px; color: #e0ebd1; font-size: clamp(16px, 2.1vw, 19px); }
.levels { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.level { text-align: left; padding: 8px 11px; min-width: 88px; color: #e9f4dc; background: #132920ed; border: 1px solid #769887; box-shadow: 0 3px #0c1712; }
.level strong, .level small { display: block; }
.level strong { font-size: 14px; }
.level small { font-size: 12px; color: #c1d0ba; margin-top: 2px; }
.level:hover, .level[aria-pressed="true"] { border-color: #dcf89d; background: #314732; }
.level[aria-pressed="true"] { box-shadow: inset 0 -3px #bce26d, 0 3px #0c1712; }
.primary, .secondary { min-height: 48px; padding: 10px 20px; font-size: 16px; font-weight: 800; }
.primary { background: #d4f478; color: #172712; border: 1px solid #ebffab; box-shadow: 0 5px #59733a, 0 8px #0c1810; }
.primary:hover { background: #e4ff98; }
.primary span { display: inline-block; margin-right: 7px; font-size: 14px; }
.secondary { margin-left: 8px; border: 1px solid #adc9a5; background: #142a22; color: #ebf4dc; }
.secondary:hover { background: #2b4937; }
.menu-actions, .editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.menu-actions .secondary, .editor-actions .secondary { margin-left: 0; }
.menu-actions .secondary { box-shadow: 0 5px #0c1810; }
.result h2 { font-size: clamp(40px, 7vw, 84px); font-weight: 950; text-shadow: 0 5px #0c201b; }
.result[data-outcome="won"] h2 { color: #d6ff89; }
.result p { margin: 9px 0 20px; color: #e5efd7; font-size: 17px; }
.foot { position: absolute; inset: auto clamp(18px, 4vw, 64px) max(18px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: center; gap: 6px; pointer-events: none; font-size: 14px; }
.foot > span { padding: 6px 9px; white-space: nowrap; }
#coin-count:not([hidden]) { display: block; color: #ffe68a; }
.hint { text-shadow: 0 2px 4px #070e0b; }
kbd { font: 650 12px ui-monospace, monospace; border: 1px solid #9abc9a90; padding: 2px 5px; background: #13241ec9; }
.editor {
  position: absolute;
  inset: 0;
  overflow: auto;
  background: radial-gradient(ellipse at 80% 0, #263d2e, #111e1a 64%);
  padding: clamp(15px, 4vw, 48px);
}
.editor-shell { max-width: 1150px; margin-inline: auto; }
.editor-header, .editor-route-header, .editor-details { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; }
.editor-header, .editor-route-header { justify-content: space-between; }
.editor-header { margin-bottom: 22px; }
.editor-header h2 { font: 950 clamp(27px, 5.4vw, 62px)/1.02 system-ui, sans-serif; letter-spacing: -.045em; color: #d4f478; }
.editor-header p { margin-top: 8px; color: #bfcdb4; font-size: 14px; }
.editor-panel { padding: clamp(12px, 2vw, 20px); margin-bottom: 14px; border: 1px solid #7c9c7e70; background: #14241ee8; box-shadow: 0 4px #0b1612; }
.editor-details { margin-bottom: 15px; font-size: 14px; font-weight: 700; }
.editor-details input { width: min(100%, 230px); padding: 8px 10px; border: 1px solid #799580; color: #eff7d8; background: #0e1e19; font: inherit; }
.editor-height { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.editor-height input { width: 4.2rem; }
.editor-height .secondary { min-height: 36px; margin-left: 0; padding: 5px 10px; font-size: 14px; }
#editor-length { color: #b7cbad; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 7px; }
.editor-tool { display: flex; align-items: center; gap: 6px; min-height: 36px; border: 1px solid #668d77; color: #eaf5db; background: #22372c; padding: 5px 9px; font-size: 14px; font-weight: 650; }
.editor-tool:hover, .editor-tool[aria-pressed="true"] { border-color: #d7f587; background: #374a30; }
.editor-tool[aria-pressed="true"] { box-shadow: inset 0 -3px #bfe16e; }
.editor-tool span, .editor-cell span { color: #d3efa2; }
.editor-tool[data-tile="^"] span, .editor-cell[data-tile="^"] span { color: #ffd2ac; }
.editor-tool[data-tile="v"] span, .editor-cell[data-tile="v"] span { color: #ffd2ac; }
.editor-tool:is([data-tile="a"], [data-tile="b"]) span, .editor-cell:is([data-tile="a"], [data-tile="b"]) span { color: #a8f3f4; }
.editor-tool[data-tile="="] span { color: #96c759; }
.editor-tool[data-tile="+"] span, .editor-cell[data-tile="+"] span { color: #ffdd7d; }
.editor-tool[data-tile="c"] span, .editor-cell[data-tile="c"] span { color: #ffe68a; }
.editor-tool:is([data-tile="f"], [data-tile="u"], [data-tile="d"]) span { color: #b8a4ff; }
.editor-tool[data-tile="p"] span { color: #c498ff; }
.editor-tool[data-tile="q"] span { color: #ffe68a; }
#editor-portal-status:empty { display: none; }
#editor-portal-settings, #editor-flight-settings { margin-top: 10px; }
#editor-portal-settings[hidden], #editor-flight-settings[hidden] { display: none; }
#editor-selection-tools { margin-top: 10px; }
#editor-selection-tools[hidden] { display: none; }
#editor-scroll[data-selecting] .editor-grid { touch-action: none; user-select: none; }
.editor-cell[data-selection] { outline: 2px solid #f5dd7b; outline-offset: -2px; }
.editor-cell[data-paste-target] { outline: 2px dashed #72e4ca; outline-offset: -2px; }
.editor-cell[data-paste-origin] { outline-style: solid; }
.editor-help { margin-top: 11px; color: #c1d2b8; font-size: 14px; }
.editor-route-header { margin-bottom: 12px; }
.editor-route-header h3 { margin: 0; font-size: 18px; }
.editor-route-header .secondary { min-height: 34px; padding: 5px 10px; font-size: 14px; }
.editor-scroll { max-width: 100%; max-height: clamp(220px, 45svh, 392px); overflow: auto; overflow-anchor: none; background: #0c1d1c; border: 1px solid #587964; scrollbar-color: #78936a #172a22; }
.editor-grid { --ground-surface-y: 32px; position: relative; }
.editor-row { display: flex; position: absolute; inset-inline: 5px; }
.editor-edge { display: grid; place-items: center; flex: 0 0 58px; color: #deefb5; background: #314632; font-size: 13px; font-weight: 800; border-block-end: 1px solid #b2c4a136; }
.editor-edge:first-child { position: sticky; inset-inline-start: 0; z-index: 2; }
.editor-cell { --surface-y: 100%; --slab-height: 19px; --spike-height: 23px; display: flex; align-items: center; justify-content: center; width: 40px; height: 39px; padding: 0; position: relative; background: #1b302b; border: 0; border-inline-end: 1px solid #b2c4a136; border-block-end: 1px solid #b2c4a136; }
.editor-ground .editor-cell { --surface-y: var(--ground-surface-y); height: 48px; align-items: end; padding-bottom: 5px; background: linear-gradient(#223e32 var(--ground-surface-y), #7ea94e var(--ground-surface-y) 76%, #654936 76%); }
.editor-ground .editor-cell[data-flight] { --surface-y: 100%; }
.editor-cell:hover { filter: brightness(1.28); }
.editor-cell { flex: 0 0 40px; }
.editor-cell:focus-visible { outline-offset: -3px; z-index: 1; }
.editor-cell span { font: 850 25px/1 system-ui, sans-serif; }
.editor-goal { position: absolute; z-index: 2; inset: 0 auto -1px calc(50% - 2px); width: 4px; background: #c9ff74; box-shadow: 0 0 6px #b6f178; pointer-events: none; }
.editor-tool[data-tile="g"] span { color: #c9ff74; }
.editor-cell:is([data-tile="="], [data-tile="s"], [data-tile="j"]) span {
  position: absolute;
  top: calc(var(--surface-y) - var(--slab-height));
  left: 12%;
  width: 76%;
  height: var(--slab-height);
  font-size: 0;
  background: linear-gradient(#96c759 25%, #577d43 25%);
}
.editor-cell:is([data-tile="o"], [data-tile="k"], [data-tile="l"]) {
  --platform-top: calc(var(--surface-y) - var(--slab-height));
}
.editor-cell:is([data-tile="o"], [data-tile="k"], [data-tile="l"]) span {
  position: absolute;
  top: var(--platform-top);
  left: 9%;
  width: 82%;
  height: var(--slab-height);
  font-size: 0;
  background: linear-gradient(#b9d98c 25%, #576e49 25%);
}
.editor-cell:is([data-on-slab], [data-on-platform]) span, .editor-cell:is([data-tile="s"], [data-tile="j"], [data-tile="k"], [data-tile="l"])::after {
  content: "";
  position: absolute;
  left: 24%;
  width: 52%;
  height: var(--spike-height);
  font-size: 0;
  background: #ffd2ac;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  z-index: 1;
  pointer-events: none;
}
.editor-cell:is([data-on-slab], [data-on-platform]) span { bottom: calc(-1px - var(--slab-height)); }
.editor-cell[data-on-ground-slab] span { bottom: -14px; }
.editor-cell[data-on-ground-slab][data-flight] span { bottom: -29px; }
.editor-cell[data-on-ground-platform] span { bottom: calc(-1px - var(--ground-surface-y) + var(--slab-height)); }
.editor-cell:is([data-tile="s"], [data-tile="j"])::after { top: calc(var(--surface-y) - var(--slab-height) - var(--spike-height)); }
.editor-cell:is([data-tile="k"], [data-tile="l"])::after { top: calc(var(--platform-top) - var(--spike-height)); }
.editor-cell:is([data-on-slab], [data-on-platform])[data-tile="a"] span, .editor-cell:is([data-tile="j"], [data-tile="l"])::after { background: repeating-linear-gradient(#c6fffc 0 4px, #60adb8 4px 8px); }
.editor-cell[data-coin-overlay]::before {
  content: "";
  position: absolute;
  inset: 4px 4px auto auto;
  width: 10px;
  height: 10px;
  background: #ffe879;
  border: 2px solid #a96124;
  border-radius: 50%;
  z-index: 2;
}
.editor-ground .editor-cell[data-tile="_"] { background: #111f1d; }
.editor-cell[data-tile="_"] span { color: #98a99f; }
.editor-ground .editor-cell:is([data-tile="o"], [data-tile="k"], [data-tile="l"]) { --platform-top: calc(var(--ground-surface-y) - var(--slab-height)); background: #162926; }
.editor-cell[data-tile="2"] span { font-size: 31px; }
.editor-cell[data-flight] { background: #302945; }
.editor-underground .editor-cell[aria-disabled="true"] { background: #111b19; cursor: default; }
.editor-underground .editor-cell[aria-disabled="true"] span { opacity: .35; }
.editor-underground .editor-edge:first-child { color: #b7e3d6; background: #24413a; }
.editor-cell[data-flight-ceiling] { box-shadow: inset 0 2px #c4a6f4; }
.editor-cell[data-flight-floor] { box-shadow: inset 0 -2px #72d1b9; }
.editor-cell[data-flight-ceiling][data-flight-floor] { box-shadow: inset 0 2px #c4a6f4, inset 0 -2px #72d1b9; }
.editor-cell[data-flight-selected] { outline: 1px solid #d2b7fb; outline-offset: -2px; }
.editor-ground .editor-cell[data-flight] { align-items: center; padding: 0; background: #3e335e; }
.editor-ground .editor-cell[data-flight-kind="u"] { background: linear-gradient(#3e335e 50%, #675387 50%); }
.editor-ground .editor-cell[data-flight-kind="d"] { background: linear-gradient(#675387 50%, #3e335e 50%); }
.editor-cell:is([data-tile="f"], [data-tile="u"], [data-tile="d"]) span { color: #e0ceff; }
.editor-cell[data-flight-start] { border-inline-start: 4px solid #c498ff; }
.editor-cell[data-flight-end] { border-inline-end: 4px solid #ffe68a; }
.portal-key { display: inline-flex; flex-wrap: wrap; gap: 5px 15px; }
.portal-key span:first-child { color: #dfc1ff; }
.portal-key span:last-child { color: #ffe68a; }
@media (max-width: 600px) {
  .hud { gap: 9px; top: 14px; }
  .stage { padding: 7px; gap: 6px; font-size: 14px; }
  .icon { width: 35px; height: 35px; }
  .keyboard-hint { display: none; }
  .foot > span { padding: 5px; font-size: 12px; }
}
@media (max-height: 550px) and (min-width: 620px) {
  .game { min-height: 350px; }
  .hud { top: 12px; }
  .foot { bottom: 11px; }
  .overlay { inset-block: 58px 43px; }
  h1 { font-size: clamp(40px, 10vh, 66px); }
  .intro { margin: 17px 0 10px; }
  .levels { margin-bottom: 10px; }
  .primary, .secondary { min-height: 40px; padding-block: 6px; }
}

.guide { pointer-events: auto; width: min(100%, 390px); padding: clamp(16px, 3vw, 26px); border: 1px solid #8ca77b; background: #10241ff5; box-shadow: 0 6px #091b15, 0 12px 26px #07171199; }
.guide h2 { color: #e1f6a5; font-size: clamp(24px, 5vw, 36px); line-height: 1.1; }
.guide p { margin: 10px 0 18px; line-height: 1.55; color: #e4efd9; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.guide-actions button { margin-left: 0; }
#guide-control { touch-action: none; user-select: none; }
.overlay[data-practice] { align-items: start; justify-content: flex-end; padding-inline: clamp(12px, 4vw, 60px); }
.overlay[data-practice]::before { background: none; }
.guide-story { height: 96px; position: relative; overflow: hidden; margin-bottom: 16px; background: linear-gradient(#2b4454, #739680 76%, #43593e 76%); image-rendering: pixelated; }
.guide-story i { position: absolute; display: block; }
.guide-story i:nth-child(1) { width: 32px; height: 35px; left: 70%; bottom: 24%; background: #6c9c59; border: 4px solid #1d3425; box-shadow: inset 4px 4px #c4eb82; animation: signal-run 4s cubic-bezier(.3,.05,.5,1) both; }
.guide-story i:nth-child(2) { width: 23px; height: 22px; left: 74%; top: 18%; background: #aceaf2; box-shadow: 0 0 0 5px #477e87, 0 0 16px #b6eaff; animation: signal-light 4s linear both; }
.guide-story i:nth-child(3) { width: 36px; height: 29px; left: 72%; bottom: 24%; background: #355348; z-index: 0; }
.guide-story i:nth-child(-n+2) { z-index: 1; }
@keyframes signal-run {
  0% { transform: translateX(-165px); }
  38% { transform: translate(-98px, -24px) rotate(35deg); }
  63% { transform: translate(-36px, -8px) rotate(0); }
  100% { transform: translateX(0); }
}
@keyframes signal-light {
  0%, 15% { opacity: .3; }
  25% { opacity: 1; }
  45%, 100% { opacity: .55; }
}
@media (prefers-reduced-motion: reduce) {
  .guide-story i { animation: none; }
}
