.playgame-section * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.hide {
    display: none !important;
}

.playgame-section {
    position: relative;
    z-index: 1;
    --ui-scale: 1;
    isolation: isolate;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
    touch-action: none;
    font-family: 'PixelFont', -apple-system, sans-serif;
}

#start-screen,
#char-select-screen {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

#start-screen {
    cursor: pointer;
}

#start-image-base,
#start-image-flash,
#char-select-bg,
#console {
    width: min(520px, 92vw, calc(88svh * 1783 / 3350));
    max-width: 100vw;
    max-height: 100svh;
    aspect-ratio: 1783 / 3350;
}

#start-image-base,
#start-image-flash,
#char-select-bg {
    position: absolute;
    left: 50%;
    top: 50%;
    height: auto;
    object-fit: contain;
    transform: translate(-50%, -50%);
}

#start-image-flash {
    animation: flash 1.8s ease-in-out infinite;
}

@keyframes flash {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* ====== 选角界面样式 ====== */
#char-select-screen {
    z-index: 200;
    pointer-events: none;
}

#char-select-bg {
    z-index: -1;
}

.char-ui-container {
    position: absolute;
    left: 50%;
    top: 38%;
    transform: translate(-50%, -50%) scale(var(--char-scale, 1));
    transform-origin: center center;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    pointer-events: auto;
}

.char-card.selected {
    border-color: #8b4513;
    background: rgba(243, 229, 171, 0.4);
    transform: scale(1.1);
}

.char-title {
    font-size: 16px;
    color: #8b4513;
    margin-bottom: 18px;
    font-weight: bold;
    text-align: center;
}

.char-options {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
}

.char-card {
    width: 95px;
    height: 140px;
    border: 3px solid transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.char-card img {
    width: 120px;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
}

@keyframes flashBorder {

    0%,
    100% {
        border-color: #8b4513;
        background: rgba(243, 229, 171, 0.4);
    }

    50% {
        border-color: transparent;
        background: transparent;
    }
}

.char-card.flash-action {
    animation: flashBorder 0.3s ease-in-out 2;
}

#console {
    position: relative;
}

#scene-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
}

#console-shell {
    position: absolute;
    inset: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

#game-screen {
    position: absolute;
    left: 50%;
    top: 53%;
    z-index: 3;
    width: 87%;
    height: 55%;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(1, 255, 0, 0.1);
    transform: translate(-50%, -82.5%);
}

#dark-mask {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.55);
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
    image-rendering: pixelated;
}

#transition-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    background: #000;
    transition: opacity .5s ease-in-out;
}


/* ====== 游戏键位说明：选角后只出现一次 ====== */
#control-guide-screen {
    position: absolute;
    inset: 0;
    z-index: 260;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: transparent;
}

#control-guide-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    pointer-events: none;
}

/* ====== 背包系统 UI 样式 ====== */
#inventory-screen {
    position: absolute;
    inset: 0;
    z-index: 120;
    background: transparent;
    pointer-events: auto;
}

#inv-dialogue-bg {
    position: absolute;
    left: 48%;
    top: 47%;
    z-index: 0;
    width: min(350px, 100%);
    height: auto;
    object-fit: contain;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.inv-avatar-box {
    position: absolute;
    top: 12%;
    left: 10%;
    width: 100px;
    height: 100px;
    z-index: 2;
}

.inv-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

.inv-items-container {
    position: absolute;
    top: 63%;
    left: 7%;
    z-index: 2;
    display: flex;
    transform: scale(0.82);
    transform-origin: center center;
    justify-content: space-around;
}

.inv-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

.inv-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.inv-text {
    font-size: 12px;
    color: #4a2e1b;
    padding: 1px 2px;
    font-weight: bold;
}

#summon-hint {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #8b4513;
    font-weight: bold;
    z-index: 10;
    animation: pulse 1.2s infinite;
    text-align: center;
    width: 100%;
}

#inv-gain-message {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    width: 90%;
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
    color: #8b4513;
    font-weight: bold;
    font-family: 'PixelFont', sans-serif !important;
    pointer-events: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ====== 召唤咖神界面样式 ====== */
#summon-screen {
    position: absolute;
    inset: 0;
    z-index: 150;
    background: #000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#summon-screen.fade-in {
    opacity: 1;
}

#summon-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.2s ease;
}

#summon-content.fade-in {
    opacity: 1;
}

#summon-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#summon-gif-img {
    position: relative;
    z-index: 2;
    width: 95%;
    height: auto;
    object-fit: contain;
}

.summon-text-group {
    position: relative;
    z-index: 2;
    margin-top: 15px;
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.summon-text-group.show {
    opacity: 1;
}

.summon-main-text {
    color: #fff;
    font-size: 18px;
    text-shadow: 1px 1px 3px #000;
    font-weight: bold;
    margin-bottom: 5px;
}

.summon-sub-text {
    color: #ccc;
    font-size: 12px;
}

/* ====== 控制器按钮 (必须处于 20 层以上) ====== */
.touch-btn {
    position: absolute;
    pointer-events: visible;
    z-index: 999;
}

#up {
    left: 17%;
    top: 60%;
    width: 13%;
    height: 10%;
}

#down {
    left: 17%;
    top: 75%;
    width: 13%;
    height: 10%;
}

#left {
    left: 7%;
    top: 70%;
    width: 14%;
    height: 5%;
}

#right {
    left: 26%;
    top: 70%;
    width: 13%;
    height: 5%;
}

#btn-a {
    right: 6%;
    top: 64%;
    width: 13%;
    height: 7%;
}

#btn-b {
    right: 20%;
    top: 70%;
    width: 13%;
    height: 7%;
}

#btn-select {
    left: 35%;
    top: 81%;
    width: 13%;
    height: 7%;
}

#dialogue-extra-img {
    position: absolute;
    z-index: 4;
    width: 58px;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

#dialogue-extra-img.extra-trophy {
    left: 72%;
    top: 88%;
    width: 30px;
}

#dialogue-extra-img.extra-cupcake {
    left: 74%;
    top: 83%;
    width: 30px;
}

#dialogue-container {
    position: absolute;
    inset: 0;
    /* 必须高于召唤界面的 150 */
    z-index: 300;
    overflow: hidden;
    pointer-events: auto;
}

#dialogue-bg {
    position: absolute;
    left: 48%;
    top: 47%;
    z-index: 0;
    width: min(350px, 100%);
    height: auto;
    object-fit: contain;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#close-dialogue,
#name-tag {
    position: absolute;
    z-index: 2;
    color: transparent;
}

#close-dialogue {
    top: 92px;
    right: 34px;
    cursor: pointer;
}

#name-tag {
    top: 94px;
    left: 42px;
    font-size: 10px;
    font-weight: bold;
}

#message-text,
.choice-list {
    position: absolute;
    top: 66%;
    left: 13.5%;
    width: 200px;
    font-family: 'PixelFont', sans-serif !important;
    max-width: 260px;
    color: #2d1b14;
    z-index: 2;
}

#message-text {
    height: 95px;
    overflow: hidden;
    font-size: clamp(14px, 2vw, 15px);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: opacity .12s ease, transform .12s ease;
}

#message-text.page-changing {
    opacity: 0;
    transform: translateY(-6px);
}

#page-next-icon {
    position: absolute;
    right: 13%;
    bottom: 11%;
    z-index: 3;
    width: calc(18px * var(--ui-scale));
    height: calc(18px * var(--ui-scale));
    object-fit: contain;
    pointer-events: none;
    animation: pageIcon 1s ease-in-out infinite;
}

@keyframes pageIcon {

    0%,
    100% {
        opacity: .35;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(2px);
    }
}

#dialogue-container.is-choice-page #message-text,
#dialogue-container.is-choice-page #page-next-icon {
    display: none !important;
}

#dialogue-container.is-choice-page #choices-box {
    display: flex !important;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--ui-scale));
    max-height: calc(128px * var(--ui-scale));
    overflow: hidden;
    z-index: 20;
}

.choice-row {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--ui-scale));
    min-height: calc(20px * var(--ui-scale));
}

.choice-cursor {
    width: calc(14px * var(--ui-scale));
    height: calc(10px * var(--ui-scale));
    object-fit: contain;
    flex-shrink: 0;
}

.choice-text {
    font-size: clamp(14px, 2vw, 15px);
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}




/* ====== PanPan 生日贺图 / 二维码保存图 ====== */
/* ====== PanPan 生日贺图：对话结束后单独展示 ====== */
#birthday-card-screen {
    position: absolute;
    inset: 0;
    z-index: 520;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    pointer-events: auto;
}

#birthday-card-screen.dialogue-backdrop {
    z-index: 240;
    pointer-events: none;
}

#birthday-card-screen.dialogue-backdrop .birthday-card-hint {
    display: none;
}

.birthday-card-panel {
    position: relative;
    width: min(330px, 92%);
    text-align: center;
    pointer-events: auto;
}

#birthday-card-img {
    display: block;
    width: 35%;
    height: auto;
    max-height: 70vh;
    margin: 0 auto;
    object-fit: contain;
    image-rendering: auto;
    pointer-events: auto;
    touch-action: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -webkit-user-drag: auto !important;
    -webkit-touch-callout: default !important;
}

.birthday-card-hint {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #fffaf0;
    font-weight: bold;
    text-align: center;
    font-family: 'PixelFont', sans-serif !important;
}


#qr-card-screen {
    position: absolute;
    inset: 0;
    z-index: 520;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    pointer-events: auto;
}

.qr-card-panel {
    width: min(380px, 92%);
    text-align: center;
    pointer-events: auto;
}

#qr-card-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    image-rendering: auto;
    pointer-events: auto;
    touch-action: auto;
    user-select: auto;
    -webkit-user-select: auto;
    -webkit-user-drag: element;
    -webkit-touch-callout: default;
}

.qr-card-hint {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #8b4513;
    font-weight: bold;
    text-align: center;
    font-family: 'PixelFont', sans-serif !important;
}

/* ====== 咖神结局：昵称 / 分享 / 随机壁纸 ====== */
#summon-ending-screen {
    position: absolute;
    inset: 0;
    z-index: 450;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    color: #4a2e1b;
    font-family: 'PixelFont', sans-serif !important;
}

.summon-ending-panel {
    position: relative;
    width: min(300px, 88%);
    padding: 18px 16px;
    border: 3px solid #8b4513;
    border-radius: 14px;
    background: rgba(255, 245, 220, 0.94);
    box-shadow: 0 4px 0 rgba(74, 46, 27, 0.35);
    text-align: center;
    z-index: 2;
}

.summon-ending-title {
    font-size: clamp(15px, 3vw, 18px);
    line-height: 1.5;
    margin-bottom: 10px;
    font-weight: bold;
}

.summon-ending-desc {
    font-size: clamp(12px, 2.5vw, 14px);
    line-height: 1.45;
    margin-bottom: 12px;
}

#summon-name-input {
    width: 86%;
    height: 34px;
    padding: 4px 8px;
    border: 2px solid #8b4513;
    border-radius: 8px;
    background: #fffaf0;
    color: #4a2e1b;
    font-size: 15px;
    line-height: 1.2;
    text-align: center;
    font-family: 'PixelFont', sans-serif !important;
    user-select: text;
    -webkit-user-select: text;
    touch-action: auto;
    outline: none;
}

.summon-ending-hint {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #8b4513;

}

.summon-ending-choice-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.summon-ending-choice {
    min-width: 76px;
    padding: 8px 10px;
    border: 2px solid #8b4513;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: #4a2e1b;
    font-size: 15px;
    font-family: 'PixelFont', sans-serif !important;
    cursor: pointer;
}

.summon-ending-choice.selected {
    background: #f3e5ab;
    transform: translateY(-2px);
    box-shadow: 0 3px 0 rgba(74, 46, 27, 0.35);
}

.summon-ending-choice.disabled,
.summon-ending-choice:disabled {
    opacity: 0.45;
    filter: grayscale(0.6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

.summon-card-panel {
    position: relative;
    width: min(330px, 92%);
    z-index: 2;
    text-align: center;
}

.summon-card-wrap {
    position: relative;
    width: 100%;
}

.summon-card-wrap img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    image-rendering: auto;
    border-radius: 3px;
    touch-action: auto;
    user-select: auto;
    -webkit-user-select: auto;
    -webkit-user-drag: element;
    -webkit-touch-callout: default;
}

#summon-share-panel {
    position: relative;
    top: 7%;
    left: 0;
}

#summon-share-name {
    position: absolute;
    left: 50%;
    top: 62%;
    transform: translate(-50%, -50%);
    width: 78%;
    color: #4a2e1b;
    font-size: clamp(18px, 5vw, 26px);
    line-height: 1.2;
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.85);
    pointer-events: none;
}


.summon-share-time-label {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #8b4513;
    font-weight: bold;
    text-align: center;
}

.summon-wallpaper-title {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: #fffaf0;
    font-weight: bold;
    text-align: center;
}


#summon-wallpaper-img {
    width: 35%;
    height: 35%;
    display: block;
    margin: 0 auto;
    /* max-height: 30vh; */
    object-fit: contain;
}

@media (max-width: 600px) {
    .summon-ending-panel {
        width: 84%;
        padding: 14px 12px;
    }

    .summon-ending-choice-row {
        gap: 12px;
    }

    .summon-ending-choice {
        min-width: 76px;
        font-size: 13px;
        padding: 7px 8px;
    }
}

@font-face {
    font-family: 'PixelFont';
    src: url('../static/fonts/fusion-pixel.woff2') format('woff2');
    font-display: swap;
}

.site-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 99999;
    width: 100%;
    padding: 6px 0;
    text-align: center;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.85);
}

.site-footer a {
    color: #999;
    text-decoration: none;
}

.site-footer a:hover {
    color: #666;
}
