/* ─── RESET & BASE ───────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Syne:wght@700;800&family=Playfair+Display:wght@700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
:root {
    --bg: #060a12;
    --surface: #0d1424;
    --card: #111827;
    --border: #1e2d45;
    --text: #e2e8f0;
    --muted: #64748b;
    --code-bg: #080f1c;

    --cr: #3b82f6; /* creational  – blue  */
    --cr-glow: rgba(59, 130, 246, 0.25);
    --st: #10b981; /* structural  – green */
    --st-glow: rgba(16, 185, 129, 0.25);
    --bh: #f59e0b; /* behavioral  – amber */
    --bh-glow: rgba(245, 158, 11, 0.25);

    --radius: 14px;
    --mono: 'JetBrains Mono', monospace;
    --sans: 'Syne', sans-serif;
}

html {
    scroll-behavior: smooth;
}
body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── ANIMATED GRID BG ───────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: gridScroll 20s linear infinite;
}
@keyframes gridScroll {
    to {
        background-position: 40px 40px;
    }
}

/* ─── HEADER ─────────────────────────────────────────── */
header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 70px 20px 50px;
}
.header-badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 5px 16px;
    border-radius: 99px;
    margin-bottom: 20px;
    animation: fadeDown 0.6s ease both;
}
header h1 {
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    animation: fadeDown 0.7s 0.1s ease both;
}
.title-cr {
    color: var(--cr);
}
.title-st {
    color: var(--st);
}
.title-bh {
    color: var(--bh);
}
header p {
    margin-top: 14px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.85rem;
    animation: fadeDown 0.7s 0.2s ease both;
}

/* ─── SEARCH ─────────────────────────────────────────── */
.search-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 20px;
    background: rgba(6, 10, 18, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.search-inner {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.search-inner input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 0.85rem;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
.search-inner input:focus {
    border-color: var(--cr);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-inner input::placeholder {
    color: var(--muted);
}

/* ─── CATEGORY TABS ──────────────────────────────────── */
.tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 30px 20px 10px;
    position: relative;
    z-index: 10;
}
.tab-btn {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    padding: 8px 20px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.25s;
}
.tab-btn.all.active,
.tab-btn.all:hover {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}
.tab-btn.cr.active,
.tab-btn.cr:hover {
    background: var(--cr);
    color: #fff;
    border-color: var(--cr);
    box-shadow: 0 0 20px var(--cr-glow);
}
.tab-btn.st.active,
.tab-btn.st:hover {
    background: var(--st);
    color: #fff;
    border-color: var(--st);
    box-shadow: 0 0 20px var(--st-glow);
}
.tab-btn.bh.active,
.tab-btn.bh:hover {
    background: var(--bh);
    color: #000;
    border-color: var(--bh);
    box-shadow: 0 0 20px var(--bh-glow);
}

/* ─── MAIN LAYOUT ────────────────────────────────────── */
main {
    position: relative;
    z-index: 5;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 20px 80px;
}

/* ─── SECTION HEADERS ────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 50px 0 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.section-icon {
    font-size: 1.6rem;
}
.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.section-count {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: 99px;
}

/* ─── PATTERN CARD ───────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    transition:
        transform 0.2s,
        box-shadow 0.2s,
        border-color 0.25s;
    animation: fadeUp 0.5s ease both;
}
.card:hover {
    transform: translateY(-3px);
}
.card.cr:hover {
    box-shadow: 0 12px 40px var(--cr-glow);
    border-color: rgba(59, 130, 246, 0.35);
}
.card.st:hover {
    box-shadow: 0 12px 40px var(--st-glow);
    border-color: rgba(16, 185, 129, 0.35);
}
.card.bh:hover {
    box-shadow: 0 12px 40px var(--bh-glow);
    border-color: rgba(245, 158, 11, 0.35);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s;
}
.card.open .card-header {
    border-bottom-color: var(--border);
}
.card-num {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    min-width: 26px;
}
.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    flex: 1;
}
.cr .card-title {
    color: var(--cr);
}
.st .card-title {
    color: var(--st);
}
.bh .card-title {
    color: var(--bh);
}
.card-tag {
    font-family: var(--mono);
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}
.cr .card-tag {
    background: rgba(59, 130, 246, 0.15);
    color: var(--cr);
}
.st .card-tag {
    background: rgba(16, 185, 129, 0.15);
    color: var(--st);
}
.bh .card-tag {
    background: rgba(245, 158, 11, 0.15);
    color: var(--bh);
}
.card-chevron {
    color: var(--muted);
    transition: transform 0.3s;
    font-size: 0.9rem;
}
.card.open .card-chevron {
    transform: rotate(180deg);
}

/* ─── CARD BODY ──────────────────────────────────────── */
.card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.card.open .card-body {
    max-height: 9999px;
}

.card-body-inner {
    padding: 22px;
}

/* ─── SECTIONS inside card ───────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
@media (max-width: 600px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}
.info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}
.info-box h4 {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.cr .info-box h4 {
    color: var(--cr);
}
.st .info-box h4 {
    color: var(--st);
}
.bh .info-box h4 {
    color: var(--bh);
}
.info-box p,
.info-box li {
    font-size: 0.83rem;
    color: var(--muted);
    line-height: 1.6;
}
.info-box ul {
    padding-left: 16px;
}

/* ─── CODE BLOCKS ────────────────────────────────────── */
.code-section {
    margin-bottom: 18px;
}
.code-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.code-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.dot-bad {
    background: #ef4444;
}
.dot-good {
    background: #22c55e;
}
pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.7;
    color: #94a3b8;
}
.kw {
    color: #818cf8;
}
.fn {
    color: #38bdf8;
}
.str {
    color: #86efac;
}
.cm {
    color: #475569;
    font-style: italic;
}
.num {
    color: #fb923c;
}

/* ─── QUIZ ───────────────────────────────────────────── */
.quiz-section {
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.quiz-title {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 14px;
}
.question-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.question-text {
    padding: 12px 16px;
    font-size: 0.87rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.question-text .q-num {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    margin-right: 10px;
}
.q-arrow {
    color: var(--muted);
    font-size: 0.8rem;
    transition: transform 0.25s;
    flex-shrink: 0;
}
.question-item.open .q-arrow {
    transform: rotate(180deg);
}
.options-wrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.question-item.open .options-wrap {
    max-height: 500px;
}
.options {
    padding: 0 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.opt {
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--mono);
    color: var(--muted);
}
.opt:hover {
    border-color: var(--muted);
    color: var(--text);
}
.opt.correct {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    color: #22c55e;
}
.opt.wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}
.opt.disabled {
    pointer-events: none;
}
.answer-reveal {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 10px 16px 14px;
    color: #22c55e;
    line-height: 1.5;
    display: none;
}
.question-item.answered .answer-reveal {
    display: block;
}

/* ─── PROGRESS BAR ───────────────────────────────────── */
.progress-bar-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 3px;
    background: transparent;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--cr), var(--st), var(--bh));
    width: 0%;
    transition: width 0.3s;
}

/* ─── STATS BAR ──────────────────────────────────────── */
.stats {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 18px;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    display: flex;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.stat-item strong {
    color: var(--text);
}

/* ─── ANIMATIONS ─────────────────────────────────────── */
@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.card:nth-child(1) {
    animation-delay: 0.05s;
}
.card:nth-child(2) {
    animation-delay: 0.1s;
}
.card:nth-child(3) {
    animation-delay: 0.15s;
}
.card:nth-child(4) {
    animation-delay: 0.2s;
}
.card:nth-child(5) {
    animation-delay: 0.25s;
}

/* ─── HIDDEN ─────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── SCROLLBAR ──────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

/* JS Pattern card color */
.card.js {
    border-color: var(--border);
}
.card.js .card-title {
    color: #a78bfa;
}
.card.js .card-tag {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}
.card.js:hover {
    box-shadow: 0 12px 40px rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.35);
}
.card.js.open {
    border-left-color: #a78bfa;
}
.card.js .info-box h4 {
    color: #a78bfa;
}
.card.js .question-item.open {
    border-color: #a78bfa;
}
.tab-btn.js.active,
.tab-btn.js:hover {
    background: #a78bfa;
    color: #fff;
    border-color: #a78bfa;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

/* ─── FAB BAR ─────────────────────── */
.fab-bar {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.fab-btn {
    font-family: var(--mono);
    font-size: 0.72rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.fab-btn:hover {
    background: var(--border);
    color: #fff;
}
.score-ring-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.score-label {
    position: absolute;
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text);
    pointer-events: none;
}
/* ─── TOAST ───────────────────────── */
.toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 9999;
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 10px 22px;
    border-radius: 10px;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-success {
    background: #14532d;
    border: 1px solid #22c55e;
    color: #86efac;
}
.toast-error {
    background: #450a0a;
    border: 1px solid #ef4444;
    color: #fca5a5;
}
/* ─── ANIMATIONS ──────────────────── */
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.card {
    animation: cardIn 0.45s ease both;
}
@keyframes correctPulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}
.opt.correct {
    animation: correctPulse 0.6s ease;
}
@keyframes wrongShake {
    0%,
    100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-6px);
    }
    40% {
        transform: translateX(6px);
    }
    60% {
        transform: translateX(-4px);
    }
    80% {
        transform: translateX(4px);
    }
}
.opt.wrong {
    animation: wrongShake 0.4s ease;
}
/* ─── CARD OPEN BORDER ────────────── */
.card.open {
    border-left-width: 3px;
}
.card.cr.open {
    border-left-color: var(--cr);
}
.card.st.open {
    border-left-color: var(--st);
}
.card.bh.open {
    border-left-color: var(--bh);
}
.card.js.open {
    border-left-color: #a78bfa;
}
/* ─── QUESTION HOVER ──────────────── */
.question-item {
    transition: border-color 0.2s;
}
.question-item:hover {
    border-color: var(--muted);
}
/* ─── SEARCH HINT ─────────────────── */
.search-inner::after {
    content: 'Press /';
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ─── Footer ───────────────── */

.dp-footer {
    padding: 48px 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    position: relative;
    z-index: 9999;
}
.dp-footer-logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 28px;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dp-footer-divider {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 99px;
}
.dp-footer-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.dp-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    padding: 4px 12px;
    border-radius: 99px;
    border: 1px solid var(--border);
    color: #64748b;
    background: var(--surface);
}
.dp-badge.cr {
    border-color: rgba(59, 130, 246, 0.4);
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}
.dp-badge.st {
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}
.dp-badge.bh {
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}
.dp-badge.js {
    border-color: rgba(167, 139, 250, 0.4);
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.08);
}
.dp-footer-copy {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #64748b;
    letter-spacing: 0.08em;
    text-align: center;
    line-height: 2;
}
.dp-footer-copy span {
    color: #e2e8f0;
    font-weight: 600;
}
.dp-footer-copy .dp-heart {
    display: inline-block;
    color: #ef4444;
    animation: dp-heartbeat 1.4s ease infinite;
}
.dp-author {
    font-family: 'Playfair Display', serif !important;
    font-size: 15px !important;
    letter-spacing: 0.04em !important;
    background: linear-gradient(135deg, #3b82f6, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    display: inline-block;
}
#dp-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #475569;
    letter-spacing: 0.05em;
}
@keyframes dp-heartbeat {
    0%,
    100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.25);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.15);
    }
    56% {
        transform: scale(1);
    }
}
.dp-footer-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #475569;
    letter-spacing: 0.05em;
}
