:root {
    --primary: #14b8a6;
    /* Teal */
    --secondary: #3b82f6;
    /* Blue */
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.chapter-nav {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    scrollbar-width: none;
}

.chapter-nav::-webkit-scrollbar {
    display: none;
}

.nav-chip {
    flex: 0 0 auto;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
}

.visual-container {
    height: 200px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px dashed var(--glass-border);
    overflow: hidden;
}

.visual-box {
    width: 160px;
    height: 160px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.axes {
    width: 100%;
    height: 100%;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    position: absolute;
    bottom: 0px;
    left: 0px;
}

.axes::before {
    position: absolute;
    top: -20px;
    left: -5px;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.axes::after {
    position: absolute;
    bottom: -15px;
    right: 0;
    font-size: 0.6rem;
    color: var(--text-muted);
    content: 'time →';
}

/* Axis Labels */
.zero-order .axes::before {
    content: '[R]';
}

.first-order .axes::before {
    content: 'log[R]';
}

.molar-cond .axes::before {
    content: 'Λm';
}

.molar-cond .axes::after {
    content: '√c';
}

.atomic-radii .axes::before {
    content: 'Radius';
}

.atomic-radii .axes::after {
    content: 'At. No.';
}

/* Specific Graphics */
.zero-order .dynamic-content {
    width: 2px;
    height: 141%;
    background: var(--primary);
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(45deg);
    transform-origin: top left;
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.5);
}

.first-order .dynamic-content {
    width: 2px;
    height: 141%;
    background: var(--secondary);
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(45deg);
    transform-origin: top left;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.act-energy .dynamic-content {
    width: 100px;
    height: 60px;
    border: 3px solid var(--primary);
    border-radius: 60px 60px 0 0;
    border-bottom: none;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to top, rgba(20, 184, 166, 0.1), transparent);
}

.octahedral .dynamic-content::before,
.octahedral .dynamic-content::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 2px;
    background: #fff;
    left: 50%;
    transform: translateX(-50%);
}

.octahedral .dynamic-content::before {
    content: 'eg (dx2-y2, dz2)';
    top: -40px;
    box-shadow: 0 5px var(--secondary);
    border-top: 2px solid var(--secondary);
    padding-top: 5px;
    font-size: 0.5rem;
    color: var(--text-muted);
}

.octahedral .dynamic-content::after {
    content: 't2g (dxy, dyz, dxz)';
    top: 20px;
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 10px var(--primary);
    padding-bottom: 5px;
    font-size: 0.5rem;
    color: var(--text-muted);
    display: flex;
    align-items: flex-end;
}

.pos-deviation .dynamic-content {
    width: 60%;
    height: 40px;
    border-top: 3px dashed var(--primary);
    border-radius: 50% 50% 0 0;
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid var(--primary);
    border-radius: 100px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.gallery-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.cft-diagram {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.level {
    width: 120px;
    height: 2px;
    background: #fff;
    position: relative;
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.level::after {
    content: '';
    position: absolute;
    right: 0;
    top: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secondary);
}

/* More Visuals */
.unit-cell .dynamic-content {
    width: 60px;
    height: 60px;
    border: 2px solid #fff;
    position: relative;
}

.unit-cell .dynamic-content::before {
    content: 'Z=4 (FCC)';
    position: absolute;
    font-size: 0.6rem;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.crystal-defect .dynamic-content {
    display: grid;
    grid-template-columns: repeat(3, 20px);
    gap: 8px;
}

.crystal-defect .dynamic-content::before {
    content: '+ - + - + -';
    font-size: 0.6rem;
    color: var(--secondary);
    letter-spacing: 5px;
}

.crystal-defect .dynamic-content::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    grid-column: 2;
    grid-row: 2;
    box-shadow: 0 0 10px #ef4444;
}

.bp-elevation .dynamic-content {
    width: 2px;
    height: 80%;
    background: var(--primary);
    position: absolute;
    bottom: 15%;
    left: 30%;
    box-shadow: 40px -20px 0 var(--secondary);
}

.molar-cond .dynamic-content {
    width: 80%;
    height: 2px;
    background: #fff;
    position: absolute;
    bottom: 30%;
    transform: rotate(-45deg);
}

.daniel-cell .dynamic-content {
    display: flex;
    gap: 20px;
}

.daniel-cell .dynamic-content::before,
.daniel-cell .dynamic-content::after {
    content: '';
    width: 30px;
    height: 60px;
    border: 2px solid #fff;
    background: rgba(59, 130, 246, 0.2);
}

.ostwald .dynamic-content {
    width: 80px;
    height: 100px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    text-align: center;
}

.ostwald .dynamic-content::before {
    content: 'Pt/Rh Catalyst';
    color: #fbbf24;
    margin-bottom: 5px;
}

.xe-fluorides .dynamic-content {
    width: 15px;
    height: 15px;
    background: var(--primary);
    border-radius: 50%;
    position: relative;
}

.xe-fluorides .dynamic-content::before {
    content: 'F';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-weight: bold;
}

.xe-fluorides .dynamic-content::after {
    content: 'F';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-weight: bold;
}

.atomic-radii .dynamic-content {
    width: 80%;
    height: 60%;
    border-bottom: 2px solid var(--primary);
    border-radius: 0 0 50px 50px;
    position: absolute;
    top: 20%;
}

.cx-bond .dynamic-content {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cx-bond .dynamic-content::before {
    content: 'Cδ+';
    color: var(--secondary);
}

.cx-bond .dynamic-content::after {
    content: 'Xδ-';
    color: var(--error);
    font-weight: bold;
}

.dna-helix .dynamic-content {
    width: 40px;
    height: 100px;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    transform: rotate(20deg);
    position: relative;
}

.dna-helix .dynamic-content::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary);
    border-radius: 50%;
    left: 10px;
    top: 5px;
}

.visual-placeholder {
    font-size: 2rem;
    filter: grayscale(1);
    opacity: 0.5;
}

.description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

footer {
    text-align: center;
    margin-top: 5rem;
    font-family: 'Dancing Script', cursive;
    font-size: 1.5rem;
    color: var(--text-muted);
}