/* ===== Refined QR Scanner UI ===== */
.qr-scan-modal .qr-modal-full {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    background: #000 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.qr-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    transition: background 0.2s;
}

.qr-close-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.qr-close-btn svg {
    width: 24px;
    height: 24px;
}

.qr-scanner-view {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
}

#qr-reader {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    position: relative !important;
    background: #000 !important;
    /* Critical for absolute children */
}

#qr-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    top: 0;
    left: 0;
    z-index: 1 !important;
}

/* Hide only noisy default areas; keep camera controls available as fallback */
#qr-reader input[type="file"],
#qr-reader__dashboard_section_swaplink,
#qr-reader__status_span {
    display: none !important;
}

#qr-reader__dashboard {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 140px;
    z-index: 30;
    text-align: center;
}

#qr-reader__dashboard button,
#qr-reader__dashboard select {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(15, 23, 42, 0.8);
    color: #f8fafc;
    padding: 8px 12px;
    margin: 0 4px;
}

/* Hide ONLY the library's default viewfinder/shaded region */
#qr-shaded-region {
    display: none !important;
}

.qr-viewfinder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Semi-transparent overlay to emphasize the viewfinder box */
.qr-viewfinder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    clip-path: polygon(0% 0%, 0% 100%,
            calc(50% - 130px) 100%,
            calc(50% - 130px) calc(50% - 130px),
            calc(50% + 130px) calc(50% - 130px),
            calc(50% + 130px) calc(50% + 130px),
            calc(50% - 130px) calc(50% + 130px),
            calc(50% - 130px) 100%,
            100% 100%, 100% 0%);
}

.qr-viewfinder-box {
    width: 250px;
    height: 250px;
    position: relative;
    box-sizing: border-box;
}

.qr-viewfinder-box .corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #00bcd4;
}

.corner.top-left {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.corner.top-right {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.corner.bottom-left {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.corner.bottom-right {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.qr-scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
    animation: scanLineMove 2s infinite ease-in-out;
}

@keyframes scanLineMove {
    0% {
        top: 5%;
    }

    50% {
        top: 95%;
    }

    100% {
        top: 5%;
    }
}

.qr-scan-hint {
    position: absolute;
    bottom: 80px;
    width: 100%;
    color: white;
    text-align: center;
    z-index: 20;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.qr-scan-hint p {
    margin: 5px 0;
    font-weight: 500;
    font-size: 0.95rem;
}

.qr-scan-hint .sub-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.qr-camera-error {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    text-align: center;
    background: rgba(2, 6, 23, 0.75);
    color: #f8fafc;
}

.qr-camera-error-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.qr-camera-error-desc {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.qr-camera-retry-btn {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    padding: 0.65rem 1rem;
    font-weight: 700;
}

/* ===== Result View (Refined & Balanced) ===== */
.qr-result-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    background: radial-gradient(circle at 50% 0%, #1e293b 0%, #020617 100%);
    z-index: 150;
    display: flex;
    flex-direction: column;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* Glassmorphism Header */
.qr-res-header {
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.qr-res-title {
    font-size: 1.15rem;
    font-weight: 700;
    flex: 1;
    text-align: center;
    color: #f8fafc;
}

.qr-header-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.qr-res-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 0.5rem;
    color: #cbd5e1;
}

/* Draw Info Card (Horizontal) */
.qr-draw-info-card {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.qr-draw-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.6rem;
}

.qr-draw-title {
    font-weight: 600;
}

.qr-draw-number {
    color: #fca5a5;
    /* Light red highlight */
    font-weight: 700;
}

.qr-win-numbers-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Winning Balls (Top Section) */
.qr-win-ball {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: #475569;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.qr-plus-small {
    font-size: 1rem;
    color: #94a3b8;
    margin: 0 2px;
}

/* Verdict Icon Style */
.qr-verdict-icon {
    font-size: 2rem;
    animation: bounce 2s infinite;
}

/* Verdict Card - Compact */
.qr-verdict-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.qr-verdict-main {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.3;
}

.qr-verdict-win {
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.3);
}

.qr-verdict-fail {
    color: #f87171;
}

/* Games List - Compact Card Style */
.qr-games-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.qr-game-row {
    background: rgba(30, 41, 59, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.qr-game-row:hover {
    background: rgba(30, 41, 59, 0.6);
}

.qr-game-row td {
    padding: 0.65rem 0.4rem;
    vertical-align: middle;
}

.qr-game-row td:first-child {
    padding-left: 0.9rem;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.qr-game-row td:last-child {
    padding-right: 0.9rem;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.qr-col-id {
    font-weight: 700;
    font-size: 1rem;
    color: #94a3b8;
    width: 40px;
}

.qr-col-rank {
    width: 70px;
    text-align: left;
}

.qr-game-rank-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-weight: 600;
    white-space: nowrap;
}

.qr-game-rank-badge.win {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.2);
}

/* Balls Container - Compact */
.qr-res-balls {
    display: flex;
    gap: 4px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.qr-res-ball {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: #475569;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Vibrant Flat Colors */
/* Vibrant Flat Colors for BOTH result balls and win balls */
.qr-res-ball.ball-10,
.qr-win-ball.ball-10 {
    background: #fbbd23 !important;
    color: #1e293b !important;
}

.qr-res-ball.ball-20,
.qr-win-ball.ball-20 {
    background: #3b82f6 !important;
}

.qr-res-ball.ball-30,
.qr-win-ball.ball-30 {
    background: #f43f5e !important;
}

.qr-res-ball.ball-40,
.qr-win-ball.ball-40 {
    background: #94a3b8 !important;
}

.qr-res-ball.ball-45,
.qr-win-ball.ball-45 {
    background: #22c55e !important;
}

/* No Match Style - Subtle */
.qr-res-ball.no-match {
    background: rgba(255, 255, 255, 0.04) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Footer & Button */
.qr-res-footer {
    padding: 1rem 1.5rem 1.5rem;
    background: rgba(2, 6, 23, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.qr-res-footer .action-btn {
    width: 100%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 0.9rem;
    border-radius: 12px;
    font-weight: 700;
    border: none;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Notice Section - Compact */
.qr-notice-section {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.qr-notice-section li {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.3rem;
    position: relative;
    padding-left: 0.9rem;
    line-height: 1.4;
}

.qr-notice-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #6366f1;
}