/* ==========================================================================
   Little Chats - Conversation Starter Cards for Kids
   A tap-to-reveal question card game for families
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800&display=swap');

/* --------------------------------------------------------------------------
   Hide shared template elements not used by this game
   -------------------------------------------------------------------------- */
#btn-account,
#btn-stats,
#btn-leaderboard,
#btn-help,
.language-selector {
    display: none !important;
}

.game-header {
    background: transparent !important;
    border-bottom: none !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
}

.game-header__title {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 700 !important;
}

.game-header__back svg {
    color: rgba(255, 255, 255, 0.9) !important;
}

.game-main {
    padding-top: 0 !important;
}

.word-game-wrapper {
    background: transparent !important;
    height: 100dvh !important;
}

/* --------------------------------------------------------------------------
   CSS Variables & Theme
   -------------------------------------------------------------------------- */
.little-chats-game {
    --lc-bg: #f0e6ff;
    --lc-card-bg: #ffffff;
    --lc-text: #2d1b4e;
    --lc-text-light: #6b5b7b;
    --lc-accent: #7c3aed;
    --lc-accent-light: #a78bfa;
    --lc-radius: 24px;
    --lc-radius-sm: 14px;
    --lc-shadow: 0 8px 32px rgba(124, 58, 237, 0.15);
    --lc-shadow-lg: 0 16px 48px rgba(124, 58, 237, 0.25);
    --lc-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Category Colors */
    --lc-silly: #ff6b6b;
    --lc-imagination: #a78bfa;
    --lc-feelings: #f472b6;
    --lc-day: #38bdf8;
    --lc-wouldyourather: #fb923c;
    --lc-gratitude: #4ade80;
    --lc-dreams: #c084fc;
    --lc-friends: #22d3ee;
    --lc-hypothetical: #fbbf24;
    --lc-nature: #34d399;
}

/* --------------------------------------------------------------------------
   Base Layout
   -------------------------------------------------------------------------- */
.little-chats-game {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Nunito', 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--lc-text);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* --------------------------------------------------------------------------
   Floating Particles Background
   -------------------------------------------------------------------------- */
.lc-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.lc-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.3;
    animation: lc-float linear infinite;
}

@keyframes lc-float {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
        transform: translateY(80vh) rotate(36deg) scale(1);
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   Welcome Screen
   -------------------------------------------------------------------------- */
.lc-welcome {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 24px;
    width: 100%;
    max-width: 480px;
    animation: lc-fadeIn 0.6s ease-out;
}

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

.lc-welcome-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--lc-radius);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--lc-shadow-lg);
    width: 100%;
}

/* Welcome Bubbles Animation */
.lc-welcome-bubbles {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.lc-bubble {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    animation: lc-bounce 1.4s ease-in-out infinite;
}

.lc-bubble-1 {
    background: var(--lc-silly);
    animation-delay: 0s;
}

.lc-bubble-2 {
    background: var(--lc-imagination);
    animation-delay: 0.2s;
}

.lc-bubble-3 {
    background: var(--lc-gratitude);
    animation-delay: 0.4s;
}

@keyframes lc-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
    }
    40% {
        transform: scale(1.3);
    }
}

.lc-welcome-title {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--lc-accent);
    margin: 0 0 4px;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.lc-welcome-subtitle {
    font-size: 1.05rem;
    color: var(--lc-text-light);
    margin: 0 0 20px;
    font-weight: 500;
}

/* Info Items */
.lc-welcome-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.lc-info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--lc-text-light);
}

.lc-info-icon {
    font-size: 1.2rem;
}

/* Category Picker */
.lc-category-picker {
    margin-bottom: 20px;
}

.lc-picker-label {
    font-size: 0.85rem;
    color: var(--lc-text-light);
    margin: 0 0 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lc-category-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.lc-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    color: #fff;
    opacity: 0.5;
    transform: scale(0.95);
}

.lc-chip.active {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.lc-chip:hover {
    transform: scale(1.05);
}

.lc-chip-silly { background: var(--lc-silly); }
.lc-chip-imagination { background: var(--lc-imagination); }
.lc-chip-feelings { background: var(--lc-feelings); }
.lc-chip-day { background: var(--lc-day); }
.lc-chip-wouldyourather { background: var(--lc-wouldyourather); }
.lc-chip-gratitude { background: var(--lc-gratitude); }
.lc-chip-dreams { background: var(--lc-dreams); }
.lc-chip-friends { background: var(--lc-friends); }
.lc-chip-hypothetical { background: var(--lc-hypothetical); }
.lc-chip-nature { background: var(--lc-nature); }

/* Start Button */
.lc-start-btn {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 16px 48px;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 1px;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    transition: all 0.25s ease;
    margin-bottom: 12px;
}

.lc-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.5);
}

.lc-start-btn:active {
    transform: translateY(0);
}

.lc-welcome-hint {
    font-size: 0.8rem;
    color: var(--lc-text-light);
    margin: 0;
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Game Area
   -------------------------------------------------------------------------- */
.lc-game-area {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    padding: 60px 16px 16px;
    box-sizing: border-box;
    gap: 12px;
}

/* Category Badge */
.lc-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lc-text);
    transition: all var(--lc-transition);
    flex-shrink: 0;
}

.lc-category-icon {
    font-size: 1.1rem;
}

/* Counter */
.lc-counter {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   The Card
   -------------------------------------------------------------------------- */
.lc-card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    min-height: 0;
    perspective: 1200px;
    cursor: pointer;
}

.lc-card {
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 55vh;
    position: relative;
    transition: transform 0.15s ease;
}

.lc-card:active {
    transform: scale(0.97);
}

.lc-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.lc-card.flipping .lc-card-inner {
    animation: lc-cardFlip 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lc-cardFlip {
    0% {
        transform: rotateY(0deg) scale(1);
    }
    50% {
        transform: rotateY(90deg) scale(0.95);
    }
    100% {
        transform: rotateY(0deg) scale(1);
    }
}

/* Card shimmer on new question */
.lc-card.shimmer .lc-card-front::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--lc-radius);
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.4) 45%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0.4) 55%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: lc-shimmer 0.6s ease-out;
    pointer-events: none;
}

@keyframes lc-shimmer {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}

.lc-card-front {
    width: 100%;
    height: 100%;
    border-radius: var(--lc-radius);
    background: var(--lc-card-bg);
    box-shadow: var(--lc-shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    transition: background var(--lc-transition);
}

/* Decorative corner elements */
.lc-card-decoration {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.08;
    transition: background var(--lc-transition);
}

.lc-card-decoration-top {
    top: -20px;
    right: -20px;
    background: var(--lc-accent);
}

.lc-card-decoration-bottom {
    bottom: -20px;
    left: -20px;
    background: var(--lc-accent);
}

/* Card colored left border */
.lc-card-front::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20px;
    bottom: 20px;
    width: 5px;
    border-radius: 0 3px 3px 0;
    background: var(--lc-accent);
    transition: background var(--lc-transition);
}

.lc-card-question {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    color: var(--lc-text);
    padding: 0 8px;
    transition: opacity 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* --------------------------------------------------------------------------
   Category-specific card tinting
   -------------------------------------------------------------------------- */
.lc-card-front[data-category="silly"] { background: linear-gradient(135deg, #fff5f5, #ffe3e3); }
.lc-card-front[data-category="silly"]::before { background: var(--lc-silly); }

.lc-card-front[data-category="imagination"] { background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
.lc-card-front[data-category="imagination"]::before { background: var(--lc-imagination); }

.lc-card-front[data-category="feelings"] { background: linear-gradient(135deg, #fdf2f8, #fce7f3); }
.lc-card-front[data-category="feelings"]::before { background: var(--lc-feelings); }

.lc-card-front[data-category="day"] { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); }
.lc-card-front[data-category="day"]::before { background: var(--lc-day); }

.lc-card-front[data-category="wouldyourather"] { background: linear-gradient(135deg, #fff7ed, #ffedd5); }
.lc-card-front[data-category="wouldyourather"]::before { background: var(--lc-wouldyourather); }

.lc-card-front[data-category="gratitude"] { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.lc-card-front[data-category="gratitude"]::before { background: var(--lc-gratitude); }

.lc-card-front[data-category="dreams"] { background: linear-gradient(135deg, #faf5ff, #f3e8ff); }
.lc-card-front[data-category="dreams"]::before { background: var(--lc-dreams); }

.lc-card-front[data-category="friends"] { background: linear-gradient(135deg, #ecfeff, #cffafe); }
.lc-card-front[data-category="friends"]::before { background: var(--lc-friends); }

.lc-card-front[data-category="hypothetical"] { background: linear-gradient(135deg, #fefce8, #fef9c3); }
.lc-card-front[data-category="hypothetical"]::before { background: var(--lc-hypothetical); }

.lc-card-front[data-category="nature"] { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.lc-card-front[data-category="nature"]::before { background: var(--lc-nature); }

/* --------------------------------------------------------------------------
   Tap Hint
   -------------------------------------------------------------------------- */
.lc-tap-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    animation: lc-pulse 2s ease-in-out infinite;
}

.lc-tap-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.lc-tap-icon {
    animation: lc-tapBounce 1.5s ease-in-out infinite;
}

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

@keyframes lc-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Bottom Controls
   -------------------------------------------------------------------------- */
.lc-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 8px);
}

.lc-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.lc-control-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

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

.lc-control-btn-primary {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.lc-control-btn-primary:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* --------------------------------------------------------------------------
   Share Toast
   -------------------------------------------------------------------------- */
.lc-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

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

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
    .lc-welcome-title {
        font-size: 2rem;
    }

    .lc-card-question {
        font-size: 1.3rem;
    }

    .lc-chip {
        padding: 6px 11px;
        font-size: 0.75rem;
    }

    .lc-start-btn {
        padding: 14px 36px;
        font-size: 1.05rem;
    }

    .lc-welcome-content {
        padding: 24px 16px;
    }
}

@media (min-width: 600px) {
    .lc-card-question {
        font-size: 1.8rem;
    }

    .lc-card {
        max-height: 60vh;
    }
}

@media (min-width: 900px) {
    .lc-card-question {
        font-size: 2rem;
    }
}

/* Landscape on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .lc-card {
        aspect-ratio: auto;
        max-height: 50vh;
        height: 50vh;
    }

    .lc-card-question {
        font-size: 1.2rem;
    }

    .lc-game-area {
        gap: 6px;
        padding: 8px;
    }

    .lc-category-badge {
        padding: 4px 12px;
        font-size: 0.75rem;
    }

    .lc-counter {
        font-size: 0.7rem;
    }

    .lc-controls {
        gap: 12px;
    }

    .lc-control-btn {
        width: 40px;
        height: 40px;
    }

    .lc-control-btn-primary {
        width: 50px;
        height: 50px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .lc-card.flipping .lc-card-inner {
        animation: none;
    }

    .lc-particle {
        animation: none;
    }

    .lc-bubble {
        animation: none;
    }

    .lc-tap-icon {
        animation: none;
    }
}

/* --------------------------------------------------------------------------
   Dark Mode
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {

    .little-chats-game {
        --lc-card-bg: #1e1b2e;
        --lc-text: #e8e0f0;
        --lc-text-light: #a99bbe;
        --lc-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
        --lc-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
        background: linear-gradient(135deg, #1a1040 0%, #2d1560 50%, #4a1a6b 100%);
    }

    /* Welcome panel */
    .lc-welcome-content {
        background: rgba(30, 27, 46, 0.95);
    }

    .lc-welcome-title {
        color: #c4b5fd;
    }

    /* Category badge */
    .lc-category-badge {
        background: rgba(30, 27, 46, 0.9);
        color: var(--lc-text);
    }

    /* Card backgrounds per category - dark tinted */
    .lc-card-front {
        background: var(--lc-card-bg);
    }

    .lc-card-front[data-category="silly"] { background: linear-gradient(135deg, #2a1520, #331a25); }
    .lc-card-front[data-category="imagination"] { background: linear-gradient(135deg, #1e1a30, #252040); }
    .lc-card-front[data-category="feelings"] { background: linear-gradient(135deg, #2a1528, #301a30); }
    .lc-card-front[data-category="day"] { background: linear-gradient(135deg, #151e2e, #1a2538); }
    .lc-card-front[data-category="wouldyourather"] { background: linear-gradient(135deg, #2a2015, #33251a); }
    .lc-card-front[data-category="gratitude"] { background: linear-gradient(135deg, #152a1a, #1a3320); }
    .lc-card-front[data-category="dreams"] { background: linear-gradient(135deg, #201530, #281a3a); }
    .lc-card-front[data-category="friends"] { background: linear-gradient(135deg, #152528, #1a3033); }
    .lc-card-front[data-category="hypothetical"] { background: linear-gradient(135deg, #2a2515, #33301a); }
    .lc-card-front[data-category="nature"] { background: linear-gradient(135deg, #152a20, #1a3328); }

    /* Card decorations */
    .lc-card-decoration {
        opacity: 0.12;
    }

    /* Shimmer toned down */
    .lc-card.shimmer .lc-card-front::after {
        background: linear-gradient(
            105deg,
            transparent 40%,
            rgba(255, 255, 255, 0.1) 45%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.1) 55%,
            transparent 60%
        );
        background-size: 200% 100%;
    }

    /* Start button */
    .lc-start-btn {
        background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
        box-shadow: 0 4px 20px rgba(109, 40, 217, 0.5);
    }

    .lc-start-btn:hover {
        box-shadow: 0 6px 28px rgba(109, 40, 217, 0.6);
    }

    /* Controls */
    .lc-control-btn {
        background: rgba(255, 255, 255, 0.1);
    }

    .lc-control-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .lc-control-btn-primary {
        background: rgba(255, 255, 255, 0.15);
    }

    .lc-control-btn-primary:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    /* Toast */
    .lc-toast {
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* Particles more subtle */
    .lc-particle {
        opacity: 0.15;
    }

    @keyframes lc-float {
        0% {
            transform: translateY(100vh) rotate(0deg) scale(0);
            opacity: 0;
        }
        10% {
            opacity: 0.15;
            transform: translateY(80vh) rotate(36deg) scale(1);
        }
        90% {
            opacity: 0.15;
        }
        100% {
            transform: translateY(-10vh) rotate(360deg) scale(0.5);
            opacity: 0;
        }
    }

    /* Chips - slightly muted in dark mode */
    .lc-chip {
        opacity: 0.45;
    }

    .lc-chip.active {
        opacity: 0.95;
    }
}

/* --------------------------------------------------------------------------
   Print (hide game for SEO text)
   -------------------------------------------------------------------------- */
@media print {
    .lc-particles,
    .lc-controls,
    .lc-tap-hint {
        display: none !important;
    }
}
