/* 双人作战 · 游戏通用样式 */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: #06080f;
    color: #e8ecff;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    overflow: hidden;
}

body { display: flex; flex-direction: column; }

.stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background:
        radial-gradient(700px 400px at 12% 0%, rgba(51, 225, 255, .08), transparent 70%),
        radial-gradient(700px 420px at 88% 8%, rgba(255, 77, 157, .08), transparent 70%),
        #06080f;
}

.stage canvas {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
    background: #0a0f1c;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .07) inset;
    touch-action: none;
}

canvas:focus { outline: none; }

/* 结束面板 */
.duo-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 7, 14, .82);
    backdrop-filter: blur(10px);
    animation: duo-fade .25s ease;
}

.duo-card {
    width: min(430px, 88vw);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    background: linear-gradient(180deg, #131a2c, #0b0f1a);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .75);
    animation: duo-pop .32s cubic-bezier(.2, 1.4, .4, 1);
}

.duo-badge {
    font-size: 11px;
    letter-spacing: 3px;
    color: #8b93b0;
    margin-bottom: 10px;
}

.duo-title {
    font-size: clamp(28px, 6vw, 40px);
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.duo-card.p1 .duo-title { color: #33e1ff; text-shadow: 0 0 26px rgba(51, 225, 255, .55); }
.duo-card.p2 .duo-title { color: #ff4d9d; text-shadow: 0 0 26px rgba(255, 77, 157, .55); }
.duo-card.draw .duo-title { color: #ffd166; text-shadow: 0 0 26px rgba(255, 209, 102, .45); }

.duo-sub {
    color: #c9d2ff;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.duo-detail {
    color: #8b93b0;
    font-size: 13px;
    line-height: 1.7;
    margin-top: 8px;
}

.duo-btns {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.duo-btns button {
    flex: 1;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #04121a;
    background: linear-gradient(90deg, #33e1ff, #7c5cff);
}

.duo-btns button:hover { filter: brightness(1.1); }

.duo-btns .ghost {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #e8ecff;
}

.duo-hint {
    margin-top: 12px;
    font-size: 11px;
    color: #6b7490;
}

@keyframes duo-fade { from { opacity: 0; } }
@keyframes duo-pop { from { transform: scale(.92); opacity: 0; } }

/* ---------- 手机端双人虚拟手柄 ---------- */
.duo-touch {
    position: fixed;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    --sz: clamp(40px, 9.5vmin, 66px);
    --gap: 6px;
}

.duo-pad {
    position: absolute;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.duo-pad-left { left: calc(10px + env(safe-area-inset-left, 0px)); }
.duo-pad-right { right: calc(10px + env(safe-area-inset-right, 0px)); flex-direction: row-reverse; }

.duo-dpad {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, var(--sz));
    grid-template-rows: repeat(3, var(--sz));
    gap: var(--gap);
}

.duo-dir,
.duo-act {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(14, 21, 38, .58);
    color: rgba(232, 236, 255, .88);
    border-radius: 12px;
    font-size: calc(var(--sz) * .32);
    line-height: 1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background .08s, transform .08s;
}

.duo-pad-left .duo-dir { box-shadow: 0 0 0 1px rgba(51, 225, 255, .2); }
.duo-pad-right .duo-dir { box-shadow: 0 0 0 1px rgba(255, 77, 157, .2); }

.duo-dir.on,
.duo-act.on { transform: scale(.96); }
.duo-pad-left .duo-dir.on, .duo-pad-left .duo-act.on { background: rgba(51, 225, 255, .5); }
.duo-pad-right .duo-dir.on, .duo-pad-right .duo-act.on { background: rgba(255, 77, 157, .5); }

.duo-dir.up { grid-area: 1 / 2; }
.duo-dir.left { grid-area: 2 / 1; }
.duo-dir.right { grid-area: 2 / 3; }
.duo-dir.down { grid-area: 3 / 2; }

.duo-tag {
    grid-area: 2 / 2;
    align-self: center;
    justify-self: center;
    font-size: calc(var(--sz) * .22);
    letter-spacing: 1px;
    color: rgba(139, 147, 176, .85);
    pointer-events: none;
}

.duo-act {
    width: calc(var(--sz) * 1.16);
    height: calc(var(--sz) * 1.16);
    border-radius: 50%;
    font-size: calc(var(--sz) * .25);
}
.duo-pad-left .duo-act { background: rgba(51, 225, 255, .2); }
.duo-pad-right .duo-act { background: rgba(255, 77, 157, .2); }

.duo-rotate {
    position: fixed;
    left: 50%;
    top: calc(8px + env(safe-area-inset-top, 0px));
    transform: translateX(-50%);
    z-index: 31;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(10, 15, 28, .88);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #c9d2ff;
    font-size: 12px;
    pointer-events: none;
}
