:root {
    --primary-color: #4a148c;
    --secondary-color: #6a1b9a;
    --accent-color: #8e24aa;
    --ectoplasm-green: #39ff14;
    --admin-dark: #2e0d4f;
    --admin-darker: #1a0a2e;
    --admin-accent: #4a1875;
    --admin-border: #7b3ea3;
    --admin-text: #e0e0e0;
    --admin-text-muted: #a0a0a0;
    --admin-success: #28a745;
    --admin-warning: #ffc107;
    --admin-danger: #dc3545;
    --admin-primary: #9c27b0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Homepage Grid Layout */
.main-grid {
    display: grid;
    grid-template-areas: 
        "logo logo"
        "sidebar carousel"
        "sidebar news"
        "footer-left footer-right";
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto 1fr 1fr auto;
    min-height: 100vh;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.logo-area { grid-area: logo; text-align: center; }
.sidebar-area { grid-area: sidebar; }
.carousel-area { grid-area: carousel; }
.news-area { grid-area: news; }
.footer-left { grid-area: footer-left; }
.footer-right { grid-area: footer-right; }

.character-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 2rem;
}

/* Homepage Styles */
body { font-family: 'Times New Roman', serif; background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%); color: #e6e6e6; height: 100vh; overflow-x: hidden; }
.homepage { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; }
.container { text-align: center; position: relative; z-index: 2; max-width: 800px; width: 90%; }
.gothic-text { font-size: clamp(3rem, 8vw, 8rem); font-weight: 300; letter-spacing: 0.2em; color: #f4f4f4; text-shadow: 0 0 20px rgba(244, 244, 244, 0.5), 0 0 40px rgba(244, 244, 244, 0.3); margin-bottom: 2rem; animation: glow 3s ease-in-out infinite alternate; user-select: none; cursor: pointer; }
.profile-container { display: flex; flex-direction: column; align-items: center; margin-bottom: 2rem; animation: fadeIn 1s ease-out; }
.profile-picture { width: 150px; height: 150px; border-radius: 50%; background-image: url('https://via.placeholder.com/150/6b3d6b/ffffff?text=SMB'); background-size: cover; background-position: center; border: 3px solid rgba(244, 244, 244, 0.5); box-shadow: 0 0 20px rgba(244, 244, 244, 0.3); margin-bottom: 1.5rem; transition: all 0.3s ease; }
.profile-picture:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(244, 244, 244, 0.5); }
.cycling-text { font-size: 1.3rem; color: #f4f4f4; font-weight: 300; letter-spacing: 0.1em; height: 1.5em; opacity: 1; transition: opacity 0.5s ease-in-out; }
.cycling-text.fade-out { opacity: 0; }
.highscores { margin-top: 2rem; background-color: rgba(0, 0, 0, 0.3); border-radius: 8px; padding: 1.5rem; backdrop-filter: blur(5px); animation: fadeIn 1.5s ease-out; }
.highscores h2 { font-size: 1.5rem; margin-bottom: 1rem; font-weight: 300; letter-spacing: 0.1em; text-align: center; color: #f4f4f4; }
.highscores-content { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.skill-item { display: flex; justify-content: space-between; padding: 0.5rem; border-radius: 4px; background-color: rgba(255, 255, 255, 0.1); transition: all 0.2s ease; }
.skill-item:hover { background-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.skill-name { font-weight: 400; }
.skill-level { color: #f1c40f; }
.particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.particle { position: absolute; background: rgba(244, 244, 244, 0.1); border-radius: 50%; animation: float 6s ease-in-out infinite; }
.floating-buttons { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 15px; }
.character-btn { padding: 12px 20px; border: 2px solid rgba(244, 244, 244, 0.3); background: rgba(74, 20, 140, 0.8); color: #f4f4f4; font-family: 'Times New Roman', serif; font-size: 14px; font-weight: 300; letter-spacing: 0.05em; border-radius: 8px; cursor: pointer; transition: all 0.3s ease; backdrop-filter: blur(10px); position: relative; overflow: hidden; min-width: 140px; }
.character-btn::before { content: ''; position: absolute; top: -2px; left: -100%; width: 100%; height: calc(100% + 4px); background: linear-gradient(90deg, transparent, rgba(244, 244, 244, 0.4), transparent); transition: left 0.5s ease; }
.character-btn:hover::before { left: 100%; }
.character-btn:hover { border-color: rgba(244, 244, 244, 0.6); box-shadow: 0 0 20px rgba(244, 244, 244, 0.3); transform: translateY(-2px); }
.character-btn.active { background: rgba(244, 244, 244, 0.1); border-color: #f4f4f4; box-shadow: 0 0 25px rgba(244, 244, 244, 0.4); }
.floating-left-buttons { position: fixed; bottom: 20px; left: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 15px; }
.news-item { background: rgba(255, 255, 255, 0.05); border-radius: 4px; padding: 1rem; margin-bottom: 1rem; border-left: 4px solid var(--accent-color); }
.news-item h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #f4f4f4; }
.news-meta { font-size: 0.85rem; color: var(--admin-text-muted); margin-bottom: 0.75rem; }
.news-content { line-height: 1.6; color: #e0e0e0; }
.news-content img { max-width: 100%; height: auto; border-radius: 4px; margin: 0.5rem 0; }
.legal { font-size: 0.75rem; color: rgba(255, 255, 255, 0.6); text-align: center; margin: 0.25rem 0; }
.legal a { color: rgba(255, 255, 255, 0.8); text-decoration: none; }
.legal a:hover { text-decoration: underline; }

/* Admin Panel Styles */
.admin-panel { display: none; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, var(--admin-darker) 0%, var(--admin-dark) 100%); color: var(--admin-text); min-height: 100vh; line-height: 1.6; }
.admin-container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.admin-header { background: var(--admin-accent); border: 1px solid var(--admin-border); border-radius: 8px; padding: 2rem; margin-bottom: 2rem; text-align: center; }
.admin-header h1 { font-size: 2.5rem; font-weight: 300; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.admin-header p { color: var(--admin-text-muted); font-size: 1.1rem; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.admin-section { background: var(--admin-accent); border: 1px solid var(--admin-border); border-radius: 8px; padding: 1.5rem; }
.section-title { font-size: 1.3rem; font-weight: 500; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--admin-border); }
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-input, .form-textarea, .form-select { width: 100%; padding: 0.75rem; background: var(--admin-dark); border: 1px solid var(--admin-border); border-radius: 4px; color: var(--admin-text); font-size: 0.95rem; }
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: var(--admin-primary); }
.form-textarea { resize: vertical; min-height: 100px; }
.btn { display: inline-block; padding: 0.75rem 1.5rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: all 0.3s ease; }
.btn-primary { background: var(--admin-primary); color: white; }
.btn-success { background: var(--admin-success); color: white; }
.btn-warning { background: var(--admin-warning); color: #212529; }
.btn-danger { background: var(--admin-danger); color: white; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn:hover { transform: translateY(-1px); }
.upload-area { border: 2px dashed var(--admin-border); border-radius: 8px; padding: 2rem; text-align: center; cursor: pointer; }
.upload-area:hover { border-color: var(--admin-primary); }
.file-input { display: none; }
.table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.table th, .table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--admin-border); }
.table th { background: var(--admin-dark); font-weight: 600; }
.table tr:hover { background: rgba(255, 255, 255, 0.05); }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 0.5rem; }
.note-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); }
.modal-content { background: var(--admin-accent); margin: 10% auto; padding: 2rem; border: 1px solid var(--admin-border); border-radius: 8px; width: 90%; max-width: 500px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--admin-border); }
.close { color: var(--admin-text-muted); font-size: 1.5rem; font-weight: bold; cursor: pointer; border: none; background: none; }
.image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; max-height: 300px; overflow-y: auto; padding: 1rem; background: var(--admin-dark); border-radius: 4px; }
.gallery-item { border: 2px solid transparent; border-radius: 4px; cursor: pointer; overflow: hidden; position: relative; }
.gallery-item:hover { border-color: var(--admin-primary); }
.gallery-item.selected { border-color: var(--admin-success); }
.gallery-item img { width: 100%; height: 80px; object-fit: cover; }
.gallery-item .name { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, 0.8); color: white; padding: 0.25rem; font-size: 0.7rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.full-width { grid-column: span 2; }
.admin-nav { position: fixed; top: 20px; right: 20px; z-index: 1001; }
.nav-btn { background: var(--admin-accent); border: 1px solid var(--admin-border); color: var(--admin-text); padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; margin-left: 0.5rem; }

/* Animations */
@keyframes glow { 0% { text-shadow: 0 0 20px rgba(244, 244, 244, 0.5), 0 0 40px rgba(244, 244, 244, 0.3); } 100% { text-shadow: 0 0 30px rgba(244, 244, 244, 0.8), 0 0 60px rgba(244, 244, 244, 0.5); } }
@keyframes fadeIn { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0px) rotate(0deg); } 50% { transform: translateY(-20px) rotate(180deg); } }
@keyframes ghostlyFloat { 0%, 100% { transform: translateY(0px); opacity: 0.7; } 50% { transform: translateY(-5px); opacity: 0.9; } }

.gothic-text:hover { transform: scale(1.05); transition: transform 0.3s ease; }

@media (max-width: 1024px) {
    .main-grid {
        grid-template-areas: 
            "logo"
            "sidebar"
            "carousel"
            "news"
            "footer-left"
            "footer-right";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr 1fr auto auto;
        gap: 1rem;
        padding: 1rem;
    }
    
    .character-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .gothic-text { font-size: clamp(2rem, 10vw, 4rem); letter-spacing: 0.1em; }
    .profile-picture { width: 120px; height: 120px; }
    .highscores-content { grid-template-columns: 1fr; }
    .floating-buttons, .floating-left-buttons { bottom: 15px; }
    .floating-buttons { right: 15px; }
    .floating-left-buttons { left: 15px; }
    .character-btn { padding: 10px 16px; font-size: 12px; min-width: 120px; }
    .admin-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
    .admin-container { padding: 1rem; }
}

@media (max-width: 480px) {
    .floating-buttons, .floating-left-buttons { flex-direction: row; gap: 10px; }
    .floating-buttons { bottom: 15px; right: 15px; left: 15px; justify-content: space-between; }
    .floating-left-buttons { bottom: 60px; right: 15px; left: 15px; justify-content: center; }
    .character-btn { flex: 1; min-width: auto; }
}