* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --simpson-yellow: #FED90F;
    --simpson-blue: #1a3a5c;
    --dark-bg: #0d1117;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass: rgba(255, 255, 255, 0.08);
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #FED90F;
    --border: rgba(255, 255, 255, 0.1);
    --glow: 0 0 20px rgba(254, 217, 15, 0.15);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--dark-bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    background-image: 
        radial-gradient(ellipse at 20% 0%, rgba(254, 217, 15, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

header {
    background: linear-gradient(180deg, rgba(254, 217, 15, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
    padding: 60px 20px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header-content {
    position: relative;
    z-index: 2;
}

.logo {
    font-family: 'Inter', sans-serif;
    font-size: 4.5em;
    font-weight: 900;
    color: var(--simpson-yellow);
    letter-spacing: -2px;
    line-height: 1;
    background: linear-gradient(135deg, #FED90F 0%, #f5a623 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.1em;
    margin-top: 12px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.4;
}

nav {
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .navbar-nav {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

nav .navbar-nav .nav-link {
    display: block;
    padding: 16px 22px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
}

nav .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--simpson-yellow);
    transition: width 0.3s ease;
}

nav .navbar-nav .nav-link:hover, nav .navbar-nav .nav-link.active {
    color: var(--text);
}

nav .navbar-nav .nav-link:hover::after, nav .navbar-nav .nav-link.active::after {
    width: 60%;
}

.theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    backdrop-filter: blur(8px);
}

nav .navbar-toggler {
    color: var(--text);
    border-color: var(--border);
}

@media (max-width: 991.98px) {
    nav .navbar-nav { align-items: stretch; }
    nav .navbar-nav .nav-link { padding: 10px 16px; text-align: center; }
    nav .theme-toggle { right: 16px; }
}

.theme-toggle:hover {
    background: var(--simpson-yellow);
    color: #000;
    border-color: var(--simpson-yellow);
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--simpson-yellow);
    color: #000;
    padding: 8px 15px;
    z-index: 200;
    font-weight: 600;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

.hero {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    box-shadow: var(--glow);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(254, 217, 15, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-text {
    flex: 1;
    min-width: 280px;
}

.hero-text h2 {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-text p {
    font-size: 1.05em;
    color: var(--text-muted);
    line-height: 1.8;
}

.hero-image {
    flex: 0 0 160px;
    display: flex;
    justify-content: center;
}

.donut {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FED90F 0%, #f5a623 100%);
    position: relative;
    animation: spin 8s linear infinite;
    box-shadow: 0 0 30px rgba(254, 217, 15, 0.3);
}

.donut::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--dark-bg);
}

.donut::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 30%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff6b6b;
    box-shadow: 25px 8px 0 #51cf66, 45px -3px 0 #339af0, 8px 40px 0 #cc5de8;
}

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

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.stat:hover {
    transform: translateY(-4px);
    border-color: var(--simpson-yellow);
    box-shadow: var(--glow);
}

.stat-number {
    display: block;
    font-size: 2.8em;
    font-weight: 900;
    color: var(--simpson-yellow);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.quote-box {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 40px;
    text-align: center;
    backdrop-filter: blur(8px);
    position: relative;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.quote-box h3 {
    color: var(--simpson-yellow);
    margin-bottom: 20px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 700;
}

.quote-box blockquote {
    font-size: 1.35em;
    font-style: italic;
    margin-bottom: 24px;
    min-height: 40px;
    color: var(--text);
    font-weight: 400;
    line-height: 1.6;
}

.btn {
    background: var(--simpson-yellow);
    color: #000;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(254, 217, 15, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--simpson-yellow), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(254, 217, 15, 0.3);
    box-shadow: var(--glow);
}

.card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 2.5em;
    margin-bottom: 16px;
}

.card h3 {
    color: var(--text);
    margin-bottom: 10px;
    font-size: 1.3em;
    font-weight: 700;
}

.card p {
    color: var(--text-muted);
    font-size: 0.95em;
    line-height: 1.7;
}

.card-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--simpson-yellow);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s;
}

.card-link:hover {
    letter-spacing: 1px;
}

.character-spotlight {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 40px;
    backdrop-filter: blur(8px);
}

.character-spotlight h2 {
    color: var(--text);
    margin-bottom: 24px;
    font-size: 1.6em;
    font-weight: 800;
}

.spotlight-card {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
}

.spotlight-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FED90F 0%, #f5a623 100%);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    font-weight: 900;
    box-shadow: 0 0 20px rgba(254, 217, 15, 0.3);
}

.spotlight-info h3 {
    color: var(--text);
    font-size: 1.5em;
    font-weight: 800;
    margin-bottom: 4px;
}

.spotlight-role {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 0.9em;
}

.spotlight-info blockquote {
    font-style: italic;
    margin-bottom: 16px;
    color: var(--text-muted);
    border-left: 3px solid var(--simpson-yellow);
    padding-left: 16px;
    font-size: 0.95em;
}

.traits {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.trait {
    background: rgba(254, 217, 15, 0.1);
    color: var(--simpson-yellow);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    border: 1px solid rgba(254, 217, 15, 0.2);
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.character-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.character-card:hover {
    transform: translateY(-4px);
    border-color: rgba(254, 217, 15, 0.2);
    box-shadow: var(--glow);
}

.char-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: 900;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #FED90F 0%, #f5a623 100%);
}

.character-card h3 {
    color: var(--text);
    margin-bottom: 4px;
    font-size: 1.15em;
    font-weight: 700;
}

.role {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.85em;
}

.char-quote {
    font-style: italic;
    color: var(--text-muted);
    margin: 12px 0;
    padding-left: 12px;
    border-left: 2px solid var(--simpson-yellow);
    font-size: 0.9em;
}

.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.episode-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.episode-card:hover {
    transform: translateY(-4px);
    border-color: rgba(254, 217, 15, 0.2);
    box-shadow: var(--glow);
}

.episode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}

.episode-card h3 {
    color: var(--text);
    font-size: 1.1em;
    font-weight: 700;
}

.rating {
    background: rgba(254, 217, 15, 0.15);
    color: var(--simpson-yellow);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 700;
    border: 1px solid rgba(254, 217, 15, 0.3);
    white-space: nowrap;
}

.meta {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-bottom: 10px;
    font-weight: 500;
}

.trivia-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.trivia-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    backdrop-filter: blur(8px);
}

.trivia-progress {
    margin-bottom: 20px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FED90F, #f5a623);
    transition: width 0.5s ease;
    border-radius: 3px;
}

.trivia-card h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--text);
    font-weight: 600;
    line-height: 1.5;
}

.options {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s ease;
    text-align: left;
    color: var(--text);
    font-weight: 500;
}

.option-btn:hover:not(:disabled) {
    background: rgba(254, 217, 15, 0.1);
    border-color: rgba(254, 217, 15, 0.3);
    transform: translateX(4px);
}

.option-btn.correct {
    background: rgba(46, 204, 113, 0.15);
    border-color: #2ecc71;
    color: #2ecc71;
}

.option-btn.wrong {
    background: rgba(231, 76, 60, 0.15);
    border-color: #e74c3c;
    color: #e74c3c;
}

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

.trivia-result {
    min-height: 28px;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 0.95em;
}

.correct-msg { color: #2ecc71; }
.wrong-msg { color: #e74c3c; }

.score-board {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.score-display {
    font-size: 3em;
    font-weight: 900;
    color: var(--simpson-yellow);
    margin-top: 16px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.gallery-item {
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--text);
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: rgba(254, 217, 15, 0.3);
    box-shadow: var(--glow);
}

.gallery-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 1em;
}

h2 {
    color: var(--text);
    font-size: 1.8em;
    font-weight: 800;
    margin-bottom: 8px;
}

footer {
    background: rgba(13, 17, 23, 0.9);
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.footer-section h3.footer-logo {
    font-size: 1.5em;
    font-weight: 900;
    color: var(--simpson-yellow);
    margin-bottom: 10px;
}

.footer-section h4 {
    color: var(--text);
    margin-bottom: 14px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

.footer-section p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.9em;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s, padding-left 0.3s;
    display: block;
    font-size: 0.9em;
}

.footer-links a:hover {
    color: var(--simpson-yellow);
    padding-left: 4px;
}

.footer-quote {
    font-style: italic;
    color: var(--text-muted);
    border-left: 3px solid var(--simpson-yellow);
    padding-left: 14px;
    margin: 0;
    font-size: 0.9em;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    max-width: 1200px;
    margin: 0 auto;
}

/* Search */
.search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 18px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95em;
    color: var(--text);
    backdrop-filter: blur(8px);
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--simpson-yellow);
    box-shadow: 0 0 0 3px rgba(254, 217, 15, 0.1);
}

.search-results {
    display: grid;
    gap: 16px;
}

.search-result-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(8px);
    transition: all 0.3s;
}

.search-result-card:hover {
    border-color: rgba(254, 217, 15, 0.2);
}

.result-type {
    display: inline-block;
    background: rgba(254, 217, 15, 0.1);
    color: var(--simpson-yellow);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    margin-bottom: 10px;
    border: 1px solid rgba(254, 217, 15, 0.2);
}

.search-result-card h3 a {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1em;
}

.search-result-card h3 a:hover {
    color: var(--simpson-yellow);
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* About */
.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.about-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    backdrop-filter: blur(8px);
    transition: all 0.3s;
}

.about-card:hover {
    border-color: rgba(254, 217, 15, 0.2);
}

.about-card h3 {
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 700;
}

.about-card p {
    color: var(--text-muted);
    font-size: 0.9em;
    line-height: 1.7;
}

.tech-details {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    backdrop-filter: blur(8px);
}

.tech-details h3 {
    color: var(--text);
    margin-bottom: 16px;
    font-weight: 700;
}

.tech-details ul {
    list-style: none;
}

.tech-details li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9em;
}

.tech-details li:last-child {
    border-bottom: none;
}

.tech-details strong {
    color: var(--text);
}

/* 404 */
.error-page {
    text-align: center;
    padding: 80px 20px;
}

.error-page h1 {
    font-size: 8em;
    font-weight: 900;
    color: var(--simpson-yellow);
    line-height: 1;
    margin-bottom: 16px;
}

.error-page h2 {
    color: var(--text);
    margin-bottom: 12px;
    font-weight: 700;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 32px 0;
}

.btn-secondary {
    background: var(--glass);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--simpson-yellow);
    color: var(--simpson-yellow);
}

/* Dark mode (light theme) */
body.light-mode {
    background: #f6f8fa;
    color: #1f2328;
}

body.light-mode .card,
body.light-mode .character-card,
body.light-mode .episode-card,
body.light-mode .trivia-card,
body.light-mode .score-board,
body.light-mode .hero,
body.light-mode .character-spotlight,
body.light-mode .search-result-card,
body.light-mode .about-card,
body.light-mode .tech-details,
body.light-mode .quote-box,
body.light-mode .gallery-item,
body.light-mode .stat {
    background: #ffffff;
    border-color: #d0d7de;
}

body.light-mode nav {
    background: rgba(255, 255, 255, 0.9);
}

body.light-mode footer {
    background: #f6f8fa;
}

body.light-mode .search-input {
    background: #ffffff;
    color: #1f2328;
    border-color: #d0d7de;
}

body.light-mode .option-btn {
    background: #f6f8fa;
    border-color: #d0d7de;
    color: #1f2328;
}

body.light-mode .progress-bar {
    background: #eaeef2;
}

body.light-mode .subtitle,
body.light-mode .role,
body.light-mode .meta,
body.light-mode .text-muted {
    color: #57606a;
}

@media (max-width: 768px) {
    .logo { font-size: 3em; }
    .trivia-container { grid-template-columns: 1fr; }
    .hero { flex-direction: column; text-align: center; padding: 32px; }
    .spotlight-card { flex-direction: column; text-align: center; }
    nav ul li a { padding: 12px 14px; font-size: 0.8em; }
    .theme-toggle { position: static; transform: none; margin: 10px auto; display: block; }
}
