:root {
    --scale: 1;
    --page-top: #f2d6b3;
    --page-bottom: #d5e6e2;
    --ink: #182026;
    --panel: rgba(252, 248, 242, 0.94);
    --panel-border: #24333f;
    --accent: #c72208;
    --accent-dark: #981901;
    --shadow: rgba(24, 32, 38, 0.18);
    --muted: #63707a;
}

html,
body {
    height: 100%;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Trebuchet MS", "Gill Sans", sans-serif;
    background: #111;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
}

code,
pre {
    font-family: "Consolas", "Courier New", monospace;
}

.app-shell {
    width: 100%;
    height: 100%;
}

.viewport {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background: #111;
}

.eyebrow {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    color: var(--muted);
}

h1,
h2,
p {
    margin: 0;
}

h1,
h2 {
    font-family: Georgia, "Times New Roman", serif;
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.dialog-panel,
.debug-panel {
    background: var(--panel);
    border: 3px solid var(--panel-border);
    border-radius: 24px;
    box-shadow: 0 18px 40px var(--shadow);
}

.stage-screen {
    width: 1440px;
    height: 1080px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(var(--scale, 1));
    transform-origin: center;
    overflow: hidden;
    background: #d9ded9;
}

.scene {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.scene.is-active {
    opacity: 1;
    pointer-events: auto;
}

.scene-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.steps {
    display: none;
}

.character {
    position: absolute;
    z-index: 1;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.10)) brightness(0.9) saturate(0.9);
    opacity: 1;
    transition:
            opacity 200ms ease,
            transform 200ms ease,
            filter 200ms ease;
}

.character.active {
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 1)) brightness(1.02) saturate(1.05);
    animation: active-speaker-float 1.9s ease-in-out infinite;
}

@keyframes active-speaker-float {
    0%,
    20%,
    80%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.item {
    position: absolute;
    z-index: 1;
    object-fit: contain;
    filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.22));
    opacity: 0;
    transition:
            opacity 200ms ease,
            transform 160ms ease,
            filter 160ms ease;
}

.character.is-swapping,
.item.is-swapping {
    opacity: 0 !important;
}

.is-swap-clone {
    pointer-events: none;
}

.scene [data-run]:not(button):not(.is-hidden) {
    cursor: pointer;
}

.scene [data-run]:not(button):not(.is-hidden):hover,
.scene [data-run]:not(button):not(.is-hidden):focus-visible {
    transform: scale(1.09);
    filter:
            drop-shadow(0 0 0.9rem rgb(242, 244, 255))
            drop-shadow(0 0.8rem 1rem rgb(255, 221, 0));
    outline: none;
}

#intro-scene {
    position: relative;

    .book {
        position: absolute;
        left: 156px;
        bottom: 560px;
        width: 85px;
        height: 130px;
    }
}
#start {
    position: absolute;
    display: flex;
    justify-content: center;
}
.intro-screen {
    position: absolute;
    display: flex;
    justify-content: center;
    flex-direction: column;
    left: 555px;
    top: 250px;
}
.title {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    font-size: 130px;
    font-family: Centaur;
    letter-spacing: 3px;
    color: #0f1303;
    padding: 15px;
    margin: 20px 20px 50px 20px;
    border-radius: 30px;
    background-color: rgba(243, 243, 243, 0.8);
}
.play {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.start {
    margin: 10px 30px;
    padding: 20px 100px;
    font-size: 25px;
    border-radius: 10px;
    border: none;
    color: #f3f3f3;


    background: linear-gradient(135deg, #ff2900, #a81903);

    cursor: pointer;
    transition: all 0.25s ease;
}

.start:hover {
    transform: translateY(-10px) scale(1.08);
    background: linear-gradient(135deg, #77adff, #249cff);
    color: #0f1303;
    box-shadow: 0 15px 40px rgb(176, 197, 236);
}

.start:active {
    transform: scale(1.5);
    box-shadow: 0 15px 40px rgb(119, 173, 255);
}
.home {
    margin: 10px 30px;
    padding: 20px 70px;
    font-size: 25px;
    border-radius: 10px;
    border: none;
    color: #f3f3f3;


    background: linear-gradient(135deg, #ff2900, #a81903);

    cursor: pointer;
    transition: all 0.25s ease;
}

.home:hover {
    transform: translateY(-10px) scale(1.08);
    background: linear-gradient(135deg, #77adff, #249cff);
    color: #0f1303;
    box-shadow: 0 15px 40px rgb(176, 197, 236);
}

.home:active {
    transform: scale(1.5);
    box-shadow: 0 15px 40px rgb(119, 173, 255);
}

#library-scene {
    .character[data-char="king"] {
        bottom: -0rem;
    }
}
#map-scene .zone1 {
    position: relative;
    left: 420px;
    top: 69px;
}

#map-scene .zone2 {
    position: relative;
    top: 400px;
    left: 500px;
}

#map-scene .zone3 {
    position: relative;
    top: 800px;
    left: 460px;
}

#map-scene .hover-zone:hover .item {
    opacity: 1;
    pointer-events: auto;

    filter:
        drop-shadow(0 0 0rem rgba(0, 0, 0, 0.0));
        outline: none;
}

#map-scene .zone1:hover .item {
    opacity: 1;
}

#map-scene .zone2:hover .item {
    opacity: 1;
}

#map-scene .zone3:hover .item {
    opacity: 1;
}

#city {
    position: absolute;

    .pil{
        position: absolute;
        top: 930px;
        left: 980px;

        filter:
                drop-shadow(0 0 0rem rgba(0, 0, 0, 0.0));
        outline: none;
    }
}
#signstall {
    position: absolute;
    .sign1 {
        position: absolute;
        top: 800px;
        left: 1045px;
    }

    .sign2 {
        position: absolute;
        top: 788px;
        left: 505px;
    }

    .sign3 {
        position: absolute;
        top: 800px;
        left: 115px;
    }
}

#tryagain {
    position: absolute;
    .sign1 {
        position: absolute;
        top: 800px;
        left: 1045px;
    }

    .sign2 {
        position: absolute;
        top: 788px;
        left: 505px;
    }

    .sign3 {
        position: absolute;
        top: 800px;
        left: 115px;
    }
}

#good {
    position: absolute;
    .sign1 {
        position: absolute;
        top: 800px;
        left: 1045px;
    }

    .sign2 {
        position: absolute;
        top: 788px;
        left: 505px;
    }

    .sign3 {
        position: absolute;
        top: 800px;
        left: 115px;
    }
}

#choice {
    position: absolute;
    .sign1 {
        position: absolute;
        top: 800px;
        left: 1045px;
    }

    .sign2 {
        position: absolute;
        top: 788px;
        left: 505px;
    }

    .sign3 {
        position: absolute;
        top: 800px;
        left: 115px;
    }
}

#choice .sign1read {
    position: relative;
    left: 940px;
    top: 490px;
}

#choice .sign2read {
    position: relative;
    top: 475px;
    left: 500px;
}

#choice .sign3read {
    position: relative;
    top: 587px;
    left: 78px;
}

#choice .hover-sign:hover .item {
    opacity: 1;
    pointer-events: auto;
}


.scene-panel {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 2;
    width: min(27rem, calc(100% - 2.5rem));
    padding: 1.15rem 1.2rem;
    background: rgba(252, 248, 242, 0.82);
    border: 3px solid rgba(36, 51, 63, 0.24);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(24, 32, 38, 0.16);
    backdrop-filter: blur(12px);
}

.scene-panel--right {
    left: auto;
    right: 1.25rem;
}

.scene-panel-copy {
    line-height: 1.6;
    color: var(--ink);
}

.scene-actions {
    display: grid;
    gap: 0.7rem;
    margin-top: 1rem;
}

.scene-actions button {
    width: 100%;
}

.ending-screen {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 1.25rem;
    padding: 4rem;
    text-align: center;
}

.ending-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
            linear-gradient(180deg, rgba(17, 22, 28, 0.26), rgba(17, 22, 28, 0.7)),
            radial-gradient(circle at top, rgba(255, 255, 255, 0.26), transparent 48%);
}

.ending-screen > * {
    position: relative;
}

.ending-screen--good {
    color: #f7f4ee;
}

.ending-screen--rough {
    color: #fff5eb;
}

.ending-kicker {
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    font-weight: 700;
}

.ending-lead {
    max-width: 40rem;
    font-size: 1.08rem;
    line-height: 1.7;
    text-wrap: balance;
}

.ending-card {
    width: min(44rem, 100%);
    padding: 1.8rem 2rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    background: rgba(18, 24, 30, 0.6);
    box-shadow: 0 24px 46px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    text-align: left;
}

.ending-screen--good .ending-card {
    background:
            linear-gradient(180deg, rgba(28, 48, 55, 0.74), rgba(19, 31, 36, 0.76)),
            rgba(18, 24, 30, 0.6);
}

.ending-screen--rough .ending-card {
    background:
            linear-gradient(180deg, rgba(62, 40, 30, 0.78), rgba(34, 22, 18, 0.82)),
            rgba(18, 24, 30, 0.6);
}

.ending-summary {
    display: grid;
    gap: 0.8rem;
    margin: 0;
    padding-left: 1.2rem;
    line-height: 1.6;
}

.ending-button {
    min-width: 12rem;
}

.is-hidden {
    display: none !important;
}

.debug-panel,
.dialog-panel,
.action-panel {
    position: absolute;
    z-index: 2;
}

.dialog-panel,
.action-panel,
.debug-panel {
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.story-ui {
    left: 1.25rem;
    right: 1.25rem;
    bottom: 1.25rem;
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.story-ui.is-hidden {
    display: none;
}

.dialog-panel {
    --dialog-border-color: var(--panel-border);
    --speaker-bg: rgba(217, 109, 63, 0.12);
    position: relative;
    width: 75%;
    min-height: 148px;
    display: grid;
    align-content: start;
    gap: 0.75rem;
    border-color: var(--dialog-border-color);
    background: rgba(232, 232, 232, 0.5);

}

.speaker-label {
    width: fit-content;
    border-radius: 999px;
    font-size: 1.9rem;
    font-family: emoji;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dialog-text {
    font-size: 1.5rem;
    line-height: 1.65;
}

.action-panel {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 0;
    backdrop-filter: none;
    width: min(720px, 100%);
}

.choice-list {
    display: grid;
    gap: 0.75rem;
    justify-items: center;
    width: 100%;
}

.action-panel > .primary-button {
    justify-self: center;
}

.choice-list:empty {
    display: none;
}

.primary-button,
.secondary-button,
.choice-list button {
    border: 0;
    border-radius: 999px;
    padding: 0.8rem 1.1rem;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(24, 32, 38, 0.18);
    transition:
            transform 120ms ease,
            background 120ms ease,
            color 120ms ease;
}

.choice-list button {
    min-width: min(420px, 100%);
}

.primary-button,
.choice-list button {
    color: #fff8f1;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.secondary-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid var(--panel-border);
}

.primary-button:hover,
.secondary-button:hover,
.choice-list button:hover {
    transform: translateY(-4px);
}

.debug-line {
    line-height: 1.55;
    color: var(--muted);
}

.debug-panel {
    top: 1.25rem;
    right: 1.25rem;
    width: auto;
    padding: 0;
    background: rgba(252, 248, 242, 0.64);
    overflow: hidden;
}

.debug-panel summary {
    list-style: none;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.debug-panel summary::-webkit-details-marker {
    display: none;
}

.debug-panel summary::before {
    content: "+ ";
}

.debug-panel[open] {
    width: 320px;
    background: rgba(252, 248, 242, 0.78);
}

.debug-panel[open] summary {
    border-bottom: 1px solid rgba(36, 51, 63, 0.14);
}

.debug-panel[open] summary::before {
    content: "- ";
}

.debug-content {
    padding: 0.8rem;
}

.debug-content h2 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.debug-panel pre {
    margin-top: 0.75rem;
    margin-bottom: 0;
    padding: 0.7rem;
    min-height: 88px;
    max-height: 240px;
    overflow: auto;
    border-radius: 12px;
    background: #1f2a33;
    color: #f4e8d9;
    font-size: 0.78rem;
}


