/**
 * Seminary Game Center - Mobile Polish & Visual Enhancements
 * Auto-injected CSS for all game templates
 */

/* Touch-friendly minimum sizes */
button, .btn, [role="button"] {
    min-height: 44px;
    touch-action: manipulation; /* Prevents double-tap zoom */
}

/* Haptic-like visual feedback */
button:active, .btn:active, [role="button"]:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* Timer urgency animations */
.timer-urgent {
    animation: timer-pulse 0.5s ease-in-out infinite;
    color: #ef4444 !important;
}

@keyframes timer-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.timer-warning {
    animation: timer-shake 0.3s ease-in-out;
    color: #eab308 !important;
}

@keyframes timer-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Smooth scroll on mobile */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Better focus states for accessibility */
button:focus, input:focus, select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Loading skeleton animation */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.1) 25%, 
        rgba(255,255,255,0.2) 50%, 
        rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Score change animations */
.score-up {
    animation: score-pop-green 0.4s ease-out;
}

.score-down {
    animation: score-pop-red 0.4s ease-out;
}

@keyframes score-pop-green {
    0% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.3); color: #22c55e; }
    100% { transform: scale(1); color: inherit; }
}

@keyframes score-pop-red {
    0% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.3); color: #ef4444; }
    100% { transform: scale(1); color: inherit; }
}

/* Leaderboard position change */
.rank-up {
    animation: slide-up 0.5s ease-out;
    background: rgba(34, 197, 94, 0.2) !important;
}

.rank-down {
    animation: slide-down 0.5s ease-out;
    background: rgba(239, 68, 68, 0.2) !important;
}

@keyframes slide-up {
    0% { transform: translateY(10px); opacity: 0.5; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes slide-down {
    0% { transform: translateY(-10px); opacity: 0.5; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Connection status indicator */
.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.connection-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.connection-dot.disconnected {
    background: #ef4444;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Prevent text selection during gameplay */
.no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* Better scrollbar for dark themes */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Answer button states with visual feedback */
.answer-selected {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5) !important;
    transform: scale(0.98);
}

.answer-correct {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    animation: correct-glow 0.5s ease-out;
}

.answer-wrong {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    animation: wrong-shake 0.5s ease-out;
}

@keyframes correct-glow {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    50% { box-shadow: 0 0 30px 10px rgba(34, 197, 94, 0.4); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes wrong-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

/* Responsive font sizing for long questions */
@media (max-width: 400px) {
    .question-text {
        font-size: 1rem !important;
    }
    
    .answer-text {
        font-size: 0.9rem !important;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .game-header {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    .question-area {
        max-height: 30vh;
        overflow-y: auto;
    }
}

/* Safe area for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
    .game-header {
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
    
    .game-footer {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
}
