﻿@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
    /* Color Palette — Warm Orange Theme */
    --bg-body: #f5f3ef;
    --bg-paper: #ffffff;
    --bg-sidebar: #faf9f7;

    --text-primary: #1a2332;
    --text-secondary: #5a6a7b;
    --text-accent: #e88a1a;
    --text-accent-hover: #d47a10;

    --accent-orange: #f5a623;
    --accent-orange-light: #fff4e0;
    --accent-orange-dark: #d48b0f;
    --accent-gradient: linear-gradient(135deg, #f5a623 0%, #e88a1a 50%, #d47a10 100%);
    --accent-gradient-soft: linear-gradient(135deg, #fff9ed 0%, #fff4e0 100%);

    --border-color: #e8e4de;
    --border-light: #f0ece6;
    --shadow-sm: 0 1px 3px rgba(26, 35, 50, 0.04), 0 1px 2px rgba(26, 35, 50, 0.06);
    --shadow-md: 0 4px 12px rgba(26, 35, 50, 0.06), 0 2px 6px rgba(26, 35, 50, 0.04);
    --shadow-lg: 0 10px 30px rgba(26, 35, 50, 0.08), 0 4px 12px rgba(26, 35, 50, 0.04);
    --shadow-orange: 0 4px 16px rgba(245, 166, 35, 0.2);

    /* Typography */
    --font-heading: 'Open Sans', system-ui, -apple-system, sans-serif;
    --font-body: 'Open Sans', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.75;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
header {
    background-color: var(--bg-paper);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(26, 35, 50, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    letter-spacing: -0.02em;
    transition: transform var(--transition-fast);
}

.logo:hover {
    transform: scale(1.02);
}

.logo span {
    color: var(--accent-orange);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

nav ul {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    position: relative;
}

nav a:hover {
    color: var(--text-accent);
    background-color: var(--accent-orange-light);
}

nav a.active-nav {
    color: var(--text-accent);
    background-color: var(--accent-orange-light);
    font-weight: 600;
}

/* ═══════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════ */
.container {
    display: flex;
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    gap: 2rem;
}

/* ═══════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════ */
aside {
    width: 260px;
    min-width: 260px;
    background-color: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 5rem;
    display: none;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}

aside:hover {
    box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
    .with-sidebar aside {
        display: block;
    }
}

aside h3 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-orange);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

aside h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

aside ul {
    list-style: none;
}

aside li {
    margin-bottom: 2px;
}

aside a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 450;
    display: block;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    border-left: 3px solid transparent;
    line-height: 1.5;
}

aside a:hover {
    color: var(--text-accent);
    background-color: var(--accent-orange-light);
    border-left-color: var(--accent-orange);
    transform: translateX(2px);
}

aside a.active {
    color: var(--text-accent);
    background-color: var(--accent-orange-light);
    font-weight: 600;
    border-left-color: var(--accent-orange);
}

/* ═══════════════════════════════════════════
   CONTENT AREA
   ═══════════════════════════════════════════ */
main {
    flex: 1;
    background-color: var(--bg-paper);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

/* ═══════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.35;
}

h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 3px solid var(--accent-orange);
    letter-spacing: -0.02em;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

h2 {
    font-size: 1.65rem;
    font-weight: 700;
    margin-top: 2.5rem;
    color: var(--text-primary);
    position: relative;
    padding-left: 1.2rem;
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2em;
    width: 5px;
    height: 1.1em;
    background: var(--accent-gradient);
    border-radius: 3px;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1.5rem;
    color: var(--text-primary);
}

h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 1.25rem;
    color: var(--text-primary);
}

p {
    margin-bottom: 1rem;
    text-align: justify;
    color: var(--text-primary);
}

strong {
    font-weight: 600;
    color: var(--text-primary);
}

ul,
ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.35rem;
}

code {
    background: var(--accent-orange-light);
    color: var(--accent-orange-dark);
    padding: 0.15em 0.45em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 500;
}

a {
    color: var(--text-accent);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-accent-hover);
}

/* ═══════════════════════════════════════════
   LANDING PAGE GRID
   ═══════════════════════════════════════════ */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background-color: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: all var(--transition-smooth);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-orange);
}

.card:hover::before {
    opacity: 1;
}

.card h3 {
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-left: 0;
}

.card h3::before {
    display: none;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0;
    text-align: left;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════
   INFO BOXES
   ═══════════════════════════════════════════ */
.info-box {
    background: var(--accent-gradient-soft);
    border-left: 4px solid var(--accent-orange);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    position: relative;
}

.info-box::before {
    content: '💡';
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 1.2rem;
    background: var(--bg-paper);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.definition {
    background: linear-gradient(135deg, #f0faf0 0%, #e6f5e1 100%);
    border-left: 4px solid #4CAF50;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ═══════════════════════════════════════════
   REACTION BOX (chemical equations)
   ═══════════════════════════════════════════ */
.reaction-box {
    background: linear-gradient(135deg, #faf9f7 0%, #f5f3ef 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.75rem;
    margin: 1rem 0;
    text-align: center;
    font-size: 1.1rem;
    font-family: 'Times New Roman', serif;
    letter-spacing: 0.5px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
    position: relative;
}

.reaction-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 3px 0 0 3px;
}

.reaction-box small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    font-family: var(--font-body);
}

/* Grid of small reaction boxes */
.reactions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.8rem;
    margin: 1rem 0;
}

.reaction-mini {
    background: linear-gradient(135deg, #ffffff 0%, #faf9f7 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    text-align: center;
    font-size: 0.95rem;
    font-family: 'Times New Roman', serif;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.reaction-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-orange);
}

.reaction-mini small {
    display: inline;
    font-size: 0.75em;
    color: #666;
    font-style: italic;
    margin-left: 0.3em;
}

/* ═══════════════════════════════════════════
   OXIDATION STATE
   ═══════════════════════════════════════════ */
.ox {
    position: relative;
    display: inline-block;
}

.ox sup {
    position: absolute;
    top: -0.6em;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65em;
    color: #d32f2f;
    font-weight: 600;
}

/* ═══════════════════════════════════════════
   SUBCLASS CARDS (Reaction Classification)
   ═══════════════════════════════════════════ */
.subclass-card {
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.75rem;
    margin: 1.5rem 0;
    border-left: 5px solid;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.subclass-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.subclass-card h4 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

/* Соединение — зелёный */
.subclass-combination {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left-color: #4CAF50;
}

.subclass-combination h4 {
    color: #2e7d32;
}

/* Разложение — красный */
.subclass-decomposition {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left-color: #f44336;
}

.subclass-decomposition h4 {
    color: #c62828;
}

/* Замещение — синий */
.subclass-substitution {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left-color: #2196F3;
}

.subclass-substitution h4 {
    color: #1565c0;
}

/* Обмен — фиолетовый */
.subclass-exchange {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-left-color: #9C27B0;
}

.subclass-exchange h4 {
    color: #7b1fa2;
}

/* Изомеризация — оранжевый */
.subclass-isomerization {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-left-color: #FF9800;
}

.subclass-isomerization h4 {
    color: #ef6c00;
}

/* ОВР — коричневый/янтарный */
.subclass-redox {
    background: linear-gradient(135deg, #fbe9e7 0%, #ffccbc 100%);
    border-left-color: #FF5722;
}

.subclass-redox h4 {
    color: #d84315;
}

/* Не ОВР — серый/синий */
.subclass-nonredox {
    background: linear-gradient(135deg, #eceff1 0%, #cfd8dc 100%);
    border-left-color: #607D8B;
}

.subclass-nonredox h4 {
    color: #455a64;
}

/* Экзотермические — тёплый оранжевый */
.subclass-exo {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border-left-color: #FFC107;
}

.subclass-exo h4 {
    color: #f57f17;
}

/* Эндотермические — холодный голубой */
.subclass-endo {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    border-left-color: #00BCD4;
}

.subclass-endo h4 {
    color: #00838f;
}

/* Гомогенные — светло-зелёный */
.subclass-homo {
    background: linear-gradient(135deg, #f1f8e9 0%, #dcedc8 100%);
    border-left-color: #8BC34A;
}

.subclass-homo h4 {
    color: #558b2f;
}

/* Гетерогенные — светло-коричневый */
.subclass-hetero {
    background: linear-gradient(135deg, #efebe9 0%, #d7ccc8 100%);
    border-left-color: #795548;
}

.subclass-hetero h4 {
    color: #4e342e;
}

/* Каталитические — бирюзовый */
.subclass-catalytic {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    border-left-color: #009688;
}

.subclass-catalytic h4 {
    color: #00695c;
}

/* Обратимые — мятный */
.subclass-reversible {
    background: linear-gradient(135deg, #e8f5e9 0%, #a5d6a7 100%);
    border-left-color: #66BB6A;
}

.subclass-reversible h4 {
    color: #388e3c;
}

/* Необратимые — розовый */
.subclass-irreversible {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
    border-left-color: #E91E63;
}

.subclass-irreversible h4 {
    color: #ad1457;
}

.subclass-card .reaction-box {
    background: rgba(255, 255, 255, 0.75);
    margin: 0.8rem 0;
    backdrop-filter: blur(4px);
}

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */
.styled-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    font-size: 0.93rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.styled-table th,
.styled-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.styled-table th {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    font-weight: 600;
    color: white;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.styled-table tbody tr {
    transition: background-color var(--transition-fast);
}

.styled-table tbody tr:nth-child(even) {
    background-color: #faf9f7;
}

.styled-table tbody tr:hover {
    background-color: var(--accent-orange-light);
}

.styled-table tbody tr:last-child td {
    border-bottom: none;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: auto;
    background-color: var(--bg-paper);
    border-top: 1px solid var(--border-color);
}

/* ═══════════════════════════════════════════
   BREADCRUMBS
   ═══════════════════════════════════════════ */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.1rem;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-weight: 450;
}

.breadcrumbs a:hover {
    color: var(--text-accent);
}

.breadcrumbs span {
    margin: 0 0.4rem;
    color: var(--border-color);
    font-weight: 300;
}

/* ═══════════════════════════════════════════
   NAVIGATION LINKS (prev/next)
   ═══════════════════════════════════════════ */
.navigation-links {
    margin-top: 3rem !important;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.navigation-links a {
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.navigation-links .prev-chapter {
    padding: 0.75rem 1.5rem !important;
    background-color: var(--bg-paper) !important;
    border: 1.5px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
}

.navigation-links .prev-chapter:hover {
    border-color: var(--accent-orange) !important;
    color: var(--text-accent) !important;
    box-shadow: var(--shadow-sm);
    transform: translateX(-3px);
}

.navigation-links .next-chapter {
    padding: 0.75rem 1.5rem !important;
    background: var(--accent-gradient) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-orange);
    cursor: pointer !important;
}

.navigation-links .next-chapter:hover {
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.35);
    transform: translateX(3px);
}

/* Disabled next button */
.navigation-links .next-chapter[href="#"] {
    background: linear-gradient(135deg, #ddd 0%, #ccc 100%) !important;
    color: #999 !important;
    cursor: not-allowed !important;
    box-shadow: none;
}

.navigation-links .next-chapter[href="#"]:hover {
    transform: none;
}

/* ═══════════════════════════════════════════
   FIGURES / IMAGES
   ═══════════════════════════════════════════ */
figure {
    margin: 1.5rem 0;
}

figure img {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}

figure img:hover {
    box-shadow: var(--shadow-md);
}

figcaption {
    color: var(--text-secondary) !important;
    font-size: 0.88rem !important;
    margin-top: 0.75rem !important;
    font-style: italic;
}

/* ═══════════════════════════════════════════
   INLINE EQUATION BOXES (used in ionic_exchange)
   ═══════════════════════════════════════════ */
.equation-box {
    background: linear-gradient(135deg, #faf9f7 0%, #f5f3ef 100%);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-orange);
    padding: 1rem 1.25rem;
    text-align: center;
    margin: 0.75rem 0;
    font-size: 1.05em;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.definition-card {
    background-color: #fff4e0;
    background-image: 
        linear-gradient(45deg, rgba(245, 166, 35, 0.08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(245, 166, 35, 0.08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(245, 166, 35, 0.08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(245, 166, 35, 0.08) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-left: 4px solid var(--accent-orange);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-sm);
}

.warning-box {
    background: linear-gradient(135deg, #fff8ed 0%, #fff3e0 100%);
    border-left: 4px solid var(--accent-orange);
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-sm);
}

.exception-box {
    background: linear-gradient(135deg, #fef0f3 0%, #fce4ec 100%);
    border-left: 4px solid #e91e63;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-sm);
}

.example-solution {
    background: linear-gradient(135deg, #f6eef9 0%, #f3e5f5 100%);
    border-left: 4px solid #9c27b0;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-sm);
}

.condition-card {
    background: var(--bg-paper);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border-top: 4px solid var(--accent-orange);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.condition-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.condition-card h4 {
    margin-top: 0;
    color: var(--text-accent);
}

.conditions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin: 1.25rem 0;
}

@media (max-width: 768px) {
    .conditions-grid {
        grid-template-columns: 1fr;
    }
}

.ion-equation {
    font-family: 'Times New Roman', serif;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
    border-left: 3px solid #4CAF50;
    font-size: 1.05em;
}

.ion-equation .label {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-family: var(--font-body);
    margin-bottom: 5px;
}

.step-box {
    background: linear-gradient(135deg, var(--accent-orange-light) 0%, #fff9ed 100%);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    border-left: 4px solid var(--accent-orange);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.step-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.step-box h4 {
    color: var(--accent-orange-dark);
    margin-top: 0;
}

.sulfide-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.sulfide-item {
    background: linear-gradient(135deg, #ffebee 0%, #fce4ec 100%);
    padding: 0.45rem 1rem;
    border-radius: 20px;
    border: 1px solid #ef9a9a;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.sulfide-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════
   TOPIC SECTIONS (spacing)
   ═══════════════════════════════════════════ */
.topic-section {
    margin-bottom: 2rem;
}

/* ═══════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        flex-direction: column;
    }

    main {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    .grid-cards {
        grid-template-columns: 1fr;
    }

    .navigation-links {
        flex-direction: column;
    }
}

/* ═══════════════════════════════════════════
   SELECTION HIGHLIGHT
   ═══════════════════════════════════════════ */
::selection {
    background-color: rgba(245, 166, 35, 0.2);
    color: var(--text-primary);
}

/* ====================================================================
   MERGED FROM modern-styles.css
   ==================================================================== */

/* --- СОВРЕМЕННЫЙ ДИЗАЙН-КОД САЙТА --- */
/* Подключается поверх всех стилей для антуража. Стиль соточек/клеточек и apple-like */

:root {
    --chem-blue: #0ea5e9;
    --chem-blue-light: #e0f2fe;
    --chem-blue-dark: #0284c7;

    --chem-yellow: #f59e0b;
    --chem-yellow-light: #fef3c7;
    --chem-yellow-dark: #b45309;

    --chem-red: #ef4444;
    --chem-red-light: #fee2e2;
    --chem-red-dark: #b91c1c;

    --chem-green: #10b981;
    --chem-green-light: #d1fae5;
    --chem-green-dark: #047857;

    --chem-purple: #8b5cf6;
    --chem-purple-light: #ede9fe;
    --chem-purple-dark: #5b21b6;

    --chem-shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.04);
    --chem-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --chem-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* 1. ОПРЕДЕЛЕНИЯ (Definitions) - Оранжевый, авторитетный с фоном-клеточкой */
.chem-def {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
    border: 1px solid #fed7aa;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    box-shadow: var(--chem-shadow-md);
    margin: 2rem 0;
    overflow: hidden;
    border-left: 6px solid var(--chem-yellow);
}

.chem-def::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: linear-gradient(rgba(245, 158, 11, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 158, 11, 0.06) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

.chem-def-content {
    position: relative;
    z-index: 1;
}

.chem-def-title {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--chem-yellow-dark);
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 0.8rem 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #fef3c7;
    padding: 0.4rem 1rem;
    border-radius: 8px;
}

.chem-def-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #334155;
    margin: 0;
}

.chem-def-text strong {
    color: var(--chem-yellow-dark);
}


/* 2. ПРИМЕЧАНИЯ И ФАКТЫ (Notes) - Желтый, яркий */
.chem-note {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
    border: 1px solid #fde68a;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    box-shadow: var(--chem-shadow-sm);
    margin: 2rem 0;
    border-left: 6px solid var(--chem-yellow);
    transition: transform 0.3s;
}

.chem-note:hover {
    transform: translateY(-2px);
    box-shadow: var(--chem-shadow-hover);
}

.chem-note-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--chem-yellow-dark);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.8rem 0;
}

.chem-note-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}


/* 3. ИСКЛЮЧЕНИЯ И УЛОВКИ ЕГЭ (Exceptions) - Красный, тревожный, стильный */
.chem-exception {
    position: relative;
    background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
    border: 1px solid #fecaca;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    box-shadow: var(--chem-shadow-md);
    margin: 2rem 0;
}

.chem-exception::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    bottom: -2px;
    width: 6px;
    background: repeating-linear-gradient(-45deg,
            var(--chem-red),
            var(--chem-red) 10px,
            #fca5a5 10px,
            #fca5a5 20px);
    border-radius: 16px 0 0 16px;
}

.chem-exception-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--chem-red-dark);
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 0.8rem 0;
}

.chem-exception-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #7f1d1d;
    margin: 0;
}


/* 4. ПРОТИВОПОЛОЖНЫЕ ПОНЯТИЯ (Grid Cards) */
.chem-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.chem-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--chem-shadow-sm);
    transition: all 0.3s ease;
    border-top: 5px solid #cbd5e1;
}

.chem-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--chem-shadow-md);
}

.chem-card[data-color="green"] {
    border-top-color: var(--chem-green);
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 30%);
}

.chem-card[data-color="purple"] {
    border-top-color: var(--chem-purple);
    background: linear-gradient(180deg, #faf5ff 0%, #ffffff 30%);
}

.chem-card[data-color="blue"] {
    border-top-color: var(--chem-blue);
    background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 30%);
}

.chem-card[data-color="yellow"] {
    border-top-color: var(--chem-yellow);
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 30%);
}

.chem-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chem-card[data-color="green"] .chem-card-title {
    color: var(--chem-green-dark);
}

.chem-card[data-color="purple"] .chem-card-title {
    color: var(--chem-purple-dark);
}

.chem-card[data-color="blue"] .chem-card-title {
    color: var(--chem-blue-dark);
}

.chem-card[data-color="yellow"] .chem-card-title {
    color: var(--chem-yellow-dark);
}


/* 5. ТАБЛИЦЫ (Modern Tables) */
.chem-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 1rem 0;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

/* Тонкий скроллбар для таблиц */
.chem-table-wrap::-webkit-scrollbar {
    height: 6px;
}

.chem-table-wrap::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.chem-table-wrap::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.chem-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

.chem-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: #fff;
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif !important;
    font-size: 0.95rem;
    border-radius: 16px;
    box-shadow: var(--chem-shadow-sm);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.chem-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #334155;
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif !important;
    font-weight: 600;
    text-align: left;
    padding: 1rem 1.2rem;
    border-bottom: 2px solid #cbd5e1;
}

.chem-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif !important;
}

.chem-table tbody tr:hover td {
    background: #f8fafc;
}

/* Зебра опционально */
.chem-table.striped tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.chem-table.striped tbody tr:hover td {
    background: #f1f5f9;
}

/* Все дочерние элементы внутри ячеек chem-table наследуют размер таблицы */
.chem-table td div,
.chem-table td li,
.chem-table td ul,
.chem-table td ol,
.chem-table td span,
.chem-table td p {
    font-size: inherit !important;
}

/* 6. СХЕМЫ / АЛГОРИТМЫ (Roadmap Steps) */
.chem-scheme {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 2rem 0;
    padding-left: 1rem;
    position: relative;
}

.chem-scheme::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 1.85rem;
    width: 2px;
    background: #cbd5e1;
    z-index: 0;
}

.chem-step {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
    padding-bottom: 2rem;
}

.chem-step:last-child {
    padding-bottom: 0;
}

.chem-step-number {
    width: 30px;
    height: 30px;
    background: var(--chem-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px #ffffff, var(--chem-shadow-sm);
}

.chem-step-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    box-shadow: var(--chem-shadow-sm);
    flex-grow: 1;
    margin-top: -5px;
}

.chem-step-title {
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
}

.chem-step-text {
    color: #475569;
    margin: 0;
    line-height: 1.5;
}

/* 7. CHAPTER NAVIGATION BUTTONS */
.chapter-nav-container {
    margin-top: 3rem;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.chapter-nav-btn {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: #fff;
    border: 1px solid #E8ECF0;
    color: #1a2332;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chapter-nav-btn:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.chapter-nav-btn.prev {
    gap: 1rem;
}

.chapter-nav-btn.next {
    gap: 1rem;
    justify-content: flex-end;
    text-align: right;
}

.chapter-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chapter-nav-btn.prev .chapter-nav-icon {
    background: #f1f5f9;
    color: #64748b;
}

.chapter-nav-btn.next .chapter-nav-icon {
    background: #FFF4E0;
    color: #F5A623;
}

.chapter-nav-btn:hover .chapter-nav-icon {
    transform: scale(1.05);
}

.chapter-nav-text {
    display: flex;
    flex-direction: column;
}

.chapter-nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8C9BAB;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.chapter-nav-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

.chapter-nav-btn.next .chapter-nav-title {
    color: #F5A623;
}

@media (max-width: 768px) {
    .chapter-nav-container {
        grid-template-columns: 1fr;
    }

    .chapter-nav-btn.next {
        justify-content: flex-start;
        text-align: left;
        flex-direction: row-reverse;
    }

    .chapter-nav-btn.next .chapter-nav-text {
        align-items: flex-start;
    }
}

/* 8. LAW CARDS (Rules and Formulas) */
.law-card {
    position: relative;
    border-radius: 16px;
    padding: 1.5rem 1.8rem;
    margin: 1.5rem 0;
    background: #fff;
    z-index: 1;
}

.law-card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 18px;
    background: linear-gradient(135deg, #43a047, #00acc1, #5c6bc0, #ab47bc);
    z-index: -1;
}

.law-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #f0faf0 0%, #e8f8fb 50%, #f3f0fa 100%);
    z-index: -1;
}

.law-card h4 {
    margin: 0 0 0.6rem 0;
    font-size: 1.15rem;
    color: #2e7d32;
    font-family: var(--font-heading);
}

.law-card p {
    margin-bottom: 0.6rem;
}

.vanthoff-card {
    position: relative;
    border-radius: 16px;
    padding: 1.5rem 1.8rem;
    margin: 1.5rem 0;
    background: #fff;
    z-index: 1;
}

.vanthoff-card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ff7043, #ffa726, #ff5252);
    z-index: -1;
}

.vanthoff-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #fff8f0 0%, #fff3e0 50%, #ffebee 100%);
    z-index: -1;
}

.vanthoff-card h4 {
    margin: 0 0 0.6rem 0;
    font-size: 1.15rem;
    color: #d84315;
    /* color: blue; */
    font-family: var(--font-heading);
}

.vanthoff-card p {
    margin-bottom: 0.6rem;
}

/* Formula bubbles — soft rectangle, scrolls gracefully for long formulas */
.formula-bubble {
    background: linear-gradient(135deg, #fafbff 0%, #eef1f8 40%, #f0eefa 100%);
    border-radius: 14px;
    padding: 0.9rem 1.4rem;
    margin: 1rem 0;
    text-align: left;
    font-size: 1.1rem;
    font-family: 'Times New Roman', serif;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 12px rgba(100, 100, 200, 0.1), inset 0 1px 4px rgba(255, 255, 255, 0.8);
    max-width: 100%;
    border: 2px solid rgba(140, 140, 220, 0.15);
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    line-height: 1.7;
    -webkit-overflow-scrolling: touch;
}

/* Invisible / ultra-thin scrollbar for formula-bubble */
.formula-bubble::-webkit-scrollbar {
    height: 3px;
}
.formula-bubble::-webkit-scrollbar-track {
    background: transparent;
}
.formula-bubble::-webkit-scrollbar-thumb {
    background: rgba(140, 140, 220, 0.25);
    border-radius: 3px;
}
.formula-bubble::-webkit-scrollbar-thumb:hover {
    background: rgba(140, 140, 220, 0.45);
}
/* Firefox thin scrollbar */
.formula-bubble {
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 140, 220, 0.25) transparent;
}

.formula-bubble small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: #666;
    font-style: italic;
    font-family: var(--font-body);
}

.formula-bubble .MathJax {
    font-size: 1.05em !important;
}

/* 8.5. SYNTHESIS METHOD CARDS (Organic Chemistry) */
.synth-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
    counter-reset: synth-counter;
}

.synth-method {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 60%, #eef5ff 100%);
    border: 1px solid #d0e0f0;
    border-left: 4px solid;
    border-radius: 14px;
    padding: 1.4rem 1.5rem 1.4rem 1.2rem;
    position: relative;
    transition: all 0.25s ease;
    overflow: hidden;
    counter-increment: synth-counter;
}

.synth-method:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}

/* Color variants for left border */
.synth-method[data-type="industry"]  { border-left-color: #2563eb; }
.synth-method[data-type="lab"]       { border-left-color: #059669; }
.synth-method[data-type="general"]   { border-left-color: #7c3aed; }
.synth-method[data-type="special"]   { border-left-color: #d97706; }

/* Numbered beaker icon */
.synth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    position: relative;
}

.synth-method[data-type="industry"] .synth-icon  { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.synth-method[data-type="lab"] .synth-icon        { background: linear-gradient(135deg, #059669, #10b981); }
.synth-method[data-type="general"] .synth-icon    { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.synth-method[data-type="special"] .synth-icon    { background: linear-gradient(135deg, #d97706, #f59e0b); }

/* Fallback when no data-type */
.synth-method:not([data-type]) { border-left-color: #2563eb; }
.synth-method:not([data-type]) .synth-icon { background: linear-gradient(135deg, #2563eb, #3b82f6); }

.synth-body {
    flex: 1;
    min-width: 0;
}

.synth-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    margin: 0 0 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.synth-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    border-radius: 5px;
    white-space: nowrap;
}

.synth-badge.industry {
    background: #dbeafe;
    color: #1e40af;
}

.synth-badge.lab {
    background: #d1fae5;
    color: #065f46;
}

.synth-badge.general {
    background: #ede9fe;
    color: #5b21b6;
}

.synth-badge.special {
    background: #fef3c7;
    color: #92400e;
}

.synth-body p {
    margin: 0.3rem 0;
    color: #475569;
    line-height: 1.55;
}

.synth-body .formula-bubble {
    margin: 0.6rem 0 0.3rem;
}

.synth-body .chem-note {
    margin-top: 0.6rem;
}

@media (max-width: 600px) {
    .synth-method {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.1rem 1rem;
    }
    .synth-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
}

/* 9. THEMATIC CARDS (Crystal & Amorphous styles) */
.crystal-card {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
    border: 2px solid #fed7aa;
    border-radius: 4px;
    padding: 2.5rem;
    box-shadow: 6px 6px 0px rgba(245, 158, 11, 0.15);
    transition: all 0.3s ease;
    overflow: hidden;
    margin-bottom: 2rem;
}

.crystal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(rgba(245, 158, 11, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 158, 11, 0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 0;
    pointer-events: none;
}

.crystal-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0px rgba(245, 158, 11, 0.25);
}

.crystal-content {
    position: relative;
    z-index: 1;
}

.crystal-title {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #c2410c;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.4rem;
    border-bottom: 2px dashed #fed7aa;
    padding-bottom: 0.8rem;
    margin-bottom: 1.2rem;
}

.crystal-list li {
    margin-bottom: 0.5rem;
}

.amorph-card {
    position: relative;
    background: linear-gradient(120deg, #ffffff 0%, #fdf4ff 100%);
    border: 1px solid #f3e8ff;
    border-radius: 40px;
    padding: 2.5rem;
    box-shadow: 0 12px 30px rgba(192, 132, 252, 0.12);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.amorph-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(216, 180, 254, 0.4) 0%, transparent 60%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.amorph-card::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.15) 0%, transparent 60%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.amorph-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(192, 132, 252, 0.2);
    border-radius: 30px 50px 30px 50px;
}

.amorph-content {
    position: relative;
    z-index: 1;
}

.amorph-title {
    font-weight: 700;
    color: #7e22ce;
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(243, 232, 255, 0.9);
    padding: 0.6rem 1.2rem;
    border-radius: 24px;
    box-shadow: 0 2px 10px rgba(147, 51, 234, 0.05);
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
}

.amorph-list li {
    margin-bottom: 0.5rem;
}

/* ===== БАЗОВЫЙ СТИЛЬ ТАБЛИЦ СВОЙСТВ ===== */
.table-properties,
.table-properties-blue,
.table-properties-orange {
    width: 100%;
    min-width: 500px !important;
    border-collapse: collapse;
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif !important;
    font-size: 1em;
    margin: 0;
}

.table-properties th,
.table-properties-blue th,
.table-properties-orange th,
.table-properties td,
.table-properties-blue td,
.table-properties-orange td {
    padding: 10px 12px;
    vertical-align: middle;
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif !important;
}

.table-properties th,
.table-properties-blue th,
.table-properties-orange th {
    font-weight: 700;
    font-size: 1.05em;
    text-align: center;
}

.table-properties td,
.table-properties-blue td,
.table-properties-orange td {
    text-align: left;
}

.table-properties td p,
.table-properties-blue td p,
.table-properties-orange td p {
    margin-bottom: 5px;
    font-size: inherit;
}

/* Примечания внутри таблиц свойств — единый размер с остальным текстом */
.table-properties .prop-note,
.table-properties-blue .prop-note,
.table-properties-orange .prop-note {
    font-size: inherit;
    color: #555;
    display: block;
    margin-top: 4px;
}

.table-properties .chem-note-text,
.table-properties-blue .chem-note-text,
.table-properties-orange .chem-note-text {
    font-size: inherit;
}

/* Все дочерние элементы внутри ячеек таблиц свойств наследуют размер таблицы */
.table-properties td div,
.table-properties td li,
.table-properties td ul,
.table-properties td ol,
.table-properties td span,
.table-properties-blue td div,
.table-properties-blue td li,
.table-properties-blue td ul,
.table-properties-blue td ol,
.table-properties-blue td span,
.table-properties-orange td div,
.table-properties-orange td li,
.table-properties-orange td ul,
.table-properties-orange td ol,
.table-properties-orange td span {
    font-size: inherit !important;
}

/* Уравнения реакций в таблицах — крупнее обычного текста */
.table-properties .reaction,
.table-properties-blue .reaction,
.table-properties-orange .reaction {
    font-size: 1.15em !important;
}

.table-properties td:first-child,
.table-properties-blue td:first-child,
.table-properties-orange td:first-child {
    font-weight: 600;
    text-align: center;
}

/* Первая колонка уже на мобильных */
@media (max-width: 768px) {

    .table-properties,
    .table-properties-blue,
    .table-properties-orange {
        min-width: 100% !important;
    }

    .table-properties td:first-child,
    .table-properties-blue td:first-child,
    .table-properties-orange td:first-child {
        min-width: 90px;
        max-width: 90px;
        width: 90px;
        font-size: 0.85em;
        padding: 6px 8px;
    }

    .table-properties th:nth-child(n+2),
    .table-properties td:nth-child(n+2),
    .table-properties-blue th:nth-child(n+2),
    .table-properties-blue td:nth-child(n+2),
    .table-properties-orange th:nth-child(n+2),
    .table-properties-orange td:nth-child(n+2) {
        min-width: 200px;
        max-width: 250px;
        font-size: 0.88em;
        padding: 6px 8px;
        word-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
}

/* 1. ФИОЛЕТОВЫЙ (Примеры веществ и общие списки - дефолт) */
.table-properties {
    border: 2px solid #7c4dff;
}

.table-properties th,
.table-properties td {
    border: 1px solid #7c4dff;
}

.table-properties th {
    background-color: #f3e5f5;
    color: #4a148c;
}

.table-properties td:first-child {
    background-color: #faf5ff;
}

.table-section-header {
    background-color: #e1bee7 !important;
    font-weight: bold;
    color: #4a148c !important;
    text-align: left !important;
    padding-left: 20px !important;
}

/* 2. СИНИЙ (Способы получения) */
.table-properties-blue {
    border: 2px solid #2563eb;
}

.table-properties-blue th,
.table-properties-blue td {
    border: 1px solid #2563eb;
}

.table-properties-blue th {
    background-color: #eff6ff;
    color: #1e3a8a;
}

.table-properties-blue td:first-child {
    background-color: #f8fafc;
}

.table-section-header-blue {
    background-color: #dbeafe !important;
    font-weight: bold;
    color: #1e3a8a !important;
    text-align: left !important;
    padding-left: 20px !important;
}

/* 3. ОРАНЖЕВЫЙ (Химические свойства) */
.table-properties-orange {
    border: 2px solid #ea580c;
}

.table-properties-orange th,
.table-properties-orange td {
    border: 1px solid #ea580c;
}

.table-properties-orange th {
    background-color: #fff7ed;
    color: #9a3412;
}

.table-properties-orange td:first-child {
    background-color: #fffbeb;
}

.table-section-header-orange {
    background-color: #ffedd5 !important;
    font-weight: bold;
    color: #9a3412 !important;
    text-align: left !important;
    padding-left: 20px !important;
}

/* ===== GLOBAL IMAGE MODAL (LIGHTBOX) ===== */
.table-properties td img, 
.table-properties-blue td img, 
.table-properties-orange td img, 
.chem-table td img {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.table-properties td img:hover, 
.table-properties-blue td img:hover, 
.table-properties-orange td img:hover, 
.chem-table td img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15) !important;
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.show {
    opacity: 1;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.image-modal.show .image-modal-content {
    transform: scale(1);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: color 0.2s;
}

.image-modal-close:hover {
    color: #F5A623;
}