* { box-sizing: border-box; }

        body {
            background: #f0f2f5;
            font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
            padding: 20px;
        }

        .compound-card {
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .compound-card:hover {
            transform: translateX(5px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

        .container-main {
            max-width: 1440px;
            margin: 0 auto;
            background: white;
            border-radius: 16px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.1);
            padding: 20px;
        }

        .results-section {
            max-width: 1440px;
            margin: 20px auto 0;
            background: white;
            border-radius: 16px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.1);
            padding: 20px;
            display: none;
        }

        /* 22.07.2026: animated database loading state for catalogue searches. */
        .database-loader {
            display: flex;
            min-height: 150px;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 14px;
            color: #4a5568;
        }

        #resultsContent {
            position: relative;
        }

        .results-loader-overlay {
            position: absolute;
            z-index: 20;
            inset: 0;
            min-height: 0;
            border-radius: 10px;
            background: rgba(255, 255, 255, .82);
            pointer-events: auto;
        }

        .database-loader-visual {
            position: relative;
            width: 70px;
            height: 62px;
            color: #3182ce;
            text-align: center;
        }

        .database-loader-visual .bi-database {
            display: block;
            font-size: 46px;
            line-height: 1;
            animation: database-pulse 1.4s ease-in-out infinite;
        }

        .database-loader-dot {
            position: absolute;
            bottom: 0;
            left: 25px;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #63b3ed;
            animation: database-transfer 1.2s ease-in-out infinite;
        }

        .database-loader-dot:nth-of-type(2) {
            left: 33px;
            animation-delay: 0.18s;
        }

        .database-loader-dot:nth-of-type(3) {
            left: 41px;
            animation-delay: 0.36s;
        }

        .database-loader-text::after {
            content: '';
            display: inline-block;
            width: 1.4em;
            animation: database-ellipsis 1.2s steps(4, end) infinite;
        }

        @keyframes database-pulse {
            0%, 100% { transform: scale(1); opacity: 0.75; }
            50% { transform: scale(1.06); opacity: 1; }
        }

        @keyframes database-transfer {
            0% { transform: translateY(-12px); opacity: 0; }
            45% { opacity: 1; }
            100% { transform: translateY(5px); opacity: 0; }
        }

        @keyframes database-ellipsis {
            0% { content: ''; }
            25% { content: '.'; }
            50% { content: '..'; }
            75%, 100% { content: '...'; }
        }

        h1 {
            font-size: 28px;
            font-weight: 600;
            color: #1a1a2e;
            margin-bottom: 5px;
        }

        /* 22.07.2026: direct catalogue search by CrystG3 code or Ref.Code. */
        .code-search {
            width: 100%;
            margin: 10px 0 16px;
            padding: 14px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #f8fafc;
        }

        .code-search > label {
            display: block;
            margin-bottom: 7px;
            color: #2d3748;
            font-size: 14px;
            font-weight: 600;
        }

        .code-search-row {
            display: flex;
            gap: 8px;
        }

        .code-search-row input {
            flex: 1 1 auto;
            min-width: 0;
            padding: 8px 10px;
            border: 1px solid #cbd5e0;
            border-radius: 7px;
            background: #fff;
        }

        .code-search-row button {
            padding: 8px 18px;
            border: 1px solid #3182ce;
            border-radius: 7px;
            background: #3182ce;
            color: #fff;
            font-weight: 600;
        }

        .code-search-row button:hover {
            background: #2b6cb0;
        }

        .controls {
            width: 100%;
            margin-bottom: 20px;
            padding: 15px;
            background: #f8fafc;
            border-radius: 12px;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            align-items: center;
        }

        .selection-info {
            margin-left: auto;
            font-size: 14px;
            color: #4a5568;
        }

        .periodic-wrapper {
            overflow-x: auto;
            flex: 1 1 auto;
            min-width: 0;
            margin-bottom: 25px;
        }

        .periodic-search-layout {
            display: flex;
            gap: 18px;
            align-items: flex-start;
            margin-bottom: 25px;
        }

        .periodic-sidebar {
            display: flex;
            flex: 0 0 240px;
            flex-direction: column;
            gap: 12px;
        }

        .periodic-sidebar .search-options,
        .periodic-sidebar .results-g3-range,
        .periodic-sidebar .filter-actions {
            width: 100%;
            max-width: none;
            margin: 0;
            flex-basis: auto;
        }

        .search-options {
            flex: 0 0 220px;
            padding: 15px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #f8fafc;
        }

        .search-options-title {
            margin-bottom: 10px;
            color: #2d3748;
            font-size: 14px;
            font-weight: 600;
        }

        .search-option {
            display: flex;
            gap: 8px;
            align-items: flex-start;
            margin-bottom: 10px;
            color: #4a5568;
            font-size: 13px;
            cursor: pointer;
        }

        .search-option:last-child {
            margin-bottom: 0;
        }

        .search-option input {
            margin-top: 3px;
            accent-color: #4299e1;
        }

        .g3-range {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 14px;
            padding-top: 12px;
            border-top: 1px solid #e2e8f0;
        }

        .results-g3-range {
            max-width: 420px;
            margin: 0 8px 18px;
            padding: 12px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #f8fafc;
        }

        .results-filters {
            display: flex;
            gap: 12px;
            align-items: stretch;
            justify-content: flex-start;
            flex-wrap: wrap;
            margin: 0 8px 18px;
        }

        .results-filters .search-options,
        .results-filters .results-g3-range {
            margin: 0;
        }

        .filter-reset-wrap {
            display: flex;
            align-items: flex-end;
        }

        .filter-actions {
            display: flex;
            flex: 0 0 190px;
            flex-direction: column;
            gap: 8px;
        }

        .filter-actions button {
            width: 100%;
            border-color: #90cdf4;
            background: #ebf8ff;
            color: #2c5282;
            text-align: left;
        }

        .filter-actions button:hover:not(:disabled) {
            border-color: #4299e1;
            background: #bee3f8;
        }

        .reset-filters-button {
            padding: 7px 12px;
            border: 1px solid #cbd5e0;
            border-radius: 6px;
            background: white;
            color: #4a5568;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .reset-filters-button:hover {
            border-color: #4299e1;
            background: #ebf8ff;
            color: #2c5282;
        }

        .g3-range-title {
            grid-column: 1 / -1;
            color: #2d3748;
            font-size: 13px;
            font-weight: 600;
        }

        .g3-range label {
            color: #718096;
            font-size: 11px;
        }

        .g3-range input {
            width: 100%;
            margin-top: 4px;
            padding: 6px 7px;
            border: 1px solid #cbd5e0;
            border-radius: 6px;
            background: white;
            color: #2d3748;
            font-size: 12px;
        }

        .g3-range input:focus {
            border-color: #4299e1;
            outline: none;
            box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.15);
        }

        .periodic-table {
            display: flex;
            flex-direction: column;
            /* 22.07.2026: compact spacing between periodic-table elements. */
            gap: 1px;
            min-width: 1133px;
            align-items: center;
        }

        .period-row {
            display: flex;
            gap: 1px;
            align-items: center;
            margin-bottom: 1px;
            justify-content: center;
        }

        .element {
            /* 22.07.2026: fit all 18 groups inside the 1440px page block. */
            width: 62px;
            background: white;
            border: 2px solid #e2e8f0;
            border-radius: 2px;
            padding: 6px 3px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }

        .element-small {
            width: 40px;
            background: white;
            border: 2px solid #e2e8f0;
            border-radius: 2px;
            padding: 4px 2px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }

        .element-number {
            font-size: 10px;
            color: #718096;
            font-weight: 500;
        }

        .element-symbol {
            font-size: 20px;
            font-weight: 700;
            line-height: 1.2;
        }

        .element-name {
            font-size: 8px;
            color: #4a5568;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .element:hover:not(.inactive):not(.context-inactive) {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0,0,0,0.12);
            border-color: #4299e1;
        }

        .element.selected {
            background: #4299e1;
            border-color: #2c5282;
            color: white;
        }

        .element.selected .element-number,
        .element.selected .element-name {
            color: white;
        }

        .element.inactive {
            opacity: 0.3;
            filter: grayscale(0.5);
            cursor: not-allowed;
            pointer-events: none;
        }

        /* 22.07.2026: unavailable combinations after selecting an element. */
        .element.context-inactive {
            opacity: 0.18;
            filter: grayscale(1);
            cursor: not-allowed;
            pointer-events: none;
        }

        .empty-cell {
            width: 62px;
            background: transparent;
            border: none;
        }

        /* Category colors for active elements */
        .alkali-metal { background: #ffd966; }
        .alkaline-earth { background: #ffe5b4; }
        .transition-metal { background: #b0c4de; }
        .lanthanide { background: #e6e6fa; }
        .actinide { background: #f0e6d2; }
        .post-transition { background: #c9e4c5; }
        .metalloid { background: #f4c2c2; }
        .nonmetal { background: #c2e0f0; }
        .halogen { background: #f7d6e0; }
        .noble-gas { background: #d8bfd8; }

        /* Inactive elements have uniform gray color */
        .inactive {
            background: #e2e8f0 !important;
        }

        .series-block {
            margin-top: 8px;
            padding-top: 0;
            border-top: none;
        }

        .series-row {
            display: flex;
            gap: 1px;
            align-items: center;
            margin-bottom: 1px;
            justify-content: center;
        }

        .compound-card {
            background: #f8fafc;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 10px;
            border-left: 4px solid #4299e1;
            transition: transform 0.2s;
        }

        .compound-card:hover {
            transform: translateX(5px);
        }

        .compound-name {
            font-size: 18px;
            font-weight: 600;
            color: #2c5282;
        }

        .compound-formula {
            font-family: monospace;
            font-size: 16px;
            color: #4a5568;
            margin-top: 5px;
        }

        .compound-elements {
            font-size: 12px;
            color: #718096;
            margin-top: 8px;
        }

        .results-table-wrapper {
            overflow: visible;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
        }

        .results-table {
            width: 100%;
            border-collapse: collapse;
            color: #2d3748;
        }

        .results-table th {
            padding: 12px 14px;
            background: #f8fafc;
            color: #4a5568;
            font-size: 13px;
            font-weight: 600;
            text-align: left;
            border-bottom: 2px solid #e2e8f0;
            white-space: nowrap;
        }

        /* 22.07.2026: short explanations for scientific result columns. */
        .results-table th.has-tooltip {
            text-decoration: none;
            cursor: help;
        }

        .scientific-tooltip {
            position: fixed;
            z-index: 10000;
            max-width: 260px;
            padding: 8px 10px;
            border-radius: 7px;
            background: #1a365d;
            box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
            color: #fff;
            font-size: 12px;
            font-weight: 400;
            line-height: 1.4;
            white-space: normal;
            opacity: 0;
            visibility: hidden;
            transform: translateY(3px);
            transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
            pointer-events: none;
        }

        .scientific-tooltip.visible {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        @media (max-width: 700px) {
            .results-table-wrapper {
                overflow-x: auto;
            }
        }

        .sort-button {
            width: 100%;
            padding: 0;
            border: 0;
            background: transparent;
            color: inherit;
            font: inherit;
            text-align: left;
            cursor: pointer;
        }

        .sort-button:hover {
            color: #2c5282;
        }

        .sort-indicator {
            display: inline-block;
            min-width: 12px;
            margin-left: 4px;
            color: #4299e1;
        }

        .reset-sort-button {
            padding: 5px 10px;
            border: 1px solid #cbd5e0;
            border-radius: 6px;
            background: white;
            color: #4a5568;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .reset-sort-button:hover:not(:disabled) {
            border-color: #4299e1;
            color: #2c5282;
            background: #ebf8ff;
        }

        .reset-sort-button:disabled {
            opacity: 0.45;
            cursor: default;
        }

        .results-table td {
            padding: 12px 14px;
            border-bottom: 1px solid #edf2f7;
            vertical-align: middle;
        }

        .results-table tbody tr {
            cursor: pointer;
            transition: background-color 0.2s ease;
        }

        .results-table tbody tr:hover {
            background: #ebf8ff;
        }

        .results-table tbody tr:last-child td {
            border-bottom: none;
        }

        .formula-cell {
            color: #2c5282;
            font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
            font-size: 17px;
            font-weight: 600;
            white-space: nowrap;
        }

        .formula-cell sub {
            font-size: 70%;
        }

.space-group-cell {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    white-space: nowrap;
}

        .space-group-cell sub {
            font-size: 70%;
        }

        .space-group-overline {
            text-decoration: overline;
            text-decoration-thickness: 1px;
        }

.space-group-number {
    margin-left: 6px;
    color: #718096;
    font-family: inherit;
    font-size: 12px;
}

        .disorder-badge {
            display: inline-block;
            padding: 4px 9px;
            background: #edf2f7;
            border-radius: 999px;
            color: #4a5568;
            font-size: 12px;
            white-space: nowrap;
        }

        .disorder-badge.present {
            background: #fff5f5;
            color: #c53030;
        }

        .g3-cell {
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #718096;
        }

        @media (max-width: 768px) {
            .element { width: 55px; }
            .element-symbol { font-size: 14px; }
            .periodic-table { min-width: 900px; }
        }

        @media (max-width: 1680px) {
            .periodic-search-layout { flex-direction: column; }
            .periodic-sidebar {
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                width: 100%;
                flex-basis: auto;
            }
        }

        @media (max-width: 900px) {
            .periodic-sidebar {
                grid-template-columns: 1fr;
            }
        }
.results-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.results-pagination-top {
    padding-top: 0;
}

.results-pagination-bottom {
    padding-bottom: 0;
}

#resultsTitle {
    scroll-margin-top: 20px;
}

.results-pagination button {
    border: 1px solid var(--border-color, #d8dee8);
    border-radius: 8px;
    background: #fff;
    padding: .45rem .9rem;
}

.results-pagination button:disabled {
    cursor: default;
    opacity: .45;
}
