:root {
    --bg: #f8f9fc;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-border: rgba(255, 255, 255, 0.6);
    --bg-nav: rgba(255, 255, 255, 0.95);
    --bg-input: #ffffff;
    --text: #1f2937;
    --text-secondary: #4a5568;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: rgba(0, 0, 0, 0.06);
    --shadow-lg: rgba(0, 0, 0, 0.1);
    --accent: #3b5bdb;
    --accent-hover: #2b4bc6;
    --accent-glow: rgba(59, 91, 219, 0.12);
    --green: #16a34a;
    --red: #dc2626;
    --gold: #f59e0b;
    --silver: #9ca3af;
    --bronze: #d97706;
    --modal-overlay: rgba(17, 24, 39, 0.75);
    --skeleton-base: #e5e7eb;
    --skeleton-shine: #f3f4f6;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-secondary);
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 5rem;
}

.glass-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.8) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 1.25rem;
    box-shadow: 0 4px 24px var(--shadow), 0 1px 3px rgba(0,0,0,0.04);
}

.solid-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: 0 2px 12px var(--shadow), 0 1px 2px rgba(0,0,0,0.03);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    transition: color 0.3s ease;
}

@media (min-width: 768px) {
    .page-header h1 {
        font-size: 2.75rem;
    }
}

.page-header .subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}


.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px var(--shadow);
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.bottom-nav .nav-inner {
    display: flex;
    max-width: 32rem;
    margin: 0 auto;
    position: relative;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.25rem 0.4rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    gap: 0.2rem;
}

.bottom-nav-item .nav-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bottom-nav-item .nav-icon svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: rgba(255,255,255,0.7);
    transition: fill 0.2s ease;
}

.bottom-nav-item.active {
    color: var(--accent);
    font-weight: 600;
}

.bottom-nav-item.active .nav-icon {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(30,41,59,0.4);
}

.bottom-nav-item.active .nav-icon svg {
    fill: white;
}

.bottom-nav-item:active .nav-icon {
    transform: scale(0.92);
}

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

.skeleton {
    background: linear-gradient(90deg, #e8eaef 25%, #f1f3f7 50%, #e8eaef 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
    border-radius: 0.75rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    padding: 1rem;
    border-radius: 0.75rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.4s ease-out forwards;
}

.fade-in-delay-1 { animation-delay: 0.05s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.15s; opacity: 0; }
.fade-in-delay-4 { animation-delay: 0.2s; opacity: 0; }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background-color: var(--bg-card);
    color: var(--text);
    padding: 2rem;
    border-radius: 1.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2), 0 10px 20px rgba(0, 0, 0, 0.1);
    max-width: 28rem;
    width: 100%;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.modal-content h3 {
    color: var(--text);
}

.modal-content p {
    color: var(--text-secondary);
}

.modal-content label {
    color: var(--text-secondary);
}

.modal-content select,
.modal-content input[type="password"],
.modal-content input[type="text"] {
    background-color: var(--bg-input);
    color: var(--text);
    border-color: var(--border);
}

.scorers-wrapper {
    position: relative;
}

.scorers-wrapper .scroll-hint {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2.5rem;
    pointer-events: none;
    z-index: 5;
}

.scorers-wrapper .scroll-hint-right {
    right: 0;
    background: linear-gradient(to left, var(--bg-card) 0%, transparent 100%);
}

.scorers-wrapper .scroll-hint-left {
    left: 0;
    background: linear-gradient(to right, var(--bg-card) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.podium-item {
    text-align: center;
    border-radius: 1rem;
    padding: 1rem 0.75rem;
    position: relative;
    transition: transform 0.2s ease;
    width: 7rem;
}

.podium-item:hover {
    transform: translateY(-3px);
}

.podium-1 {
    background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    color: white;
    order: 2;
    min-height: 11rem;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.35);
}

.podium-2 {
    background: linear-gradient(145deg, #c0c7d0 0%, #9ca3af 50%, #6b7280 100%);
    color: white;
    order: 1;
    min-height: 9rem;
    box-shadow: 0 4px 15px rgba(156, 163, 175, 0.4);
}

.podium-3 {
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    color: white;
    order: 3;
    min-height: 7.5rem;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.podium-rank {
    font-size: 2rem;
    font-weight: 900;
    opacity: 0.9;
    line-height: 1;
}

.podium-name {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.5rem;
    line-height: 1.2;
    min-height: 2.4em;
}

.podium-score {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 0.25rem;
}

.remaining-leaderboard {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.remaining-item {
    flex: 0 0 auto;
    text-align: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.875rem;
    width: 6rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.remaining-rank {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.remaining-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    margin: 0.25rem 0;
    min-height: 2.4em;
}

.remaining-score {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--red);
}

select,
input[type="password"],
input[type="text"] {
    background-color: var(--bg-input);
    color: var(--text);
    border-color: var(--border);
}

.bg-white {
    background-color: var(--bg-card) !important;
}

.text-gray-900 {
    color: var(--text) !important;
}

.text-gray-800 {
    color: var(--text) !important;
}

.text-gray-700 {
    color: var(--text-secondary) !important;
}

.text-gray-600 {
    color: var(--text-muted) !important;
}

.text-gray-500 {
    color: var(--text-faint) !important;
}

.border-gray-200,
.border-gray-300 {
    border-color: var(--border) !important;
}

.bg-gray-50,
.bg-gray-100 {
    background-color: var(--bg-card-hover) !important;
}

.bg-blue-100 {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

.text-blue-800 {
    color: #1e40af !important;
}

.bg-yellow-100 {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

.text-yellow-800 {
    color: #b45309 !important;
}

.bg-red-100 {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

.text-red-700 {
    color: #be123c !important;
}

.bg-indigo-100 {
    background-color: rgba(99, 102, 241, 0.15) !important;
}

.text-indigo-800,
.text-indigo-700 {
    color: #3730a3 !important;
}

.bg-green-100 {
    background-color: rgba(34, 197, 94, 0.15) !important;
}

.text-green-800 {
    color: #15803d !important;
}

.shadow-2xl,
.shadow-lg,
.shadow-md {
    box-shadow: 0 4px 20px var(--shadow-lg) !important;
}

.nav-auth-btn {
    background: none;
    border: none;
    cursor: pointer;
}
.nav-auth-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-auth-icon svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: rgba(255,255,255,0.7);
}
.nav-auth-photo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}
.auth-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.auth-panel-backdrop.show {
    display: block;
    opacity: 1;
}
.auth-dropdown-bottom {
    position: fixed;
    bottom: 4.5rem;
    left: 0;
    right: 0;
    background: white;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
    padding: 1.25rem 1.25rem 1rem;
    z-index: 999;
    display: none;
    text-align: left;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-dropdown-bottom.show {
    display: block;
    transform: translateY(0);
}
.auth-dropdown-name { font-weight: 700; color: #1e293b; font-size: 0.95rem; }
.auth-dropdown-email { color: #64748b; font-size: 0.8rem; margin-top: 0.15rem; }
.auth-dropdown-linked { color: #3b5bdb; font-size: 0.8rem; margin-top: 0.25rem; font-weight: 500; }
.auth-panel-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.75rem 0;
}
.auth-panel-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.auth-panel-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: 0.5rem;
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease;
}
.auth-panel-nav-item:hover {
    background: #f1f5f9;
}
.auth-panel-nav-item.active {
    color: #3b5bdb;
    background: #eef2ff;
}
.auth-panel-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}
.auth-panel-nav-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}
.auth-dropdown-btn {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    border: none;
}
.auth-dropdown-signout { background: #f1f5f9; color: #64748b; }
.auth-dropdown-signout:hover { background: #e2e8f0; }
.ios-install-tip {
    display: none;
    background: #f0f4ff;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.45;
    margin-top: 0.25rem;
}
.ios-install-tip .ios-tip-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.ios-install-tip .share-icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
}

.link-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.link-modal {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 360px;
    text-align: center;
}
.link-modal h3 { font-size: 1.1rem; font-weight: 800; color: #1e293b; margin-bottom: 0.25rem; }
.link-modal p { font-size: 0.85rem; color: #64748b; margin-bottom: 1rem; }
.link-modal select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.link-modal-confirm {
    width: 100%;
    padding: 0.6rem;
    background: #3b5bdb;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}
.link-modal-confirm:hover { background: #2f4fc7; }
.link-modal-confirm:disabled { opacity: 0.5; cursor: not-allowed; }
.link-modal-pin {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-align: center;
    letter-spacing: 0.3em;
}
.link-modal-error {
    color: #dc2626;
    font-size: 0.8rem;
    min-height: 1.2rem;
    margin-bottom: 0.25rem;
}

.my-picks-label {
    display: inline-block;
    background: rgba(59,91,219,0.15);
    color: #3b5bdb;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}
.edit-picks-btn {
    display: inline-block;
    background: #3b5bdb;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}
.edit-picks-btn:hover { background: #2f4fc7; }
.my-picks-card { border: 2px solid rgba(59,91,219,0.3); }
