/* Base styles */
body { font-family: 'Inter', sans-serif; }
* { transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out; }

/* CSS Custom Properties for Safe Area Insets */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
    /* Initial view display values (set by inline script to prevent flicker) */
    --initial-login-display: block;
    --initial-review-display: none;
}

/* Prevent flicker on initial load by using CSS variables set in head */
#login-required-view {
    display: var(--initial-login-display) !important;
}
#review-view {
    display: var(--initial-review-display) !important;
}
/* JavaScript will override these with class changes after checking session */
#login-required-view.hidden,
#review-view.hidden {
    display: none !important;
}

/* Browser compatibility fixes */
@supports not (height: 100dvh) {
    body {
        min-height: 100vh !important;
    }
}

/* Mobile Navigation Styles */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e5e7eb;
    height: calc(3.5rem + var(--sab));
    min-height: calc(3.5rem + var(--sab));
    max-height: calc(3.5rem + var(--sab));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    padding-bottom: 0;
}
.dark .mobile-nav {
    background: rgba(17, 24, 39, 0.95);
    border-top-color: #374151;
}
.mobile-nav-tabs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--sab);
    height: 3.5rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}
.mobile-nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.375rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    color: #6b7280;
    text-decoration: none;
    min-width: 3.5rem;
}
.mobile-nav-tab.active {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.1);
}
.dark .mobile-nav-tab.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}
.mobile-nav-tab:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.dark .mobile-nav-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.mobile-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-bottom: 0.125rem;
}
.mobile-nav-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-align: center;
}

/* Mobile Header Styles */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    padding: 0.375rem 1rem;
    padding-top: calc(0.375rem + var(--sat));
    height: calc(3rem + var(--sat));
    min-height: calc(3rem + var(--sat));
    max-height: calc(3rem + var(--sat));
    pointer-events: none;
}
.mobile-header-content {
    pointer-events: auto;
}
.dark .mobile-header {
    background: rgba(17, 24, 39, 0.95);
    border-bottom-color: #374151;
}
.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
}
.mobile-logo {
    width: 1.75rem;
    height: 1.75rem;
}
.mobile-app-name {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}
.dark .mobile-app-name {
    color: #fff;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        justify-content: flex-start !important;
        padding-top: calc(3rem + var(--sat)) !important;
        padding-bottom: calc(3.5rem + var(--sab)) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
        margin-top: 0 !important;
    }

    /* Center review container vertically on mobile */
    body > div.flex-1 {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        min-height: calc(100vh - 7rem - var(--sat) - var(--sab)) !important;
        min-height: calc(100dvh - 7rem - var(--sat) - var(--sab)) !important;
    }

    main {
        margin-top: 0 !important;
        width: 100% !important;
        padding-top: 0 !important;
    }

    /* Reduce padding on review containers on mobile */
    #login-required-view,
    #review-view {
        padding: 0.75rem !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid #e5e7eb !important;
        box-shadow: none !important;
    }

    .dark #login-required-view,
    .dark #review-view {
        border-top: 1px solid #374151 !important;
    }

    .desktop-header {
        display: none !important;
    }

    /* Ensure proper sizing on mobile */
    .mobile-header {
        height: calc(3rem + var(--sat)) !important;
        min-height: calc(3rem + var(--sat)) !important;
        max-height: calc(3rem + var(--sat)) !important;
        border-bottom: none !important;
    }
    .mobile-nav {
        height: calc(3.5rem + var(--sab)) !important;
        min-height: calc(3.5rem + var(--sab)) !important;
        max-height: calc(3.5rem + var(--sab)) !important;
    }
}

@media (min-width: 769px) {
    .mobile-nav { display: none !important; }
    .mobile-header { display: none !important; }

    /* Desktop navigation spacing and styling */
    main {
        margin-top: 5rem !important; /* Add top margin for desktop header */
    }
}

/* Pre-generated TailwindCSS */
:root {
    --tw-ring-color: rgb(59 130 246 / 0.5);
    --tw-translate-x: 0;
    --tw-translate-y: 0;
    --tw-rotate: 0;
    --tw-skew-x: 0;
    --tw-skew-y: 0;
    --tw-scale-x: 1;
    --tw-scale-y: 1;
}
*, ::before, ::after {
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: #e5e7eb;
}
::before, ::after { --tw-content: ''; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; font-feature-settings: normal; font-variation-settings: normal; }
body { margin: 0; line-height: inherit; }
h1, h2, p { margin: 0; }
button { font-family: inherit; font-size: 100%; font-weight: inherit; line-height: inherit; color: inherit; margin: 0; padding: 0; text-transform: none; background-color: transparent; background-image: none; cursor: pointer; }
.dark { color-scheme: dark; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
.absolute { position: absolute; } .relative { position: relative; }
.top-4 { top: 1rem; } .left-4 { left: 1rem; } .right-4 { right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.mt-6 { margin-top: 1.5rem; } .ml-3 { margin-left: 0.75rem; }
.flex { display: flex; } .hidden { display: none; }
.h-8 { height: 2rem; } .h-10 { height: 2.5rem; } .h-12 { height: 3rem; }
.w-8 { width: 2rem; } .w-10 { width: 2.5rem; } .w-12 { width: 3rem; } .w-20 { width: 5rem; } .w-full { width: 100%; }
.max-w-2xl { max-width: 42rem; }
.min-h-screen { min-height: 100vh; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-center { justify-content: center; } .justify-start { justify-content: flex-start; }
.gap-4 { gap: 1rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.5rem; }
.space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.75rem; }
.rounded-lg { border-radius: 0.5rem; } .rounded-r-lg { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }
.border { border-width: 1px; } .border-l-4 { border-left-width: 4px; }
.border-gray-200 { border-color: #e5e7eb; } .dark .dark\:border-gray-700 { border-color: #374151; }
.border-red-500 { border-color: #ef4444; }
.bg-gray-100 { background-color: #f3f4f6; } .dark .dark\:bg-gray-900 { background-color: #111827; }
.bg-white { background-color: #fff; } .dark .dark\:bg-gray-800 { background-color: #1f2937; } .dark .dark\:bg-gray-700 { background-color: #374151; } .dark .dark\:bg-gray-600 { background-color: #4b5563; }
.bg-gray-300 { background-color: #d1d5db; } .dark .dark\:bg-gray-500 { background-color: #6b7280; }
.bg-blue-50 { background-color: #eff6ff; } .dark .dark\:bg-blue-900\/20 { background-color: rgb(30 58 138 / 0.2); }
.bg-green-50 { background-color: #f0fdf4; } .dark .dark\:bg-green-900\/20 { background-color: rgb(20 83 45 / 0.2); }
.bg-green-500 { background-color: #22c55e; } .bg-green-600 { background-color: #16a34a; }
.bg-red-100 { background-color: #fee2e2; } .dark .dark\:bg-red-900\/30 { background-color: rgb(127 29 29 / 0.3); }
.bg-red-500 { background-color: #ef4444; } .bg-red-600 { background-color: #dc2626; }
.p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; } .py-4 { padding-top: 1rem; padding-bottom: 1rem; } .py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.leading-tight { line-height: 1.25; }
.text-gray-400 { color: #9ca3af; } .text-gray-500 { color: #6b7280; } .dark .dark\:text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; } .dark .dark\:text-gray-400 { color: #9ca3af; }
.text-gray-700 { color: #374151; } .dark .dark\:text-gray-300 { color: #d1d5db; } .dark .dark\:text-gray-200 { color: #e5e7eb; }
.text-gray-900 { color: #111827; } .dark .dark\:text-white { color: #fff; }
.text-blue-600 { color: #2563eb; } .dark .dark\:text-blue-400 { color: #60a5fa; }
.text-red-800 { color: #991b1b; } .dark .dark\:text-red-200 { color: #fecaca; }
.text-white { color: #fff; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.object-contain { object-fit: contain; }
.hover\:bg-gray-400:hover { background-color: #9ca3af; } .dark .dark\:hover\:bg-gray-500:hover { background-color: #6b7280; }
.hover\:bg-green-600:hover { background-color: #16a34a; }
.hover\:bg-red-600:hover { background-color: #dc2626; }
.hover\:underline:hover { text-decoration-line: underline; }
.hover\:opacity-80:hover { opacity: 0.8; }
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* Transition utilities */
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 200ms; }
.duration-200 { transition-duration: 200ms; }

/* Additional utility classes for desktop navigation */
.space-x-1 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.25rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-right: 0; margin-left: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.font-medium { font-weight: 500; }
.text-gray-300 { color: #d1d5db; } .dark .dark\:text-gray-300 { color: #d1d5db; }
.bg-blue-50 { background-color: #eff6ff; } .dark .dark\:bg-blue-900\/20 { background-color: rgb(30 58 138 / 0.2); }
.hover\:text-blue-600:hover { color: #2563eb; } .dark .dark\:hover\:text-blue-400:hover { color: #60a5fa; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; } .dark .dark\:hover\:bg-gray-800:hover { background-color: #1f2937; }
.hover\:bg-gray-200:hover { background-color: #e5e7eb; } .dark .dark\:hover\:bg-gray-700:hover { background-color: #374151; }
.inline-flex { display: inline-flex; }
.w-11 { width: 2.75rem; }
.h-6 { height: 1.5rem; }
.bg-gray-300 { background-color: #d1d5db; }
.rounded-full { border-radius: 9999px; }

@media (min-width: 640px) {
    .sm\:w-auto { width: auto; }
    .sm\:flex-row { flex-direction: row; }
}

/* Review-specific button hover effects */
#skip-btn {
    background-color: #d1d5db !important;
    color: #374151 !important;
}

#skip-btn:hover {
    background-color: #9ca3af !important;
}

.dark #skip-btn {
    background-color: #4b5563 !important;
    color: #e5e7eb !important;
}

.dark #skip-btn:hover {
    background-color: #6b7280 !important;
}

#thumbs-down-btn {
    background-color: #ef4444 !important;
}

#thumbs-down-btn:hover {
    background-color: #dc2626 !important;
}

#thumbs-up-btn {
    background-color: #22c55e !important;
}

#thumbs-up-btn:hover {
    background-color: #16a34a !important;
}

/* Button disabled state */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Leaderboard button - minimal clickable enhancement */
#leaderboard-btn {
    background: none !important;
    text-decoration: none !important;
    display: inline-flex !important;
    width: auto !important;
    cursor: pointer !important;
    transition: transform 0.2s ease, filter 0.2s ease !important;
    border-radius: 0.5rem;
    padding: 0.25rem;
    position: relative;
}

#leaderboard-btn:hover {
    transform: scale(1.08) translateY(-1px);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
}

#leaderboard-btn:active {
    transform: scale(1.02);
}

/* Subtle pulse animation to hint it's interactive - plays 3 times then stops */
@keyframes subtle-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

#leaderboard-btn img {
    animation: subtle-pulse 1.5s ease-in-out 3;
}

#leaderboard-btn:hover img {
    animation: none;
}

/* Mobile-specific enhancements for leaderboard button */
@media (max-width: 768px) {
    /* More prominent pulse on mobile - plays 3 times then stops */
    @keyframes mobile-pulse {
        0%, 100% {
            opacity: 1;
            transform: scale(1);
        }
        50% {
            opacity: 0.8;
            transform: scale(0.98);
        }
    }

    #leaderboard-btn img {
        animation: mobile-pulse 1.5s ease-in-out 3;
    }

    /* Add a subtle glowing ring on mobile - synced with pulse, plays 3 times */
    #leaderboard-btn::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        border-radius: 0.5rem;
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(249, 115, 22, 0.25));
        opacity: 0;
        animation: glow-ring 1.5s ease-in-out 3;
        pointer-events: none;
        z-index: -1;
    }

    @keyframes glow-ring {
        0%, 100% {
            opacity: 0;
        }
        50% {
            opacity: 0.8;
        }
    }

    /* Tactile feedback on tap */
    #leaderboard-btn:active {
        transform: scale(0.92);
    }
}

/* Hidden class utility */
.hidden {
    display: none !important;
}

/* Modal z-index and display */
#leaderboard-modal {
    z-index: 9999 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

#leaderboard-modal:not(.hidden) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#leaderboard-backdrop {
    pointer-events: auto;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure modal content is above backdrop */
#leaderboard-modal > div {
    position: relative;
    z-index: 10;
}

#leaderboard-modal .inline-block {
    z-index: 20 !important;
}

/* Leaderboard table styling */
#leaderboard-content table {
    border-collapse: separate;
    border-spacing: 0;
}

/* Scrollbar styling for leaderboard */
#leaderboard-content .max-h-96::-webkit-scrollbar {
    width: 8px;
}

#leaderboard-content .max-h-96::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dark #leaderboard-content .max-h-96::-webkit-scrollbar-track {
    background: #374151;
}

#leaderboard-content .max-h-96::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#leaderboard-content .max-h-96::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Additional utility classes for leaderboard */
.bg-yellow-50 {
    background-color: #fefce8;
}

.dark .dark\:bg-yellow-900\/10 {
    background-color: rgba(113, 63, 18, 0.1);
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.dark .dark\:bg-blue-900\/20 {
    background-color: rgba(30, 58, 138, 0.2);
}

.text-blue-600 {
    color: #2563eb;
}

.dark .dark\:text-blue-400 {
    color: #60a5fa;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.divide-y > :not([hidden]) ~ :not([hidden]) {
    border-top-width: 1px;
}

.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e5e7eb;
}

.dark .dark\:divide-gray-700 > :not([hidden]) ~ :not([hidden]) {
    border-color: #374151;
}

.overflow-hidden {
    overflow: hidden;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.sticky {
    position: sticky;
}

.top-0 {
    top: 0;
}

.z-50 {
    z-index: 50;
}

.overflow-y-auto {
    overflow-y: auto;
}

.border-yellow-500 {
    border-color: #f59e0b;
}

.dark .dark\:border-yellow-600 {
    border-color: #d97706;
}

.bg-opacity-75 {
    --tw-bg-opacity: 0.75;
}

.dark .dark\:bg-opacity-75 {
    --tw-bg-opacity: 0.75;
}

/* ============================================
   Feedback Overlay Animation (UX Enhancement)
   ============================================ */

/* Overlay Container */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

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

/* Icon Container */
.feedback-icon-container {
    background: white;
    border-radius: 50%;
    padding: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    animation: feedback-scale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark .feedback-icon-container {
    background: #1f2937;
}

/* Icon Styles */
.feedback-icon {
    width: 80px;
    height: 80px;
    stroke-width: 3;
}

/* Color Variants */
.feedback-icon.success {
    color: #22c55e;
}

.feedback-icon.error {
    color: #ef4444;
}

.feedback-icon.skip {
    color: #6b7280;
}

/* Keyframe Animations */
@keyframes feedback-scale {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes feedback-fadeout {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Apply fade-out animation when hiding */
.feedback-overlay.hide {
    animation: feedback-fadeout 0.2s ease-out forwards;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .feedback-overlay,
    .feedback-icon-container {
        animation: none;
        transition: none;
    }
}

/* Theme Toggle Peer and After Pseudo-element Styles */
::before, ::after { --tw-content: ''; }
.peer:focus ~ .peer-focus\:outline-none { outline: 2px solid transparent; outline-offset: 2px; }
.peer:checked ~ .peer-checked\:after\:translate-x-full::after { --tw-translate-x: 100%; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
.peer:checked ~ .peer-checked\:after\:border-white::after { border-color: #fff; }
.peer:checked ~ .peer-checked\:bg-blue-600 { background-color: #2563eb; }
.after\:absolute::after { content: var(--tw-content); position: absolute; }
.after\:left-\[2px\]::after { left: 2px; }
.after\:top-\[2px\]::after { top: 2px; }
.after\:h-5::after { height: 1.25rem; }
.after\:w-5::after { width: 1.25rem; }
.after\:rounded-full::after { border-radius: 9999px; }
.after\:border::after { border-width: 1px; }
.after\:border-gray-300::after { border-color: #d1d5db; }
.after\:bg-white::after { background-color: #fff; }
.after\:transition-all::after { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 200ms; }
