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

:root {
    --bg: #0e0e0e;
    --bg2: #1a1a1a;
    --bg3: #242424;
    --accent: #ff6b2b;
    --accent2: #ff8c55;
    --green: #00e676;
    --red: #ff1744;
    --text: #f0f0f0;
    --muted: #888;
    --border: #333;
    --font-display: 'Boogaloo', cursive;
    --font-body: 'Nunito', sans-serif;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent2);
}

img {
    max-width: 100%;
    display: block;
}

/* ===== HEADER ===== */
#site-header {
    background: #111;
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(255, 107, 43, 0.2);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--text);
    letter-spacing: 0.5px;
}

.logo span {
    color: var(--accent);
}

nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

nav a {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--accent);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
}

/* ===== FOOTER ===== */
#site-footer {
    background: #111;
    border-top: 1px solid var(--border);
    margin-top: auto;
    padding: 2rem 1.5rem;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--muted);
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copy {
    color: var(--muted);
    font-size: 0.8rem;
}

/* ===== MAIN WRAPPER ===== */
main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1.5rem;
}

/* ===== HERO (home) ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 6vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero h1 em {
    color: var(--accent);
    font-style: normal;
}

.hero p {
    font-size: 1.15rem;
    color: #bbb;
    max-width: 560px;
    margin: 0 auto 1.5rem;
}

.badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

/* ===== PUZZLE GRID ===== */
.section-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.section-title span {
    color: var(--accent);
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.puzzle-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: block;
    color: var(--text);
}

.puzzle-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--accent), #ff1744) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}

.puzzle-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(255, 107, 43, 0.2);
}

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

.card-number {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--accent);
    opacity: 0.3;
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    line-height: 1;
}

.card-category {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.card-desc {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.5;
}

.card-difficulty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
}

.diff-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.diff-dot.on {
    background: var(--accent);
}

/* ===== PUZZLE PAGE ===== */
.puzzle-page {
    max-width: 760px;
    margin: 0 auto;
}

.puzzle-header {
    margin-bottom: 2rem;
}

.puzzle-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}

.puzzle-header .back-link:hover {
    color: var(--accent);
}

.puzzle-header h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.puzzle-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.tag {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag.accent {
    background: rgba(255, 107, 43, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== PUZZLE CARD (page) ===== */
.puzzle-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.puzzle-question {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: #ddd;
}

.puzzle-question strong {
    color: var(--text);
}

.puzzle-image {
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid var(--border);
    width: 100%;
}

/* ===== OPTIONS ===== */
.options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.option-btn {
    background: var(--bg3);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--accent);
    background: rgba(255, 107, 43, 0.08);
    transform: translateX(4px);
}

.option-btn .opt-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
    transition: background 0.2s;
}

.option-btn:hover:not(:disabled) .opt-letter {
    background: var(--accent);
}

.option-btn.correct {
    border-color: var(--green);
    background: rgba(0, 230, 118, 0.1);
    animation: pulse-green 0.5s ease;
}

.option-btn.correct .opt-letter {
    background: var(--green);
    color: #000;
}

.option-btn.wrong {
    border-color: var(--red);
    background: rgba(255, 23, 68, 0.1);
    animation: shake 0.4s ease;
}

.option-btn.wrong .opt-letter {
    background: var(--red);
}

.option-btn:disabled {
    cursor: default;
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* ===== FREE TEXT INPUT ===== */
.free-input-wrap {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.free-input {
    flex: 1;
    min-width: 200px;
    background: var(--bg3);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.free-input:focus {
    border-color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.85rem 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--accent2);
    transform: translateY(-1px);
}

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

/* ===== REVEAL ===== */
.reveal-section {
    display: none;
    animation: fadeSlideUp 0.5s ease forwards;
}

.reveal-section.visible {
    display: block;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-banner {
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.result-banner.correct-banner {
    background: rgba(0, 230, 118, 0.12);
    border: 1px solid var(--green);
    color: var(--green);
}

.result-banner.wrong-banner {
    background: rgba(255, 23, 68, 0.12);
    border: 1px solid var(--red);
    color: var(--red);
}

.result-banner .icon {
    font-size: 1.5rem;
}

.explanation-box {
    background: var(--bg3);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.explanation-box h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.explanation-box p {
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.explanation-box p:last-child {
    margin-bottom: 0;
}

.science-box {
    background: rgba(255, 107, 43, 0.06);
    border: 1px solid rgba(255, 107, 43, 0.2);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.science-box h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--accent2);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.science-box p {
    font-size: 0.92rem;
    color: #bbb;
    line-height: 1.6;
}

/* ===== NEXT PUZZLE ===== */
.next-puzzle-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-next {
    background: linear-gradient(135deg, var(--accent), #ff1744);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.9rem 1.75rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-next:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    color: #fff;
}

/* ===== PROGRESS BAR ===== */
.progress-wrap {
    margin-bottom: 2rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.progress-bar {
    height: 6px;
    background: var(--bg3);
    border-radius: 999px;
    overflow: hidden;
}

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

/* ===== STATS (home) ===== */
.stats-row {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.stat-item {
    text-align: center;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 2rem;
    min-width: 120px;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* ===== ABOUT / STATIC PAGES ===== */
.static-page {
    max-width: 720px;
    margin: 0 auto;
}

.static-page h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.static-page h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--accent);
    margin: 2rem 0 0.75rem;
}

.static-page p {
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.static-page ul {
    color: #ccc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.static-page ul li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .nav-toggle {
        display: flex;
    }

    nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: #111;
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 1rem;
    }

    nav.open {
        display: flex;
    }

    .puzzle-box {
        padding: 1.25rem;
    }

    .stats-row {
        gap: 0.75rem;
    }

    .stat-item {
        padding: 1rem 1.25rem;
        min-width: 90px;
    }
}