/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a1628;
    --bg-secondary: #121f3d;
    --bg-card: #1a2a4a;
    --bg-card-hover: #223560;
    --gold: #f0c040;
    --gold-glow: #f0c04066;
    --green: #4caf50;
    --green-dark: #388e3c;
    --blue: #42a5f5;
    --purple: #ab47bc;
    --red: #ef5350;
    --orange: #ff9800;
    --text-primary: #e8e8e8;
    --text-secondary: #a0b0c8;
    --text-dim: #607090;
    --border: #2a3a5a;
    --shadow: rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== GAME CONTAINER ===== */
#game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 12px 80px;
    position: relative;
}

/* ===== HEADER ===== */
#header {
    text-align: center;
    padding: 20px 0 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

#header h1 {
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--gold), #ffd700, var(--orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

#app-version {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

#stats-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
}

/* ===== MUSIC CONTROLS ===== */
#music-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 0 2px;
}

#music-toggle {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

#music-toggle:hover {
    border-color: var(--gold);
    color: var(--gold);
}

#music-toggle.playing {
    border-color: var(--green);
    color: var(--green);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

#share-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--purple), #7b1fa2);
    border: 1px solid var(--purple);
    border-radius: 20px;
    color: #fff;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

#share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(171, 71, 188, 0.4);
}

#install-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    border: 1px solid var(--green);
    border-radius: 20px;
    color: #fff;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    animation: installPulse 2s ease-in-out infinite;
}

#install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

#install-btn.hidden { display: none; }

/* Generic hidden utility */
.hidden { display: none !important; }

/* Update button */
#update-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border: 1px solid #ff9800;
    border-radius: 20px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    animation: updatePulse 1.5s ease-in-out infinite;
}

#update-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.5);
}

#update-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    animation: none;
}

#update-btn.hidden { display: none; }

/* Support Developer section */
#support-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
#support-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e91e63, #c2185b);
    border: 1px solid #e91e63;
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-bottom: 12px;
}
#support-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(233, 30, 99, 0.5);
}

/* Support Modal */
.support-modal {
    text-align: center;
}
.support-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.support-qris {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    display: inline-block;
    margin: 8px auto 16px;
}
.support-qris img {
    max-width: 280px;
    width: 100%;
    height: auto;
    display: block;
}
.support-thanks {
    color: var(--gold);
    font-size: 0.85rem;
    margin-top: 4px;
}

@keyframes updatePulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255, 152, 0, 0.2); }
    50% { box-shadow: 0 0 16px rgba(255, 152, 0, 0.6); }
}

@keyframes installPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(76, 175, 80, 0.2); }
    50% { box-shadow: 0 0 14px rgba(76, 175, 80, 0.5); }
}

/* iOS install banner */
#ios-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUpBanner 0.4s ease;
}

#ios-install-banner.hidden { display: none; }

@keyframes slideUpBanner {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

#ios-install-banner .banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

#ios-install-banner .banner-text {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.4;
}

#ios-install-banner .banner-text strong {
    color: var(--gold);
}

#ios-install-banner .banner-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

/* ===== SHARE MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInModal 0.3s ease;
}

.modal-overlay.hidden { display: none; }

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUpModal 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-title {
    font-size: 1.2rem;
    margin-bottom: 16px;
    text-align: center;
    color: var(--gold);
}

#share-preview-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
}

#share-canvas {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn:hover { transform: translateY(-2px); }

.btn-dl {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #fff;
}

.btn-share-native {
    background: linear-gradient(135deg, var(--blue), #1e88e5);
    color: #fff;
}

.btn-copy {
    background: linear-gradient(135deg, var(--orange), #e68900);
    color: #fff;
}

.modal-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 12px;
}

#volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
}

#volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: none;
}

/* ===== CLICK SECTION ===== */
#click-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 16px;
    position: relative;
}

#click-area {
    position: relative;
    width: 160px;
    height: 160px;
}

#click-button {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #2a4a7a, #1a2a4a);
    border: 3px solid var(--gold);
    box-shadow: 0 0 20px var(--gold-glow), inset 0 0 20px rgba(240, 192, 64, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#click-button:active {
    transform: scale(0.93);
    box-shadow: 0 0 30px var(--gold-glow), inset 0 0 30px rgba(240, 192, 64, 0.15);
}

.click-emoji {
    font-size: 3rem;
    display: block;
    line-height: 1;
    margin-bottom: 4px;
}

.click-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
}

.click-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Float texts */
#float-texts {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.float-text {
    position: absolute;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gold);
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 0 6px var(--gold-glow);
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}

/* Ramadan Timer */
#ramadan-timer {
    margin-top: 12px;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== TABS ===== */
#tabs {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    position: sticky;
    top: 90px;
    z-index: 99;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 10px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.tab.active {
    background: linear-gradient(135deg, #1a3a6a, #223a70);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

/* ===== TAB PANELS ===== */
.tab-panel {
    display: none;
    padding: 16px 0;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.tab-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.tab-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* ===== ITEM GRID ===== */
.item-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== ITEM CARD ===== */
.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.item-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--gold);
    box-shadow: 0 0 12px var(--gold-glow);
}

.item-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.item-card.locked:hover {
    border-color: var(--border);
    box-shadow: none;
}

.item-card.cant-afford {
    opacity: 0.6;
}

.item-icon {
    font-size: 2.2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 10px;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.item-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.item-stats {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
}

.item-stats span {
    color: var(--text-dim);
}

.item-stats .income-val {
    color: var(--green);
}

.item-stats .cost-val {
    color: var(--orange);
}

.item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.item-count {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
}

.item-price {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--orange);
    background: rgba(255, 152, 0, 0.12);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Level badge on card */
.item-level {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.6rem;
    color: var(--text-dim);
    background: var(--bg-secondary);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ===== ABILITY CARD SPECIAL ===== */
.ability-card {
    border-left: 3px solid var(--purple);
}

.ability-card.on-cooldown {
    opacity: 0.5;
}

.ability-card .cooldown-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--purple);
    border-radius: 0 0 12px 12px;
    transition: width 0.5s linear;
}

.ability-duration {
    font-size: 0.7rem;
    color: var(--purple);
    font-weight: 600;
}

/* Active abilities */
#active-abilities {
    margin-top: 20px;
}

#active-abilities h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

#active-ability-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-ability-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(171, 71, 188, 0.2), rgba(171, 71, 188, 0.1));
    border: 1px solid var(--purple);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--purple);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(171, 71, 188, 0.3); }
    50% { box-shadow: 0 0 12px rgba(171, 71, 188, 0.5); }
}

.active-ability-badge .timer {
    font-weight: 700;
    color: var(--text-primary);
}

.no-active {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

/* ===== ACHIEVEMENT TOAST ===== */
#achievement-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2a1a00, #3a2800);
    border: 2px solid var(--gold);
    box-shadow: 0 4px 20px var(--gold-glow);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    animation: toastIn 0.4s ease;
    max-width: 90%;
}

#achievement-toast.hidden {
    display: none;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-content strong {
    font-size: 0.85rem;
    color: var(--gold);
}

.toast-content span {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* ===== NOTIFICATION ===== */
#notification-area {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
    max-width: 280px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* ===== PROGRESS BAR (for logistics) ===== */
.progress-wrap {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--blue));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    #header h1 { font-size: 1.2rem; }
    .stat-value { font-size: 0.85rem; }
    .stat-label { font-size: 0.65rem; }
    #click-button { width: 130px; height: 130px; }
    #click-area { width: 130px; height: 130px; }
    .click-emoji { font-size: 2.4rem; }
    .tab { font-size: 0.68rem; padding: 8px 4px; }
    .item-icon { width: 40px; height: 40px; font-size: 1.6rem; }
}

/* ===== SPARKLE EFFECT ===== */
.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    animation: sparkle 0.6s ease-out forwards;
    pointer-events: none;
}

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

/* Berkah multiplier glow */
.berkah-active #click-button {
    border-color: #4caf50;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5), inset 0 0 20px rgba(76, 175, 80, 0.15);
}

/* Buy flash */
.buy-flash {
    animation: buyFlash 0.3s ease;
}

@keyframes buyFlash {
    0% { background: rgba(76, 175, 80, 0.2); }
    100% { background: var(--bg-card); }
}

/* ===== MOD TAB ===== */
#mod-type-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mod-type-btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mod-type-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.mod-type-btn.active {
    background: linear-gradient(135deg, #2a1a4a, #3a2260);
    border-color: #b070ff;
    color: #d4a0ff;
    box-shadow: 0 0 8px rgba(176, 112, 255, 0.3);
}

.mod-form {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.mod-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.mod-field {
    margin-bottom: 12px;
}

.mod-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.mod-field input,
.mod-field select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.mod-field input:focus,
.mod-field select:focus {
    border-color: #b070ff;
    box-shadow: 0 0 6px rgba(176, 112, 255, 0.25);
}

.mod-field input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.mod-field-row {
    display: flex;
    gap: 12px;
}

.mod-field-row .mod-field {
    flex: 1;
}

.mod-add-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6a3dad, #8b5cf6);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.mod-add-btn:hover {
    background: linear-gradient(135deg, #7c4dbc, #9d6ff8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.mod-add-btn:active {
    transform: scale(0.97);
}

#mod-list-section {
    margin-top: 20px;
}

#mod-list-section h3 {
    color: var(--gold);
    font-size: 1rem;
    margin-bottom: 10px;
}

.mod-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
    opacity: 0.6;
}

.mod-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.mod-item:hover {
    border-color: rgba(176, 112, 255, 0.4);
}

.mod-item-icon {
    font-size: 1.5rem;
    width: 36px;
    text-align: center;
}

.mod-item-info {
    flex: 1;
    min-width: 0;
}

.mod-item-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.mod-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.mod-item-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.mod-item-type.menu { background: rgba(240, 192, 64, 0.15); color: var(--gold); }
.mod-item-type.logistic { background: rgba(64, 160, 240, 0.15); color: #40a0f0; }
.mod-item-type.employee { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.mod-item-type.ability { background: rgba(176, 112, 255, 0.15); color: #b070ff; }

.mod-delete-btn {
    padding: 6px 10px;
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 6px;
    color: #f44336;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mod-delete-btn:hover {
    background: rgba(244, 67, 54, 0.3);
}

.item-card.custom-mod {
    border-left: 3px solid #b070ff;
}

.custom-badge {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(176, 112, 255, 0.2);
    color: #d4a0ff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ===== FLEXING TAB ===== */
.flexing-stats {
    display: flex;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.flexing-stats strong {
    color: var(--gold);
}

.flexing-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flex-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.flex-card:hover {
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}
.flex-card.owned {
    border-color: var(--green);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08), var(--bg-secondary));
    cursor: default;
}
.flex-card.owned::after {
    content: '✅ OWNED';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--green);
    background: rgba(76, 175, 80, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
}
.flex-card.cant-afford {
    opacity: 0.55;
}
.flex-card.locked {
    opacity: 0.35;
    filter: grayscale(0.5);
    cursor: not-allowed;
}

.flex-icon {
    font-size: 2.2rem;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 215, 0, 0.08);
    border-radius: 12px;
    flex-shrink: 0;
}
.flex-card.owned .flex-icon {
    background: rgba(76, 175, 80, 0.12);
}

.flex-info {
    flex: 1;
    min-width: 0;
}
.flex-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.flex-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.flex-category {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 215, 0, 0.12);
    color: var(--gold);
}

.flex-price {
    text-align: right;
    flex-shrink: 0;
}
.flex-price-val {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gold);
}
.flex-card.owned .flex-price-val {
    color: var(--green);
    text-decoration: line-through;
    opacity: 0.6;
}

/* Rp prefix input wrapper */
.mod-input-rp {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.mod-input-rp:focus-within {
    border-color: #b070ff;
    box-shadow: 0 0 6px rgba(176, 112, 255, 0.25);
}

.rp-prefix {
    padding: 10px 0 10px 12px;
    color: var(--gold);
    font-weight: 700;
    font-size: 0.85rem;
    user-select: none;
    flex-shrink: 0;
}

.mod-input-rp input {
    flex: 1;
    padding: 10px 12px 10px 6px;
    background: transparent;
    border: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.mod-input-rp input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* ===== LEADERBOARD TAB ===== */
#lb-name-section {
    margin-bottom: 16px;
}

#lb-name-section label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.lb-name-row {
    display: flex;
    gap: 8px;
}

.lb-name-row input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.lb-name-row input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.2);
}

.lb-submit-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #4caf50, #388e3c);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.lb-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(76, 175, 80, 0.3);
}

.lb-submit-btn:active {
    transform: scale(0.97);
}

.lb-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.lb-my-rank {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 183, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 16px;
}

.lb-my-rank-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 8px;
}

.lb-my-rank-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gold);
}

#lb-table-wrapper {
    margin-bottom: 12px;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.lb-table thead th {
    padding: 10px 8px;
    background: var(--bg-primary);
    color: var(--gold);
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lb-table thead th:first-child {
    width: 40px;
    text-align: center;
}

.lb-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
}

.lb-table tbody tr:hover {
    background: rgba(255, 215, 0, 0.05);
}

.lb-table tbody tr.lb-me {
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid var(--gold);
}

.lb-table tbody td {
    padding: 10px 8px;
    color: var(--text-primary);
}

.lb-table tbody td:first-child {
    text-align: center;
    font-weight: 700;
}

.lb-rank-1 td:first-child { color: #ffd700; }
.lb-rank-2 td:first-child { color: #c0c0c0; }
.lb-rank-3 td:first-child { color: #cd7f32; }

.lb-rank-medal {
    font-size: 1.1rem;
}

.lb-loading, .lb-empty, .lb-error {
    text-align: center;
    padding: 24px 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.lb-error {
    color: #f44336;
}

.lb-refresh-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lb-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ===== COMMUNITY MODS ===== */
#community-mods-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.cm-share-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #7c4dff, #651fff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.cm-share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124, 77, 255, 0.3);
}

.cm-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.cm-filters input,
.cm-filters select {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s;
}

.cm-filters input:focus,
.cm-filters select:focus {
    border-color: var(--gold);
}

.cm-filters input { flex: 2; }

/* Community Mod Card */
.cm-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.cm-card:hover {
    border-color: rgba(255, 215, 0, 0.3);
}

.cm-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cm-card-icon {
    font-size: 1.4rem;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.cm-card-info {
    flex: 1;
    min-width: 0;
}

.cm-card-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-card-type {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(124, 77, 255, 0.2);
    color: #b388ff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: 6px;
}

.cm-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.cm-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cm-card-author {
    opacity: 0.8;
}

.cm-card-actions {
    display: flex;
    gap: 6px;
}

.cm-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.cm-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cm-btn-install {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(56, 142, 60, 0.1));
    border-color: rgba(76, 175, 80, 0.3);
    color: #81c784;
    font-weight: 700;
}

.cm-btn-install:hover {
    background: rgba(76, 175, 80, 0.3);
}

.cm-btn-like.liked {
    border-color: rgba(255, 82, 82, 0.4);
    color: #ff5252;
}

.cm-btn-delete {
    border-color: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.cm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.cm-page-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.cm-page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.cm-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cm-page-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Share Modal */
.cm-modal {
    max-height: 80vh;
    overflow-y: auto;
}

.cm-share-list {
    max-height: 50vh;
    overflow-y: auto;
}

.cm-share-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.cm-share-item:hover {
    border-color: rgba(124, 77, 255, 0.4);
}

.cm-share-item-icon {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
}

.cm-share-item-info {
    flex: 1;
    min-width: 0;
}

.cm-share-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.cm-share-item-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.cm-share-item-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, #7c4dff, #651fff);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.cm-share-item-btn:hover {
    box-shadow: 0 2px 8px rgba(124, 77, 255, 0.3);
}

.cm-share-item-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== RANDOM EVENT MODAL ===== */
.re-modal {
    text-align: center;
    max-width: 380px;
}

.re-icon {
    font-size: 4rem;
    margin-bottom: 8px;
    animation: reShake 0.5s ease;
}

.re-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff4444;
    margin: 0 0 8px 0;
}

.re-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.re-amount {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    border: 2px solid rgba(255, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    animation: rePulse 0.6s ease;
}

.re-dismiss-btn {
    background: linear-gradient(135deg, #555, #333);
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.re-dismiss-btn:hover {
    background: linear-gradient(135deg, #666, #444);
    transform: scale(1.05);
}

@keyframes reShake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-15deg); }
    40% { transform: rotate(15deg); }
    60% { transform: rotate(-10deg); }
    80% { transform: rotate(10deg); }
}

@keyframes rePulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Screen shake */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5px, -3px); }
    20% { transform: translate(5px, 3px); }
    30% { transform: translate(-4px, 2px); }
    40% { transform: translate(4px, -2px); }
    50% { transform: translate(-3px, 3px); }
    60% { transform: translate(3px, -3px); }
    70% { transform: translate(-2px, 2px); }
    80% { transform: translate(2px, -2px); }
    90% { transform: translate(-1px, 1px); }
}

.shake {
    animation: screenShake 0.5s ease;
}

/* ===== NOTIFICATION PERMISSION BANNER ===== */
.notif-permission-banner {
    position: fixed;
    bottom: -120px;
    left: 0;
    right: 0;
    z-index: 3000;
    padding: 12px 16px;
    transition: bottom 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.notif-permission-banner.show {
    bottom: 0;
}

.notif-perm-content {
    background: linear-gradient(135deg, #1a2744, #0f1d35);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.notif-perm-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.notif-perm-text {
    flex: 1;
}

.notif-perm-text strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.notif-perm-text p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 2px 0 0;
}

.notif-perm-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.notif-perm-yes {
    background: linear-gradient(135deg, var(--accent), #e6a800);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.notif-perm-yes:hover {
    transform: scale(1.05);
}

.notif-perm-no {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.notif-perm-no:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
