@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.45);
    --accent: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.4);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.35);
    --warn: #f59e0b;
    --bg-dark: #090a0f;
    --glass-bg: rgba(15, 18, 26, 0.82);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text-main: #f3f4f6;
    --text-dim: #9ca3af;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-premium: 0 12px 40px rgba(0,0,0,0.65);
}

body, html {
    margin: 0; padding: 0; height: 100%;
    font-family: 'Outfit', -apple-system, sans-serif;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-main);
    user-select: none;
}

#video-wrap { position:absolute; inset:0; z-index:1; background:#000; }
#video-background { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }

/* ================= UTILS & GLASSMORPHISM ================= */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
}

.animate-pop {
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ================= HEADER & CONTROLS ================= */
#main-header {
    position: fixed; top: 16px; left: 16px; right: 16px;
    height: 64px; z-index: 10000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; border-radius: 40px;
    gap: 16px; transition: 0.3s;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.user-badge {
    padding: 6px 14px; border-radius: 20px;
    font-weight: 600; font-size: 13px;
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border);
    color: #fff;
}
.avatar-icon { display: flex; align-items: center; justify-content: center; opacity: 0.85; }
#display-username { color: white; font-weight: 700; }
.logout-btn { 
    background: rgba(255,255,255,0.1); border: none; color: #ef4444; 
    font-size: 13px; cursor: pointer; margin-left: 6px;
    width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: 0.2s;
}
.logout-btn:hover { background: rgba(239, 68, 68, 0.25); }

.btn-login {
    background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border);
    color: #fff; padding: 7px 16px; border-radius: 20px; font-weight: 600; font-size: 12px;
    cursor: pointer; transition: 0.2s;
}
.btn-login:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.25); }

#game-category {
    background: rgba(255,255,255,0.08); color: white; border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 7px 16px; font-size: 13px; font-weight: 600;
    backdrop-filter: blur(8px); cursor: pointer; outline: none; transition: 0.2s;
}
#game-category:hover { background: rgba(255,255,255,0.14); }

.player-controls {
    display: flex; align-items: center; gap: 14px; flex: 1; justify-content: flex-end;
}

/* Playback Control Bar */
.video-playback-ctrls {
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,0.45); padding: 4px 6px; border-radius: 30px;
    border: 1px solid var(--glass-border);
}

.playback-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: #e5e7eb; cursor: pointer;
    border-radius: 50%; transition: 0.2s;
}
.playback-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

.playback-btn .btn-subtext {
    font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}

.playback-btn.play-pause {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; font-size: 18px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}
.playback-btn.play-pause:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.6);
}

/* Speed Cluster */
.speed-cluster {
    display: flex; align-items: center; gap: 2px;
    background: rgba(0,0,0,0.45); padding: 4px; border-radius: 20px;
    border: 1px solid var(--glass-border);
}
.spd-pill {
    background: transparent; border: none; color: #9ca3af;
    padding: 5px 9px; border-radius: 14px; font-size: 11px; font-weight: 700;
    cursor: pointer; transition: 0.2s;
}
.spd-pill:hover { color: #fff; background: rgba(255,255,255,0.08); }
.spd-pill.active {
    background: #3b82f6; color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Primary Action Buttons */
.primary-actions { display: flex; align-items: center; gap: 8px; }

.btn-report {
    background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171; padding: 8px 14px; border-radius: 20px; cursor: pointer;
    font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px;
    transition: 0.2s;
}
.btn-report:hover {
    background: rgba(239, 68, 68, 0.22); border-color: rgba(239, 68, 68, 0.6); color: #fff;
}

.btn-skip {
    background: linear-gradient(135deg, #ec4899, #be185d);
    color: white; padding: 8px 18px; border-radius: 20px;
    font-weight: 800; font-size: 12px; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
    transition: 0.2s;
}
.btn-skip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.55);
}

/* ================= VIDEOS & OVERLAYS ================= */
/* Barra inferior densa para cobrir totalmente legendas */
#yt-bottom-mask {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 165px;
    z-index: 6; 
    background: linear-gradient(to top, #000 65%, rgba(0,0,0,0.92) 82%, transparent 100%);
    display: flex; align-items: flex-end; justify-content: center; padding-bottom: 24px;
    pointer-events: none;
}
.mask-brand {
    font-weight: 800; font-size: 13px; letter-spacing: 4px; color: rgba(255,255,255,0.35);
    text-transform: uppercase;
}

#yt-top-mask {
    position: absolute; top: 0; left: 0; width: 100%; height: 86px;
    z-index: 6; background: #000;
}

.video-overlay {
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.4) 100%);
    pointer-events: auto;
}

/* ================= MAP TOGGLES ================= */
#hint-toggle, #rank-toggle, #map-toggle {
    position: fixed; bottom: 28px;
    width: 58px; height: 58px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; z-index: 9005; cursor: pointer;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#hint-toggle {
    left: 28px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

#rank-toggle {
    left: 98px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

#map-toggle {
    left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.45);
    width: 80px; height: 80px; font-size: 32px;
}

#hint-toggle:hover, #rank-toggle:hover { transform: scale(1.08); }
#map-toggle:hover { transform: translateX(-50%) scale(1.08); }

/* ================= MODALS & WINDOWS ================= */
.modal, #login-modal, #report-modal, #guess-modal, #result-modal, #rank-modal, #hint-modal, #profile-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    z-index: 11000; display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
}

.modal-box {
    background: #11141d; border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 24px;
    box-shadow: var(--shadow-premium);
    position: relative; z-index: 11001;
}

.window-header {
    height: 48px; background: rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; font-weight: 700; font-size: 15px;
    border-bottom: 1px solid var(--glass-border);
}
.close-x { cursor: pointer; font-size: 20px; color: var(--text-dim); transition: 0.2s; }
.close-x:hover { color: #fff; }

.game-window {
    width: min(1000px, 94vw); height: min(680px, 86vh);
    background: #11141d; border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); z-index: 11001;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-premium);
    position: relative;
}

.window-content { flex: 1; background: #1a1d28; position: relative; }
.window-footer {
    background: #0f121a; padding: 14px 20px;
    border-top: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}

/* Report Reasons Radio List */
.report-reasons { display: flex; flex-direction: column; gap: 8px; }
.reason-option {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13px;
    transition: 0.2s;
}
.reason-option:hover { background: rgba(255,255,255,0.08); }
.reason-option input[type=radio] { accent-color: #ef4444; width: 16px; height: 16px; margin: 0; }

/* ================= BUTTONS & INPUTS ================= */
.btn {
    padding: 10px 20px; border-radius: 12px; border: none;
    font-weight: 700; cursor: pointer; transition: 0.2s;
    font-size: 13px; font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-guess {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white; box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-guess:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--accent-glow); }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.btn-close {
    background: rgba(255,255,255,0.06); color: #e5e7eb;
    border: 1px solid var(--glass-border);
}
.btn-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

input[type=text], input[type=password] {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px; padding: 12px;
    color: white; font-family: inherit; font-size: 13px;
    width: 100%; box-sizing: border-box; outline: none;
}
input[type=text]:focus, input[type=password]:focus {
    border-color: var(--primary); background: rgba(255,255,255,0.08);
}

/* ================= TOAST ================= */
#toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.95); color: #fff; padding: 12px 24px;
    border-radius: 30px; z-index: 20000; display: none;
    border: 1px solid var(--glass-border); backdrop-filter: blur(12px);
    font-weight: 600; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#toast.show { display: block; animation: fadeInUp 0.3s forwards; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translate(-50%, 15px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ================= RANKING TABS ================= */
.rank-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn {
    flex: 1; padding: 8px 12px; background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border); border-radius: 10px;
    color: var(--text-dim); font-weight: 700; font-size: 13px; cursor: pointer;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.rank-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.rank-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: rgba(255,255,255,0.04);
    border-radius: 10px; font-size: 13px; font-weight: 600;
}

/* ================= MOBILE ADAPTATIONS ================= */
@media (max-width: 768px) {
    #main-header {
        top: 0; left: 0; right: 0; border-radius: 0;
        height: auto; padding: 10px 14px; flex-direction: column;
        gap: 10px; border-top: none; border-left: none; border-right: none;
    }
    .header-left { width: 100%; justify-content: space-between; }
    .player-controls { width: 100%; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
    .speed-cluster { order: 3; width: 100%; justify-content: center; }
    .video-playback-ctrls { flex: 1; justify-content: center; }
    .primary-actions { gap: 6px; }
    #yt-bottom-mask { height: 130px; }
    #hint-toggle { width: 48px; height: 48px; bottom: 20px; left: 16px; font-size: 20px; }
    #rank-toggle { width: 48px; height: 48px; bottom: 20px; left: 74px; font-size: 20px; }
    #map-toggle { width: 68px; height: 68px; bottom: 20px; font-size: 28px; }
}
