:root {
    --black: #0a0a0a;
    --warm-white: #f5f0e8;
    --cream: #ece6d9;
    --gold: #c9a227;
    --gold-light: #dbb94e;
    --text: #e8e4dc;
    --text-dim: #c0b7aa;
    --line: rgba(255, 255, 255, 0.1);
    --panel: rgba(8, 7, 6, 0.88);
    --panel-strong: rgba(12, 10, 8, 0.97);
    --shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
    background: var(--black);
    color: var(--text);
    font-family: "Manrope", sans-serif;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
a {
    font: inherit;
}

a {
    color: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 30;
    transform: translateY(-150%);
    padding: 0.8rem 1rem;
    background: var(--warm-white);
    color: var(--black);
    text-decoration: none;
    font-weight: 800;
}

.skip-link:focus {
    transform: translateY(0);
}

.world-shell {
    position: fixed;
    inset: 0;
    isolation: isolate;
    background:
        radial-gradient(circle at 52% 14%, rgba(219, 185, 78, 0.12), transparent 32%),
        linear-gradient(115deg, rgba(201, 162, 39, 0.12), transparent 34%),
        linear-gradient(180deg, #0f0c0a 0%, #070605 100%);
}

#studioCanvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    cursor: grab;
    touch-action: none;
}

#studioCanvas:active {
    cursor: grabbing;
}

.grain {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='0.8'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
}

.world-topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 4vw, 2rem);
    border-bottom: 1px solid rgba(201, 162, 39, 0.12);
    background: linear-gradient(180deg, rgba(5, 5, 4, 0.9), rgba(5, 5, 4, 0.42));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.brand {
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--warm-white);
}

.brand span {
    color: var(--gold);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.quality-pill,
.fast-link,
.primary-action,
.secondary-action {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.quality-pill {
    min-height: 2.25rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.fast-link {
    padding: 0.78rem 1rem;
    color: var(--black);
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.world-ui {
    position: fixed;
    z-index: 10;
    left: clamp(0.85rem, 2vw, 1.35rem);
    bottom: clamp(0.85rem, 2vw, 1.35rem);
    width: min(21.75rem, calc(100vw - 1.7rem));
    pointer-events: none;
}

.mobile-move-controls {
    position: fixed;
    z-index: 11;
    right: clamp(0.85rem, 2vw, 1.35rem);
    bottom: clamp(0.85rem, 2vw, 1.35rem);
    display: none;
    pointer-events: none;
}

.mobile-move-pad {
    position: relative;
    width: 5.3rem;
    aspect-ratio: 1;
    border: 1px solid rgba(201, 162, 39, 0.38);
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 50%, rgba(245, 240, 232, 0.08), transparent 42%),
        linear-gradient(180deg, rgba(9, 8, 7, 0.78), rgba(9, 8, 7, 0.52));
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.mobile-move-pad::before,
.mobile-move-pad::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 58%;
    height: 1px;
    transform: translate(-50%, -50%);
    background: rgba(245, 240, 232, 0.14);
}

.mobile-move-pad::after {
    width: 1px;
    height: 58%;
}

.mobile-move-stick {
    --move-x: 0rem;
    --move-y: 0rem;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2.1rem;
    aspect-ratio: 1;
    border-radius: 999px;
    transform: translate(calc(-50% + var(--move-x)), calc(-50% + var(--move-y)));
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    transition: transform 80ms linear;
}

.mobile-move-controls.is-active .mobile-move-stick {
    transition-duration: 0ms;
}

.mobile-move-pad:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 4px;
}

.station-panel,
.fallback-box {
    pointer-events: auto;
    padding: clamp(1rem, 2vw, 1.35rem);
    border: 1px solid rgba(201, 162, 39, 0.18);
    border-radius: 0.5rem;
    background: linear-gradient(180deg, var(--panel-strong), var(--panel));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.station-panel {
    color: var(--text);
    border-color: rgba(201, 162, 39, 0.34);
    background:
        linear-gradient(180deg, rgba(10, 8, 7, 0.9), rgba(10, 8, 7, 0.78));
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    transition: opacity 420ms ease, transform 420ms ease;
}

.intro-active .station-panel {
    opacity: 0.78;
    transform: translateY(8px);
    pointer-events: none;
}

.station-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
}

.station-panel-body {
    display: block;
}

.panel-kicker {
    margin-bottom: 0.7rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.26em;
    font-size: 0.62rem;
    font-weight: 800;
}

.panel-toggle {
    display: inline-flex;
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--warm-white);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.panel-toggle:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

.station-panel h1,
.fallback-box h1 {
    font-family: "Prata", serif;
    color: var(--warm-white);
    font-size: clamp(1.8rem, 5vw, 2.45rem);
    line-height: 1.05;
    font-weight: 400;
    letter-spacing: 0;
}

.station-panel h1 {
    color: var(--warm-white);
    font-size: clamp(1.34rem, 2.6vw, 1.68rem);
    line-height: 1.12;
}

.station-panel.is-compact {
    width: min(22rem, calc(100vw - 1.7rem));
    padding: 0.7rem;
}

.station-panel.is-compact .station-panel-head {
    align-items: center;
}

.station-panel.is-compact .panel-kicker {
    margin-bottom: 0;
}

.station-panel.is-compact .station-panel-body {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.55rem;
}

.station-panel.is-compact h1 {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: clamp(1.05rem, 2.4vw, 1.32rem);
}

.station-panel.is-compact p,
.station-panel.is-compact .growth-spot,
.station-panel.is-compact .station-actions {
    display: none;
}

.station-panel.is-compact .station-list {
    margin-top: 0;
}

.station-panel p,
.fallback-box p {
    margin-top: 0.8rem;
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.65;
}

.station-panel p {
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.48;
}

.station-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.growth-spot {
    margin-top: 0.82rem;
    padding: 0.62rem;
    border: 1px solid rgba(201, 162, 39, 0.18);
    border-radius: 0.38rem;
    background:
        linear-gradient(145deg, rgba(201, 162, 39, 0.13), transparent 44%),
        rgba(255, 255, 255, 0.04);
}

.growth-spot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.58rem;
    font-weight: 800;
}

.growth-spot-head strong {
    color: var(--text-dim);
    font-size: 0.54rem;
    white-space: nowrap;
}

.growth-list {
    display: grid;
    gap: 0.42rem;
    margin-top: 0.56rem;
}

.growth-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 0.75rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.56rem 0.62rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.34rem;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.growth-item:hover,
.growth-item:focus-visible,
.growth-item.is-active {
    border-color: rgba(219, 185, 78, 0.56);
    outline: none;
}

.growth-item span {
    align-self: center;
    color: var(--warm-white);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
}

.growth-item small {
    grid-column: 1 / -1;
    color: var(--text-dim);
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1.35;
}

.growth-meter {
    position: relative;
    align-self: center;
    width: 4.1rem;
    height: 1.5rem;
}

.growth-meter::before {
    content: "";
    position: absolute;
    inset: 0.7rem 0 0.58rem;
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.16), rgba(219, 185, 78, 0.68));
    transform: skewX(-18deg);
}

.growth-meter i {
    position: absolute;
    bottom: 0.12rem;
    width: 0.34rem;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    box-shadow: 0 0 16px rgba(219, 185, 78, 0.24);
}

.growth-meter i:nth-child(1) {
    left: 0.18rem;
    height: 0.42rem;
}

.growth-meter i:nth-child(2) {
    left: 1.18rem;
    height: 0.68rem;
}

.growth-meter i:nth-child(3) {
    left: 2.18rem;
    height: 0.96rem;
}

.growth-meter i:nth-child(4) {
    left: 3.18rem;
    height: 1.28rem;
}

.station-chip {
    min-height: 2.16rem;
    padding: 0.5rem 0.68rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
}

.station-chip:hover,
.station-chip:focus-visible,
.station-chip.is-active {
    border-color: rgba(201, 162, 39, 0.72);
    color: var(--gold-light);
    outline: none;
}

.station-actions,
.fallback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.95rem;
}

.primary-action,
.secondary-action {
    cursor: pointer;
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
}

.primary-action {
    color: var(--black);
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.secondary-action {
    color: var(--warm-white);
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
}

.primary-action:focus-visible,
.secondary-action:focus-visible,
.fast-link:focus-visible,
.brand:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 3px;
}

.screen-viewer {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background:
        radial-gradient(circle at 50% 0%, rgba(201, 162, 39, 0.16), transparent 34%),
        rgba(3, 3, 3, 0.97);
    color: var(--warm-white);
}

.screen-viewer[hidden] {
    display: none;
}

.screen-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: clamp(0.8rem, 2vw, 1.2rem) clamp(1rem, 3vw, 1.8rem);
    border-bottom: 1px solid rgba(201, 162, 39, 0.22);
    background: linear-gradient(180deg, rgba(7, 6, 5, 0.96), rgba(7, 6, 5, 0.74));
}

.screen-viewer h2 {
    font-family: "Prata", serif;
    font-size: clamp(1.05rem, 2.4vw, 1.55rem);
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.1;
}

.screen-viewer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.65rem;
}

.screen-viewer-scroll {
    overflow: auto;
    display: grid;
    justify-items: center;
    align-items: start;
    padding: clamp(1rem, 3vw, 2rem);
    overscroll-behavior: contain;
}

.screen-viewer-scroll img {
    display: block;
    width: min(34rem, 92vw);
    height: auto;
    min-height: 120vh;
    border: 1px solid rgba(201, 162, 39, 0.32);
    border-radius: 0.45rem;
    background: #080807;
    box-shadow:
        0 34px 100px rgba(0, 0, 0, 0.62),
        0 0 0 0.55rem rgba(201, 162, 39, 0.08);
}

.fallback {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 1rem;
    background:
        linear-gradient(130deg, rgba(201, 162, 39, 0.12), transparent 38%),
        rgba(10, 10, 10, 0.94);
}

.fallback[hidden] {
    display: none;
}

.fallback-box {
    width: min(34rem, 100%);
}

.no-script {
    z-index: 40;
}

.qa-panel {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 35;
    width: min(22rem, calc(100vw - 2rem));
    padding: 0.9rem;
    border: 1px solid rgba(201, 162, 39, 0.42);
    border-radius: 0.5rem;
    background: rgba(8, 8, 7, 0.88);
    color: var(--warm-white);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
}

.qa-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.qa-panel__title {
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.qa-panel__copy {
    min-height: 1.8rem;
    padding: 0.42rem 0.58rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--warm-white);
    cursor: pointer;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.qa-panel__copy:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

.qa-panel__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.8rem;
    margin-top: 0.7rem;
}

.qa-panel dt {
    color: var(--text-dim);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.qa-panel dd {
    margin-top: 0.12rem;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.3;
}

.qa-panel.is-complete {
    border-color: rgba(219, 185, 78, 0.82);
}

@media (max-width: 760px) {
    .world-topbar {
        align-items: center;
        min-width: 0;
        padding-block: 0.7rem;
    }

    .quality-pill {
        display: none;
    }

    .topbar-actions {
        flex: 0 0 auto;
        gap: 0.5rem;
        margin-left: auto;
    }

    .fast-link {
        width: 2.45rem;
        min-width: 2.45rem;
        min-height: 2.35rem;
        padding: 0;
        letter-spacing: 0;
        font-size: 0;
    }

    .fast-link::before {
        content: "\2190";
        font-size: 1rem;
        line-height: 1;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 12rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.5;
        font-size: 0.68rem;
        letter-spacing: 0.22em;
    }

    .world-ui {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: auto;
    }

    .mobile-move-controls {
        right: 0.85rem;
        bottom: calc(0.75rem + min(18svh, 9.4rem) + 0.85rem);
    }

    .station-panel {
        max-height: min(38svh, 21rem);
        overflow: auto;
        padding: 0.95rem;
    }

    .panel-toggle {
        display: inline-flex;
    }

    .panel-kicker {
        margin-bottom: 0.45rem;
        font-size: 0.56rem;
    }

    .station-panel h1 {
        font-size: clamp(1.38rem, 7vw, 1.9rem);
    }

    .station-panel p {
        margin-top: 0.55rem;
        font-size: 0.82rem;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .station-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .station-list::-webkit-scrollbar {
        display: none;
    }

    .station-chip {
        flex: 0 0 auto;
        min-height: 2.15rem;
        scroll-snap-align: start;
        font-size: 0.68rem;
    }

    .station-actions {
        margin-top: 0.85rem;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .station-panel.is-compact {
        max-height: min(18svh, 9.4rem);
        padding: 0.68rem;
    }

    .station-panel.is-compact .station-panel-head {
        align-items: center;
    }

    .station-panel.is-compact .panel-kicker {
        margin-bottom: 0;
    }

    .station-panel.is-compact .station-panel-body {
        display: grid;
        gap: 0.52rem;
        margin-top: 0.52rem;
    }

    .station-panel.is-compact h1 {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .station-panel.is-compact p,
    .station-panel.is-compact .growth-spot,
    .station-panel.is-compact .station-actions {
        display: none;
    }

    .station-panel.is-compact .station-list {
        margin-top: 0;
    }

    .station-panel.is-compact .station-chip {
        min-height: 2rem;
        padding: 0.48rem 0.65rem;
        font-size: 0.64rem;
    }

    .primary-action,
    .secondary-action {
        min-height: 2.45rem;
        padding: 0.72rem 0.72rem;
        letter-spacing: 0.1em;
        font-size: 0.61rem;
    }

    .screen-viewer-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .screen-viewer-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .screen-viewer-scroll img {
        width: min(28rem, 94vw);
    }

    .qa-panel {
        right: 0.75rem;
        left: 0.75rem;
        bottom: auto;
        top: 4.65rem;
        width: auto;
        padding: 0.75rem;
    }

    .qa-panel__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .qa-panel__copy {
        min-height: 1.65rem;
        padding: 0.34rem 0.48rem;
        font-size: 0.5rem;
    }

    .qa-panel dt {
        font-size: 0.5rem;
    }

    .qa-panel dd {
        font-size: 0.62rem;
    }
}

@media (max-width: 480px) {
    .world-topbar {
        gap: 0.65rem;
        padding-inline: 1rem;
    }

    .brand {
        max-width: 10.5rem;
        font-size: 0.62rem;
        letter-spacing: 0.16em;
    }

    .station-panel {
        max-height: min(40svh, 22rem);
    }

    .station-panel.is-compact {
        max-height: min(24svh, 12rem);
    }

    .mobile-move-controls {
        bottom: calc(0.75rem + min(24svh, 12rem) + 0.8rem);
    }
}

@media (pointer: coarse) {
    .mobile-move-controls {
        display: flex;
    }
}

@media (pointer: coarse) and (min-width: 761px) {
    .mobile-move-controls {
        right: 1.25rem;
        bottom: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
