:root {
    --cream: #fff7dc;
    --deep-green: #203a2b;
    --gold: #f2cf72;
    --brown: #5b3518;
    --panel: rgba(26, 47, 36, 0.86);
    --tower-width: clamp(520px, 64vw, 1086px);
    --term-height: 200vh;
    --term-overlap: 30vh;
    --world-height: 710vh;
    --travel-time: 2200ms;
}

@supports (height: 100svh) {
    :root {
        --term-height: 200svh;
        --term-overlap: 30svh;
        --world-height: 710svh;
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: #8ec9ed;
    color: var(--cream);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.prototype {
    height: 100vh;
    height: 100svh;
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.prototype::after {
    background: linear-gradient(180deg, rgba(10, 27, 31, 0.14), transparent 32%, transparent 72%, rgba(10, 24, 18, 0.2));
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 2;
}

.world {
    height: var(--world-height);
    inset: 0 0 auto;
    overflow: hidden;
    position: absolute;
    transform: translate3d(0, -610vh, 0);
    transition: transform var(--travel-time) cubic-bezier(0.65, 0, 0.23, 1);
    will-change: transform;
    z-index: 0;
}

@supports (height: 100svh) {
    .world {
        transform: translate3d(0, -610svh, 0);
    }
}

.background-section {
    height: var(--term-height);
    left: 0;
    overflow: hidden;
    position: absolute;
    width: 100%;
}

.term-one-background {
    top: calc(var(--world-height) - var(--term-height));
    z-index: 0;
}

.term-two-background {
    top: calc(var(--world-height) - var(--term-height) - var(--term-height) + var(--term-overlap));
    z-index: 1;
}

.term-three-background {
    top: calc(var(--term-height) - var(--term-overlap));
    z-index: 2;
}

.term-four-background {
    top: 0;
    z-index: 3;
}

.term-two-background,
.term-three-background,
.term-four-background {
    /* Each upper section crossfades its bottom 15% over the matching scene below. */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 85%, transparent 100%);
}

.term-background {
    height: 100%;
    inset: 0;
    object-fit: fill;
    position: absolute;
    width: 100%;
}

.tower {
    align-items: center;
    display: flex;
    flex-direction: column;
    filter: drop-shadow(0 14px 18px rgba(27, 23, 13, 0.2));
    bottom: 0;
    justify-content: flex-end;
    pointer-events: none;
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: var(--tower-width);
    z-index: 4;
}

.tower-middle {
    background-image: url("assets/tower/sandstone-middle.webp");
    background-position: center bottom;
    background-repeat: repeat-y;
    background-size: 100% auto;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.tower-base {
    display: block;
    flex: 0 0 auto;
    height: auto;
    margin-top: -2px;
    width: 100%;
}

.transition-mist {
    background:
        radial-gradient(ellipse at 18% 52%, rgba(255, 255, 255, 0.72), transparent 38%),
        radial-gradient(ellipse at 82% 47%, rgba(255, 255, 255, 0.64), transparent 40%),
        linear-gradient(180deg, transparent 18%, rgba(255, 255, 255, 0.62) 50%, transparent 82%);
    filter: blur(18px);
    inset: -10%;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    z-index: 3;
}

.transition-mist.active-up {
    animation: mist-rise var(--travel-time) ease-in-out;
}

.transition-mist.active-down {
    animation: mist-rise var(--travel-time) ease-in-out reverse;
}

@keyframes mist-rise {
    0% { opacity: 0; transform: translateY(28%); }
    36% { opacity: 0.44; }
    62% { opacity: 0.38; }
    100% { opacity: 0; transform: translateY(-28%); }
}

.top-bar {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr auto 1fr;
    left: max(18px, env(safe-area-inset-left));
    position: absolute;
    right: max(18px, env(safe-area-inset-right));
    top: max(16px, env(safe-area-inset-top));
    z-index: 5;
}

.back-link,
.prototype-label {
    backdrop-filter: blur(12px);
    background: rgba(27, 48, 36, 0.72);
    border: 1px solid rgba(255, 247, 220, 0.52);
    border-radius: 999px;
    color: var(--cream);
    font-size: 0.88rem;
    font-weight: 700;
    padding: 10px 15px;
    text-decoration: none;
    width: fit-content;
}

.back-link:hover,
.back-link:focus-visible {
    background: rgba(54, 83, 62, 0.92);
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

.prototype-label {
    justify-self: end;
}

.prototype-actions {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    justify-self: end;
}

.title-group {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: center;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.72);
}

.title-group h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.35rem, 3.2vw, 2.2rem);
    margin: 0;
}

.alpha-pill {
    background: var(--gold);
    border: 2px solid var(--brown);
    border-radius: 999px;
    color: #33220f;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.13em;
    padding: 5px 9px;
    text-shadow: none;
    text-transform: uppercase;
}

.level-card {
    backdrop-filter: blur(12px);
    background: var(--panel);
    border: 2px solid rgba(242, 207, 114, 0.82);
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(8, 24, 16, 0.32);
    left: 50%;
    max-width: min(560px, calc(100% - 34px));
    padding: 13px 24px 12px;
    position: absolute;
    text-align: center;
    top: clamp(88px, 14vh, 142px);
    transform: translateX(-50%);
    width: max-content;
    z-index: 5;
}

.level-range {
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.level-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.35rem, 4vw, 2.2rem);
    margin: 4px 0 9px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

.level-dots {
    display: flex;
    gap: 7px;
    justify-content: center;
}

.level-dot {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    height: 8px;
    transition: background 250ms ease, width 250ms ease;
    width: 8px;
}

.level-dot.active {
    background: var(--gold);
    width: 28px;
}

.climb-controls {
    bottom: max(36px, calc(env(safe-area-inset-bottom) + 28px));
    display: flex;
    gap: 12px;
    justify-content: center;
    left: 50%;
    max-width: calc(100% - 28px);
    position: absolute;
    transform: translateX(-50%);
    width: max-content;
    z-index: 5;
}

.control-button {
    align-items: center;
    border-radius: 14px;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: clamp(0.86rem, 2vw, 1rem);
    font-weight: 800;
    gap: 9px;
    justify-content: center;
    min-height: 52px;
    padding: 12px 19px;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.control-button.primary {
    background: var(--gold);
    border: 3px solid var(--brown);
    box-shadow: 0 5px 0 var(--brown), 0 9px 20px rgba(0, 0, 0, 0.28);
    color: #33220f;
}

.control-button.secondary {
    backdrop-filter: blur(10px);
    background: rgba(27, 48, 36, 0.8);
    border: 2px solid var(--cream);
    color: var(--cream);
}

.control-button.play {
    background: linear-gradient(135deg, #315f46, #203f30);
    border: 2px solid var(--gold);
    box-shadow: 0 5px 0 #142d21, 0 9px 20px rgba(0, 0, 0, 0.28);
    color: var(--cream);
}

.control-button:hover:not(:disabled),
.control-button:focus-visible:not(:disabled) {
    outline: 3px solid white;
    outline-offset: 3px;
    transform: translateY(-2px);
}

.control-button.primary:active:not(:disabled) {
    box-shadow: 0 2px 0 var(--brown), 0 5px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(3px);
}

.control-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.keyboard-hint {
    bottom: max(8px, env(safe-area-inset-bottom));
    font-size: 0.76rem;
    left: 50%;
    margin: 0;
    opacity: 0.84;
    position: absolute;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 5;
}

.alpha-play-shell {
    align-items: center;
    background: rgba(13, 30, 24, 0.96);
    display: flex;
    inset: 0;
    justify-content: center;
    overflow: hidden;
    position: absolute;
    z-index: 20;
}

.alpha-play-shell[hidden] {
    display: none;
}

.alpha-play-heading {
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(25, 47, 36, 0.9);
    border: 2px solid rgba(240, 203, 104, 0.88);
    border-radius: 12px;
    display: flex;
    gap: 10px;
    left: 50%;
    padding: 8px 13px;
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 8;
}

.alpha-play-heading strong {
    color: #ffe89b;
}

.alpha-play-heading span {
    font-size: 0.72rem;
    opacity: 0.82;
}

.alpha-close-play {
    background: rgba(27, 48, 36, 0.92);
    border: 2px solid var(--cream);
    border-radius: 999px;
    color: var(--cream);
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 9px 13px;
    position: absolute;
    right: max(14px, env(safe-area-inset-right));
    top: max(12px, env(safe-area-inset-top));
    z-index: 9;
}

.alpha-stage-frame {
    border: 2px solid rgba(255, 247, 220, 0.74);
    border-radius: 12px;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
    overflow: hidden;
    position: relative;
}

.alpha-stage {
    background: #78bde5;
    height: 768px;
    left: 0;
    overflow: hidden;
    position: absolute;
    top: 0;
    touch-action: none;
    transform-origin: top left;
    user-select: none;
    width: 1024px;
}

.alpha-stage-background {
    height: 1536px;
    left: 0;
    object-fit: fill;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 1024px;
    z-index: 0;
}

.alpha-scene-shade {
    background: linear-gradient(180deg, rgba(18, 37, 34, 0.04), transparent 52%, rgba(26, 42, 29, 0.08));
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

.alpha-tower-layer {
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    left: 192px;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 640px;
    z-index: 2;
}

.alpha-tower-middle {
    background-image: url("assets/tower/sandstone-middle.webp");
    background-position: center bottom;
    background-repeat: repeat-y;
    background-size: 100% auto;
    flex: 1 1 auto;
    width: 100%;
}

.alpha-tower-base {
    display: block;
    flex: 0 0 auto;
    margin-top: -2px;
    width: 100%;
}

.alpha-tower-base[hidden] {
    display: none;
}

.alpha-object-layer {
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 5;
}

.alpha-object {
    position: absolute;
    transform-origin: center;
}

.alpha-object-shape {
    height: 100%;
    position: relative;
    width: 100%;
}

.alpha-object.platform .alpha-object-shape,
.alpha-object.path .alpha-object-shape {
    background:
        repeating-linear-gradient(90deg, transparent 0 54px, rgba(94, 59, 27, 0.25) 55px 59px),
        linear-gradient(#e3c187 0 46%, #bc8e54 47% 78%, #8c6239 79% 100%);
    border: 4px solid #6f4b2a;
    border-radius: 8px 8px 5px 5px;
    box-shadow: inset 0 4px 0 rgba(255, 246, 206, 0.5), 0 7px 10px rgba(43, 31, 18, 0.28);
}

.alpha-object.has-asset .alpha-object-shape {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border: 0;
    box-shadow: none;
    filter: drop-shadow(0 6px 7px rgba(43, 31, 18, 0.26));
}

.alpha-object .alpha-object-shape.alpha-modular-ladder-shape {
    background: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alpha-ladder-part {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: block;
    flex: 0 0 auto;
    width: 100%;
}

.alpha-object-shape.alpha-flipped-horizontal {
    transform: scaleX(-1);
}

.alpha-object .alpha-object-shape.alpha-smart-ledge-shape {
    background: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alpha-smart-ledge-course {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    min-height: 0;
    width: 100%;
}

.alpha-smart-ledge-course-top { height: 20px; }
.alpha-smart-ledge-course-middle { height: 26px; }
.alpha-smart-ledge-course-bottom { height: 12px; }

.alpha-smart-ledge-part {
    background-image: var(--alpha-smart-ledge-image);
    background-repeat: no-repeat;
    background-size: auto 58px;
    display: block;
    height: 100%;
    min-width: 0;
}

.alpha-smart-ledge-left { background-position-x: left; }
.alpha-smart-ledge-middle {
    background-position-x: -44px;
    background-repeat: repeat-x;
}
.alpha-smart-ledge-right { background-position-x: right; }
.alpha-smart-ledge-course-top .alpha-smart-ledge-part { background-position-y: top; }
.alpha-smart-ledge-course-middle .alpha-smart-ledge-part { background-position-y: -20px; }
.alpha-smart-ledge-course-bottom .alpha-smart-ledge-part { background-position-y: bottom; }

.alpha-object .alpha-object-shape.alpha-smart-stair-shape {
    background: none;
    clip-path: none;
    overflow: hidden;
    position: relative;
}

.alpha-object .alpha-object-shape.alpha-uniform-stair-shape {
    background: none;
}

.alpha-smart-stair-shape.climb-left {
    transform: scaleX(-1);
}

.alpha-uniform-stair-block {
    background-image: var(--alpha-smart-stair-block);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: block;
    height: 20px;
    position: absolute;
}

.alpha-smart-stair-module {
    display: block;
    height: 100px;
    overflow: hidden;
    position: absolute;
    z-index: 1;
}

.alpha-smart-stair-module-image {
    background-image: var(--alpha-smart-stair-image);
    background-position: left top;
    background-repeat: no-repeat;
    background-size: 350px 100px;
    display: block;
    height: 100px;
    width: 350px;
}

.alpha-smart-stair-fill {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    z-index: 0;
}

.alpha-smart-stair-fill-row {
    background-color: #c88740;
    display: flex;
    flex: 0 0 20px;
    height: 20px;
    width: 100%;
}

.alpha-smart-stair-fill-tile {
    background-color: #c88740;
    background-image: var(--alpha-smart-stair-image);
    background-repeat: no-repeat;
    background-size: 350px 100px;
    display: block;
    flex: 0 0 70px;
    height: 20px;
}

.alpha-object.ramp-up .alpha-object-shape {
    clip-path: polygon(0 82%, 100% 0, 100% 100%, 0 100%);
}

.alpha-object.ramp-down .alpha-object-shape {
    clip-path: polygon(0 0, 100% 82%, 100% 100%, 0 100%);
}

.alpha-object.door .alpha-object-shape {
    background:
        radial-gradient(circle at 78% 58%, #f1d06e 0 5px, #6c401f 6px 9px, transparent 10px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 7px, transparent 8px 18px),
        linear-gradient(90deg, #56301b, #a95f2d 50%, #62351c);
    border: 7px solid #d6b26e;
    border-bottom-width: 10px;
    border-radius: 46% 46% 5px 5px;
    box-shadow: 0 0 0 4px #6d4c2b, inset 0 4px 12px rgba(255,255,255,0.16), 0 8px 12px rgba(38,26,16,0.34);
    overflow: hidden;
    position: relative;
}

.alpha-object.door.has-asset .alpha-object-shape {
    background-color: transparent;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    filter: drop-shadow(0 6px 7px rgba(43, 31, 18, 0.3));
    overflow: visible;
}

.alpha-object.door-s.has-asset .alpha-object-shape::before {
    content: none;
}

.alpha-object.door-s .alpha-object-shape::before {
    background: radial-gradient(circle, rgba(255, 240, 167, 0.2), transparent 66%);
    content: "";
    inset: 8px 5px 18px;
    position: absolute;
}

.alpha-door-rune {
    align-items: center;
    background: radial-gradient(circle, #6eaf68, #315c36 72%);
    border: 4px solid #f0cb68;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #65441f, 0 4px 8px rgba(27, 20, 12, 0.5);
    color: #fff7c8;
    display: flex;
    font-family: Georgia, serif;
    font-size: 39px;
    font-weight: 900;
    height: 58px;
    justify-content: center;
    left: 50%;
    line-height: 1;
    position: absolute;
    text-shadow: 0 3px 2px #284526;
    top: 28px;
    transform: translateX(-50%);
    width: 58px;
}

.alpha-door-status {
    align-items: center;
    background: #45341f;
    border: 2px solid #f0cb68;
    border-radius: 999px;
    bottom: 7px;
    color: #fff3b3;
    display: flex;
    font-size: 15px;
    font-weight: 900;
    height: 25px;
    justify-content: center;
    left: 50%;
    line-height: 1;
    min-width: 25px;
    padding: 0 5px;
    position: absolute;
    transform: translateX(-50%);
    z-index: 3;
}

.alpha-object.door.locked .alpha-object-shape {
    filter: saturate(0.62) brightness(0.74);
}

.alpha-object.door.locked .alpha-door-rune {
    background: radial-gradient(circle, #756b58, #3e3b34 72%);
    border-color: #bda76b;
    color: #ddd1a7;
    text-shadow: 0 3px 2px #292720;
}

.alpha-object.door.completed .alpha-object-shape {
    box-shadow: 0 0 0 4px #6d4c2b, inset 0 4px 12px rgba(255,255,255,0.16), 0 0 22px rgba(120, 222, 115, 0.88);
}

.alpha-object.door.completed .alpha-door-status {
    background: #2f6a3d;
    border-color: #f6d876;
    color: white;
}

.alpha-object.door.actionable.in-range .alpha-object-shape {
    animation: alpha-door-pulse 900ms ease-in-out infinite alternate;
}

@keyframes alpha-door-pulse {
    from { filter: drop-shadow(0 0 4px rgba(255, 232, 142, 0.4)); }
    to { filter: drop-shadow(0 0 13px rgba(255, 232, 142, 0.95)); }
}

.alpha-progress-hud {
    align-items: center;
    background: rgba(25, 47, 36, 0.94);
    border: 2px solid rgba(240, 203, 104, 0.88);
    border-radius: 999px;
    color: #fff8d8;
    display: flex;
    font-size: 15px;
    font-weight: 800;
    gap: 13px;
    padding: 8px 13px;
    position: absolute;
    right: 14px;
    top: 14px;
    z-index: 70;
}

.alpha-progress-hud > span + span {
    border-left: 1px solid rgba(255, 244, 200, 0.4);
    padding-left: 13px;
}

.alpha-key-symbol {
    color: #f3ca59;
    display: inline-block;
    filter: drop-shadow(0 1px 1px #5c3b12);
    transform: rotate(45deg);
}

.alpha-starter-key {
    animation: alpha-key-float 1.15s ease-in-out infinite alternate;
    filter: drop-shadow(0 5px 5px rgba(66, 43, 11, 0.5));
    height: 42px;
    pointer-events: none;
    position: absolute;
    transform-origin: center;
    width: 70px;
    z-index: 48;
}

.alpha-starter-key[hidden] {
    display: none;
}

.alpha-key-ring {
    background: radial-gradient(circle, transparent 0 8px, #ffe58a 9px 13px, #b8791e 14px 17px, transparent 18px);
    height: 38px;
    left: 0;
    position: absolute;
    top: 1px;
    width: 38px;
}

.alpha-key-shaft {
    background: linear-gradient(#ffe58a, #c48626);
    border: 2px solid #8d5917;
    border-radius: 4px;
    height: 12px;
    left: 29px;
    position: absolute;
    top: 14px;
    width: 37px;
}

.alpha-key-shaft::after {
    background: #d69a32;
    border: 2px solid #8d5917;
    border-top: 0;
    content: "";
    height: 12px;
    position: absolute;
    right: 4px;
    top: 8px;
    width: 8px;
}

@keyframes alpha-key-float {
    from { transform: translateY(0) rotate(-7deg); }
    to { transform: translateY(-9px) rotate(4deg); }
}

.alpha-progress-message {
    background: rgba(30, 66, 46, 0.96);
    border: 2px solid #f0cb68;
    border-radius: 999px;
    color: #fff6cc;
    font-size: 18px;
    font-weight: 900;
    left: 50%;
    max-width: 72%;
    opacity: 0;
    padding: 10px 18px;
    pointer-events: none;
    position: absolute;
    text-align: center;
    top: 74px;
    transform: translate(-50%, -8px);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 72;
}

.alpha-progress-message.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.alpha-player {
    height: 52px;
    left: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform-origin: center bottom;
    width: 34px;
    z-index: 50;
}

.alpha-player-sprite {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: url("spire-workshop-7f3a91c2e6d8/assets/characters/spelling-spire-boy-walk-cycle-v2.png") -45px 0 / 225px 84px no-repeat;
    bottom: 0;
    display: block;
    filter: drop-shadow(0 3px 2px rgba(28, 29, 24, 0.28));
    height: 84px;
    left: 50%;
    position: absolute;
    transform: translate3d(-50%, 0, 0) scale3d(0.9, 0.9, 1);
    transform-origin: center bottom;
    will-change: transform, background-position;
    width: 45px;
}

.alpha-player.facing-left .alpha-player-sprite {
    transform: translate3d(-50%, 0, 0) scale3d(-0.9, 0.9, 1);
}

.alpha-player.running .alpha-player-sprite {
    animation: alpha-player-walk 600ms steps(5) infinite;
}

.alpha-player.jumping .alpha-player-sprite,
.alpha-player.landing .alpha-player-sprite {
    animation: none;
    background-image: url("spire-workshop-7f3a91c2e6d8/assets/characters/spelling-spire-boy-jump-cycle.png");
    background-position: var(--alpha-player-jump-offset, 0px) 0;
    background-size: 315px 84px;
}

.alpha-player.ladder-climbing .alpha-player-sprite {
    animation: none;
    background-image: url("spire-workshop-7f3a91c2e6d8/assets/characters/spelling-spire-boy-ladder-climb-cycle-v1.png");
    background-position: 0 0;
    background-size: 270px 84px;
}

.alpha-player.ladder-climbing.ladder-moving .alpha-player-sprite {
    animation: alpha-player-ladder-climb 720ms steps(6) infinite;
}

.alpha-player.ladder-climbing.ladder-descending .alpha-player-sprite {
    animation-direction: reverse;
}

.alpha-player.ceiling-hanging .alpha-player-sprite {
    animation: none;
    background-image: url("spire-workshop-7f3a91c2e6d8/assets/characters/spelling-spire-boy-monkey-bar-cycle-v1.png");
    background-position: 0 0;
    background-size: 336px 84px;
    bottom: auto;
    top: 0;
    transform-origin: center top;
    width: 56px;
}

.alpha-player.ceiling-hanging.ceiling-moving .alpha-player-sprite {
    animation: alpha-player-monkey-bar 660ms steps(6) infinite;
}

@keyframes alpha-player-walk {
    from { background-position-x: 0; }
    to { background-position-x: -225px; }
}

@keyframes alpha-player-ladder-climb {
    from { background-position-x: 0; }
    to { background-position-x: -270px; }
}

@keyframes alpha-player-monkey-bar {
    from { background-position-x: 0; }
    to { background-position-x: -336px; }
}

.alpha-play-instructions {
    background: rgba(25, 47, 36, 0.92);
    border: 1px solid rgba(240, 203, 104, 0.75);
    border-radius: 999px;
    bottom: max(12px, env(safe-area-inset-bottom));
    font-size: 0.72rem;
    left: 50%;
    margin: 0;
    padding: 7px 12px;
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 8;
}

.alpha-touch-controls {
    align-items: flex-end;
    bottom: max(18px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    left: max(18px, env(safe-area-inset-left));
    pointer-events: none;
    position: absolute;
    right: max(18px, env(safe-area-inset-right));
    z-index: 9;
}

.alpha-touch-controls div {
    display: flex;
    gap: 10px;
}

.alpha-touch-controls button,
.alpha-enter-door {
    align-items: center;
    background: rgba(29, 63, 46, 0.94);
    border: 3px solid #f0cb68;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 24px;
    font-weight: 900;
    height: 58px;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
    width: 58px;
}

.alpha-enter-door {
    background: linear-gradient(#ffe69a, #e8bd55);
    border-color: #5e3d1d;
    border-radius: 999px;
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px));
    color: #35230f;
    font-size: 15px;
    height: auto;
    left: 50%;
    padding: 11px 18px;
    position: absolute;
    transform: translateX(-50%);
    width: auto;
    z-index: 9;
}

.alpha-enter-door[hidden] {
    display: none;
}

.alpha-enter-door.locked {
    background: rgba(51, 55, 49, 0.94);
    border-color: #9d947f;
    color: #e4dfd1;
}

.alpha-admin-button {
    background: rgba(24, 45, 34, 0.68);
    border: 1px solid rgba(255, 247, 220, 0.46);
    border-radius: 999px;
    bottom: max(7px, env(safe-area-inset-bottom));
    color: rgba(255, 247, 220, 0.82);
    cursor: pointer;
    font: inherit;
    font-size: 0.66rem;
    font-weight: 800;
    opacity: 0.62;
    padding: 5px 9px;
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    transition: opacity 160ms ease, background 160ms ease;
    z-index: 6;
}

.alpha-admin-button:hover,
.alpha-admin-button:focus-visible,
.alpha-admin-button[aria-expanded="true"] {
    background: rgba(24, 45, 34, 0.94);
    opacity: 1;
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.prototype.alpha-build-mode .level-card,
.prototype.alpha-build-mode .climb-controls,
.prototype.alpha-build-mode .keyboard-hint,
.prototype.alpha-build-mode .alpha-admin-button,
.prototype.alpha-build-mode .prototype-label {
    display: none;
}

.prototype.alpha-build-mode {
    --alpha-builder-rail-width: clamp(245px, 18vw, 310px);
}

.prototype.alpha-build-mode .top-bar {
    display: block;
    inset: 0;
    pointer-events: none;
    z-index: 45;
}

.prototype.alpha-build-mode .top-bar > .back-link,
.prototype.alpha-build-mode .title-group {
    display: none;
}

.prototype.alpha-build-mode .prototype-actions {
    left: max(12px, env(safe-area-inset-left));
    pointer-events: auto;
    position: absolute;
    right: auto;
    top: max(10px, env(safe-area-inset-top));
}

.prototype.alpha-build-mode .world {
    transition: none;
    visibility: hidden;
}

.prototype.alpha-build-mode .tower {
    width: min(
        var(--tower-width),
        calc(100vw - var(--alpha-builder-rail-width) - var(--alpha-builder-rail-width) - 52px)
    );
}

.prototype.alpha-build-mode .prototype-actions {
    left: auto;
    right: max(16px, env(safe-area-inset-right));
    top: max(14px, env(safe-area-inset-top));
}

.prototype.alpha-build-mode .alpha-native-builder {
    inset: 0;
}

.alpha-editor-close {
    backdrop-filter: blur(12px);
    background: #f0cb68;
    border: 2px solid #5b3518;
    border-radius: 999px;
    color: #35230f;
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 900;
    padding: 9px 14px;
}

.alpha-editor-close:hover,
.alpha-editor-close:focus-visible {
    background: #f7d982;
    outline: 3px solid white;
    outline-offset: 2px;
}

.alpha-editor-close[hidden],
.alpha-native-builder[hidden] {
    display: none;
}

.alpha-native-builder {
    inset: max(82px, calc(env(safe-area-inset-top) + 70px)) 0 0;
    position: absolute;
    z-index: 40;
}

@media (max-width: 700px) {
    :root {
        --tower-width: clamp(340px, 94vw, 650px);
    }

    .top-bar {
        grid-template-columns: 1fr auto;
    }

    .prototype-label {
        display: none;
    }

    .title-group {
        justify-self: end;
    }

    .level-card {
        top: max(82px, calc(env(safe-area-inset-top) + 74px));
    }

    .climb-controls {
        align-items: stretch;
        flex-direction: column-reverse;
        width: calc(100% - 32px);
    }

    .control-button {
        width: 100%;
    }

    .keyboard-hint {
        display: none;
    }

    .alpha-play-heading span,
    .alpha-play-instructions {
        display: none;
    }

    .alpha-play-heading {
        left: max(12px, env(safe-area-inset-left));
        transform: none;
    }

    .alpha-editor-close {
        font-size: 0.7rem;
        padding: 8px 11px;
    }
}

@media (max-width: 1120px) {
    .prototype.alpha-build-mode .tower {
        width: min(var(--tower-width), calc(100vw - 28px));
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        /* Keep the essential spatial change visible without the full-length animation. */
        --travel-time: 900ms;
    }

    .transition-mist.active-up,
    .transition-mist.active-down {
        animation: none;
    }

    .alpha-player.running .alpha-player-sprite {
        animation: none;
    }

    .alpha-player.ladder-climbing.ladder-moving .alpha-player-sprite {
        animation: none;
        background-position: -90px 0;
    }

    .alpha-player.ceiling-hanging.ceiling-moving .alpha-player-sprite {
        animation: none;
        background-position: -112px 0;
    }

    .alpha-player.jumping .alpha-player-sprite {
        background-position: -180px 0;
    }

    .alpha-player.landing .alpha-player-sprite {
        background-position: -270px 0;
    }
}
