:root {
    --bg-color: #FFD700; /* Yellow background */
    --text-color: #333333;
    --hint-color: #666666;
    --link-color: #2481cc;
    --button-color: #FF8C00; /* Dark Orange */
    --button-text-color: #ffffff;
    --secondary-bg-color: #FFFACD; /* Lemon Chiffon */
    --card-bg: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 9999;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    transition: opacity 0.5s;
}

.loading-banana {
    font-size: 60px;
    animation: bounce 1s infinite alternate cubic-bezier(0.5, 0.05, 1, 0.5);
}

.loading-shadow {
    width: 50px;
    height: 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    margin-top: 10px;
    animation: shrink 1s infinite alternate cubic-bezier(0.5, 0.05, 1, 0.5);
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-50px) rotate(10deg); }
}

@keyframes shrink {
    from { transform: scale(1); opacity: 0.3; }
    to { transform: scale(0.5); opacity: 0.1; }
}

.loading-text {
    margin-top: 20px;
    font-weight: bold;
    color: var(--button-color);
    letter-spacing: 2px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Chat List in Top */
.chat-select-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-select-item {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.chat-select-item:hover {
    transform: scale(1.02);
}

.chat-select-name {
    font-weight: bold;
}

.chat-select-arrow {
    color: var(--hint-color);
}

/* Skins Grid */
.skins-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.skin-item {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.skin-item.active {
    border-color: var(--button-color);
    background-color: var(--secondary-bg-color);
}

.skin-item.locked {
    opacity: 0.7;
    background-color: rgba(0,0,0,0.05);
}

.skin-preview {
    font-size: 30px;
    margin-bottom: 5px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-name {
    font-size: 10px;
    font-weight: bold;
}

.lock-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
}

/* Extra Attempts Indicator */
.extra-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: bold;
    color: var(--button-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 100;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Payment Loader */
.payment-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: white;
    font-weight: bold;
}

.payment-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced Theme Transitions */
body, .screen, .nav-item, .banana-btn, .user-card {
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.screen.active {
    animation: fadeIn 0.3s ease-out;
}

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

/* Particles */
.particle {
    position: absolute;
    pointer-events: none;
    animation: particleFloat 1s ease-out forwards;
    z-index: 100;
}

@keyframes particleFloat {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --hint-color: #aaaaaa;
    --link-color: #4da6ff;
    --button-color: #FFD700;
    --button-text-color: #000000;
    --secondary-bg-color: #2d2d2d;
    --card-bg: #333333;
    --shadow: 0 4px 15px rgba(0,0,0,0.5);
}

[data-theme="pastel"] {
    --bg-color: #fdf2f8;
    --text-color: #5d5d5d;
    --hint-color: #9ca3af;
    --link-color: #f472b6;
    --button-color: #f472b6;
    --button-text-color: #ffffff;
    --secondary-bg-color: #fce7f3;
    --card-bg: #ffffff;
    --shadow: 0 4px 15px rgba(244, 114, 182, 0.1);
}

.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 15px 0;
    border-radius: 20px;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item.active {
    opacity: 1;
    transform: scale(1.1);
    color: var(--button-color);
}

.nav-item span {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-item p {
    margin: 0;
    font-size: 12px;
    font-weight: bold;
}

/* Main Screen */
.screen {
    padding: 20px;
    display: none;
    animation: fadeIn 0.3s ease;
}

/* Context Selector */
.context-selector {
    background-color: rgba(255,255,255,0.8);
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: bold;
    transition: background 0.2s;
}

.context-selector:hover {
    background-color: #fff;
}

.context-selector .arrow {
    margin-left: 10px;
    font-size: 12px;
    transition: transform 0.2s;
}

.context-dropdown {
    display: none;
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    width: 80%;
    max-width: 300px;
    z-index: 100;
    overflow: hidden;
}

.context-dropdown.active {
    display: block;
    animation: fadeIn 0.2s;
}

.context-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.context-item:hover {
    background-color: var(--secondary-bg-color);
}

.context-item.selected {
    background-color: var(--secondary-bg-color);
    font-weight: bold;
    color: var(--button-color);
}

/* Shop */
.shop-header {
    text-align: center;
    margin-bottom: 20px;
}

.shop-items {
    display: grid;
    gap: 15px;
}

.shop-item {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
}

.item-icon {
    font-size: 30px;
    margin-right: 15px;
}

.item-details {
    flex: 1;
}

.item-title {
    font-weight: bold;
    font-size: 16px;
}

.item-desc {
    font-size: 12px;
    color: var(--hint-color);
}

.buy-btn {
    background-color: var(--button-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}

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

/* Settings */
.settings-section {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--hint-color);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.setting-item:last-child {
    border-bottom: none;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--button-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eee;
    transition: transform 0.2s;
}

.theme-btn.active {
    border-color: var(--button-color);
    transform: scale(1.1);
}

/* Timer States */
.timer.ready {
    background-color: #90EE90;
    color: #006400;
}

.timer.wait {
    background-color: #FFB6C1;
    color: #8B0000;
}

.screen.active {
    display: block;
}

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

.user-card {
    background-color: var(--card-bg);
    border-radius: 25px;
    padding: 25px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.user-card::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 100px;
    height: 100px;
    background-color: var(--secondary-bg-color);
    border-radius: 50%;
    z-index: 0;
}

.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin-bottom: 15px;
    object-fit: cover;
    border: 4px solid var(--bg-color);
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.username {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
}

.pencil-size {
    font-size: 48px;
    font-weight: 900;
    color: var(--button-color);
    margin: 10px 0;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

.banana-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
}

.banana-btn {
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 100px;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.2));
    animation: float 3s ease-in-out infinite;
}

.banana-btn:active {
    transform: scale(0.9) rotate(-10deg);
}

.banana-btn:disabled {
    filter: grayscale(100%);
    cursor: not-allowed;
    animation: none;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.timer {
    font-size: 16px;
    color: var(--hint-color);
    margin-top: 10px;
    font-weight: 500;
    background-color: rgba(255,255,255,0.5);
    padding: 5px 15px;
    border-radius: 15px;
    display: inline-block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 25px;
    width: 80%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
}

.group-list {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
}

.group-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 10px;
    margin-bottom: 5px;
}

.group-item:hover {
    background-color: var(--secondary-bg-color);
}

.group-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f9f9f9;
}

.group-name {
    font-weight: bold;
    font-size: 16px;
}

.group-timer {
    font-size: 12px;
    color: var(--hint-color);
}

.close-modal {
    margin-top: 20px;
    background-color: #eee;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

/* Top Screen */
.tabs {
    display: flex;
    margin-bottom: 20px;
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 5px;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.tab.active {
    background-color: var(--button-color);
    color: white;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.rank {
    width: 35px;
    font-weight: 900;
    color: var(--hint-color);
    font-size: 1.1em;
}

.rank.top-1 { color: #FFD700; font-size: 1.5em; text-shadow: 1px 1px 0 #000; }
.rank.top-2 { color: #C0C0C0; font-size: 1.3em; text-shadow: 1px 1px 0 #000; }
.rank.top-3 { color: #CD7F32; font-size: 1.3em; text-shadow: 1px 1px 0 #000; }

.player-info {
    flex: 1;
    display: flex;
    align-items: center;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.player-name {
    font-weight: 600;
    font-size: 16px;
}

.player-score {
    font-weight: 800;
    color: var(--button-color);
    font-size: 18px;
}

/* Profile Screen */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--button-color);
}

.stat-label {
    font-size: 14px;
    color: var(--hint-color);
    margin-top: 5px;
    font-weight: 500;
}
