/* For exactly 5 cards, center the 5th one */
.tabletop > .table-item:nth-child(5):nth-last-child(2) {
    grid-column: 2 / 4;
}

/* For exactly 6 cards, center the last 2 */
.tabletop > .table-item:nth-child(5):nth-last-child(3) {
    grid-column: 2;
}

.tabletop > .table-item:nth-child(6):nth-last-child(2) {
    grid-column: 3;
}
@media (min-width: 641px) {
    /* Ensure weather and map stay side by side on larger screens */
    .info-cards-row {
        grid-template-columns: 1fr 1fr !important;
    }
    
    /* Desktop-specific shelf spacing */
    .quick-log-widgets-container::after {
        bottom: -1.8rem; /* Adjusted for better desktop spacing */
    }
}
/* ========================================
   DASHBOARD STYLES
   ======================================== */
:root {
    --bg-primary: #FFFDF7;
    --bg-secondary: #F0EAD6;
    --text-primary: #4A2C2A;
    --text-secondary: #856f6f;
    --brand-primary: #4CAF50;
    --brand-secondary: #45a049;
    --brand-warning: #f0a500;
    --brand-danger: #d32f2f;
    --border-color: #DED0B6;
    --wood-dark: #3a2422;
    --wood-light: #5c4240;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    background-color: var(--wood-light); /* QUICK FIX: Prevents white flash on load */
    height: 100%; /* Ensure body 100% min-height can reference viewport */
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--wood-light);
    background-image:
        radial-gradient(circle at 10% 10%, rgba(255,255,255,0.08) 0%, transparent 40%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 40" width="80" height="40"><path fill="none" stroke="%233a2422" stroke-width="1.5" d="M-10 10 C 30 0, 50 0, 90 10 S 130 20, 170 30" opacity="0.3"></path><path fill="none" stroke="%233a2422" stroke-width="1.5" d="M-10 30 C 30 20, 50 20, 90 30 S 130 40, 170 30" opacity="0.3"></path></svg>');
    color: var(--text-primary);
    margin: 0;
    min-width: 320px;
    /* Ensure the patterned background fills the viewport even when content is short */
    min-height: 100vh;
    /* On modern mobile browsers, svh/dvh handle dynamic toolbars better */
    min-height: 100svh;
}

/* ========================================
   LOADING INDICATOR
   ======================================== */
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background-color: var(--wood-light); /* Match body background */
    z-index: 200;
}
.spinner {
    width: 48px; height: 48px; border: 4px solid var(--border-color);
    border-radius: 50%; border-top-color: var(--brand-primary);
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   LAYOUT & STRUCTURE
   ======================================== */
.dashboard-container {
    padding: 1.5rem 1rem 8rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    /* Ensure the container fills the viewport height minus the fixed bottom nav */
    min-height: calc(100svh - 60px);
}
#main-content-wrapper {
    width: 100%;
    overflow: visible;
    /* Prevent overlap with the fixed bottom nav and floating UI */
    padding-bottom: 90px; /* 60px nav + ~30px cushion for FAB/public pill */
}
.main-section { display: none; }
.main-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Header for the page title */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #e5d9c1 100%);
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    border: 3px solid var(--wood-dark);
    box-shadow:
        0 10px 30px rgba(0,0,0,0.3),
        inset 0 0 20px rgba(255,255,255,0.2);
    position: relative;
    transform: rotate(-1deg);
}

.dashboard-header::before, .dashboard-header::after {
    content: '';
    position: absolute;
    top: -15px;
    width: 40px;
    height: 30px;
    background: var(--wood-dark);
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.dashboard-header::before { left: 20%; }
.dashboard-header::after { right: 20%; }

#page-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 2.8rem;
    color: var(--wood-dark);
    margin: 0;
    line-height: 1.1;
    text-shadow: 2px 2px 0 rgba(255,255,255,0.3);
}

#welcome-message {
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 2px; /* Slight indent */
    padding: 0;
}


.avatar-button {
    padding: 0; border: none; background: none; cursor: pointer;
    border-radius: 50%; position: relative;
}

.avatar-button::before {
    content: '✏️'; position: absolute; bottom: -5px; right: -5px;
    background: var(--brand-primary); width: 24px; height: 24px;
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 0.8rem; border: 2px solid var(--bg-primary);
    opacity: 0; transform: scale(0.8); transition: all 0.2s ease;
    z-index: 2;
}

.avatar-button:hover::before { opacity: 1; transform: scale(1); }
.avatar {
    width: 56px; height: 56px; border-radius: 50%;
    border: 3px solid var(--bg-primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
    position: relative;
    z-index: 1;
}
.avatar-button:hover .avatar { transform: scale(1.1); }

.wave {
    display: inline-block;
    animation: wave-animation 2.5s ease-in-out infinite;
    transform-origin: 70% 70%;
    margin-right: 0.5rem;
}

@keyframes wave-animation {
    0% { transform: rotate(0deg); } 10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); } 30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); }
    60% { transform: rotate(0deg); } 100% { transform: rotate(0deg); }
}

.user-name {
    color: var(--brand-primary); font-weight: 900;
    text-decoration: underline; text-decoration-style: wavy;
    text-decoration-color: var(--brand-secondary); text-underline-offset: 4px;
}

/* University Badge */
#university-badge {
    display: inline-block;
    padding: 0.2rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    color: var(--bg-secondary);
    background: linear-gradient(135deg, var(--wood-light), var(--wood-dark));
    border-radius: 6px;
    border: 1px solid #2a1a18;
    box-shadow: 
        inset 0 1px 1px rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    white-space: nowrap;
    max-width: fit-content;
    transition: transform 0.2s ease;
}

#university-badge:hover {
    transform: translateY(-1px);
}

.university-icon {
    font-size: 0.9rem; /* Adjusted size */
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3)); /* Icon shadow */
}

/* ========================================
   QUICK LOG WIDGETS - FIXED DELETE BUTTON
   ======================================== */
.quick-log-widgets-container {
    padding: 0 1rem 1rem 1rem; 
    max-width: 1000px;
    margin: -1rem auto 0 auto;
    text-align: center;
    overflow: visible; 
    position: relative; 
    margin-bottom: 2rem; /* More space for the shelf */
}

/* Shelf Divider */
.quick-log-widgets-container::after {
    content: '';
    position: absolute;
    bottom: 0; /* Adjusted shelf position */
    left: 50%;
    transform: translateX(-50%);
    width: var(--shelf-width, 0px);
    max-width: 90%;
    height: 12px;
    background: linear-gradient(to bottom, var(--wood-light) 0%, var(--wood-dark) 100%);
    border-radius: 4px;
    border: 1px solid #2a1a18;
    box-shadow: 
        0 2px 0 rgba(255, 255, 255, 0.1) inset,
        0 -2px 2px rgba(0, 0, 0, 0.3) inset,
        0 2px 4px rgba(0, 0, 0, 0.4);
    z-index: 1;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}


.quick-log-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.5rem;
    color: var(--bg-secondary);
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.quick-log-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    padding: 15px;
    overflow: visible;
    position: relative;
    z-index: 2;
    margin-bottom: 0; 
}

.quick-log-widget-btn {
    position: relative;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease-out;
    background: var(--bg-secondary);
    border: 2px solid var(--wood-dark);
    border-radius: 12px;
    border-bottom: 5px solid var(--wood-dark);
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.1);
    
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    line-height: 1.2;
}

.widget-name {
    font-size: 1em;
    font-weight: 700;
}

.widget-price {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: rgba(0,0,0,0.05);
    padding: 1px 8px;
    border-radius: 8px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.quick-log-widget-btn:hover {
    background-color: #f7f2e5;
    transform: translateY(-2px);
    border-bottom-width: 7px;
}

.quick-log-widget-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.2);
    transition-duration: 0.05s;
}

.delete-widget-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background: var(--brand-danger);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    border: 3px solid var(--bg-primary);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 20;
    
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

@media (hover: hover) and (pointer: fine) {
    .quick-log-widget-btn:hover .delete-widget-btn {
        opacity: 1;
        transform: scale(1);
    }
}

.delete-widget-btn:hover {
    background: #e57373;
    transform: scale(1.1) rotate(90deg);
}

.quick-log-error {
    background-color: var(--brand-danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 700;
    animation: fadeInOut 3s ease forwards;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateY(10px); }
    10%, 90% { opacity: 1; transform: translateY(0); }
}

@keyframes jiggle {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}

.quick-log-widgets-container.delete-mode {
    overflow: visible;
}

.quick-log-widgets-container.delete-mode .quick-log-widget-btn {
    animation: jiggle 0.2s infinite;
}

.quick-log-widgets-container.delete-mode .delete-widget-btn {
    opacity: 1;
    transform: scale(1);
}

.quick-log-widgets-container.delete-mode .quick-log-buttons {
    gap: 1.5rem;
    padding: 20px;
}


/* ========================================
   TABLETOP GRID
   ======================================== */
.tabletop {
    display: grid; 
    gap: 2rem; 
    grid-template-columns: repeat(4, 1fr);
    max-width: 1000px; 
    margin: 0 auto;
    position: relative;
}

.tabletop[data-card-count="1"] {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
}

.tabletop[data-card-count="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.tabletop[data-card-count="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.tabletop[data-card-count="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.info-cards-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
    margin-top: 0;
}

.table-item {
    min-height: 160px; position: relative;
    transition: transform 0.3s ease; filter: drop-shadow(3px 5px 5px rgba(0,0,0,0.2));
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.75rem; padding: 1rem;
}
.table-item:hover { transform: translateY(-5px) rotate(1deg); z-index: 10; }
.item-details { text-align: center; }
.item-title { font-family: 'Nunito', sans-serif; font-weight: 700; color: var(--bg-secondary); font-size: 1rem; margin-bottom: 0.5rem; }
.item-balance { font-family: 'Patrick Hand', cursive; font-size: 2.5rem; color: var(--bg-primary); }

[class*="item-custom"] .custom-token-stack { width: 80px; height: 80px; }

.bell-bag { width: 100px; height: 100px; }
.wallet { width: 90px; height: 80px; position: relative; }
.wallet-top { position: absolute; top: 0; width: 100%; height: 40px; background: #8B4513; border-radius: 10px 10px 0 0; border: 2px solid #654321; box-shadow: inset 0 2px 5px rgba(0,0,0,0.2); z-index: 2; }
.wallet-bottom { position: absolute; bottom: 0; width: 100%; height: 45px; background: #A0522D; border-radius: 0 0 10px 10px; border: 2px solid #654321; border-top: none; }
.cash-bills { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 70px; height: 35px; }
.bill { position: absolute; width: 60px; height: 25px; background: linear-gradient(135deg, #85bb65 0%, #6fa052 100%); border: 1px solid #5a8543; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.bill::after { content: '$'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,0.7); font-size: 1.2rem; font-weight: bold; }
.bill-1 { top: 0; left: 0; }
.bill-2 { top: 3px; left: 5px; transform: rotate(3deg); }
.bill-3 { top: 6px; left: 10px; transform: rotate(-2deg); }
.coaster-stack { position: relative; width: 100px; height: 100px; }
.coaster { position: absolute; width: 90px; height: 90px; background-color: #D2B48C; background-image: radial-gradient(circle at center, transparent 15%, #D2B48C 15%), url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48ZmlsdGVyIGlkPSJub2lzZSI+PGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9IjAuOCIgbnVtT2N0YXZlcz0iMyIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNub2lzZSkiIG9wYWNpdHk9IjAuMTUiLz48L3N2Zz4='); border: 3px solid #b39a7c; border-radius: 50%; box-shadow: inset 0 0 15px rgba(0,0,0,0.1), 0 2px 5px rgba(0,0,0,0.2); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.coaster::before { content: ''; position: absolute; top: 20%; left: 20%; right: 20%; bottom: 20%; border: 2px solid rgba(0,0,0,0.1); border-radius: 50%; }
.coaster:nth-child(2) { transform: translate(-45%, -55%) rotate(15deg); }
.coaster:nth-child(3) { transform: translate(-40%, -60%) rotate(-10deg); }
.bonus-coaster { background-color: #ffd700; background-image: radial-gradient(circle at center, transparent 15%, #ffd700 15%); border-color: #e6c200; font-size: 2rem; display: flex; align-items: center; justify-content: center; color: var(--text-primary); width: 75px; height: 75px; }
.bonus-coaster::before { display: none; }

.custom-token-stack {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-token {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #e8e2d5 0%, #d4c8b6 50%, #c0b4a2 100%);
    border: 3px solid var(--wood-dark);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(0,0,0,0.2),
        0 4px 8px rgba(0,0,0,0.3);
    transform: rotate(-3deg);
}

.custom-token.money-token {
    background: linear-gradient(135deg, #d4e4bc 0%, #b8d19e 50%, #9cb580 100%);
    border-color: #6b8e4e;
}

.custom-token.count-token {
    background: linear-gradient(135deg, #f0e2d2 0%, #e6d0b6 50%, #dcc0a0 100%);
    border-color: #a0826d;
}

.custom-token::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    right: 10%;
    bottom: 10%;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
}

.token-symbol {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--wood-dark);
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
    position: relative;
    z-index: 1;
}

.reset-info {
    font-size: 0.7rem;
    color: var(--wood-dark);
    margin-top: 0.3rem;
    font-style: normal;
    font-family: 'Patrick Hand', cursive;
    opacity: 0.8;
    background: #fdfaf2;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    display: inline-block;
    position: relative;
    border: 1px dashed var(--border-color);
    transform: rotate(-2deg);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.reset-info:hover {
    transform: rotate(-1deg) scale(1.05);
    opacity: 1;
}

.reset-info::before {
    content: '↻';
    margin-right: 0.2rem;
    font-size: 0.8rem;
    opacity: 0.7;
    display: inline-block;
    animation: gentleSpin 4s ease-in-out infinite;
}

@keyframes gentleSpin {
    0%, 90%, 100% { transform: rotate(0deg); }
    95% { transform: rotate(360deg); }
}

@keyframes resetPulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; transform: rotate(-2deg) scale(1.05); }
}

.reset-info.resets-today {
    background: #fff3cd;
    color: var(--wood-dark);
    border-color: #ffc107;
    font-weight: 600;
    animation: resetPulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.3);
}

.weather-note { 
    background: #fdfaf2; 
    border: 1px solid var(--border-color); 
    border-radius: 0.5rem; 
    padding: 2rem; 
    transform: rotate(-1deg); 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    min-height: 200px;
    width: 100%;
}

.map-container { 
    background: transparent; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 200px;
    width: 100%;
}

.weather-note::before { content: ''; position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(3deg); width: 120px; height: 30px; background: rgba(135, 206, 250, 0.4); border-left: 1px dashed rgba(255,255,255,0.4); border-right: 1px dashed rgba(255,255,255,0.4); }

.weather-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}
.weather-icon { width: 80px; height: 80px; flex-shrink: 0; }
.weather-details { display: flex; flex-direction: column; align-items: flex-start; }
.weather-temp { font-size: 3rem; font-weight: 900; line-height: 1; color: var(--text-primary); }
.weather-location { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.weather-description { font-size: 1.1rem; color: var(--text-secondary); text-transform: capitalize; }
.weather-error { text-align: center; font-weight: 500; }
.folded-map { width: 240px; height: 160px; position: relative; transform: rotate(3deg); }
.map-fold-top, .map-fold-bottom { position: absolute; width: 100%; height: 50%; background-color: #e9e3d8; border: 2px solid #d1c8b8; box-shadow: 0 3px 8px rgba(0,0,0,0.2); background-image: linear-gradient(45deg, rgba(0,0,0,0.05) 25%, transparent 25%), linear-gradient(-45deg, rgba(0,0,0,0.05) 25%, transparent 25%); background-size: 15px 15px; }
.map-fold-top { top: 0; transform: perspective(400px) rotateX(-25deg); border-radius: 8px 8px 0 0; }
.map-fold-bottom { bottom: 0; transform: perspective(400px) rotateX(25deg); border-radius: 0 0 8px 8px; }

.map-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-2deg);
    font-family: 'Patrick Hand', cursive;
    color: var(--wood-dark);
    font-size: 1.8rem;
    background-color: #fdfaf2;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-shadow: none;
    box-shadow: 2px 2px 0px var(--border-color);
    white-space: nowrap;
}

@keyframes balanceUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); color: var(--brand-primary); }
    100% { transform: scale(1); }
}

.item-balance.updating {
    animation: balanceUpdate 0.6s ease-out;
}

.table-item.loading {
    background: var(--bg-secondary);
    opacity: 0.6;
    pointer-events: none;
}

.table-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.balance-error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    background: rgba(211, 47, 47, 0.1);
    border: 2px dashed var(--brand-danger);
    border-radius: 1rem;
    color: var(--brand-danger);
    font-family: 'Patrick Hand', cursive;
    font-size: 1.2rem;
}

.no-balances-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    font-family: 'Patrick Hand', cursive;
    font-size: 1.5rem;
    color: var(--text-secondary);
}


/* ========================================
   LEADERBOARD (NEWSPAPER)
   ======================================== */
#leaderboard-section { overflow: visible; position: relative; padding-left: 20px; }
.leaderboard-newspaper {
    background-color: #f5f1e8;
    background-image: repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(0, 0, 0, 0.03) 20px, rgba(0, 0, 0, 0.03) 21px), repeating-linear-gradient(90deg, transparent, transparent 20px, rgba(0, 0, 0, 0.03) 20px, rgba(0, 0, 0, 0.03) 21px);
    border: 2px solid #d1c8b8; padding: 3rem; font-family: 'Special Elite', monospace;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-width: 900px; margin: 0 auto; position: relative;
}
.leaderboard-newspaper::before { content: ''; position: absolute; top: 80px; right: 100px; width: 120px; height: 120px; background: radial-gradient(ellipse at center, rgba(139, 69, 19, 0.1) 0%, transparent 70%); border-radius: 50%; transform: rotate(45deg); pointer-events: none; }
.leaderboard-header { text-align: center; padding-bottom: 2rem; margin-bottom: 2rem; border-bottom: 4px double var(--text-primary); position: relative; }
.newspaper-title { font-size: 4rem; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: 3px; margin: 0; text-shadow: 2px 2px 0 rgba(0,0,0,0.1); }
.newspaper-subtitle { font-size: 1.2rem; color: var(--text-secondary); margin-top: 0.5rem; font-style: italic; }
.newspaper-date { font-size: 1rem; color: var(--text-secondary); margin-top: 1rem; font-style: normal; text-transform: uppercase; letter-spacing: 1px; }
.leaderboard-header::after { content: 'VOL. XCIX NO. 42'; position: absolute; top: 0; right: 0; font-size: 0.8rem; color: var(--text-secondary); }
.leaderboard-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; column-gap: 3rem; }
.leaderboard-item { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border-color); }
.leaderboard-item:nth-child(1) { grid-column: 1 / -1; font-size: 1.4rem; background: linear-gradient(to right, rgba(76, 175, 80, 0.1), transparent); padding: 1.5rem; margin: 0 0 1rem 0; border: 2px solid var(--text-primary); border-left: 8px solid var(--brand-primary); }
.leaderboard-item:nth-child(2), .leaderboard-item:nth-child(3) { font-size: 1.1rem; }
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-item.current-user { background-color: rgba(76, 175, 80, 0.15); padding: 0.5rem; box-shadow: inset 0 0 0 2px rgba(76, 175, 80, 0.3); }

/* Top #1 flair */
.leaderboard-item.top-one {
    position: relative;
    overflow: hidden; /* ensure effects stay inside border */
    border: 2px solid rgba(212, 175, 55, 0.6); /* softer gold */
    border-left-width: 10px;
    /* 3D button: give it a bottom edge like pfp save button */
    border-bottom-width: 8px;
    border-bottom-color: rgba(140, 105, 15, 0.42);
    background:
    /* top highlight film */
    linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.06) 28%, rgba(0,0,0,0) 70%),
        linear-gradient(90deg, rgba(212, 175, 55, 0.10), rgba(212, 175, 55, 0.04) 40%, transparent 70%),
        linear-gradient(to right, rgba(76, 175, 80, 0.06), transparent);
    box-shadow:
    0 10px 16px rgba(212, 175, 55, 0.10),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-bottom-width 0.15s ease, background-color 0.15s ease;
    cursor: pointer;
}

.leaderboard-item.top-one::before {
    /* animated sheen sweep, clipped inside borders */
    content: '';
    position: absolute;
    top: 6px; bottom: 6px; left: 12px; width: 18%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    transform: skewX(-20deg);
    animation: lb-sheen 3.6s ease-in-out infinite alternate; /* L->R then R->L */
    pointer-events: none;
}

/* remove rank-side crown (we place the crown on the avatar) */
.leaderboard-item.top-one::after { content: none; }

.leaderboard-item.top-one .leaderboard-avatar {
    border: 2px solid rgba(212, 175, 55, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.13), 0 6px 18px rgba(212, 175, 55, 0.22);
    animation: lb-pulse 2.4s ease-in-out infinite;
}

.leaderboard-item.top-one .leaderboard-name::after {
    content: ' • Bellionaire ';
    color: #8a6d1a; /* toned-down amber */
    font-weight: 800;
    letter-spacing: 0.2px;
}

@keyframes lb-sheen {
    0% { left: 12px; }
    100% { left: calc(100% - 12px - 18%); }
}

/* Crown on top of the avatar for #1 */
.leaderboard-item.top-one .avatar-wrap {
    position: relative;
    display: inline-block;
}
.leaderboard-item.top-one .avatar-wrap::after {
    content: '👑';
    position: absolute;
    top: -12px;
    left: 18px; /* sits over the avatar slightly to the right */
    font-size: 18px;
    transform: rotate(-10deg);
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
    pointer-events: none;
}

@keyframes lb-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12), 0 6px 18px rgba(212, 175, 55, 0.20); }
    50% { box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.20), 0 10px 24px rgba(212, 175, 55, 0.28); }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .leaderboard-item.top-one::before,
    .leaderboard-item.top-one .leaderboard-avatar {
        animation: none !important;
    }
}

.leaderboard-item.top-one:hover {
    transform: translateY(-2px);
    box-shadow:
        0 14px 26px rgba(212, 175, 55, 0.16),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    /* deepen bottom edge like pfp save button */
    border-bottom-width: 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.08) 28%, rgba(0,0,0,0) 70%),
        linear-gradient(90deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.06) 40%, transparent 70%),
        linear-gradient(to right, rgba(76, 175, 80, 0.08), transparent);
}

.leaderboard-item.top-one:active {
    transform: translateY(1px);
    box-shadow:
        0 8px 16px rgba(212, 175, 55, 0.12),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    /* pressed edge like pfp button */
    border-bottom-width: 4px;
}

/* keyboard focus parity with buttons */
.leaderboard-item.top-one:focus-visible {
    outline: 3px solid rgba(212, 175, 55, 0.55);
    outline-offset: 2px;
}

.leaderboard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
    /* Hide default broken-image icon; JS restores initials on error */
    background-color: transparent;
}

.leaderboard-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.leaderboard-bio {
    font-family: 'Patrick Hand', cursive;
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-newspaper::after {
    content: 'CAMPUS EXCLUSIVE'; position: absolute; top: 20px; left: -30px;
    background: #d32f2f; color: white; padding: 0.5rem 2rem; transform: rotate(-5deg);
    font-size: 0.9rem; font-weight: bold; box-shadow: 0 2px 10px rgba(0,0,0,0.3); letter-spacing: 1px;
}
.section-headline { font-size: 1.8rem; font-weight: 700; text-align: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--text-primary); text-transform: uppercase; position: relative; overflow: visible; }
.section-headline .streak-info-btn { margin-left: 8px; vertical-align: middle; position: relative; top: -2px; }
.streak-info { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; font-weight: 800; font-size: 0.9rem; padding: 0; line-height: 1; position: relative; }
.streak-info.pfp-button { 
    /* Override green save-button palette with newspaper tones */
    background: linear-gradient(180deg, #f5f1e8 0%, #e9e1d2 100%);
    color: var(--text-primary);
    border-color: #cdbf9f; /* softer edge color */
}
.streak-info.pfp-button:hover { 
    background: linear-gradient(180deg, #fffaf0 0%, #efe6d6 100%);
}
.streak-info.pfp-button:active { 
    background: linear-gradient(180deg, #e9e1d2 0%, #d8ccb6 100%);
}
.streak-info::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); background: #2b2b2b; color: #fff; font-weight: 600; font-size: 0.8rem; line-height: 1.35; padding: 10px 12px; border-radius: 8px; min-width: 220px; max-width: 320px; width: auto; white-space: normal; overflow-wrap: break-word; word-break: normal; hyphens: auto; box-shadow: 0 6px 18px rgba(0,0,0,0.35); opacity: 0; pointer-events: none; transition: opacity 0.15s ease, transform 0.15s ease; text-align: left; z-index: 999; }
.streak-info:hover::after, .streak-info:focus::after { opacity: 1; transform: translateX(-50%) translateY(-2px); }

@media (max-width: 480px) {
        .streak-info::after { max-width: calc(100vw - 32px); min-width: min(220px, calc(100vw - 32px)); left: 50%; transform: translateX(-50%); white-space: normal; overflow-wrap: break-word; }
    /* Prevent clipping by parents and ensure it layers above */
    .section-headline { overflow: visible; z-index: 1; }
    .streak-info { position: relative; z-index: 2; }
    .section-headline .streak-info-btn { top: -1px; }
}
.newspaper-columns { margin-top: 2rem; }

/* ========================================
   BOTTOM NAV & FAB
   ======================================== */
.fab-container {
    position: fixed; bottom: 75px; right: 15px; z-index: 100;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.fab {
    width: 56px; height: 56px;
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white; font-size: 2rem; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); border: 3px solid var(--bg-primary);
    cursor: pointer; transition: all 0.15s ease-out; text-decoration: none; border-bottom: 4px solid #388E3C;
    position: relative; z-index: 3;
}
.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.fab:active {
    transform: translateY(1px);
    border-bottom-width: 2px;
    transition-duration: 0.05s;
}

.fab-secondary {
    width: 48px; height: 48px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--border-color) 100%);
    color: var(--text-primary); font-size: 1.2rem; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 3px 10px rgba(0,0,0,0.2); border: 2px solid var(--bg-primary);
    cursor: pointer; text-decoration: none; border-bottom: 3px solid var(--wood-dark);
    opacity: 0; transform: scale(0.8) translateY(20px); transition: all 0.2s ease-out;
    pointer-events: none; position: relative; z-index: 2;
}
.fab-secondary:hover {
    transform: scale(1) translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.fab-secondary:active {
    transform: scale(1) translateY(1px);
    border-bottom-width: 1px;
}

.fab-secondary#custom-log-btn {
    background: linear-gradient(180deg, #FFE4B5 0%, #FFDAB9 100%);
    border-color: #FFD4A3;
}

.fab-secondary#eod-update-btn {
    background: linear-gradient(180deg, #a29bfe 0%, #6c5ce7 100%);
    border-color: #4834d4;
    color: white;
}

.fab-secondary[href="log_purchase.html"] {
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 100%);
    border-color: #A5D6A7;
}

.fab-label {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 10px;
    background: var(--wood-dark);
    color: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

@media (hover: hover) and (pointer: fine) {
    .fab-container:hover .fab-secondary {
        opacity: 1; transform: scale(1) translateY(0); pointer-events: auto;
    }
    .fab-container:hover .fab-secondary .fab-label {
        opacity: 1;
    }
    .fab-container:hover .fab {
        transform: translateY(-2px) rotate(45deg);
    }
}

.fab-container.expanded .fab-secondary {
    opacity: 1; transform: scale(1) translateY(0); pointer-events: auto;
}
.fab-container.expanded .fab-secondary .fab-label {
    opacity: 1;
}
.fab-container.expanded .fab {
    transform: rotate(45deg);
}

@media (max-width: 768px) {
    .fab-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.3);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 98;
    }
    .fab-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Custom Log Modal */
.custom-log-modal {
    background-color: var(--bg-primary); border-radius: 1.5rem; padding: 2rem;
    width: 90%; max-width: 400px; position: relative; transform: scale(0.95);
    transition: transform 0.3s ease; border: 3px solid var(--wood-dark);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.modal-overlay:not(.hidden) .custom-log-modal { transform: scale(1); }
.custom-log-modal h2 { 
    margin-top: 0; font-family: 'Patrick Hand', cursive; font-size: 2rem; 
    color: var(--text-primary); text-align: center; margin-bottom: 1.5rem;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block; margin-bottom: 0.5rem; font-weight: 700;
    color: var(--text-primary); font-size: 0.9rem;
}
.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}
.form-group input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background-color: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    cursor: pointer;
}

.custom-select-wrapper select:focus {
    outline: none;
    border-color: var(--brand-primary);
    background-color: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.custom-select-wrapper::after {
    content: '▼';
    font-size: 1rem;
    color: var(--text-secondary);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.price-input-wrapper {
    position: relative; display: flex; align-items: center;
}
.price-prefix {
    position: absolute; left: 1rem; color: var(--text-secondary);
    font-weight: 700; font-size: 1.1rem;
}
.price-input-wrapper input {
    padding-left: 2.5rem;
}

.form-group-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 0.75rem;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}
.form-group-inline label {
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}
.custom-checkbox {
    appearance: none;
    background-color: var(--bg-primary);
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.25em;
    height: 1.25em;
    border: 2px solid var(--wood-dark);
    border-radius: 4px;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;
    cursor: pointer;
}
.custom-checkbox::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--brand-primary);
    transform-origin: bottom left;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.custom-checkbox:checked::before {
    transform: scale(1);
}

.custom-log-actions {
    display: flex; gap: 1rem; margin-top: 2rem;
}
.custom-log-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.25);
}
.custom-log-btn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.25), 0 4px 8px rgba(0,0,0,0.2);
}
.custom-log-btn:active {
    transform: translateY(1px);
    transition-duration: 0.05s;
    box-shadow: inset 0 1.5px 1px rgba(0,0,0,0.2);
}
.custom-log-btn.cancel {
    background: linear-gradient(180deg, #A0522D 0%, #8B4513 100%);
    color: var(--bg-primary);
    border-bottom: 4px solid var(--wood-dark);
}
.custom-log-btn.cancel:hover {
    background: linear-gradient(180deg, #b35f37 0%, #a0522d 100%);
}
.custom-log-btn.cancel:active {
    border-bottom-width: 2px;
}
.custom-log-btn.save {
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border-bottom: 4px solid #388E3C;
    flex: 1.5;
}
.custom-log-btn.save:hover {
    background: linear-gradient(180deg, #59c05c 0%, #4caf50 100%);
}
.custom-log-btn.save:active {
    border-bottom-width: 2px;
}
.custom-log-btn.save-widget {
    background: linear-gradient(180deg, #ffc107 0%, #ffb300 100%);
    color: var(--wood-dark);
    border-bottom: 4px solid #e69500;
    flex: 1.5;
}
.custom-log-btn.save-widget:hover {
    background: linear-gradient(180deg, #ffca28 0%, #ffc107 100%);
}
.custom-log-btn.save-widget:active {
    border-bottom-width: 2px;
}
.custom-log-btn:disabled {
    opacity: 0.6; cursor: not-allowed;
}

/* ========================================
   LAZY LOG MODAL
   ======================================== */
.lazy-log-modal {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    color: #edf2f7;
    border-radius: 1.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    border: 3px solid #1a202c;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.modal-overlay:not(.hidden) .lazy-log-modal { transform: scale(1); }

.lazy-log-modal h2 {
    margin-top: 0;
    font-family: 'Patrick Hand', cursive;
    font-size: 2.2rem;
    color: #fff;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.lazy-log-subtitle {
    text-align: center;
    color: #a0aec0;
    font-family: 'Nunito', sans-serif;
    margin-top: 0;
    margin-bottom: 2rem;
}

#lazy-log-inputs-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.lazy-log-modal .form-group label {
    color: #a0aec0;
    font-size: 0.9rem;
    font-weight: 700;
}
.lazy-log-modal .form-group label small {
    color: #718096;
    font-weight: 500;
}

.lazy-log-modal .price-input-wrapper input {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #edf2f7;
    font-size: 1.2rem;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
}
.lazy-log-modal .price-input-wrapper input::placeholder {
    color: #718096;
}
.lazy-log-modal .price-input-wrapper input:focus {
    background-color: #1a202c;
    border-color: var(--brand-warning);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 3px rgba(240, 165, 0, 0.4);
}

.lazy-log-modal .price-prefix {
    color: #a0aec0;
}

#lazy-log-error {
    color: #f56565;
    background-color: rgba(245, 101, 101, 0.1);
    border: 1px solid rgba(245, 101, 101, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1.5rem;
    text-align: center;
    font-weight: 700;
}

.lazy-log-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.lazy-log-btn {
    flex: 1;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.1);
}
.lazy-log-btn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 0.1), 0 4px 8px rgba(0,0,0,0.3);
}
.lazy-log-btn:active {
    transform: translateY(1px);
    transition-duration: 0.05s;
    box-shadow: inset 0 2px 2px rgba(0,0,0,0.2);
}

.lazy-log-btn.cancel {
    background: linear-gradient(180deg, #718096 0%, #4a5568 100%);
    color: #edf2f7;
    border-bottom: 4px solid #2d3748;
}
.lazy-log-btn.cancel:hover {
    background: linear-gradient(180deg, #a0aec0 0%, #718096 100%);
}
.lazy-log-btn.cancel:active { border-bottom-width: 2px; }

.lazy-log-btn.save {
    background: linear-gradient(180deg, #f6ad55 0%, var(--brand-warning) 100%);
    color: var(--wood-dark);
    border-bottom: 4px solid #dd6b20;
    flex: 1.5;
}
.lazy-log-btn.save:hover {
    background: linear-gradient(180deg, #fbd38d 0%, #f6ad55 100%);
}
.lazy-log-btn.save:active { border-bottom-width: 2px; }

.lazy-log-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


@media (hover: hover) and (pointer: fine) {
    .fab::after {
        content: 'Log Purchase';
        position: absolute;
        bottom: -30px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--wood-dark);
        color: var(--bg-secondary);
        padding: 0.3rem 0.8rem;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 700;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    
    .fab:hover::after {
        opacity: 1;
    }
    
    .fab-container.expanded .fab::after,
    .fab-container:hover .fab::after {
        opacity: 0;
    }
}

.bottom-tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to bottom, var(--wood-dark) 0%, #2a1a18 100%);
    border-top: 3px solid #1a0f0e; box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
    display: flex; justify-content: space-around; align-items: center;
    z-index: 99; padding: 0 0.5rem;
}

.tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 0.4rem 0.8rem;
    color: var(--bg-secondary); text-decoration: none;
    font-size: 0.7rem;
    font-weight: 700; font-family: 'Nunito', sans-serif;
    transition: all 0.15s ease-out; cursor: pointer; position: relative;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
    border-radius: 30px; border: 1px solid rgba(255,255,255,0.1);
    border-bottom: 3px solid rgba(0,0,0,0.3); min-width: auto;
}
.tab-item svg { margin-bottom: 0; transition: transform 0.15s ease-out; width: 20px; height: 20px; }

.tab-item:hover:not(.active) {
    color: var(--bg-primary);
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.08) 100%);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.tab-item:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition-duration: 0.05s;
}

.tab-item.active {
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white; border-color: transparent; border-bottom: 3px solid #388E3C;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

#logout-button { background: linear-gradient(180deg, rgba(211, 47, 47, 0.08) 0%, rgba(211, 47, 47, 0.03) 100%); border-color: rgba(211, 47, 47, 0.2); }
#logout-button:hover { background: linear-gradient(180deg, #d32f2f 0%, #b71c1c 100%); color: white; border-color: transparent; border-bottom: 3px solid #8b0000; box-shadow: 0 3px 10px rgba(211, 47, 47, 0.3); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 150; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }
.pfp-modal { background-color: var(--bg-primary); border-radius: 1.5rem; padding: 2rem; text-align: center; width: 90%; max-width: 400px; position: relative; transform: scale(0.95); transition: transform 0.3s ease; }
.modal-overlay:not(.hidden) .pfp-modal { transform: scale(1); }
.pfp-modal h2 { margin-top: 0; font-family: 'Patrick Hand', cursive; font-size: 2rem; }
.pfp-preview { width: 128px; height: 128px; border-radius: 50%; border: 3px solid var(--border-color); margin: 1rem auto; object-fit: cover; }
.pfp-buttons { display: flex; gap: 1rem; margin-top: 1.5rem; }

.pfp-button {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    border-style: solid;
    border-width: 2px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 0.9rem;
    border-bottom-width: 5px;
}

.pfp-button:hover {
    transform: translateY(-2px);
    border-bottom-width: 7px;
}

.pfp-button:active {
    transform: translateY(1px);
    border-bottom-width: 2px;
    transition-duration: 0.05s;
}

.upload-button {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--wood-dark);
}

.upload-button:hover {
    background-color: #f7f2e5;
}

.save-button {
    background-color: var(--brand-secondary);
    color: white;
    border-color: #388E3C;
}

/* Roadmap link – blend with newspaper background */
#roadmap-link {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
    border-width: 2px;
    border-style: solid;
    border-bottom-width: 3px; /* subtle 3D, but lighter than default */
    box-shadow: none;
}
#roadmap-link:hover {
    background-color: var(--bg-primary);
    transform: none; /* avoid big pop */
    border-bottom-width: 3px;
}
#roadmap-link:active {
    transform: none;
    border-bottom-width: 2px;
}
#roadmap-link:focus-visible {
    outline: 2px solid var(--border-color);
    outline-offset: 2px;
}
.save-button:hover {
    background-color: var(--brand-primary);
}

#pfp-upload-input { display: none; }
.close-button { position: absolute; top: 10px; right: 15px; background: none; border: none; color: var(--text-secondary); font-size: 2rem; cursor: pointer; }
.error-message { color: #c0392b; font-weight: 500; margin-top: 1rem; min-height: 1.2em; }
.map-modal { background-color: var(--bg-primary); border-radius: 1rem; padding: 0; width: 90%; max-width: 800px; height: 600px; position: relative; overflow: hidden; }
#map-render-target { width: 100%; height: 100%; border-radius: 1rem; }
.public-leaderboard-container { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); z-index: 100; width: auto; max-width: calc(100% - 90px); border-radius: 999px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; background-color: var(--wood-dark); border: 2px solid var(--wood-light); box-shadow: 0 4px 15px rgba(0,0,0,0.3); transition: opacity 0.3s ease, transform 0.3s ease; }
.public-leaderboard-container.hidden { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.public-leaderboard-container span { font-weight: 700; color: var(--bg-secondary); font-size: 0.9rem; white-space: nowrap; font-family: 'Nunito', sans-serif; line-height: 1; display: inline-flex; align-items: center; gap: 6px; max-width: none; }

/* Compact helper text inside pill */
.public-leaderboard-container small { display: none !important; }
.public-leaderboard-label { color: var(--bg-secondary); }
.info-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--wood-light); background: rgba(255,255,255,0.12); color: var(--bg-secondary); font-weight: 800; font-size: 0.75rem; line-height: 16px; text-align: center; cursor: help; position: relative; padding: 0; }
.info-dot:hover { background: rgba(255,255,255,0.18); }
.info-dot:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 2px; }
.info-dot::after { content: attr(data-tip); position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); background: #2b2b2b; color: #fff; font-weight: 600; font-size: 0.75rem; line-height: 1.25; padding: 8px 10px; border-radius: 8px; display: block; min-width: 200px; max-width: 260px; width: auto; white-space: normal; overflow-wrap: break-word; word-break: normal; hyphens: auto; text-align: left; box-shadow: 0 6px 18px rgba(0,0,0,0.35); opacity: 0; pointer-events: none; transition: opacity 0.15s ease, transform 0.15s ease; z-index: 1000; }
.info-dot:hover::after, .info-dot:focus::after { opacity: 1; transform: translateX(-50%) translateY(-2px); }

@media (max-width: 480px) {
    .public-leaderboard-container { padding: 6px 10px; gap: 6px; max-width: calc(100% - 40px); }
    .public-leaderboard-container span { font-size: 0.85rem; }
    /* Anchor tooltip above the info button, keep inside viewport */
    .info-dot::after {
        position: absolute;
        left: 50%;
        bottom: calc(100% + 10px);
        transform: translateX(-50%);
        width: auto;
        max-width: min(320px, calc(100vw - 32px));
        min-width: min(220px, calc(100vw - 32px));
        box-sizing: border-box;
        text-align: left;
        font-size: 0.8rem;
        line-height: 1.35;
        padding: 10px 12px;
    }
}
.public-leaderboard-toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.public-leaderboard-toggle input { opacity: 0; width: 0; height: 0; }
.public-leaderboard-toggle .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--wood-light); border: 1px solid var(--wood-dark); transition: .4s; border-radius: 34px; }
.public-leaderboard-toggle .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 2px; bottom: 2px; background-color: var(--bg-secondary); transition: .4s; border-radius: 50%; }
.public-leaderboard-toggle input:checked + .slider { background-color: var(--brand-secondary); }
.public-leaderboard-toggle input:checked + .slider:before { background-color: white; transform: translateX(20px); }
.hidden { display: none !important; }

.pfp-modal .form-group.bio-group {
    text-align: center;
    margin: 1.5rem 0;
}
.pfp-modal .form-group.bio-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Patrick Hand', cursive;
    font-size: 1.5rem;
}
.pfp-modal textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    color: var(--text-primary);
    resize: vertical;
    min-height: 60px;
    transition: all 0.15s ease-out;
    background: var(--bg-secondary);
    border: 2px solid var(--wood-dark);
    border-radius: 12px;
    border-bottom: 5px solid var(--wood-dark);
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.1);
}
.pfp-modal textarea:focus {
    outline: none;
    background-color: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(76, 175, 80, 0.4);
    border-bottom-width: 5px;
}
.pfp-modal textarea.bio-warning:focus {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(240, 165, 0, 0.5);
}
.pfp-modal textarea.bio-danger:focus {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(211, 47, 47, 0.5);
}
.pfp-modal textarea:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.2);
}

/* --- Rename Balance Labels Modal Styles --- */
#rename-balances-modal .pfp-modal {
    text-align: left;
    padding: 2rem 2rem 1.75rem;
    background: var(--bg-primary);
    border: 2px solid var(--wood-dark);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35), inset 0 -4px 12px rgba(0,0,0,0.15);
}
#rename-balances-modal h2 {
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    letter-spacing: .5px;
    text-align: center;
    margin-bottom: .35rem;
}
#rename-balances-modal p { font-family: 'Nunito', sans-serif; font-size: .8rem; opacity: .85; }

.rename-balance-inputs { scrollbar-width: thin; scrollbar-color: var(--wood-dark) var(--bg-secondary); }
.rename-balance-inputs::-webkit-scrollbar { width: 10px; }
.rename-balance-inputs::-webkit-scrollbar-track { background: var(--bg-secondary); border-radius: 12px; }
.rename-balance-inputs::-webkit-scrollbar-thumb { background: var(--wood-dark); border-radius: 12px; border: 2px solid var(--bg-secondary); }
.rename-balance-inputs::-webkit-scrollbar-thumb:hover { background: var(--brand-primary); }

.rename-balance-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 0.65rem; }
.rename-balance-label { font-size: 0.55rem; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; opacity: 0.7; font-family: 'Nunito', sans-serif; background: var(--bg-secondary); padding: 0.4rem 0.55rem; border-radius: 8px; border: 1px solid var(--wood-dark); text-align: center; }
.rename-balance-row input {
    background: var(--bg-secondary);
    border: 2px solid var(--wood-dark);
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: 'Nunito', sans-serif;
    color: var(--text-primary);
    font-weight: 700;
    transition: border-color .25s, background .25s, transform .15s, box-shadow .25s;
    border-bottom: 5px solid var(--wood-dark);
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.15);
}
.rename-balance-row input:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--brand-primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.08), 0 0 0 3px rgba(76, 175, 80, 0.35);
    border-bottom-width: 5px;
}
.rename-balance-row input:hover { border-color: var(--brand-primary); }
.rename-balance-row input:active { transform: translateY(2px); border-bottom-width: 2px; }

#rename-balances-modal .pfp-button { font-size: 0.85rem; }
#rename-balances-save { position: relative; }

@media (max-width: 520px) {
  .rename-balance-row { grid-template-columns: 1fr; }
  .rename-balance-label { justify-self: flex-start; }
}

.delete-account-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease-out;
    background: linear-gradient(180deg, #e57373 0%, #d32f2f 100%);
    border: 2px solid #a02424;
    border-radius: 12px;
    border-bottom: 5px solid #a02424;
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.delete-account-btn:hover {
    background: linear-gradient(180deg, #ef9a9a 0%, #e57373 100%);
    transform: translateY(-2px);
    border-bottom-width: 7px;
}
.delete-account-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.3);
    transition-duration: 0.05s;
}


#delete-confirm-button {
    background-color: var(--brand-danger) !important;
    border-color: #a02424 !important;
}
#delete-confirm-button:hover {
    background-color: #e57373 !important;
}


/* ========================================
   RESPONSIVE STYLES
   ======================================== */
@media (max-width: 968px) {
    .tabletop { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 1.5rem; 
    }
    .info-cards-row {
        grid-template-columns: 1fr 1fr;
    }
    .leaderboard-list { grid-template-columns: 1fr; }
    .leaderboard-item:nth-child(1) { grid-column: 1; }
}

@media (max-width: 640px) {
    .dashboard-container { padding: 1rem 0.5rem 6rem 0.5rem; max-width: 100%; }
    .dashboard-header { margin-bottom: 1.5rem; padding: 1rem; transform: rotate(-0.5deg); }
    .dashboard-header::before, .dashboard-header::after { display: none; }
    #page-title { font-size: 2.2rem; }
    #welcome-message { font-size: 1rem; }
    #university-badge { 
        font-size: 0.8rem; 
        padding: 0.2rem 0.4rem; /* Tighter padding */
        margin-top: 0.3rem;
    }
    .university-icon { font-size: 0.85rem; }
    .tabletop { 
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem; 
        padding: 0 0.5rem; 
    }
    
    /* Center the last balance card on its own row if there's an odd number */
    .tabletop > .table-item:not(.info-cards-row):nth-last-child(2):nth-child(odd) {
        grid-column: 1 / -1;
    }

    /* FIXED: Reset desktop-specific grid spanning for ALL card counts on mobile */
    .tabletop[data-card-count="3"],
    .tabletop[data-card-count="4"],
    .tabletop > .table-item:nth-child(5):nth-last-child(2),
    .tabletop > .table-item:nth-child(5):nth-last-child(3),
    .tabletop > .table-item:nth-child(6):nth-last-child(2) {
        grid-column: auto;
        /* Also ensure the grid template is correct */
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* This rule ensures that for 3 or 4 cards, the grid is 2 columns wide */
    .tabletop[data-card-count="3"],
    .tabletop[data-card-count="4"] {
        grid-template-columns: repeat(2, 1fr);
    }


    .tabletop[data-card-count="1"] {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto;
    }

    .info-cards-row {
        display: flex;
        flex-direction: column-reverse;
        gap: 1rem;
    }
    .table-item { min-height: 140px; }
    .bell-bag { width: 80px; height: 80px; }
    .wallet { width: 70px; height: 65px; }
    .wallet-top { height: 30px; }
    .wallet-bottom { height: 35px; }
    .cash-bills { width: 55px; height: 25px; }
    .bill { width: 45px; height: 18px; }
    .bill::after { font-size: 0.7rem; }
    .coaster-stack { width: 70px; height: 70px; }
    .coaster { width: 60px; height: 60px; }
    .custom-token-stack { width: 70px; height: 70px; }
    .custom-token { width: 60px; height: 60px; }
    .token-symbol { font-size: 2rem; }
    .bonus-coaster { width: 60px; height: 60px; font-size: 1.5rem; }
    .item-balance { font-size: 1.8rem; }
    .item-title { font-size: 0.85rem; }
    .reset-info { 
        font-size: 0.65rem; 
        padding: 0.1rem 0.4rem;
        margin-top: 0.2rem;
    }
    .weather-temp { font-size: 2rem; }
    .weather-icon { width: 50px; height: 50px; }
    .weather-note { padding: 1rem; }
    .folded-map { width: 140px; height: 90px; }
    .map-label { font-size: 1.2rem; }

    /* Mobile Quick Log Styles */
    .quick-log-buttons {
        display: flex;
        flex-wrap: wrap; 
        justify-content: center;
        gap: 0.75rem;
        padding: 15px;
        overflow: visible;
        margin-bottom: 0; /* FIXED: Use container padding for spacing */
    }

    .quick-log-widget-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        flex-grow: 0; 
        flex-basis: auto;
        
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        -webkit-touch-callout: none;
    }
    
    .delete-widget-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
        top: -10px;
        right: -10px;
        border: 2px solid var(--bg-primary);
    }
    
    .quick-log-widgets-container.delete-mode .quick-log-buttons {
        gap: 1.25rem;
        padding: 20px;
    }
    
    .quick-log-widgets-container {
        overflow: visible;
        padding: 0.5rem 0.5rem 2rem 0.5rem; /* FIXED: Added padding for shelf */
        margin-bottom: 0.5rem;
    }
    
    .quick-log-widgets-container::after {
        bottom: 0.5rem; /* FIXED: Closer to widgets */
    }

    #leaderboard-section {
        padding-left: 0;
    }
    
    .leaderboard-newspaper { 
        padding: 1.5rem 1rem; 
        width: 100%;
        box-sizing: border-box;
    }

    .leaderboard-newspaper::after {
        left: 10px;
        top: -10px;
        font-size: 0.7rem;
        padding: 0.4rem 1rem;
        transform: rotate(-3deg);
        z-index: 1;
    }

    .newspaper-title { font-size: 2.5rem; letter-spacing: 1px; }
    .leaderboard-header::after { display: none; }
    
    .leaderboard-item {
        font-size: 0.9rem;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 0;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }
    
    .leaderboard-rank {
        font-size: 1.2rem;
        width: 30px;
        text-align: center;
        flex-shrink: 0;
    }
    
    .leaderboard-avatar { 
        width: 40px; 
        height: 40px; 
    }
    
    .leaderboard-details {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        overflow: hidden;
    }
    
    .leaderboard-name {
        font-size: 1rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .leaderboard-bio {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .leaderboard-streak {
        font-size: 1rem;
        font-weight: 700;
        margin-left: 0;
        padding-left: 0;
        flex-shrink: 0;
        white-space: nowrap;
        min-width: fit-content;
        text-align: right;
    }
    
    .leaderboard-item:nth-child(1) {
        grid-column: 1;
        font-size: 1rem;
        padding: 1rem 0.5rem;
        margin-bottom: 1rem;
    }
    
    .leaderboard-item:nth-child(1) .leaderboard-rank {
        font-size: 1.4rem;
        width: 35px;
    }
    
    .leaderboard-item:nth-child(1) .leaderboard-avatar {
        width: 45px;
        height: 45px;
    }
    
    .leaderboard-item:nth-child(1) .leaderboard-streak {
        font-size: 1.2rem;
    }
    
    .section-headline { font-size: 1.3rem; }
    .map-modal { height: 400px; }
    .bottom-tab-bar { height: 60px; padding: 0 0.5rem; }
    .tab-item { border-bottom: 2px solid rgba(0,0,0,0.3); }
    .tab-item.active { border-bottom: 3px solid #388E3C; }
    .tab-item span { display: block; }
    .fab-container { bottom: 70px; right: 10px; }
    .fab { width: 48px; height: 48px; font-size: 1.5rem; }
    .fab-secondary { width: 42px; height: 42px; font-size: 1rem; }
    .public-leaderboard-container { bottom: 70px; padding: 0.5rem 1rem; max-width: calc(100% - 40px); }
    .public-leaderboard-container span { font-size: 0.85rem; max-width: calc(100vw - 140px); }
    /* Keep pill slim on mobile: hide helper line */
    .public-leaderboard-container small { display: none !important; }
    
    .fab:not(.expanded) {
        animation: pulse 2s ease-in-out infinite;
    }
    .fab-container.expanded .fab {
        animation: none;
    }
    
    .fab-hint {
        position: absolute;
        bottom: -25px;
        right: 0;
        background: var(--wood-dark);
        color: var(--bg-secondary);
        padding: 0.3rem 0.6rem;
        border-radius: 15px;
        font-size: 0.7rem;
        font-weight: 700;
        white-space: nowrap;
        opacity: 0.8;
        pointer-events: none;
        animation: fadeInOut 3s ease-in-out;
    }
    
    @keyframes pulse {
        0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
        50% { transform: scale(1.05); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0; }
        20%, 80% { opacity: 0.8; }
    }
}

@media (max-width: 380px) {
    .tab-item {
        padding: 0.5rem 0.75rem;
    }
    .tab-item span { display: none; }
    .tab-item svg { width: 24px; height: 24px; margin-bottom: 0; }
}
