/* Core CSS Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg-dark: #090d16;
    --primary-blue: #2563eb;
    --light-blue: #38bdf8;
    --neon-green: #10b981;
    --neon-red: #ef4444;
    --accent-yellow: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background Animated Gradient Glow */
.bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, rgba(56, 189, 248, 0.15) 50%, rgba(9, 13, 22, 0) 75%);
    transform: translate(-50%, -50%);
    filter: blur(60px);
    pointer-events: none;
    z-index: 1;
    transition: background 0.5s ease;
}

body.success-flash .bg-glow {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.5) 0%, rgba(52, 211, 153, 0.2) 50%, rgba(9, 13, 22, 0) 75%);
}

body.fail-flash .bg-glow {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.6) 0%, rgba(248, 113, 113, 0.2) 50%, rgba(9, 13, 22, 0) 75%);
}

body.fail-flash {
    animation: screenShake 0.4s ease-in-out;
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-12px) translateY(4px); }
    40% { transform: translateX(12px) translateY(-4px); }
    60% { transform: translateX(-8px) translateY(2px); }
    80% { transform: translateX(8px) translateY(-2px); }
}

/* Main Container */
.game-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 540px;
    height: 100vh;
    max-height: 860px;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

/* Scoreboard Header */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.85rem 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #94a3b8;
    text-transform: uppercase;
}

.score-value {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
    margin-top: 0.2rem;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.player-card .score-value {
    background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.guy-card .score-value {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.vs-badge {
    font-weight: 900;
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Arena */
.arena {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 1rem;
    width: 100%;
}

/* Guy Container & Speech Bubble */
.guy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

.speech-bubble {
    position: relative;
    background: #ffffff;
    color: #0f172a;
    padding: 1.25rem 2rem;
    border-radius: 24px;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    margin-bottom: 1.5rem;
    min-width: 260px;
    max-width: 90%;
    transition: transform 0.2s ease, background 0.3s ease;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 14px 14px 0;
    border-style: solid;
    border-color: #ffffff transparent;
    display: block;
    width: 0;
}

.speech-bubble.povedz-lod {
    background: #fef08a;
    color: #854d0e;
}

.speech-bubble.povedz-lod::after {
    border-color: #fef08a transparent;
}

.speech-bubble.success-state {
    background: #d1fae5;
    color: #065f46;
}

.speech-bubble.success-state::after {
    border-color: #d1fae5 transparent;
}

.speech-bubble.fail-state {
    background: #fee2e2;
    color: #991b1b;
}

.speech-bubble.fail-state::after {
    border-color: #fee2e2 transparent;
}

/* Timer Bar in Bubble */
.timer-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    margin-top: 0.6rem;
    overflow: hidden;
    display: none;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
    border-radius: 999px;
    transform-origin: left;
}

/* Avatar Frame */
.avatar-frame {
    position: relative;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: 4px solid var(--glass-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(56, 189, 248, 0.2);
    overflow: hidden;
    background: #111;
}

.guy-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.guy-img.active {
    display: block;
}

/* Target Button "NEPOVIEM!" - Random Positioning Support */
.nepoviem-btn {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 2.2rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 3px solid #6ee7b7;
    border-radius: 28px;
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.5),
                0 0 25px rgba(16, 185, 129, 0.7);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.2s ease;
    z-index: 50;
}

.nepoviem-btn.visible {
    opacity: 1;
    visibility: visible;
    animation: pulseButton 0.8s infinite alternate;
}

@keyframes pulseButton {
    0% { transform: scale(1); box-shadow: 0 15px 35px rgba(16, 185, 129, 0.5); }
    100% { transform: scale(1.08); box-shadow: 0 20px 45px rgba(16, 185, 129, 0.8); }
}

.nepoviem-btn:active {
    transform: scale(0.92) !important;
}

.btn-text {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-sub {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.9;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    padding: 2.5rem 2rem;
    width: 90%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.modal-title {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(180deg, #ffffff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.modal-desc {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 2rem;
}

.cta-btn {
    width: 100%;
    padding: 1.1rem 2rem;
    font-family: var(--font-family);
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: 2px solid #60a5fa;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.6);
}

.cta-btn:active {
    transform: translateY(1px);
}

/* Game Over Card Details */
.result-img-container {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 1.2rem;
    position: relative;
}

.result-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.result-img.active {
    display: block;
}

.result-title {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.result-desc {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.final-score {
    font-size: 1.25rem;
    font-weight: 800;
    color: #38bdf8;
    margin-bottom: 1.8rem;
}
