* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --accent: #f59e0b;
    --success: #10b981;
    --bg-main: #0f0e17;
    --bg-card: #1a1a2e;
    --bg-card-hover: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border: rgba(255, 255, 255, 0.1);
    --glow-purple: rgba(99, 102, 241, 0.4);
    --glow-pink: rgba(236, 72, 153, 0.4);
    --glow-amber: rgba(245, 158, 11, 0.4);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ─── PARTICLES ──────────────────────────────────────── */

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: float-particle linear infinite;
    opacity: 0;
}

@keyframes float-particle {
    0%   { transform: translateY(100vh) rotate(0deg);    opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

/* ─── HEADER ─────────────────────────────────────────── */

header {
    position: relative;
    z-index: 10;
    padding: 2rem 1rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 100px;
    padding: 0.4rem 1.2rem;
    font-size: 0.8rem;
    color: #a5b4fc;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.header-badge::before {
    content: '✦';
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

h1.main-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 40%, #f9a8d4 80%, #fde68a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.header-tag {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── STATS BAR ──────────────────────────────────────── */

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #a5b4fc, #f9a8d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
    align-self: center;
}

/* ─── MAIN ───────────────────────────────────────────── */

main {
    position: relative;
    z-index: 10;
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

/* ─── SECTION ────────────────────────────────────────── */

section {
    margin-bottom: 5rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.section-title-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.section-title-wrapper::before,
.section-title-wrapper::after {
    content: '';
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, currentColor);
    opacity: 0.5;
}

.section-title-wrapper::after {
    background: linear-gradient(90deg, currentColor, transparent);
}

.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.section-6 .section-title          { color: #a78bfa; }
.section-7 .section-title          { color: #f472b6; }
.section-8 .section-title          { color: #fb923c; }
.section-6 .section-title-wrapper  { color: #a78bfa; }
.section-7 .section-title-wrapper  { color: #f472b6; }
.section-8 .section-title-wrapper  { color: #fb923c; }

.section-divider {
    width: 80px;
    height: 4px;
    border-radius: 100px;
    margin: 0.8rem auto 0;
}

.section-6 .section-divider { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.section-7 .section-divider { background: linear-gradient(90deg, #db2777, #f472b6); }
.section-8 .section-divider { background: linear-gradient(90deg, #ea580c, #fb923c); }

/* ─── SECTION RIBBON ─────────────────────────────────── */

.section-ribbon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.section-6 .section-ribbon {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.section-7 .section-ribbon {
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #f472b6;
}

.section-8 .section-ribbon {
    background: rgba(251, 146, 60, 0.15);
    border: 1px solid rgba(251, 146, 60, 0.3);
    color: #fb923c;
}

/* ─── GRID ───────────────────────────────────────────── */

.subject-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .subject-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .subject-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
    .subject-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ─── SUBJECT CARD ───────────────────────────────────── */

details.subject-card {
    background: var(--bg-card);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

details.subject-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

details.subject-card:hover {
    transform: translateY(-4px);
}

/* ─── HOVER GLOWS ────────────────────────────────────── */

details.card-history:hover   { box-shadow: 0 20px 60px rgba(245, 158,  11, 0.2); }
details.card-geo:hover       { box-shadow: 0 20px 60px rgba( 16, 185, 129, 0.2); }
details.card-nature:hover    { box-shadow: 0 20px 60px rgba(132, 204,  22, 0.2); }
details.card-math:hover      { box-shadow: 0 20px 60px rgba( 99, 102, 241, 0.2); }
details.card-croatian:hover  { box-shadow: 0 20px 60px rgba(239,  68,  68, 0.2); }
details.card-german:hover    { box-shadow: 0 20px 60px rgba(234, 179,   8, 0.2); }
details.card-physics:hover   { box-shadow: 0 20px 60px rgba(168,  85, 247, 0.2); }
details.card-chemistry:hover { box-shadow: 0 20px 60px rgba( 20, 184, 166, 0.2); }

/* ─── OPEN STATE BORDER GLOWS ────────────────────────── */

details[open].card-history   { border-color: rgba(245, 158,  11, 0.3); }
details[open].card-geo       { border-color: rgba( 16, 185, 129, 0.3); }
details[open].card-nature    { border-color: rgba(132, 204,  22, 0.3); }
details[open].card-math      { border-color: rgba( 99, 102, 241, 0.3); }
details[open].card-croatian  { border-color: rgba(239,  68,  68, 0.3); }
details[open].card-german    { border-color: rgba(234, 179,   8, 0.3); }
details[open].card-physics   { border-color: rgba(168,  85, 247, 0.3); }
details[open].card-chemistry { border-color: rgba( 20, 184, 166, 0.3); }

/* ─── SUMMARY ────────────────────────────────────────── */

details.subject-card > summary {
    list-style: none;
    padding: 1.8rem 1.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: background 0.3s ease;
    user-select: none;
}

details.subject-card > summary::-webkit-details-marker { display: none; }
details.subject-card > summary::marker                 { display: none; }

details[open].subject-card > summary {
    border-bottom: 1px solid var(--border);
}

/* ─── SUMMARY BACKGROUNDS ────────────────────────────── */

.card-history  > summary { background: linear-gradient(135deg, rgba(245, 158,  11, 0.15), rgba(234,  88,  12, 0.10)); }
.card-geo      > summary { background: linear-gradient(135deg, rgba( 16, 185, 129, 0.15), rgba(  5, 150, 105, 0.10)); }
.card-nature   > summary { background: linear-gradient(135deg, rgba(132, 204,  22, 0.15), rgba(101, 163,  13, 0.10)); }
.card-math     > summary { background: linear-gradient(135deg, rgba( 99, 102, 241, 0.15), rgba( 67,  56, 202, 0.10)); }
.card-croatian > summary { background: linear-gradient(135deg, rgba(239,  68,  68, 0.15), rgba(220,  38,  38, 0.10)); }
.card-german   > summary { background: linear-gradient(135deg, rgba(234, 179,   8, 0.15), rgba(202, 138,   4, 0.10)); }
.card-physics  > summary { background: linear-gradient(135deg, rgba(168,  85, 247, 0.15), rgba(126,  34, 206, 0.10)); }
.card-chemistry> summary { background: linear-gradient(135deg, rgba( 20, 184, 166, 0.15), rgba( 13, 148, 136, 0.10)); }

/* ─── SUBJECT ICON ───────────────────────────────────── */

.subject-icon {
    font-size: 3rem;
    margin-bottom: 0.8rem;
    display: block;
    filter: drop-shadow(0 0 20px currentColor);
    animation: icon-float 3s ease-in-out infinite;
}

@keyframes icon-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

.icon-text {
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 0.8rem;
    display: block;
    color: #fde68a;
    letter-spacing: 0.05em;
}

/* ─── SUBJECT NAME ───────────────────────────────────── */

.subject-name {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    letter-spacing: -0.01em;
}

.card-history  .subject-name { color: #fcd34d; }
.card-geo      .subject-name { color: #6ee7b7; }
.card-nature   .subject-name { color: #bef264; }
.card-math     .subject-name { color: #a5b4fc; }
.card-croatian .subject-name { color: #fca5a5; }
.card-german   .subject-name { color: #fde68a; }
.card-physics  .subject-name { color: #d8b4fe; }
.card-chemistry .subject-name { color: #99f6e4; }

/* ─── SUBJECT HINT ───────────────────────────────────── */

.subject-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.subject-hint::before {
    content: '▼';
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

details[open] .subject-hint::before {
    transform: rotate(180deg);
}

/* ─── CARD TOGGLE BUTTON ─────────────────────────────── */

.card-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

details[open] .card-toggle {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
}

/* ─── CARD CONTENT ───────────────────────────────────── */

.card-content {
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.2);
}

.content-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* ─── TOPIC LIST ─────────────────────────────────────── */

.topic-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.topic-list li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 0.6rem;
    font-size: 0.78rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    line-height: 1.4;
}

.topic-list li a::before {
    content: '→';
    font-size: 0.65rem;
    opacity: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: inherit;
}

/* Active links */
.topic-list li a:not([href="#"]) {
    color: #c4b5fd;
}

.topic-list li a:not([href="#"])::before {
    opacity: 0.5;
}

.topic-list li a:not([href="#"]):hover {
    color: #fff;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(3px);
    padding-left: 0.8rem;
}

.topic-list li a:not([href="#"]):hover::before {
    opacity: 1;
}

/* Inactive placeholder links */
.topic-list li a[href="#"] {
    opacity: 0.35;
    cursor: default;
}

.topic-list li a[href="#"]::after {
    content: '·';
    margin-left: auto;
    font-size: 1.2rem;
    line-height: 1;
}

/* ─── PER-SUBJECT LINK COLOURS ───────────────────────── */

.card-history .topic-list li a:not([href="#"])              { color: #fcd34d; }
.card-history .topic-list li a:not([href="#"]):hover        { background: rgba(245, 158,  11, 0.2); border-color: rgba(245, 158,  11, 0.3); }

.card-geo .topic-list li a:not([href="#"])                  { color: #6ee7b7; }
.card-geo .topic-list li a:not([href="#"]):hover            { background: rgba( 16, 185, 129, 0.2); border-color: rgba( 16, 185, 129, 0.3); }

.card-nature .topic-list li a:not([href="#"])               { color: #bef264; }
.card-nature .topic-list li a:not([href="#"]):hover         { background: rgba(132, 204,  22, 0.2); border-color: rgba(132, 204,  22, 0.3); }

.card-math .topic-list li a:not([href="#"])                 { color: #a5b4fc; }
.card-math .topic-list li a:not([href="#"]):hover           { background: rgba( 99, 102, 241, 0.2); border-color: rgba( 99, 102, 241, 0.3); }

.card-croatian .topic-list li a:not([href="#"])             { color: #fca5a5; }
.card-croatian .topic-list li a:not([href="#"]):hover       { background: rgba(239,  68,  68, 0.2); border-color: rgba(239,  68,  68, 0.3); }

.card-german .topic-list li a:not([href="#"])               { color: #fde68a; }
.card-german .topic-list li a:not([href="#"]):hover         { background: rgba(234, 179,   8, 0.2); border-color: rgba(234, 179,   8, 0.3); }

.card-physics .topic-list li a:not([href="#"])              { color: #d8b4fe; }
.card-physics .topic-list li a:not([href="#"]):hover        { background: rgba(168,  85, 247, 0.2); border-color: rgba(168,  85, 247, 0.3); }

.card-chemistry .topic-list li a:not([href="#"])            { color: #99f6e4; }
.card-chemistry .topic-list li a:not([href="#"]):hover      { background: rgba( 20, 184, 166, 0.2); border-color: rgba( 20, 184, 166, 0.3); }

/* ─── FOOTER ─────────────────────────────────────────── */

footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2.5rem 1rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.footer-sub {
    color: #4b5563;
    font-size: 0.8rem;
}

.footer-hearts {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 1rem;
}

.footer-heart {
    font-size: 1.2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.footer-heart:nth-child(2) { animation-delay: 0.2s; }
.footer-heart:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 100% { transform: scale(1);   opacity: 0.6; }
    50%      { transform: scale(1.3); opacity: 1;   }
}

/* ─── RESPONSIVE ─────────────────────────────────────── */

@media (max-width: 639px) {
    .subject-icon { font-size: 2.5rem; }
    .subject-name { font-size: 1rem; }
}

/* ─── SCROLLBAR ──────────────────────────────────────── */

::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.4); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.7); }
