/* Leaderboard Modal Custom Styles */
.leaderboard-entry {
    font-family: var(--md-ref-typeface-brand);
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1.5px solid #e5e7eb;
    margin-bottom: 1.1rem;
    padding: 1.1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow 0.2s;
}
.leaderboard-entry:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #1d1d1b;
}
.leaderboard-entry .font-bold {
    font-size: 1.25rem;
    font-weight: 700;
}
.leaderboard-entry .font-semibold {
    font-size: 1.1rem;
    font-weight: 600;
}
.leaderboard-entry .text-lg {
    font-size: 1.15rem;
}
.leaderboard-entry .text-xs {
    font-size: 0.95rem;
}
/* Tab selected visual */

/* Leaderboard Modal Tab Styles - Removed duplicate, using unified styles below */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Albert+Sans:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --my-brand-font: 'Albert Sans', sans-serif;
    --my-plain-font: system-ui;

    --md-ref-typeface-brand: var(--my-brand-font);
    --md-ref-typeface-plain: var(--my-plain-font);
    --md-sys-color-primary: #1E1E1E;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-outline: #6b6969;
}

* {
    box-sizing: border-box;
    font-family: var(--md-ref-typeface-brand);
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
    min-height: 100vh;
    min-width: 100vw; /* Allows the body to expand */
    background-color: #f7f7f7;
    padding: 20px 10px;
    margin: 0;
}


.bg-white {
    background-color: #ffffff;
}

.p-6 {
    padding: 1.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-2xl {
    font-size: 1.5rem;
    font-weight: bold;
}

.font-bold {
    font-weight: bold;
}

.rounded-lg {
    border-radius: 0.75rem;
}

.shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.max-w-md {
    max-width: 28rem;
}

.w-full {
    width: 100%;
}

.h-screen {
    height: 100vh;
}

.border {
    border: 1px solid #ccc;
}

.border-gray-300 {
    border-color: #e2e8f0;
}

.rounded {
    border-radius: 0.25rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.space-y-3 > * + * {
    margin-top: 0.75rem;
}

.text-gray-700 {
    color: #4a5568;
}

.text-black {
    color: #000000;
}

.bg-gray{
    background-color: #999999;


}

.bg-green {
    background-color: #6aa84f !important;
}
.bg-red {
    background-color: #cc0000 !important;
}
.bg-yellow {
    background-color: #FFC107 !important;
}


.cursor-not-allowed {
    cursor: not-allowed;
}

.opacity-50 {
    opacity: 0.5;
}

.icon-button {
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}



.icon-button img {
    width: 24px;
    height: auto;
    transition: opacity 0.3s ease;
}

.default-icon,
.hover-icon {
    position: absolute; /* Ensures images stack on each other */
    transition: opacity 0.3s ease; /* Smooth opacity transition */
}

.icon-button:hover .default-icon {
    opacity: 0; /* Hide the default icon */
}

.icon-button:hover .hover-icon {
    opacity: 1; /* Show the hover icon */
}

.elevated-button {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: bold;
    height: 36px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center ;
}

.elevated-button:hover {
    background: #2C2C2C;
}

.outlined-button {
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: bold;
    height: 36px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center
}

.outlined-button:hover {
    background: var(--md-sys-color-outline);
    color: var(--md-sys-color-on-primary);
}

.separator-line {
    height: 1px;
    background-color: #ccc;
    margin: 0.25rem 0;
}

.custom-line {
    border: 0;
    height: 2px;
    background: #ccc;
    margin: 0.5rem 0;
}

.main-line {
    border: 0;
    height: 2px;
    background: #484547;

    margin-bottom: 0.5rem;
}

.title {
    /* background-color: #3d85c6; */
    color: #484547;
}

/* Ensure question is left-aligned and horizontally scrollable on small screens */
/*#question {*/
/*    text-align: left !important;*/
/*    overflow-x: auto;*/
    white-space: nowrap; /* keep one line and allow horizontal scroll */
/*    -webkit-overflow-scrolling: touch;*/
/*}*/

/* Keep attempts area visible when scrolling */
#attempts {
    position: sticky;
    top: 0; /* stick to top of viewport within the card */
    z-index: 3;
    background: #ffffff; /* avoid transparency overlap */
}

.attempt-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
    min-width: fit-content; /* Ensures it doesn’t shrink */
    max-width: 100%;
    overflow-x: auto; /* Allows scrolling if it's too wide */
}

.attempt-row.active {
    transform: scale(1.02);
    background-color: #e0f7fa;
    border-radius: 0.25rem;
    /* border: 2px solid #00bcd4; */
    box-shadow: 0 2px 8px rgba(0, 188, 212, 0.3);
    animation: pulse-highlight 2s infinite;
}

.attempt-row .input-box {
    flex: 1;
    min-width: 18px;
    max-width: 44px;
    height: 28px;
    text-align: center;
    font-size: 0.50rem;
    border: 2px solid #ccc;
    border-radius: 0.25rem;
    margin: 0.25rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* background-color: #f8f9fa; */
    cursor: default;
    user-select: none;
}

#options-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin-bottom: 0.125rem;
}


.option-button:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 2px 8px #0002;
    z-index: 1;
}
#options-container button {
    flex: 1 1 23%;

}
#function-buttons {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem; /* Adjust spacing between buttons */
    margin-bottom: 0.5rem; /* Adjust margin at the bottom */
}


.table {
    width: 90%;
    margin: 0 auto;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

th {
    background-color: var(--md-sys-color-primary);
    color: white;
    text-align: left;
    padding: 0.75rem;
    font-size: 1rem;
}

td {
    padding: 0.5rem;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid #ddd;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #cfdef5;
}

@media (max-width: 600px) {
    .game-container {
        max-width: 90%;
    }

    .attempt-row .input-box {
        flex: 1 0 25%;
    }

    #options-container button {
        flex: 1 1 45%;

    }
}

.progress-container {
    width: 100%; /* Full width for progress bar */
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    width: 0; /* Start with 0 width */
    background-color: #4caf50; /* Green color */
    border-radius: 5px;
    transition: width 0.4s ease; /* Smooth transition */
}

.dashboard-body {
    padding: 20px; /* Adjust the padding value as needed */
    margin: 20px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .dashboard-body {
        padding: 10px; /* Adjust padding for smaller screens */
        margin: 10px; /* Adjust margin for smaller screens */
    }

    #user-data-table {
        width: 100%; /* Make the table full width */

/* === Mobile-first sizing and whitespace for game UI === */
.attempt-row { gap: 0.5rem; margin-bottom: 0.5rem; }
.attempt-row .input-box { height: 36px; max-width: 48px; font-size: 0.85rem; border-radius: 8px; }
#options-container { gap: 8px; margin-bottom: 0.5rem; }
#options-container button { flex: 1 1 45%; }

/* Option buttons unified style */
.option-button {
  background: #f8fafc; color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: 12px;
  padding: 10px 12px; font-weight: 600; min-height: 40px;
}
.option-button:active { transform: scale(0.98); }

/* Action buttons row */
#function-buttons { gap: 0.75rem; margin-bottom: 0.75rem; }
#function-buttons .elevated-button, #function-buttons .outlined-button { flex: 1 1 0; }

/* Celebratory effects */
@keyframes celebrate-glow { 0%{box-shadow:0 0 0 rgba(16,185,129,0);} 50%{box-shadow:0 0 0 6px rgba(16,185,129,0.25);} 100%{box-shadow:0 0 0 rgba(16,185,129,0);} }
.celebrate { animation: celebrate-glow 1200ms ease-out 2; border-radius: var(--card-radius); }
@keyframes pulse-once { 0%{transform:scale(1);} 40%{transform:scale(1.05);} 100%{transform:scale(1);} }
.pulse-once { animation: pulse-once 600ms ease-out 1; }

        font-size: 0.9rem; /* Slightly smaller font size for better fit */
    }

    th, td {
        padding: 0.5rem; /* Adjust padding for table cells */
    }

    .progress-container {
        width: 100%; /* Full width for progress bar */
    }

    .progress-bar {
        height: 8px; /* Slightly smaller height for progress bar */
    }
}

@media (max-width: 480px) {
    #user-data-table {
        font-size: 0.8rem; /* Further reduce font size for very small screens */
    }

    th, td {
        padding: 0.3rem; /* Further reduce padding for table cells */
    }

    .dashboard-body {
        padding: 5px; /* Minimal padding for very small screens */
        margin: 5px; /* Minimal margin for very small screens */
    }

    /* Additional zoom-friendly styles */
    .title {
        font-size: 1.25rem; /* Smaller title on mobile */
    }

    .text-2xl {
        font-size: 1.25rem; /* Smaller text on mobile */
    }
}

/* Handle very high zoom levels */
@media (max-height: 500px) {
    body {
        padding: 5px;
    }

    #welcome-container,
    #game-container {
        margin-top: 5px;
        margin-bottom: 5px;
        padding: 0.75rem;
    }

    .title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .text-2xl {
        font-size: 1.1rem;
    }

    .mb-4 {
        margin-bottom: 0.5rem;
    }

    .mb-6 {
        margin-bottom: 0.75rem;
    }
}

.table-responsive {
    overflow-x: auto; /* Allow horizontal scrolling */
    width: 100%; /* Full width */
}

/* Custom styles for Intro.js tooltips */
.introjs-tooltip {
    font-family: var(--my-brand-font); /* Use the custom brand font */
}

.introjs-tooltip .introjs-title {
    font-weight: bold; /* Optional: Make the title bold */
}

.introjs-tooltip .introjs-content {
    font-size: 1rem; /* Optional: Adjust font size if needed */
}

/* Style for disabled buttons */
button:disabled {
    background-color: #343434; /* Light gray background */
    color: #ccc; /* Darker gray text */
    cursor: not-allowed; /* Change cursor to indicate it's not clickable */
    opacity: 0.6; /* Slightly transparent to indicate disabled state */
}


#share-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #6aa84f; /* Green background */
    transition: background-color 0.3s ease;

}

#share-btn:hover {
    background-color: #45a049; /* Darker green on hover */
}

#share-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
/* ===== History Modal UI improvements ===== */
#history-modal .modal-content {
    max-width: 560px;
    width: 95vw;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
}
#history-modal h2 { color: var(--color-text); }

/* Stats summary bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    background: #eef2ff; /* soft indigo */
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) inset;
}
.stats-bar .stat { padding: 8px 6px; }
.stats-bar .stat .text-3xl { font-size: 1.75rem; font-weight: 800; color: #111827; }
.stats-bar .stat .text-xs { font-size: 0.7rem; letter-spacing: 0.02em; text-transform: uppercase; color: #6b7280; }

/* History list chips and badges */
.history-result-badge {
    width: 28px; height: 28px; border-radius: 9999px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-right: 8px;
    border: 1px solid var(--color-border);
}
.chip-win { background: #ecfdf5 !important; color: #065f46 !important; border: 1px solid #a7f3d0 !important; }
.chip-loss { background: #fee2e2 !important; color: #991b1b !important; border: 1px solid #fecaca !important; }

/* Latest attempt subtle highlight */
.lb-entry.latest-badge { border-left: 3px solid var(--color-accent); background: #f8fafc; }

/* Date text stacking inside left block */
.history-date-info .lb-username { font-weight: 700; color: var(--color-text); }
.history-date-info .text-xs { color: #6b7280; }

/* Responsive: collapse stats bar into two rows on very small screens */
@media (max-width: 420px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
}

    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

.rating-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.rating-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.rating-btn.selected {
    opacity: 1;
}

#feedback-comment {
    width: 100%;
    min-height: 100px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
}

.text-gray-600 {
    color: #666666;
}

.text-sm {
    font-size: 0.875rem;
}

#time-remaining {
    font-weight: 500;
    color: #2C2C2C;
}

#timer {
    font-weight: 500;
    color: #2C2C2C;
}

#leaderboard-btn {
    transition: all 0.2s ease;
}

#leaderboard-btn:hover {
    transform: translateY(-1px);
}
.tour-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2C2C2C;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    /* z-index: 1; */
}

.tour-icon {
    font-size: 16px;
}

.tour-button:hover {
    background: #454545;
    transform: scale(1.1);
}

.tour-tooltip {
    position: absolute;
    background: #2C2C2C;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    right: 40px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tour-button:hover .tour-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Ensure game container has relative positioning for absolute tour button */
#game-container {
    position: relative;
    margin-top: 20px;
    margin-bottom: 20px;
}

#welcome-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Ensure containers don't get cut off when zoomed */
@media (max-height: 600px) {
    body {
        padding: 10px 10px;
    }

    #welcome-container,
    #game-container {
        margin-top: 10px;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px 5px;
    }

    #welcome-container,
    #game-container {
        margin-top: 10px;
        margin-bottom: 10px;
        padding: 1rem;
    }
}

/* Leaderboard Styling - Consistent with Game UI */
.leaderboard-category {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
}

.leaderboard-category.fast-riders {
    border-left: 3px solid var(--md-sys-color-primary);
}

.leaderboard-category.early-birds {
    border-left: 3px solid #6aa84f;
}

.leaderboard-category h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    color: var(--md-sys-color-primary);
    font-family: var(--md-ref-typeface-brand);
}

.leaderboard-entry {
    background-color: white;
    border: 2px solid #ccc;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    margin-bottom: 0.25rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
}

.leaderboard-entry:hover {
    background-color: #e0f7fa;
    border-color: var(--md-sys-color-primary);
    transform: scale(1.02);
}

.leaderboard-entry.rank-1 {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.leaderboard-entry.rank-2 {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.leaderboard-entry.rank-3 {
    background-color: #fed7aa;
    border-color: #ea580c;
}

/* Leaderboard modal styling to match game modals */
#leaderboard-container .bg-white {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#leaderboard-container h2 {
    color: var(--md-sys-color-primary);
    font-family: var(--md-ref-typeface-brand);
    font-weight: bold;
}

#leaderboard-container .text-gray-500 {
    color: #666666;
    font-family: var(--md-ref-typeface-brand);
}

#leaderboard-container .text-gray-600 {
    color: #666666;
    font-family: var(--md-ref-typeface-brand);
}

#leaderboard-container .text-gray-800 {
    color: var(--md-sys-color-primary);
    font-family: var(--md-ref-typeface-brand);
}

#leaderboard-container .font-semibold {
    font-weight: bold;
    font-family: var(--md-ref-typeface-brand);
}

#leaderboard-container .font-bold {
    font-weight: bold;
    font-family: var(--md-ref-typeface-brand);
}

/* Micro-interaction: Shake animation for wrong answer */
@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}
.shake {
    animation: shake 0.5s;
}

/* Pulse animation for current attempt highlighting */
@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 188, 212, 0.3), 0 0 0 0 rgba(0, 188, 212, 0.4);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0, 188, 212, 0.3), 0 0 0 4px rgba(0, 188, 212, 0.1);
    }
}

.button-press {
    transform: scale(0.95);
    transition: transform 0.1s;
}
.option-button, #go-btn, #start-game-btn {
    transition: transform 0.1s;
}

.input-box.active {
    box-shadow: 0 0 8px #007bff55;
    border-color: #007bff;
    transition: box-shadow 0.2s, border-color 0.2s;
}

#copied-message {
    opacity: 0;
    transition: opacity 0.4s;
}
#copied-message.visible {
    opacity: 1;
}

.leaderboard-entry {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
}
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Date Selector Button Styles */
.leaderboard-date-btn {
  padding: 0.5rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  outline: none;
  border-radius: 0.5rem;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  margin-right: 0.3rem;
  transition: background 0.2s, color 0.2s;
}
.leaderboard-date-btn.selected {
  background: #111;
  color: #fff;
  font-weight: 700;
}


/* === App Design Language (mobile-first) === */
:root {
  --btn-bg: var(--color-primary);
  --btn-fg: var(--color-on-primary);
  --btn-bg-hover: #2c2c2c;
  --card-radius: 14px;
  --card-shadow: 0 6px 18px rgba(17,17,26,0.08);
  --tap-scale: 0.98;
}

/* Cards */
.app-card { border: 1px solid var(--color-border); border-radius: var(--card-radius); box-shadow: var(--card-shadow); }

/* Buttons */
button, .elevated-button, .outlined-button {
  -webkit-tap-highlight-color: transparent;
}
.elevated-button { background: var(--btn-bg); color: var(--btn-fg); border-radius: 12px; font-weight: 700; height: 44px; }
.elevated-button:active { transform: scale(var(--tap-scale)); }
.outlined-button { border-radius: 12px; height: 44px; }
.outlined-button:active { transform: scale(var(--tap-scale)); }

/* Inputs */
input[type="text"], input[type="date"] {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px; /* mobile-friendly */
}
input:focus { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.25); border-color: #93c5fd; }

/* Typography scale */
.title { font-size: 1.375rem; }
.text-sm { font-size: 0.92rem; }

/* Chips / micro-interactions */
.lb-chip { transition: transform .12s ease; }
.lb-chip:active { transform: scale(0.96); }

/* Buttons micro-interactions */
button { transition: transform .12s ease, box-shadow .12s ease; }
button:active { transform: scale(var(--tap-scale)); }
/* Mobile layout: stack name (left) on first row and metrics (right) on second row */
@media (max-width: 440px) {
  .lb-entry { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .lb-left { grid-column: 1; grid-row: 1; justify-self: start; padding-right: 10px; }
  .lb-metrics { grid-column: 1; grid-row: 2; justify-self: end; padding-left: 10px; margin-top: 4px; }
  .lb-username { max-width: 100%; }
}
/* Landing header compact tweaks */
#landing-user-profile .truncate { max-width: 180px; }
@media (max-width: 420px) {
  #landing-user-profile { flex-wrap: wrap; gap: 8px; }
  #landing-user-profile .truncate { max-width: 140px; }
}



/* Compact, aligned leaderboard layout for mobile */
.lb-entry { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.lb-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.lb-username { max-width: 180px; }
@media (max-width: 420px) { .lb-username { max-width: 140px; } }

/* Tighten chips on very small screens */
@media (max-width: 380px) {
  .lb-chip { padding: 2px 6px; font-size: 11px; }
}

/* Allow names to wrap to two lines gracefully */
.lb-username-wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2; }



/* Spacing tweaks for mobile */
@media (max-width: 480px) {
  #welcome-container, #game-container { padding: 16px; }
}

/* === Leaderboard 2.0: Cleaner, spacious, playful === */
:root {
  --color-bg: #f7f7fb;
  --color-surface: #ffffff;
  --color-card: #ffffff;
  --color-border: #e5e7eb;
  --color-border-soft: #eef2f7;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-primary: var(--md-sys-color-primary);
  --color-on-primary: var(--md-sys-color-on-primary);
  --color-accent: #10b981; /* playful green */
  --color-info: #3b82f6;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
}

/* Modal sizing tweaks */
#leaderboard-container .modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

/* Date controls */
.leaderboard-date-btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: 10px;
}
.leaderboard-date-btn.selected { background: var(--color-primary); color: var(--color-on-primary); }

/* Tabs - Updated to ensure visibility */
.leaderboard-tabs {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  display: flex;
  margin-bottom: 1rem;
}
.leaderboard-tab {
  flex: 1;
  padding: 0.6rem 0;
  border-radius: 10px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  font-size: 14px;
}
.leaderboard-tab.selected {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.leaderboard-tab:hover:not(.selected) {
  background: #e5e7eb;
  color: #374151;
}

/* Entry card */
.lb-entry {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* User position tile styling - same as leaderboard entries but with distinctive border */
.user-position-entry {
  background: var(--color-card);
  border: 3px solid #fbbf24;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 0;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
}

/* Leaderboard scroll container */
#leaderboard-scroll-container {
  min-height: 200px;
  max-height: 400px;
}
.lb-entry:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(17,17,26,0.06); }

.lb-rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9999px;
  font-weight: 800; color: #111; background: #f3f4f6; margin-right: 8px;
}
.rank-1 .lb-rank-badge { background: linear-gradient(135deg,#fde68a,#f59e0b); color: #111; }
.rank-2 .lb-rank-badge { background: linear-gradient(135deg,#e5e7eb,#9ca3af); color: #111; }
.rank-3 .lb-rank-badge { background: linear-gradient(135deg,#fed7aa,#f97316); color: #111; }

.lb-username { font-weight: 700; color: var(--color-text); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lb-metrics { display: inline-flex; align-items: center; gap: 8px; }
.lb-chip { background: #f3f4f6; color: #374151; font-size: 12px; padding: 2px 8px; border-radius: 9999px; font-weight: 600; }
.lb-chip.star { background: #fff7ed; color: #92400e; border: 1px solid #fed7aa; }
.lb-chip.time { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.lb-chip.attempts { background: #ecfeff; color: #155e75; border: 1px solid #a5f3fc; }
