@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-ThinItalic.ttf') format('truetype');
    font-weight: 100;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-ExtraLightItalic.ttf') format('truetype');
    font-weight: 200;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-LightItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-SemiBoldItalic.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-ExtraBoldItalic.ttf') format('truetype');
    font-weight: 800;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/montserrat/Montserrat-BlackItalic.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --red: #c21b17;
    --white: #ffffff;
    --ink: #151515;
    --glass: rgba(255, 255, 255, .88);
    --shadow: 0 18px 48px rgba(0, 0, 0, .28);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
    font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--white);
    background: #111;
    cursor: none;
}
button, a, input, .clickable { cursor: none; }
.no-select { user-select: none; -webkit-user-select: none; }

.game-shell {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    isolation: isolate;
}

.screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
    animation: fadeIn .38s ease both;
}

.bg-blur, .bg-main {
    position: absolute;
    inset: 0;
    background-position: center;
    background-repeat: no-repeat;
}
.bg-blur {
    background-size: cover;
    filter: blur(18px) brightness(.72);
    transform: scale(1.08);
    z-index: 0;
}
.bg-main {
    background-size: contain;
    z-index: 1;
}
.screen-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(circle at 50% 10%, rgba(255,255,255,.16), transparent 42%), linear-gradient(to bottom, rgba(0,0,0,.12), rgba(0,0,0,.36));
}
.screen-content {
    position: relative;
    z-index: 3;
    height: 100%;
    width: min(100vw, calc(100dvh * 9 / 16));
    max-width: 520px;
    margin: 0 auto;
    padding: calc(18px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
}

.title {
    margin: 0 auto;
    padding: 8px 48px 6px;
    text-align: center;
    font-size: clamp(22px, 6vw, 34px);
    line-height: 1.05;
    font-weight: 800;
    text-shadow: 0 5px 18px rgba(0,0,0,.42);
}
.title.small { font-size: clamp(19px, 5vw, 28px); }

.ui-box {
    position: absolute;
    border-radius: inherit;
    padding: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.ui-box-scroll {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
}
.ui-box-scroll::-webkit-scrollbar { width: 5px; }
.ui-box-scroll::-webkit-scrollbar-thumb { background: rgba(194,27,23,.75); border-radius: 999px; }
.ui-box.has-overflow::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34px;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,.86));
}
.ui-box.has-overflow::before {
    content: '⌄';
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    color: var(--red);
    font-size: 22px;
    animation: bounceY 1s ease infinite;
}

.cta-row, .stack-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.btn {
    border: 0;
    border-radius: 999px;
    padding: 15px 22px;
    font: inherit;
    font-weight: 800;
    color: var(--white);
    background: var(--red);
    box-shadow: 0 12px 32px rgba(194,27,23,.32);
    transform: translateZ(0);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover, .btn:focus-visible { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(194,27,23,.42); outline: none; }
.btn.secondary { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.75); color: #fff; box-shadow: none; }
.btn.ghost { background: rgba(255,255,255,.9); color: var(--red); box-shadow: var(--shadow); }

.intro-start { position: absolute; left: 50%; bottom: calc(46px + var(--safe-bottom)); transform: translateX(-50%); z-index: 5; white-space: nowrap; }
.restart-btn {
    position: absolute;
    top: calc(14px + var(--safe-top));
    right: 14px;
    z-index: 10;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 50%;
    color: #fff;
    background: rgba(0,0,0,.32);
    backdrop-filter: blur(8px);
    font-size: 18px;
}

.carousel-wrap { position: absolute; left: 16px; right: 16px; top: 210px; bottom: 94px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.carousel-stage { width: min(86vw, 380px); aspect-ratio: 1 / 1; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); background: rgba(255,255,255,.14); }
.carousel-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-arrows { display: flex; gap: 18px; align-items: center; justify-content: center; }
.arrow-btn { width: 52px; height: 42px; border-radius: 999px; border: 1px solid rgba(255,255,255,.52); background: rgba(0,0,0,.32); color: #fff; font-size: 24px; backdrop-filter: blur(8px); }
.arrow-btn.hint { animation: pulseGlow .9s ease infinite alternate; }
.level1-choose { position: absolute; left: 50%; bottom: calc(46px + var(--safe-bottom)); transform: translateX(-50%); z-index: 6; white-space: nowrap; }

.level2-image { width: min(72vw, 310px); aspect-ratio: 1 / 1; margin: 12px auto; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: rgba(255,255,255,.14); }
.level2-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.answer-card { position: absolute; left: 16px; right: 16px; bottom: calc(46px + var(--safe-bottom)); background: rgba(255,255,255,.9); color: var(--ink); border-radius: 24px; padding: 14px; box-shadow: var(--shadow); }
.answer-title { text-align: center; font-weight: 800; margin-bottom: 10px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.option { border: 2px solid rgba(194,27,23,.28); color: var(--ink); background: #fff; border-radius: 16px; padding: 12px 10px; font-weight: 800; }
.option.selected { background: var(--red); color: #fff; border-color: var(--red); }

.compare-panel { position: absolute; left: 12px; right: 12px; top: 96px; bottom: calc(102px + var(--safe-bottom)); overflow-y: auto; padding: 8px; }
.compare-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 7px; color: var(--ink); }
.compare-cell { min-height: 54px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 9px 7px; background: rgba(255,255,255,.9); border-radius: 14px; font-size: 13px; font-weight: 700; box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.compare-cell.header { flex-direction: column; gap: 5px; background: rgba(255,255,255,.95); color: var(--red); }
.compare-cell img { width: 34px; height: 34px; object-fit: contain; }
.compare-mark { font-size: 24px; }
.compare-actions { position: absolute; left: 16px; right: 16px; bottom: calc(18px + var(--safe-bottom)); display: grid; gap: 10px; }

.level3-area { position: absolute; left: 12px; right: 12px; top: calc(18px + var(--safe-top)); bottom: 146px; overflow-y: auto; padding: 8px 4px 18px; scrollbar-width: thin; }
.level3-area::-webkit-scrollbar { width: 6px; }
.level3-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,.7); border-radius: 999px; }
.steps-pool, .slots-list { display: grid; gap: 10px; }
.steps-pool { margin-bottom: 16px; }
.step-item, .slot { min-height: 88px; border-radius: 18px; background: rgba(255,255,255,.9); box-shadow: 0 10px 26px rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.step-item { border: 2px solid rgba(255,255,255,.9); padding: 6px; }
.step-item.selected { outline: 4px solid rgba(194,27,23,.58); }
.step-item img { max-width: 100%; max-height: 92px; object-fit: contain; pointer-events: none; }
.slot { border: 2px dashed rgba(194,27,23,.42); position: relative; padding-left: 48px; }
.slot-number { position: absolute; left: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 900; }
.slot.filled { border-style: solid; }
.slot.error { animation: shake .42s ease; box-shadow: 0 0 0 4px rgba(194,27,23,.36), 0 10px 26px rgba(0,0,0,.18); }
.level3-check { margin-top: 12px; width: 100%; }

.final-card { position: absolute; left: 16px; right: 16px; top: 120px; background: rgba(255,255,255,.9); color: var(--ink); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { border: 1px solid rgba(194,27,23,.22); border-radius: 18px; padding: 12px 8px; text-align: center; background: #fff; }
.stat strong { display: block; color: var(--red); font-size: 20px; margin-bottom: 3px; }
.stat span { font-size: 12px; font-weight: 700; }
.final-actions { position: absolute; left: 16px; right: 16px; bottom: calc(46px + var(--safe-bottom)); display: grid; gap: 10px; }

.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.modal-root.active { pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); display: grid; place-items: center; padding: 18px; animation: fadeIn .2s ease both; }
.modal-card { width: min(92vw, 420px); background: rgba(255,255,255,.95); color: var(--ink); border-radius: 26px; padding: 20px; text-align: center; box-shadow: var(--shadow); }
.modal-card p { margin: 0 0 16px; }

.loader { position: fixed; inset: 0; display: none; place-items: center; background: #111; z-index: 200; }
.loader.is-visible { display: grid; }
.loader-card { text-align: center; color: #fff; }
.loader-mark { width: 54px; height: 54px; border: 5px solid rgba(255,255,255,.2); border-top-color: var(--red); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }

#customCursor { position: fixed; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.8); box-shadow: 0 0 18px #fff, 0 0 32px rgba(194,27,23,.7); pointer-events: none; z-index: 300; transform: translate(-50%, -50%); }
#sparkleLayer, #confettiLayer { position: fixed; inset: 0; pointer-events: none; z-index: 250; overflow: hidden; }
.sparkle { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #fff; animation: sparkleOut .8s ease forwards; }
.confetti { position: absolute; width: 8px; height: 14px; background: #fff; animation: confettiFall 1.2s ease forwards; }

.debug-panel { position: fixed; z-index: 400; left: 8px; bottom: 8px; width: min(92vw, 360px); max-height: 42vh; overflow: auto; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.78); color: #00ff9c; font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; }
.debug-panel pre { white-space: pre-wrap; margin: 6px 0 0; }

@keyframes fadeIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounceY { 50% { transform: translate(-50%, 4px); } }
@keyframes pulseGlow { from { box-shadow: 0 0 0 rgba(255,255,255,0); } to { box-shadow: 0 0 18px rgba(255,255,255,.95); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes sparkleOut { to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.1); } }
@keyframes confettiFall { to { opacity: 0; transform: translateY(180px) rotate(260deg); } }

@media (max-height: 700px) {
    .carousel-wrap { top: 188px; bottom: 84px; }
    .carousel-stage { width: min(70vw, 300px); }
    .ui-box { padding: 13px; font-size: 14px; }
    .title { font-size: clamp(20px, 5.2vw, 30px); }
}

@media (pointer: coarse) {
    body { cursor: none; }
    #customCursor { width: 22px; height: 22px; }
}

/* === Update 2026-05-28: requested UI/UX refinements === */
.screen { animation: none !important; }
.modal-backdrop { animation: none !important; }

.btn:hover,
.btn:focus-visible {
    transform: translateY(-2px);
}
.intro-start.btn:hover,
.intro-start.btn:focus-visible,
.level1-choose.btn:hover,
.level1-choose.btn:focus-visible {
    transform: translateX(-50%) translateY(-2px);
}

.title {
    overflow-wrap: anywhere;
    hyphens: auto;
}
.ui-box {
    z-index: 6;
}
.level1-instruction {
    z-index: 7;
}

.carousel-wrap {
    top: 226px;
    transition: top .18s ease;
}
.carousel-stage {
    border: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    cursor: none;
}
.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform .34s cubic-bezier(.2,.8,.2,1);
    will-change: transform;
}
.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.carousel-arrows {
    gap: 10px;
}
.info-btn {
    width: 44px;
    font-size: 20px;
    font-weight: 900;
    background: rgba(255,255,255,.92);
    color: var(--red);
    border-color: rgba(194,27,23,.46);
}
.arrow-btn:hover,
.arrow-btn:focus-visible,
.info-btn:hover,
.info-btn:focus-visible {
    transform: translateY(-2px);
    outline: none;
}

.level2-image {
    /*width: calc(100% + 32px) !important;*/ width: 100%;
    max-width: none !important;
    /*margin: 10px -16px 0 !important;*/ 
    aspect-ratio: 1 / 1;
    box-shadow: 0 16px 46px rgba(0,0,0,.26);
    background: rgba(255,255,255,.1);
}
.level2-image img {
    object-fit: cover;
}

.compare-panel {
    top: 92px;
    bottom: calc(118px + var(--safe-bottom));
    padding: 0;
    overflow-y: auto;
}
.compare-board {
    color: var(--ink);
    border: 1px solid rgba(255,255,255,.45);
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.84));
    box-shadow: 0 22px 60px rgba(0,0,0,.34);
    backdrop-filter: blur(10px);
    overflow: hidden;
}
.compare-board-head {
    display: grid;
    grid-template-columns: 1.24fr .92fr .92fr;
    background: #fff;
    border-bottom: 2px solid rgba(194,27,23,.72);
}
.compare-head {
    min-height: 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    text-align: center;
    font-size: 14px;
    line-height: 1.12;
    font-weight: 900;
    color: var(--ink);
    border-left: 1px solid rgba(194,27,23,.18);
}
.compare-head-feature {
    align-items: flex-start;
    padding-left: 12px;
    font-size: 14px;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: .03em;
    border-left: 0;
}
.compare-head-strong {
    background: linear-gradient(180deg, rgba(194,27,23,.12), rgba(194,27,23,.03));
    color: var(--red);
}
.compare-head img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,.14));
}
.compare-rows {
    display: grid;
    gap: 0;
}
.compare-row {
    display: grid;
    grid-template-columns: 1.24fr .92fr .92fr;
    min-height: 64px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.compare-row:last-child {
    border-bottom: 0;
}
.compare-feature {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.18;
    font-weight: 800;
    background: rgba(255,255,255,.64);
}
.compare-value {
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(0,0,0,.08);
    font-size: 28px;
    font-weight: 900;
}
.compare-no {
    color: #5d5d5d;
    background: rgba(0,0,0,.035);
}
.compare-yes {
    color: var(--red);
    background: rgba(194,27,23,.08);
}
.compare-actions {
    bottom: calc(36px + var(--safe-bottom));
}

.level3-instruction {
    top: calc(18px + var(--safe-top)) !important;
    bottom: auto !important;
    z-index: 8;
    box-shadow: 0 18px 44px rgba(0,0,0,.32);
}
.level3-area {
    top: calc(158px + var(--safe-top));
    bottom: calc(16px + var(--safe-bottom));
    padding: 10px 4px 24px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.steps-pool,
.slots-list {
    width: 100%;
}
.steps-pool {
    gap: 8px;
    margin-bottom: 18px;
    padding: 2px 0 0;
}
.step-item {
    width: 100%;
    min-height: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: block;
}
.step-item img {
    width: 100%;
    max-width: 100%;
    max-height: none;
    height: auto;
    display: block;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,.32));
}
.step-item.selected img {
    filter: drop-shadow(0 0 0 rgba(0,0,0,0)) drop-shadow(0 0 20px rgba(194,27,23,.85));
}
.slot {
    min-height: 118px;
    background: radial-gradient(circle at 50% 20%, rgba(255,255,255,.1), transparent 45%), rgba(0,0,0,.48);
    border: 2px solid rgba(255,255,255,.32);
    box-shadow: inset 0 12px 24px rgba(0,0,0,.42), inset 0 -8px 16px rgba(255,255,255,.08), 0 10px 26px rgba(0,0,0,.24);
    color: rgba(255,255,255,.86);
    padding: 12px 10px 12px 50px;
    overflow: hidden;
}
.slot::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px dashed rgba(255,255,255,.26);
    pointer-events: none;
}
.slot-number {
    left: 10px;
    top: 10px;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255,255,255,.8);
    box-shadow: 0 8px 18px rgba(194,27,23,.42);
}
.slot-placeholder {
    position: relative;
    z-index: 1;
    font-weight: 800;
    letter-spacing: .01em;
    opacity: .86;
}
.slot.filled {
    background: rgba(0,0,0,.36);
    border-color: rgba(255,255,255,.5);
}
.slot .step-item.in-slot {
    width: 100%;
    padding: 0 !important;
    margin: 0;
}
.slot .step-item.in-slot img {
    width: 100%;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,.28));
}
.level3-check {
    margin-top: 14px;
}

.debug-panel {
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(0,255,156,.35);
}
.debug-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(0,0,0,.92);
    border-bottom: 1px solid rgba(0,255,156,.28);
}
.debug-toggle {
    width: 28px;
    height: 24px;
    border: 1px solid rgba(0,255,156,.5);
    background: rgba(0,0,0,.6);
    color: #00ff9c;
    font: inherit;
    font-weight: 900;
}
.debug-panel pre {
    max-height: calc(42vh - 40px);
    overflow: auto;
    margin: 0;
    padding: 10px;
}
.debug-panel.is-collapsed {
    width: auto;
    max-height: none;
}
.debug-panel.is-collapsed pre {
    display: none;
}
.debug-panel.is-collapsed .debug-head {
    border-bottom: 0;
}


@media (max-height: 700px) {
    .carousel-wrap { bottom: 78px; }
    .carousel-stage { width: min(78vw, 340px); }
    .level3-area { top: calc(146px + var(--safe-top)); }
    .level3-instruction { height: 106px !important; }
    .slot { min-height: 102px; }
}

@media (max-width: 380px) {
    .compare-head { font-size: 12px; }
    .compare-feature { font-size: 12px; }
    .compare-value { font-size: 25px; }
    .level1-choose { font-size: 13px; padding-left: 14px; padding-right: 14px; }
}


/* === Update v1.2: Level 3 mechanics + selective corner rules === */
.ui-box,
.btn,
.option,
.restart-btn,
.arrow-btn,
.debug-toggle {
    border-radius: inherit;
}

.title {
    padding-left: 64px;
    padding-right: 64px;
}

.restart-btn {
    top: calc(12px + var(--safe-top));
    right: 12px;
}

.loader-mark,
#customCursor,
.sparkle,
.confetti {
    border-radius: 999px;
}

.carousel-stage,
.level2-image,
.answer-card,
.compare-board,
.final-card,
.modal-card,
.stat,
.debug-panel {
    border-radius: 18px;
}

.level3-instruction {
    top: calc(18px + var(--safe-top)) !important;
    bottom: auto !important;
    z-index: 8;
}

.level3-area {
    top: calc(150px + var(--safe-top));
    bottom: calc(12px + var(--safe-bottom));
    padding: 8px 2px 22px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.level3-step-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.level3-step-card {
    min-height: 78px;
    border: 1px solid rgba(255,255,255,.74);
    border-radius: 30px 0 30px 0 !important;
    background: linear-gradient(180deg, #d92621, var(--red));
    color: #fff;
    box-shadow: 0 12px 28px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.22);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: .02em;
    touch-action: manipulation;
}

.level3-step-card span {
    display: block;
    font-size: 11px;
    line-height: 1;
    font-weight: 900;
}

.level3-step-card strong {
    display: block;
    font-size: clamp(28px, 9vw, 42px);
    line-height: .9;
    font-weight: 900;
}

.level3-step-card.selected {
    outline: 3px solid rgba(255,255,255,.9);
    box-shadow: 0 0 0 4px rgba(194,27,23,.55), 0 16px 34px rgba(0,0,0,.34);
}

.level3-step-card.is-placed {
    opacity: .48;
    filter: grayscale(.2);
}

.level3-step-card.error,
.level3-image-slot.error {
    animation: shake .42s ease;
    box-shadow: 0 0 0 4px rgba(194,27,23,.52), 0 14px 34px rgba(0,0,0,.34);
}

.level3-image-slots {
    display: grid;
    gap: 12px;
}

.level3-image-slot {
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    /*border: 1px solid rgba(255,255,255,.35);
    border-radius: 18px !important;
    background: rgba(255,255,255,.12);
    box-shadow: 0 16px 38px rgba(0,0,0,.32); */
    touch-action: manipulation;
    background: rgba(255,255,255,0);
    border: 0px;
}

.level3-image-slot img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.level3-image-slot::after {
    content: '';
    position: absolute;
    inset: 0;
    /*border: 2px dashed rgba(255,255,255,.42);*/
    border: 0px;
    pointer-events: none;
    opacity: .55;
}

.level3-image-slot.filled::after {
    border-color: rgba(194,27,23,.78);
    background: linear-gradient(180deg, rgba(194,27,23,.06), rgba(0,0,0,.04));
    opacity: 1;
}

.drop-hint {
    position: absolute;
    right: 0px;
    bottom: 5px;
    z-index: 2;
    padding: 6px 9px;
    background: rgba(200,30,25,.58);
    border-radius: 15px 0px 15px 0px;
    width:60%;
    color: #fff;
    font-size: 12px;
    text-align: center;
    pointer-events: none;
}

.placed-step-badge {
    position: absolute;
    z-index: 3;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,.58);
    border-radius:10px 0 10px 0;
    background: linear-gradient(180deg, #d92621, var(--red));
    color: #fff;
    display: grid;
    place-items: center;
    align-content: center;
    box-shadow: 0 12px 28px rgba(0,0,0,.34);
    text-transform: uppercase;
    pointer-events: none;
}

.placed-step-badge span {
    font-size: 5px;
    text-transform: uppercase;
    display: none;
    line-height: 1;
    font-weight: 900;
}

.placed-step-badge strong {
    font-size: 12px;
    line-height: .92;
    font-weight: 900;
}

@media (max-height: 700px) {
    .level3-step-card { min-height: 66px; }
    .level3-step-card strong { font-size: 30px; }
    .level3-image-slots { gap: 9px; }
    .drop-hint { font-size: 11px; padding: 6px 8px; }
    .placed-step-badge { width: 70px; height: 60px; }
    .placed-step-badge strong { font-size: 28px; }
}


/* === Update v1.3: error modal contrast + stronger fireworks === */
.modal-card.modal-error {
    background: linear-gradient(180deg, #d4221d, var(--red));
    color: #fff;
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 22px 56px rgba(194,27,23,.42), 0 10px 34px rgba(0,0,0,.34);
}

.modal-card.modal-error p {
    color: #fff;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(0,0,0,.22);
}

.modal-card.modal-error .btn {
    background: #fff;
    color: var(--red);
    border: 1px solid rgba(255,255,255,.92);
    box-shadow: 0 12px 30px rgba(0,0,0,.24);
}

.firework-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 28%, rgba(255,255,255,.52), rgba(255,255,255,.18) 18%, transparent 48%);
    animation: fireworkFlash .52s ease-out forwards;
}

.firework-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    box-shadow: 0 0 12px currentColor, 0 0 22px rgba(255,255,255,.72);
    animation: fireworkBurst 1.05s cubic-bezier(.12,.74,.22,1) forwards;
}

.confetti {
    animation: confettiFall 1.8s ease forwards;
    box-shadow: 0 0 10px rgba(255,255,255,.45);
}

@keyframes fireworkBurst {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(.45);
    }
    10% {
        opacity: 1;
    }
    72% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(.1);
    }
}

@keyframes fireworkFlash {
    0% { opacity: 0; }
    18% { opacity: 1; }
    100% { opacity: 0; }
}


/* === Update v1.5: cursor lifecycle + reliable Level 3 pointer drag === */
#customCursor {
    opacity: 0;
    transition: opacity .12s ease;
}
#customCursor.is-visible {
    opacity: 1;
}
@media (pointer: coarse) {
    #customCursor {
        opacity: 0;
    }
    #customCursor.is-visible {
        opacity: .92;
    }
}
.level3-step-card {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}
.level3-step-card * {
    pointer-events: none;
}
.level3-image-slot.drag-over {
    outline: 3px solid rgba(255,255,255,.92);
    box-shadow: 0 0 0 5px rgba(194,27,23,.36), 0 16px 34px rgba(0,0,0,.26);
}
.level3-drag-ghost {
    position: fixed !important;
    z-index: 9999 !important;
    width: min(30vw, 112px) !important;
    min-height: 74px !important;
    pointer-events: none !important;
    transform: translate(-50%, -50%) scale(1.04) !important;
    opacity: .96 !important;
    box-shadow: 0 20px 48px rgba(0,0,0,.42), 0 0 0 4px rgba(255,255,255,.68) !important;
}


/* === Update v1.6: mobile backgrounds fill the full viewport === */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .bg-blur {
        display: none;
    }

    .bg-main {
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
    }

    .screen-content {
        width: 100vw;
        max-width: none;
        margin: 0;
    }
}

@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .bg-blur {
        display: block;
    }

    .bg-main {
        background-size: contain;
        background-position: center center;
        background-repeat: no-repeat;
    }

    .screen-content {
        width: min(100vw, calc(100dvh * 9 / 16));
        max-width: 520px;
        margin: 0 auto;
    }
}
