/* Frogames Gamification Hub Styles */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;500;700;900&display=swap');

:root {
    /* Frogames Brand Colors */
    --primary: #449cb9;
    --primary-dark: #2a7a94;
    --primary-glow: rgba(68, 156, 185, 0.5);

    --secondary: #2dd4bf;
    --accent: #f472b6;
    --warning: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;

    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(68, 156, 185, 0.3);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

/* =========================================
   WIDGET STYLES
   ========================================= */

/* Reset Box Sizing inside the widget to prevent overflow */
.gh-modal-overlay * {
    box-sizing: border-box;
}

/* FAB (Floating Action Button) */
.curiosity-fab {
    position: fixed !important;
    top: 120px !important;
    right: 60px !important;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--primary), var(--primary-dark));
    box-shadow:
        0 10px 25px -5px var(--primary-glow),
        inset 0 0 15px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: float 6s ease-in-out infinite;
}

.curiosity-fab:hover {
    transform: scale(1.15) rotate(-5deg);
}

.curiosity-fab svg {
    color: white;
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.5s ease;
}

.curiosity-fab:hover svg {
    transform: rotate(360deg);
}

/* MODAL OVERLAY */
.gh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* MODAL OVERLAY */
.gh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.gh-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* MAIN CARD */
.gh-card {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 90%;
    max-width: 850px;
    /* Wider for menu */
    min-height: 450px;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gh-modal-overlay.open .gh-card {
    transform: scale(1) translateY(0);
}

/* HEADER */
.gh-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    /* For absolute centering of title */
}

.gh-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.gh-title svg {
    color: var(--primary);
}

.gh-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    margin-left: auto;
    /* Push to right if needed */
    z-index: 2;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    /* margin-right: auto; Removed auto margin to not conflict with centering */
    z-index: 2;
}

.gh-close-btn:hover,
.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* CONTENT AREA */
.gh-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* For transitions */
    width: 100%;
}

.gh-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    box-sizing: border-box;
    /* Ensure padding doesn't overflow width */
}

.gh-view.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
    position: relative;
    /* Let it flow */
}

/* === MENU VIEW === */
.gh-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
}

.gh-menu-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.gh-menu-item:hover {
    transform: translateY(-5px) scale(1.05);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.gh-menu-item h3 {
    font-size: 1.1rem;
    margin: 0;
    color: white;
    font-weight: 600;
}

.gh-menu-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.3;
}

/* === BUG HUNTER STYLES === */
.bug-game-container {
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bug {
    position: absolute;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.1s;
    animation: jitter 0.5s infinite;
}

.bug:active {
    transform: scale(0.8);
}

@keyframes jitter {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(2px, 2px) rotate(5deg);
    }

    50% {
        transform: translate(0, 0) rotate(0deg);
    }

    75% {
        transform: translate(-2px, 2px) rotate(-5deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* === MEMORY MATCH STYLES === */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(100px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
}

.memory-card {
    aspect-ratio: 1;
    perspective: 1000px;
    cursor: pointer;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
    opacity: 0.5;
}

.memory-front,
.memory-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.memory-front {
    background: linear-gradient(135deg, var(--bg-dark), #1e293b);
    color: var(--primary);
}

.memory-back {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    transform: rotateY(180deg);
}

/* === COOKIE VIEW === */
.cookie-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.cookie-icon {
    color: white;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 2rem;
    background: rgba(68, 156, 185, 0.15);
    color: var(--primary);
    border: 1px solid rgba(68, 156, 185, 0.3);
}

.score-badge {
    background: rgba(68, 156, 185, 0.15);
    color: var(--primary);
    border: 1px solid rgba(68, 156, 185, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
}

.fact-text {
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1.5;
    margin-bottom: 2.5rem;
    color: #f8fafc !important;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

/* Fixed mismatched class name from .btn-control to .btn-nav */
.btn-nav {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-nav:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.click-hint {
    position: absolute;
    bottom: 1rem;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0.8;
}

.trivial-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    overflow-y: auto;
    /* Allow scrolling if text is too long */
    padding-bottom: 2rem;
}

.trivial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5rem;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
}

.progress-text {
    margin-left: auto;
}

.trivial-timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.trivial-timer-fill {
    height: 100%;
    background: var(--warning);
    width: 100%;
    transition: width 1s linear;
}

.trivial-question {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: white;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.trivial-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    width: 100%;
}

.btn-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.btn-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-option.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.btn-option.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    color: var(--danger);
    opacity: 0.6;
}

.trivial-start,
.trivial-end {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1.5rem;
    color: white;
    /* Ensure text is visible */
}

.trivial-start h3,
.trivial-end h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

/* === CARDS VIEW === */
.cards-container {
    width: 100%;
    height: 100%;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Context for controls */
}

.flashcard {
    width: 100%;
    max-width: 400px;
    height: 250px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    cursor: pointer;
    margin-bottom: 2rem;
    z-index: 10;
    /* Ensure card is above background but allow controls */
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-front {
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

.card-back {
    background: linear-gradient(135deg, var(--primary-dark), #1e293b);
    transform: rotateY(180deg);
}

.card-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.card-text {
    font-size: 1.3rem;
    color: white;
    line-height: 1.5;
    overflow-y: auto;
    /* Scroll if text is huge */
    max-height: 100%;
    scrollbar-width: thin;
}

.card-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    position: relative;
    z-index: 20;
    /* Higher than card to ensure clickability */
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    /* Slight contrast */
    border-radius: 50px;
}



.score-big {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
}

/* === GENERAL UTILS === */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* === CODE BREAKER STYLES === */
.breaker-board {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 350px;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    /* Space for controls */
    max-height: 280px;
    overflow-y: auto;
}

.breaker-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.breaker-row.active {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.breaker-inputs {
    display: flex;
    gap: 0.5rem;
}

.breaker-slot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.1s;
}

.breaker-row.active .breaker-slot:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.breaker-feedback {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-left: auto;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.feedback-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.feedback-dot.correct {
    background: var(--success);
    box-shadow: 0 0 5px var(--success);
}

.feedback-dot.close {
    background: var(--warning);
    box-shadow: 0 0 5px var(--warning);
}

.breaker-controls {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    width: 100%;
    padding-top: 1rem;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.selected {
    border-color: white;
    transform: scale(1.1);
}

/* Colors */
.cb-red {
    background: #ef4444;
}

.cb-blue {
    background: #3b82f6;
}

.cb-green {
    background: #10b981;
}

.cb-yellow {
    background: #f59e0b;
}

.cb-purple {
    background: #8b5cf6;
}

.cb-cyan {
    background: #06b6d4;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(calc(-50% - 10px));
    }
}