/* ═══════════════════════════════════════════
   PRISM 논산 체험 — 게임 오버레이 스타일
   ═══════════════════════════════════════════ */

/* ─── 공통 오버레이 ─────────────────────── */
.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: gameOverlayFadeIn 0.3s ease-out;
}

@keyframes gameOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ─── 시작 팝업 & 결과 카드 ──────────────── */
.game-popup-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    max-width: 28rem;
    width: calc(100% - 2rem);
    text-align: center;
    animation: gameCardSlideUp 0.4s ease-out;
}

@keyframes gameCardSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.game-popup-logo {
    height: 3rem;
    margin: 0 auto 1.5rem;
}

.game-popup-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
}

.game-popup-desc {
    font-size: 0.875rem;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.game-popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ─── 버튼 ───────────────────────────────── */
.game-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
}

.game-btn:active {
    transform: scale(0.97);
}

.game-btn-primary {
    background: #2563eb;
    color: #fff;
}

.game-btn-primary:hover {
    background: #3b82f6;
}

.game-btn-primary:disabled {
    background: #475569;
    cursor: default;
}

.game-btn-secondary {
    background: #334155;
    color: #cbd5e1;
}

.game-btn-secondary:hover {
    background: #475569;
}

/* ─── 미션 HUD ───────────────────────────── */
#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    pointer-events: none;
}

.game-hud-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    pointer-events: auto;
}

.game-hud-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-hud-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(251, 191, 36, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.game-hud-mission-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.game-hud-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e8f0;
}

.game-hud-hint {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ─── 답변 입력 (HUD 가운데) ─────────────── */
.game-hud-center {
    display: flex;
    align-items: center;
}

.game-answer-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid #475569;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
}

.game-answer-label {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
}

.game-answer-input {
    width: 5rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid #475569;
    border-radius: 0.375rem;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    cursor: pointer;
}

.game-answer-input:hover,
.game-answer-input:focus {
    border-color: #3b82f6;
}

.game-answer-btn {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.8rem !important;
    border-radius: 0.375rem !important;
    width: auto !important;
}

/* ─── 숫자패드 드롭다운 ──────────────────── */
.game-numpad-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9700;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 0.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: numpadSlideDown 0.2s ease-out;
}

@keyframes numpadSlideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.game-numpad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.game-numpad-btn {
    padding: 0.5rem 0.6rem;
    border: 2px solid #475569;
    border-radius: 0.4rem;
    background: #334155;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
    white-space: nowrap;
}

.game-numpad-btn:hover {
    background: #475569;
    border-color: #64748b;
    transform: scale(1.05);
}

.game-numpad-btn.selected {
    background: #2563eb;
    border-color: #3b82f6;
    color: #fff;
}

.game-hud-timer {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #f1f5f9;
    font-variant-numeric: tabular-nums;
    min-width: 3.5rem;
    text-align: right;
}

.game-timer-danger {
    color: #ef4444 !important;
    animation: timerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes timerPulse {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* ─── 컷신 오버레이 ──────────────────────── */
.game-cutscene-overlay {
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    z-index: 9500;
    cursor: pointer;
}

.game-cutscene-character {
    position: absolute;
    bottom: 0;
    left: 2rem;
    height: 55%;
    display: flex;
    align-items: flex-end;
}

.game-cutscene-character img {
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

/* 이미지 없을 때 플레이스홀더 사각형 */
.game-cutscene-character img[src=""],
.game-cutscene-character img:not([src]),
.game-cutscene-character img[style*="display: none"],
.game-cutscene-character img[style*="display:none"] {
    display: none !important;
}

.game-cutscene-character:has(img[style*="display: none"])::after,
.game-cutscene-character:has(img[style*="display:none"])::after,
.game-cutscene-character:has(img:not([src]))::after {
    content: '';
    display: block;
    width: 180px;
    height: 260px;
    background: #334155;
    border: 2px dashed #64748b;
    border-radius: 0.75rem;
    position: relative;
}

/* onerror fallback: 이미지 로드 실패 시 */
.game-cutscene-character img.game-char-placeholder {
    display: none !important;
}

.game-cutscene-dialogue-box {
    width: 100%;
    max-width: 40rem;
    margin: 0 1rem 2rem;
    padding: 1.5rem 2rem;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid #475569;
    border-radius: 0.75rem;
    position: relative;
    z-index: 1;
}

.game-cutscene-speaker {
    font-size: 0.875rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 0.5rem;
}

.game-cutscene-text {
    font-size: 1.1rem;
    color: #f1f5f9;
    line-height: 1.7;
    min-height: 2em;
}

.game-cutscene-hint {
    font-size: 0.75rem;
    color: #64748b;
    text-align: right;
    margin-top: 0.75rem;
}

/* ─── 결과 화면 ──────────────────────────── */
.game-result-card {
    max-width: 26rem;
}

.game-result-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.game-result-success {
    color: #34d399;
}

.game-result-timeout {
    color: #f87171;
}

.game-result-score {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 0.25rem;
}

.game-result-detail {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.game-ranking-input {
    margin-bottom: 1.5rem;
}

.game-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #475569;
    border-radius: 0.75rem;
    background: #334155;
    color: #f1f5f9;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 0.75rem;
    outline: none;
    box-sizing: border-box;
}

.game-input:focus {
    border-color: #3b82f6;
}

.game-input::placeholder {
    color: #64748b;
}

.game-ranking-status {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.game-ranking-success {
    color: #34d399;
}

.game-ranking-error {
    color: #f87171;
}

.game-result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ─── 토스트 알림 ────────────────────────── */
.game-toast {
    position: fixed;
    top: 4rem;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.game-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.game-toast-wrong {
    background: #991b1b;
    color: #fecaca;
    border: 1px solid #dc2626;
}

.game-toast-correct {
    background: #065f46;
    color: #a7f3d0;
    border: 1px solid #10b981;
}

/* ─── 서버 카드 영역 하이라이트 ──────────── */
.game-target-area {
    outline: 3px solid #3b82f6;
    outline-offset: 8px;
    border-radius: 1rem;
    animation: gameTargetPulse 2s ease-in-out infinite;
    position: relative;
}

@keyframes gameTargetPulse {
    0%, 100% { outline-color: #3b82f6; box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
    50% { outline-color: #60a5fa; box-shadow: 0 0 20px 4px rgba(59, 130, 246, 0.15); }
}

/* 게임 중 서버 카드 호버 효과 */
.game-target-area .server-card {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.game-target-area .server-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
    border-color: #3b82f6 !important;
}

/* 안내 배너 */
.game-click-guide {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
    color: #93c5fd;
    font-size: 0.85rem;
    font-weight: 500;
    animation: gameGuideSlideDown 0.4s ease-out;
}

.game-click-guide strong {
    color: #60a5fa;
}

.game-click-guide-icon {
    font-size: 1.1rem;
    animation: gameBounce 1s ease-in-out infinite;
}

@keyframes gameBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

@keyframes gameGuideSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── 시나리오 선택 ──────────────────────── */
.game-scenario-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.game-btn-scenario {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.5rem;
    border: 2px solid #475569;
    border-radius: 0.75rem;
    background: #334155;
    color: #e2e8f0;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.game-btn-scenario:hover {
    border-color: #3b82f6;
    background: #3b4f6b;
}

.game-scenario-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.game-scenario-desc {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ─── 스텝 패널 (우하단 고정) ────────────── */
.game-step-panel {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9100;
    animation: gameStepSlideUp 0.3s ease-out;
}

@keyframes gameStepSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-step-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1.25rem;
    min-width: 16rem;
    max-width: 20rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.game-step-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
    text-align: center;
}

.game-step-submit {
    margin-top: 0.75rem;
}

/* ─── GPU 선택 그리드 (4x2) ──────────────── */
.game-gpu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

/* ─── 체크리스트 ─────────────────────────── */
.game-checklist-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.game-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #475569;
    border-radius: 0.5rem;
    background: #334155;
    cursor: pointer;
    transition: all 0.1s;
}

.game-checklist-item:hover {
    background: #3b4f6b;
    border-color: #64748b;
}

.game-checklist-item:has(input:checked) {
    background: rgba(37, 99, 235, 0.2);
    border-color: #3b82f6;
}

.game-checklist-check {
    width: 1rem;
    height: 1rem;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.game-checklist-text {
    font-size: 0.85rem;
    color: #e2e8f0;
    cursor: pointer;
}

/* ─── 반응형 ─────────────────────────────── */
@media (max-width: 640px) {
    .game-cutscene-character {
        left: 0.5rem;
        height: 40%;
    }

    .game-cutscene-dialogue-box {
        margin-bottom: 1rem;
        padding: 1rem 1.25rem;
    }

    .game-cutscene-text {
        font-size: 0.95rem;
    }

    .game-hud-bar {
        padding: 0.4rem 0.75rem;
    }

    .game-hud-text {
        font-size: 0.75rem;
    }
}
