:root {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --accent-color: #ff4b2b;
    --secondary-bg: #333;
    --modal-bg: rgba(0, 0, 0, 0.85);
}

[data-theme='light'] {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --secondary-bg: #e4e6eb;
    --modal-bg: rgba(255, 255, 255, 0.9);
}

[data-theme='cyberpunk'] {
    --bg-color: #0b0b19;
    --card-bg: #121225;
    --text-color: #00ff9f;
    --accent-color: #ff0055;
    --secondary-bg: #1f1f3a;
    --modal-bg: rgba(10, 10, 20, 0.9);
}

[data-theme='retro'] {
    --bg-color: #f4e4c3;
    --card-bg: #e8d5b5;
    --text-color: #4a3b2a;
    --accent-color: #d9534f;
    --secondary-bg: #d7c4a1;
    --modal-bg: rgba(240, 230, 200, 0.9);
}

[data-theme='forest'] {
    --bg-color: #1b261b;
    --card-bg: #263326;
    --text-color: #d1e7d1;
    --accent-color: #4caf50;
    --secondary-bg: #364d36;
    --modal-bg: rgba(20, 40, 20, 0.9);
}

[data-theme='ocean'] {
    --bg-color: #001f3f;
    --card-bg: #002b55;
    --text-color: #7fdbff;
    --accent-color: #0074d9;
    --secondary-bg: #003366;
    --modal-bg: rgba(0, 31, 63, 0.9);
}

[data-theme='sunset'] {
    --bg-color: #2d1b2e;
    --card-bg: #442747;
    --text-color: #e0e0e0;
    --accent-color: #ff6b6b;
    --secondary-bg: #5a345e;
    --modal-bg: rgba(45, 27, 46, 0.9);
}

[data-theme='midnight'] {
    --bg-color: #000000;
    --card-bg: #111111;
    --text-color: #cccccc;
    --accent-color: #6666ff;
    --secondary-bg: #222222;
    --modal-bg: rgba(10, 10, 10, 0.9);
}

[data-theme='candy'] {
    --bg-color: #fff0f5;
    --card-bg: #ffe4e1;
    --text-color: #d81b60;
    --accent-color: #ff69b4;
    --secondary-bg: #ffc0cb;
    --modal-bg: rgba(255, 240, 245, 0.9);
}

[data-theme='hacker'] {
    --bg-color: #0d0d0d;
    --card-bg: #1a1a1a;
    --text-color: #00ff00;
    --accent-color: #008f11;
    --secondary-bg: #262626;
    --modal-bg: rgba(13, 13, 13, 0.9);
}

[data-theme='autumn'] {
    --bg-color: #3e2723;
    --card-bg: #4e342e;
    --text-color: #ffcc80;
    --accent-color: #ef6c00;
    --secondary-bg: #5d4037;
    --modal-bg: rgba(62, 39, 35, 0.9);
}

[data-theme='neon'] {
    --bg-color: #000000;
    --card-bg: #1a1a1a;
    --text-color: #00ffff;
    --accent-color: #ff00ff;
    --secondary-bg: #333333;
    --modal-bg: rgba(0, 0, 0, 0.9);
}

[data-theme='monochrome'] {
    --bg-color: #ffffff;
    --card-bg: #eeeeee;
    --text-color: #000000;
    --accent-color: #555555;
    --secondary-bg: #dddddd;
    --modal-bg: rgba(255, 255, 255, 0.9);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

header {
    background-color: var(--card-bg);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--accent-color), #ff416c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
}

.nav-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--secondary-bg);
    border-radius: 20px;
    padding: 2px 10px;
    border: 1px solid transparent;
}

.search-container:focus-within {
    border-color: var(--accent-color);
}

.search-container input {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 8px;
    outline: none;
    width: 150px;
    font-size: 0.9rem;
}

.search-container button {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
}
.search-container button:hover {
    color: var(--accent-color);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.1s;
    position: relative;
}

.nav-btn:hover {
    background: var(--secondary-bg);
    transform: scale(1.1);
}

.nav-btn.active {
    color: var(--accent-color);
}

select {
    background: var(--secondary-bg);
    color: var(--text-color);
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    outline: none;
}

#stories-container {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    overflow-x: auto;
    max-width: 800px;
    margin: 0 auto;
    scrollbar-width: none; /* Firefox */
}
#stories-container::-webkit-scrollbar { display: none; }

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    min-width: 70px;
}

.story-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, var(--accent-color), #ff416c);
    position: relative;
    transition: transform 0.2s;
}

.story-circle.viewed {
    background: #555;
}

.story-circle:hover {
    transform: scale(1.05);
}

.story-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--card-bg);
    object-fit: cover;
}

.story-username {
    font-size: 0.8rem;
    margin-top: 5px;
    max-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#feed-container, #saved-container, #personalities-container, #profile-container {
    max-width: 600px;
    margin: 20px auto;
    padding-bottom: 50px;
}

.meme {
    background: var(--card-bg);
    border-radius: 10px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: relative;
    transition: box-shadow 0.3s;
}

.meme:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 15px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.post-meta {
    display: flex;
    flex-direction: column;
}

.post-author {
    font-weight: bold;
    font-size: 0.95rem;
}

.post-time {
    font-size: 0.8rem;
    color: #888;
}

.meme img {
    width: 100%;
    display: block;
    max-height: 800px; /* Prevent super long images */
    object-fit: contain;
    background: #000;
}

.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10rem;
    pointer-events: none;
    opacity: 0;
    animation: popFade 0.8s ease-out;
}

@keyframes popFade {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.caption {
    padding: 15px;
    font-size: 1.1rem;
    line-height: 1.4;
    outline: none;
}

.post-stats {
    padding: 0 15px;
    font-size: 0.9rem;
    color: #888;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.reaction-bar {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    border-top: 1px solid var(--secondary-bg);
}

.reaction-bar button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.1s;
    color: var(--text-color);
}

.reaction-bar button:hover {
    transform: scale(1.2);
}

.reaction-bar button.reacted {
    animation: bounce 0.4s;
}

@keyframes bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.hidden {
    display: none !important;
}

.loading {
    border: 4px solid var(--secondary-bg);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error-message {
    text-align: center;
    color: var(--accent-color);
    padding: 20px;
    display: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--modal-bg);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

/* Editor Styles */
.editor-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.canvas-wrapper {
    position: relative;
    margin: 0 auto;
    border: 2px dashed #666;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

#meme-canvas {
    max-width: 100%;
    display: block;
}

#drop-zone {
    position: absolute;
    text-align: center;
    color: #aaa;
    pointer-events: none; /* Let clicks pass through if needed, but we handle click on div */
}

/* Fix pointer events for drop zone click */
#drop-zone { pointer-events: auto; cursor: pointer; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center;}
#meme-canvas + #drop-zone { display: none; } /* Hide if canvas has content logic? No, JS handles visibility via clearing/drawing */
/* Actually, JS clears canvas. We can just hide dropzone if canvas has image */

.editor-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-row {
    display: flex;
    gap: 10px;
}

.control-group.half {
    width: 50%;
}

input[type="text"], input[type="number"], select {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background: var(--secondary-bg);
    color: var(--text-color);
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: filter 0.2s;
}

.action-btn.primary {
    background: var(--accent-color);
    color: white;
}

.action-btn.secondary {
    background: var(--secondary-bg);
    color: var(--text-color);
}

.action-btn:hover {
    filter: brightness(1.1);
}

.sticker-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
    max-height: 100px;
    overflow-y: auto;
}

.sticker-options button {
    font-size: 1.5rem;
    background: var(--secondary-bg);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 5px;
}

/* Template Grid */
#template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--secondary-bg);
    border-radius: 5px;
}

.template-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.template-thumb:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
}

/* Filters */
.filter-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.filter-btn {
    flex: 1;
    padding: 8px;
    font-size: 0.8rem;
    background: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
    min-width: 60px;
}

.filter-btn:hover {
    background: #444;
}

/* Comments Section */
.comments-section {
    background: var(--secondary-bg);
    padding: 15px;
    border-top: 1px solid #444;
}

.comments-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.comment.comment-reply {
    margin-left: 40px;
    border-left: 2px solid var(--accent-color);
    padding-left: 10px;
}

.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 15px;
    flex: 1;
}

.comment-author {
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.comment-input-area {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-input {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: none;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
}

.comment-submit-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Personalities Page */
.personalities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.personality-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
    padding-bottom: 10px;
}

.personality-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.personality-info {
    padding: 10px;
}

.personality-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.personality-text {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    margin-bottom: 10px;
    height: 3em; /* limit height */
    overflow: hidden;
}

.remove-personality-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
}

/* Profile Stats */
.profile-header {
    text-align: center;
    margin-bottom: 20px;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    margin-bottom: 10px;
}

.profile-level-badge {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--secondary-bg);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.stat-card h3 {
    margin: 5px 0;
    font-size: 1.5rem;
}

.stat-card p {
    margin: 0;
    font-size: 0.8rem;
    color: #aaa;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.badge-item {
    font-size: 2rem;
    text-align: center;
    background: var(--secondary-bg);
    padding: 10px;
    border-radius: 10px;
    cursor: help;
}

.badge-item.locked {
    filter: grayscale(1);
    opacity: 0.3;
}

.level-progress-container {
    margin-top: 20px;
}

.level-progress-bar {
    height: 10px;
    background: var(--secondary-bg);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
}

.level-progress-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.5s;
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    width: 300px;
    background: var(--card-bg);
    border: 1px solid var(--secondary-bg);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    overflow: hidden;
}

.notification-header {
    padding: 10px;
    border-bottom: 1px solid var(--secondary-bg);
    font-weight: bold;
    background: var(--secondary-bg);
}

#notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid #333;
    align-items: center;
}

.notification-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
}

.notif-content {
    font-size: 0.85rem;
}

.notif-time {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-top: 2px;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4b2b;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scroll to top */
#scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 900;
}

/* Zen Mode Overlay */
.zen-active {
    color: #00ff00 !important;
    animation: pulse 2s infinite;
}

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

/* Story Viewer */
.story-content {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 800px;
    background: black;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.story-main-img {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.story-header {
    position: absolute;
    top: 20px;
    left: 10px;
    display: flex;
    align-items: center;
    z-index: 10;
    width: 90%;
}

.close-story {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.story-caption {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 20px;
    background: rgba(0,0,0,0.5);
    color: white;
}

.story-progress-bar {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
    z-index: 20;
}

.progress-fill {
    height: 100%;
    background: white;
    width: 0%;
}

/* Quest System */
.quest-card {
    background: var(--secondary-bg);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.quest-card.claimed {
    opacity: 0.6;
    border: 1px solid var(--accent-color);
}

.quest-icon {
    font-size: 2rem;
}

.quest-info {
    flex: 1;
    text-align: left;
}

.quest-desc {
    font-weight: bold;
    margin-bottom: 5px;
}

.quest-reward {
    font-size: 0.8rem;
    color: #ffd700; /* Gold */
}

.quest-progress-bar {
    height: 6px;
    background: #444;
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}

.quest-progress-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s;
}

.quest-action {
    min-width: 80px;
    text-align: right;
}

.claim-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    animation: pulse 1s infinite;
}

.quest-done {
    color: #4caf50;
    font-weight: bold;
}

.quest-progress-text {
    font-size: 0.9rem;
    color: #888;
}

@media (max-width: 600px) {
    .nav-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    .search-container {
        width: 100%;
        margin-bottom: 5px;
    }
    .search-container input {
        width: 100%;
    }
    .profile-stats {
        grid-template-columns: 1fr;
    }
}

/* Shop Styles */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    padding: 10px;
}

.shop-item {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.shop-item:hover {
    transform: translateY(-5px);
}

.shop-item-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.shop-item-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.shop-item-desc {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 10px;
    height: 2.5em; /* limit height */
    overflow: hidden;
}

.shop-buy-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    width: 100%;
}

.shop-buy-btn:disabled {
    background: var(--secondary-bg);
    color: #888;
    cursor: not-allowed;
}

/* Battle Styles */
.battle-arena {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.battle-card {
    background: var(--card-bg);
    padding: 10px;
    border-radius: 10px;
    width: 45%;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.battle-card img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 5px;
    background: #000;
}

.vs-badge {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    animation: pulse 1s infinite alternate;
}

/* Chart Styles */
.chart-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 150px;
    justify-content: flex-end;
    width: 100%;
}

.chart-bar {
    width: 20px;
    background: var(--accent-color);
    border-radius: 5px 5px 0 0;
    transition: height 0.5s;
}

.chart-label {
    font-size: 0.7rem;
    margin-top: 5px;
    color: #888;
}

#activity-chart {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    height: 180px;
    margin-bottom: 20px;
    background: var(--secondary-bg);
    padding: 15px;
    border-radius: 10px;
}

@media (max-width: 600px) {
    .battle-card {
        width: 100%;
    }
    .vs-badge {
        width: 100%;
        margin: 10px 0;
    }
}

/* Leaderboard Styles */
#leaderboard-container {
    max-width: 600px;
    margin: 20px auto;
    text-align: center;
}

.leaderboard-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.leaderboard-row:hover {
    transform: scale(1.02);
}

.leaderboard-rank {
    font-size: 1.5rem;
    font-weight: bold;
    width: 40px;
    color: var(--accent-color);
}

.leaderboard-user {
    display: flex;
    align-items: center;
    flex: 1;
    text-align: left;
    margin-left: 10px;
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.leaderboard-info {
    display: flex;
    flex-direction: column;
}

.leaderboard-name {
    font-weight: bold;
    font-size: 1rem;
}

.leaderboard-score {
    font-weight: bold;
    color: #ffd700;
}

/* News Ticker */
#news-ticker-bar {
    width: 100%;
    background: var(--card-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--secondary-bg);
    overflow: hidden;
    height: 30px;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    white-space: nowrap;
}

.ticker-wrap {
    width: 100%;
    overflow: hidden;
    padding-left: 100%; /* Start off-screen */
}

.ticker-move {
    display: inline-block;
    white-space: nowrap;
    animation: ticker 30s linear infinite;
}

.ticker-item {
    display: inline-block;
    padding: 0 20px;
}

@keyframes ticker {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Tutorial Overlay */
#tutorial-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    pointer-events: none;
}

#tutorial-box {
    position: absolute;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5), 0 0 0 10000px rgba(0,0,0,0.5);
    z-index: 3001;
    max-width: 300px;
    pointer-events: auto;
    transition: top 0.5s, left 0.5s;
    border: 2px solid var(--accent-color);
}

.tutorial-highlight {
    position: relative;
    z-index: 3002;
    box-shadow: 0 0 15px var(--accent-color);
    transition: box-shadow 0.3s;
}
