/**
 * Bible Clues — Leaderboard UI Stylesheet
 * Faithfully matches the reference visual design, 3D tactility, and game design style guide.
 */

/* ==========================================================================
   CSS Custom Properties & Design Tokens
   ========================================================================== */
:root {
    --lb-font-title: 'Lilita One', 'Baloo 2', 'Baloo', cursive, sans-serif;
    --lb-font-body: 'Baloo 2', 'Baloo', system-ui, -apple-system, sans-serif;

    /* Palette */
    --lb-blue-header-top: #1555ba;
    --lb-blue-header-bot: #0d3d8a;
    --lb-blue-header-lip: #08285c;
    --lb-gold-divider: linear-gradient(90deg, #ff9f1c, #ffd166, #ff9f1c);
    --lb-event-pill-bg: #44648c;
    --lb-event-pill-border: #6385af;
    --lb-col-bar-bg: #5a7ea7;

    /* Row 3D Colors */
    --lb-card-grad-top: #f7e8b8;
    --lb-card-grad-bot: #ead79f;
    --lb-card-border: #cfba85;
    --lb-card-lip: #b89c68;
    --lb-card-text: #3c2a1a;
    --lb-num-stroke: #5a412c;

    /* Pinned Row (Green) */
    --lb-pinned-grad-top: #9ee03a;
    --lb-pinned-grad-bot: #6eb922;
    --lb-pinned-border: #7ec71f;
    --lb-pinned-lip: #447712;
    --lb-pinned-text: #1d3f04;

    /* Footer */
    --lb-footer-bg: #26364d;
    --lb-cta-green-top: #93dc33;
    --lb-cta-green-bot: #67b01d;
    --lb-cta-green-lip: #3b6b0e;

    /* Max Width Constraint */
    --lb-max-width: 440px;
}

/* ==========================================================================
   Leaderboard Root Modal & Backdrop
   ========================================================================== */
.lb-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 16, 36, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10050;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lb-backdrop.lb-active {
    opacity: 1;
    pointer-events: auto;
}

.lb-modal {
    width: 100vw;
    max-width: var(--lb-max-width);
    height: 100vh;
    max-height: 860px;
    background: #0d2243;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(255, 255, 255, 0.1);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (min-width: 481px) {
    .lb-modal {
        border-radius: 22px;
        height: 92vh;
    }
}

.lb-backdrop.lb-active .lb-modal {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   Top Header & 3D Title
   ========================================================================== */
.lb-header {
    background: linear-gradient(180deg, var(--lb-blue-header-top) 0%, var(--lb-blue-header-bot) 100%);
    padding: 16px 14px 12px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 3px solid var(--lb-blue-header-lip);
    flex-shrink: 0;
}

.lb-title {
    font-family: var(--lb-font-title);
    font-size: 34px;
    color: #fff9bd;
    margin: 0;
    letter-spacing: 0.5px;
    text-align: center;
    text-shadow: 
        -1.5px -1.5px 0 #522e03,
         1.5px -1.5px 0 #522e03,
        -1.5px  1.5px 0 #522e03,
         1.5px  1.5px 0 #522e03,
         0 3px 0 #8c4e00,
         0 5px 0 #5a3100,
         0 8px 10px rgba(0, 0, 0, 0.5);
    -webkit-text-stroke: 1.5px #4a2800;
    paint-order: stroke fill;
    user-select: none;
}

/* 3D Red Close Button */
.lb-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease;
}

.lb-close-btn img,
.lb-close-btn svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.lb-close-btn:hover {
    transform: scale(1.08);
}

.lb-close-btn:active {
    transform: scale(0.92);
}

/* Golden Accent Divider Bar */
.lb-gold-bar {
    height: 4px;
    background: var(--lb-gold-divider);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* ==========================================================================
   Offline / Status Warning Banner
   ========================================================================== */
.lb-status-bar {
    display: none;
    background: #e67e22;
    color: #ffffff;
    font-family: var(--lb-font-body);
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    padding: 4px 10px;
    letter-spacing: 0.3px;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.lb-status-bar.lb-visible {
    display: block;
}

/* ==========================================================================
   Event Banner ("YOUTH WEEK 2026")
   ========================================================================== */
.lb-event-wrap {
    padding: 10px 14px 6px;
    flex-shrink: 0;
}

.lb-event-pill {
    background: var(--lb-event-pill-bg);
    border: 1px solid var(--lb-event-pill-border);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2), 0 2px 5px rgba(0, 0, 0, 0.25);
}

.lb-event-title {
    font-family: var(--lb-font-title);
    color: #ffffff;
    font-size: 19px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Column Headers ("PLAYER", "TODAY'S POINTS", "TOTAL POINTS")
   ========================================================================== */
.lb-col-bar {
    background: var(--lb-col-bar-bg);
    margin: 4px 12px 0;
    border-radius: 8px 8px 0 0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.lb-col-title {
    font-family: var(--lb-font-title);
    font-size: 11px;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.15;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.lb-col-player {
    flex: 1;
    padding-left: 36px;
}

.lb-col-today {
    width: 68px;
    text-align: center;
}

.lb-col-total {
    width: 76px;
    text-align: right;
    padding-right: 4px;
}

/* ==========================================================================
   Scrollable List Container & 3D Rows
   ========================================================================== */
.lb-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
}

/* Custom Sleek Scrollbar */
.lb-list::-webkit-scrollbar {
    width: 5px;
}
.lb-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
.lb-list::-webkit-scrollbar-thumb {
    background: #476a94;
    border-radius: 4px;
}

/* 3D Row Card (Beige/Cream) */
.lb-row {
    height: 58px;
    background: linear-gradient(180deg, var(--lb-card-grad-top) 0%, var(--lb-card-grad-bot) 100%);
    border: 1px solid var(--lb-card-border);
    border-bottom: 4px solid var(--lb-card-lip);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 10px 0 6px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    user-select: none;
    transition: transform 0.1s ease;
}

.lb-row:active {
    transform: scale(0.99);
}

/* Rank Styling */
.lb-rank-wrap {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lb-medal-icon {
    width: 32px;
    height: 32px;
    display: block;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.lb-rank-num {
    font-family: var(--lb-font-title);
    font-size: 21px;
    color: #fff9d6;
    -webkit-text-stroke: 1.5px var(--lb-num-stroke);
    paint-order: stroke fill;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
    text-align: center;
}

/* Avatar Frame */
.lb-avatar-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    margin: 0 8px 0 6px;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.lb-avatar-wrap svg,
.lb-avatar-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* Player Info & Nickname */
.lb-info {
    flex: 1;
    min-width: 0; /* Enables text truncation */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 6px;
}

.lb-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lb-name {
    font-family: var(--lb-font-body);
    font-weight: 800;
    font-size: 16px;
    color: var(--lb-card-text);
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.lb-time-sub {
    font-family: var(--lb-font-body);
    font-weight: 600;
    font-size: 11px;
    color: #795d43;
}

/* Badges (YOU tag) */
.lb-tag-you {
    background: #ff5722;
    color: #ffffff;
    font-family: var(--lb-font-title);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* Points Numerals */
.lb-today-pts {
    width: 64px;
    text-align: center;
    font-family: var(--lb-font-title);
    font-size: 18px;
    color: #4a3421;
    -webkit-text-stroke: 0.6px #5d422a;
    paint-order: stroke fill;
    flex-shrink: 0;
}

.lb-total-pts {
    width: 76px;
    text-align: right;
    font-family: var(--lb-font-title);
    font-size: 19px;
    color: #fffdec;
    -webkit-text-stroke: 1.4px #4a3321;
    paint-order: stroke fill;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    padding-right: 4px;
}

/* ==========================================================================
   Pinned "Me" Row (Juicy Apple Green 3D Pill)
   ========================================================================== */
.lb-pinned-container {
    padding: 0 12px 6px;
    flex-shrink: 0;
}

.lb-row-pinned {
    height: 60px;
    background: linear-gradient(180deg, var(--lb-pinned-grad-top) 0%, var(--lb-pinned-grad-bot) 100%);
    border: 1px solid var(--lb-pinned-border);
    border-bottom: 4px solid var(--lb-pinned-lip);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 10px 0 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    user-select: none;
}

.lb-row-pinned .lb-name {
    color: var(--lb-pinned-text);
}

.lb-row-pinned .lb-rank-num {
    color: #ffffff;
    -webkit-text-stroke: 1.5px #2b5507;
}

.lb-row-pinned .lb-today-pts {
    color: #2b5507;
    -webkit-text-stroke: 0.6px #1b3803;
}

.lb-row-pinned .lb-total-pts {
    color: #ffffff;
    -webkit-text-stroke: 1.4px #2b5507;
}

/* ==========================================================================
   Bottom Action Footer
   ========================================================================== */
.lb-footer {
    background: var(--lb-footer-bg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.lb-footer-msg {
    font-family: var(--lb-font-body);
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
    line-height: 1.25;
    max-width: 230px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* 3D Green CTA Button ("Join" / "Share" using PNG assets) */
.lb-btn-cta {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: transform 0.12s ease, filter 0.15s ease;
    flex-shrink: 0;
}

.lb-cta-img {
    height: 52px;
    width: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
    transition: transform 0.1s ease;
}

.lb-btn-cta:hover {
    filter: brightness(1.06);
}

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

/* ==========================================================================
   Loading, Empty & Error States
   ========================================================================== */
.lb-state-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
    color: #ffffff;
}

.lb-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.lb-state-title {
    font-family: var(--lb-font-title);
    font-size: 24px;
    margin-bottom: 8px;
    color: #ffd166;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.lb-state-desc {
    font-family: var(--lb-font-body);
    font-size: 14px;
    color: #cfd8dc;
    max-width: 280px;
    line-height: 1.4;
    margin-bottom: 18px;
}

.lb-btn-retry {
    background: #3498db;
    border: none;
    border-bottom: 4px solid #217dbb;
    border-radius: 10px;
    color: #ffffff;
    font-family: var(--lb-font-title);
    font-size: 17px;
    padding: 8px 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease;
}

.lb-btn-retry:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

/* Skeleton Loading Shimmer */
.lb-skeleton-row {
    height: 58px;
    border-radius: 12px;
    background: linear-gradient(90deg, #1b3356 25%, #2a4874 50%, #1b3356 75%);
    background-size: 200% 100%;
    animation: lb-shimmer 1.5s infinite;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Toast Notification (Clipboard copy fallback) */
.lb-toast {
    position: absolute;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #27ae60;
    color: #ffffff;
    font-family: var(--lb-font-body);
    font-weight: 700;
    font-size: 13px;
    padding: 8px 18px;
    border-radius: 20px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 10100;
    white-space: nowrap;
}

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

/* ==========================================================================
   Bottom Sheets (Join Sheet & Profile Setup Sheet)
   ========================================================================== */
.lb-sheet-scrim {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10080;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lb-sheet-scrim.lb-sheet-open {
    opacity: 1;
    pointer-events: auto;
}

.lb-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: #182e4e;
    border-radius: 22px 22px 0 0;
    border-top: 2px solid #2e5388;
    padding: 20px 20px 24px;
    z-index: 10090;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.15);
}

.lb-sheet-open .lb-sheet {
    transform: translateY(0);
}

/* Sheet Drag Handle */
.lb-sheet-handle {
    width: 44px;
    height: 5px;
    background: #44648c;
    border-radius: 3px;
    margin: 0 auto 16px;
}

.lb-sheet-title {
    font-family: var(--lb-font-title);
    font-size: 24px;
    color: #ffffff;
    text-align: center;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lb-sheet-subtitle {
    font-family: var(--lb-font-body);
    font-size: 13px;
    color: #b0c4de;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Provider Buttons (Google & Facebook) */
.lb-provider-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.lb-btn-provider {
    height: 48px;
    border-radius: 12px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--lb-font-body);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s ease, filter 0.15s ease;
    user-select: none;
}

.lb-btn-provider svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.lb-btn-provider:active {
    transform: scale(0.98);
}

.lb-btn-google {
    background: #ffffff;
    color: #3c4043;
}

.lb-btn-facebook {
    background: #1877f2;
    color: #ffffff;
}

.lb-sheet-notice {
    font-family: var(--lb-font-body);
    font-size: 11px;
    color: #8da4c4;
    text-align: center;
    line-height: 1.35;
    margin-bottom: 14px;
}

.lb-sheet-cancel {
    background: none;
    border: none;
    color: #9cb3d4;
    font-family: var(--lb-font-body);
    font-weight: 700;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    padding: 6px 12px;
}

/* Profile Setup Sheet: Avatar Grid */
.lb-avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.lb-avatar-option {
    aspect-ratio: 1;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 3px solid transparent;
    cursor: pointer;
    position: relative;
    padding: 3px;
    transition: transform 0.15s ease, border-color 0.2s ease;
}

.lb-avatar-option svg {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: block;
}

.lb-avatar-option:hover {
    transform: scale(1.05);
}

.lb-avatar-option.lb-selected {
    border-color: #f1c40f;
    box-shadow: 0 0 12px rgba(241, 196, 15, 0.6);
    transform: scale(1.06);
}

.lb-avatar-option .lb-check-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    display: none;
}

.lb-avatar-option.lb-selected .lb-check-badge {
    display: block;
}

/* Nickname Input & Validation */
.lb-input-group {
    margin-bottom: 16px;
    position: relative;
}

.lb-nickname-input {
    width: 100%;
    height: 48px;
    background: #0e1c31;
    border: 2px solid #365b8c;
    border-radius: 10px;
    padding: 0 14px;
    font-family: var(--lb-font-body);
    font-weight: 700;
    font-size: 16px;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.lb-nickname-input:focus {
    border-color: #f1c40f;
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.4);
}

.lb-nickname-input.lb-input-invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
}

.lb-validation-msg {
    font-family: var(--lb-font-body);
    font-size: 11px;
    color: #e74c3c;
    margin-top: 4px;
    min-height: 16px;
}

.lb-char-counter {
    position: absolute;
    right: 12px;
    top: 16px;
    font-family: var(--lb-font-body);
    font-size: 11px;
    color: #728caa;
    pointer-events: none;
}
