/* Ghost Battle surfaces are isolated here so the base game theme stays intact. */

#scene-game {
    position: relative;
}

.ghost-picker {
    position: absolute;
    z-index: 20;
    top: 50%;
    left: 50%;
    width: min(540px, calc(100% - 2rem));
    max-height: min(620px, calc(100% - 2rem));
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    overflow: hidden;
    padding: 1rem;
    border: 1px solid rgba(114, 242, 164, 0.62);
    border-radius: 7px;
    background: rgba(3, 12, 20, 0.96);
    box-shadow: 0 0 24px rgba(114, 242, 164, 0.2), 0 24px 70px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(18px);
}

.ghost-picker h2 {
    margin: 0;
    color: var(--accent-green, #72f2a4);
    font-size: 1.2rem;
    text-align: center;
}

.ghost-picker-subtitle,
.ghost-picker-hint {
    margin: 0;
    color: var(--text-dim, #597477);
    font-size: 0.65rem;
    text-align: center;
}

.ghost-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
    overflow-y: auto;
}

.ghost-picker-item {
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(141, 255, 225, 0.12);
    border-radius: 5px;
    color: var(--text-primary, #effffb);
    background: rgba(9, 27, 36, 0.78);
    cursor: pointer;
    text-align: left;
}

.ghost-picker-item:hover,
.ghost-picker-item.selected {
    border-color: var(--accent-green, #72f2a4);
    color: var(--accent-green, #72f2a4);
    background: rgba(114, 242, 164, 0.1);
    box-shadow: inset 3px 0 0 var(--accent-green, #72f2a4);
}

.ghost-picker-name {
    min-width: 0;
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ghost-picker-meta {
    color: var(--text-secondary, #9bbcb8);
    font-size: 0.62rem;
    text-align: right;
}

.ghost-result-card {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.25rem 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(141, 255, 225, 0.2);
    border-radius: 6px;
    background: rgba(8, 22, 30, 0.76);
    text-align: left;
    backdrop-filter: blur(12px);
}

.ghost-result-card strong {
    grid-column: 2;
    grid-row: 1;
    color: var(--accent-green, #72f2a4);
    font-size: 1.05rem;
}

.ghost-result-card > span:last-child {
    grid-column: 2;
    color: var(--text-secondary, #9bbcb8);
    font-size: 0.68rem;
}

.ghost-result-kicker {
    grid-row: 1 / span 2;
    color: var(--text-dim, #597477);
    font-size: 0.6rem;
    font-weight: 700;
}

.ghost-result-lost,
.ghost-result-tied {
    border-color: rgba(255, 114, 189, 0.34);
}

.ghost-result-lost strong,
.ghost-result-tied strong {
    color: var(--accent-magenta, #ff72bd);
}

.ghost-result-recorded strong {
    color: #8ec9ff;
}

.ghost-effects {
    position: fixed;
    z-index: 90;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.ghost-confetti,
.ghost-sad-face {
    position: absolute;
    top: -12vh;
    display: block;
    will-change: transform, opacity;
}

.ghost-confetti {
    width: 9px;
    height: 16px;
    border-radius: 2px;
    animation: ghost-confetti-fall 3.5s linear infinite;
}

.ghost-sad-face {
    font-family: "Segoe UI Emoji", sans-serif;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    filter: drop-shadow(0 0 7px rgba(255, 114, 189, 0.45));
    animation: ghost-sad-fall 4.2s linear infinite;
}

@keyframes ghost-confetti-fall {
    0% { transform: translate3d(0, -12vh, 0) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translate3d(6vw, 116vh, 0) rotate(760deg); opacity: 0.85; }
}

@keyframes ghost-sad-fall {
    0% { transform: translate3d(0, -12vh, 0) rotate(-8deg); opacity: 0; }
    12% { opacity: 0.95; }
    100% { transform: translate3d(-4vw, 116vh, 0) rotate(24deg); opacity: 0.55; }
}

@media (max-width: 600px) {
    .ghost-picker {
        padding: 0.75rem;
    }

    .ghost-picker-item {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .ghost-picker-meta {
        text-align: left;
    }

    .ghost-result-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .ghost-result-kicker,
    .ghost-result-card strong,
    .ghost-result-card > span:last-child {
        grid-column: 1;
        grid-row: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ghost-confetti,
    .ghost-sad-face {
        animation-duration: 8s;
    }
}
