* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a6aff;
    --secondary: #00008b;
    --accent: #e1bc36;
    --dark: #050508;
    --darker: #000000;
    --light: #ffffff;
    --gray: rgba(255, 255, 255, 0.6);
    --card-bg: rgba(8, 12, 24, 0.9);
    --border: rgba(26, 106, 255, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--darker);
    color: var(--light);
    min-height: 100vh;
    overflow: hidden;
}

/* Subtle background */
.background-grid {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(26, 106, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 0, 139, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.particle-container { display: none; }

/* Flag icons styling */
.fi {
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.filter-option .fi {
    flex: 0 0 auto;
    width: 30px;
    height: 21px;
    margin-right: 2px;
    font-size: 1rem;
    background-size: cover;
    background-position: center;
}

.patent-country .fi {
    margin-right: 4px;
    font-size: 1.1em;
}

.patent-country-badge .fi {
    margin-right: 8px;
    font-size: 1.2em;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 48px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 24px;
}

.opentext-logo {
    height: 40px;
    width: auto;
}

.title-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

.subtitle {
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: var(--gray);
    text-transform: uppercase;
}

.stats-bar {
    display: flex;
    gap: 8px;
}

.stat-item {
    text-align: center;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.1) 0%, rgba(8, 12, 24, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(26, 106, 255, 0.25);
    min-width: 120px;
}

.stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray);
    margin-top: 2px;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 48px;
    gap: 24px;
    border-bottom: 1px solid var(--border);
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-container input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--light);
    outline: none;
    transition: all 0.2s;
}

.search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 106, 255, 0.1);
}

.search-container input::placeholder {
    color: var(--gray);
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.5;
}

.filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-clear,
.filter-menu-toggle {
    min-height: 44px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-clear,
.filter-menu-toggle {
    padding: 10px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--gray);
}

.filter-clear:hover,
.filter-menu-toggle:hover {
    border-color: var(--primary);
    color: var(--light);
}

.filter-clear.active,
.filter-menu-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--light);
}

.filter-clear .count {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.filter-clear.active .count {
    background: rgba(255, 255, 255, 0.25);
}

.filter-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
}

.filter-menu-toggle .ti {
    font-size: 1.15rem;
}

.filter-summary {
    padding-left: 10px;
    margin-left: 2px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.filter-menu-toggle.active .filter-summary {
    color: rgba(255, 255, 255, 0.82);
}

.filter-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px;
    background: rgba(0, 0, 0, 0.76);
    backdrop-filter: blur(10px);
    z-index: 1800;
}

.filter-overlay.hidden {
    display: none;
}

.filter-modal {
    width: min(1640px, calc(100vw - 112px));
    max-height: calc(100vh - 112px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(12, 18, 34, 0.98) 0%, rgba(3, 7, 16, 0.98) 100%);
    border: 1px solid rgba(26, 106, 255, 0.35);
    border-radius: 18px;
    box-shadow:
        0 40px 120px rgba(0, 0, 0, 0.78),
        0 0 90px rgba(26, 106, 255, 0.16);
    overflow: hidden;
}

.filter-modal-header,
.filter-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 34px;
    border-bottom: 1px solid rgba(26, 106, 255, 0.18);
}

.filter-modal-footer {
    border-top: 1px solid rgba(26, 106, 255, 0.18);
    border-bottom: none;
}

.filter-modal-kicker {
    color: var(--gray);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.filter-modal h2 {
    font-size: 2rem;
    font-weight: 650;
}

.filter-modal-close {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-modal-close:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--light);
}

.filter-modal-close .ti {
    font-size: 1.25rem;
}

.filter-modal-body {
    padding: 30px 34px;
    overflow-y: auto;
}

.filter-section + .filter-section {
    margin-top: 30px;
    padding-top: 28px;
    border-top: 1px solid rgba(26, 106, 255, 0.16);
}

.filter-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.filter-section h3 {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.68);
}

.filter-small-action {
    min-height: 42px;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.filter-small-action:hover {
    color: var(--light);
    border-color: var(--primary);
}

.filter-country-grid,
.filter-topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: 12px;
}

.filter-topic-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.filter-option {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    font-family: inherit;
    color: var(--gray);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.country-filter-option {
    min-height: 58px;
    padding: 12px 14px;
}

.filter-option:hover {
    border-color: var(--primary);
    color: var(--light);
}

.filter-option.active {
    color: var(--light);
    background: rgba(26, 106, 255, 0.24);
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(26, 106, 255, 0.25);
}

.filter-option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 700;
}

.country-filter-option .filter-option-label {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}

.filter-option-count {
    flex: 0 0 auto;
    padding: 3px 8px;
    color: rgba(255, 255, 255, 0.74);
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.year-filter {
    padding: 18px;
    background: rgba(255, 255, 255, 0.018);
    border: 1px solid rgba(26, 106, 255, 0.14);
    border-radius: 12px;
}

.year-readout {
    display: flex;
    justify-content: space-between;
    color: var(--primary);
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.range-slider {
    position: relative;
    height: 48px;
}

.range-slider input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 48px;
    margin: 0;
    background: transparent;
    pointer-events: none;
    appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    background: rgba(26, 106, 255, 0.28);
    border-radius: 999px;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    width: 34px;
    height: 34px;
    margin-top: -13px;
    background: var(--primary);
    border: 3px solid var(--light);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    appearance: none;
    box-shadow: 0 0 24px rgba(26, 106, 255, 0.55);
}

.range-slider input[type="range"]::-moz-range-track {
    height: 8px;
    background: rgba(26, 106, 255, 0.28);
    border-radius: 999px;
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: var(--primary);
    border: 3px solid var(--light);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
}

.year-quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.year-quick {
    min-height: 46px;
    padding: 10px 16px;
    font-family: inherit;
    color: var(--gray);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.year-quick:hover,
.year-quick.active {
    color: var(--light);
    background: var(--primary);
    border-color: var(--primary);
}

.filter-result-count {
    color: var(--light);
    font-size: 1.25rem;
    font-weight: 800;
}

.filter-modal-actions {
    display: flex;
    gap: 12px;
}

.filter-primary-action,
.filter-secondary-action {
    min-height: 52px;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-primary-action {
    color: var(--light);
    background: var(--primary);
    border: 1px solid var(--primary);
}

.filter-secondary-action {
    color: var(--gray);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
}

.filter-primary-action:hover,
.filter-secondary-action:hover {
    filter: brightness(1.08);
    border-color: var(--primary);
    color: var(--light);
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--card-bg);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 106px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    border: none;
    color: var(--gray);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.view-btn:hover { color: var(--light); }
.view-btn.active {
    background: var(--primary);
    color: var(--light);
}

/* Autoplay indicator */
.autoplay-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autoplay-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--gray);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.autoplay-toggle:hover { border-color: var(--primary); }
.autoplay-toggle.active {
    border-color: var(--accent);
    color: var(--accent);
}

.autoplay-toggle .icon { font-size: 1.1rem; }

/* Tabler icons styling */
.ti {
    vertical-align: middle;
}

.view-btn .ti {
    font-size: 1.2rem;
}

.search-icon.ti {
    font-size: 1.1rem;
}

.modal-close .ti {
    font-size: 1rem;
}

/* Main content */
main {
    height: calc(100vh - 160px);
    padding: 24px 48px;
    overflow: hidden;
}

.view-container {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.view-container::-webkit-scrollbar { width: 6px; }
.view-container::-webkit-scrollbar-track { background: transparent; }
.view-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.view-container.hidden { display: none; }

.empty-state {
    width: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--gray);
    border: 1px dashed rgba(26, 106, 255, 0.25);
    border-radius: 12px;
    background: rgba(8, 12, 24, 0.55);
    font-size: 0.9rem;
    text-align: center;
}

.empty-state-message {
    max-width: 420px;
    line-height: 1.5;
}

.empty-state-action {
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--light);
    background: rgba(26, 106, 255, 0.16);
    border: 1px solid rgba(26, 106, 255, 0.45);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.empty-state-action:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.patent-grid .empty-state {
    grid-column: 1 / -1;
}

/* Patent Grid */
.patent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding-bottom: 24px;
}

.patent-card {
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.08) 0%, rgba(8, 12, 24, 0.95) 100%);
    border: 1px solid rgba(26, 106, 255, 0.25);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.patent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.8;
}

.patent-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 
        0 8px 32px rgba(26, 106, 255, 0.2),
        0 0 0 1px rgba(26, 106, 255, 0.3),
        inset 0 1px 0 rgba(26, 106, 255, 0.1);
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.12) 0%, rgba(8, 12, 24, 0.95) 100%);
}

.patent-card.highlighted {
    border-color: var(--accent);
    box-shadow: 
        0 0 30px rgba(225, 188, 54, 0.3),
        0 0 0 2px rgba(225, 188, 54, 0.5);
    animation: pulse-highlight 1.5s ease-in-out infinite;
}

@keyframes pulse-highlight {
    0%, 100% { box-shadow: 0 0 30px rgba(225, 188, 54, 0.3), 0 0 0 2px rgba(225, 188, 54, 0.5); }
    50% { box-shadow: 0 0 40px rgba(225, 188, 54, 0.5), 0 0 0 3px rgba(225, 188, 54, 0.7); }
}

.patent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.patent-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px rgba(26, 106, 255, 0.5);
}

.patent-country {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(26, 106, 255, 0.2);
    border: 1px solid rgba(26, 106, 255, 0.3);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.patent-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--light);
}

.patent-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--gray);
    padding-top: 12px;
    border-top: 1px solid rgba(26, 106, 255, 0.15);
}

.patent-date { color: var(--accent); font-weight: 600; }

.patent-inventors {
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Timeline View */
.timeline-container { padding: 16px 0; }

.timeline-year { margin-bottom: 32px; }

.timeline-year-header {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    padding-left: 24px;
    position: relative;
}

.timeline-year-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateY(-50%);
}

.timeline-patents {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-left: 32px;
    border-left: 2px solid var(--border);
    margin-left: 5px;
}

.timeline-patent {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    width: 280px;
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-patent:hover {
    border-color: var(--primary);
}

.timeline-patent-title {
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Word Cloud */
.word-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 32px;
}

.cloud-word {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.cloud-word:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.cloud-word.size-1 { font-size: 0.75rem; opacity: 0.5; }
.cloud-word.size-2 { font-size: 0.875rem; opacity: 0.6; }
.cloud-word.size-3 { font-size: 1rem; opacity: 0.75; }
.cloud-word.size-4 { font-size: 1.25rem; opacity: 0.9; }
.cloud-word.size-5 { font-size: 1.5rem; color: var(--accent); font-weight: 600; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal.closing {
    opacity: 0;
}

.modal-content {
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.08) 0%, rgba(8, 12, 24, 0.98) 100%);
    border: 1px solid rgba(26, 106, 255, 0.3);
    border-radius: 20px;
    padding: 48px;
    padding-top: 56px;
    max-width: 750px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 
        0 32px 100px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(26, 106, 255, 0.2),
        inset 0 1px 0 rgba(26, 106, 255, 0.15);
}

.modal.active .modal-content {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal.closing .modal-content {
    animation: slideDown 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}

/* Progress bar inside modal */
.modal-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 20px 20px 0 0;
    transition: width 0.1s linear;
    box-shadow: 0 0 15px rgba(26, 106, 255, 0.6);
}

/* Clean slide-up fade animations for elements */
.modal.active .modal-header {
    animation: fadeSlideUp 0.5s ease 0.1s both;
}

.modal.active .modal-title {
    animation: fadeSlideUp 0.5s ease 0.18s both;
}

.modal.active .modal-details {
    animation: fadeSlideUp 0.5s ease 0.26s both;
}

.modal.active .inventors-section {
    animation: fadeSlideUp 0.5s ease 0.34s both;
}

/* Exit animations */
.modal.closing .modal-header,
.modal.closing .modal-title,
.modal.closing .modal-details,
.modal.closing .inventors-section {
    animation: fadeSlideDown 0.3s ease forwards;
}

@keyframes fadeSlideUp {
    from { 
        opacity: 0; 
        transform: translateY(20px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

@keyframes fadeSlideDown {
    from { 
        opacity: 1; 
        transform: translateY(0);
    }
    to { 
        opacity: 0; 
        transform: translateY(-10px);
    }
}

/* Inventor tags staggered */
.modal.active .inventor-tag {
    animation: fadeSlideUp 0.4s ease both;
}

.modal.active .inventor-tag:nth-child(1) { animation-delay: 0.38s; }
.modal.active .inventor-tag:nth-child(2) { animation-delay: 0.42s; }
.modal.active .inventor-tag:nth-child(3) { animation-delay: 0.46s; }
.modal.active .inventor-tag:nth-child(4) { animation-delay: 0.50s; }
.modal.active .inventor-tag:nth-child(5) { animation-delay: 0.54s; }
.modal.active .inventor-tag:nth-child(6) { animation-delay: 0.58s; }
.modal.active .inventor-tag:nth-child(n+7) { animation-delay: 0.62s; }

.modal.closing .inventor-tag {
    animation: fadeSlideDown 0.25s ease forwards;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--gray);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--light);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-right: 48px;
}

.patent-number-large {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(26, 106, 255, 0.4);
}

.patent-country-badge {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.15) 0%, rgba(26, 106, 255, 0.05) 100%);
    border: 1px solid rgba(26, 106, 255, 0.3);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 28px;
}

.modal-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.detail-row {
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.08) 0%, rgba(26, 106, 255, 0.02) 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(26, 106, 255, 0.1);
}

.detail-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray);
    margin-bottom: 6px;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-granted { color: var(--accent); }

.inventors-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 16px;
    color: var(--gray);
}

.inventors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.inventor-tag {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.12) 0%, rgba(26, 106, 255, 0.05) 100%);
    border: 1px solid rgba(26, 106, 255, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--darker);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
    font-size: 0.875rem;
    color: var(--gray);
    letter-spacing: 0.1em;
}



/* Globe View - Space theme with starfield */
.globe-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000000;
    overflow: hidden;
}

/* Starfield canvas */
.starfield-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Subtle glow behind globe */
.globe-wrapper::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(58, 123, 213, 0.12) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

#globeContainer {
    position: relative;
    width: 100%;
    height: calc(100% + 80px);
    margin-top: -48px;
    margin-bottom: -32px;
    cursor: grab;
    z-index: 2;
}

#globeContainer:active {
    cursor: grabbing;
}

#globeContainer canvas {
    outline: none;
}

.globe-legend {
    position: absolute;
    bottom: 32px;
    left: 32px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.legend-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--light);
    margin-bottom: 6px;
}

.legend-hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

.globe-tooltip {
    display: none;
}

/* Globe label tooltip styling - clean minimal design */
.globe-label {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: 'Inter', sans-serif;
    text-align: left;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    min-width: 140px;
}

.globe-label-country {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.globe-label-count {
    font-size: 0.75rem;
    color: #60a5fa;
    font-weight: 500;
}

/* Country patents panel - center-right position */
.country-patents-panel {
    position: absolute;
    top: 50%;
    right: 32px;
    transform: translateY(-50%);
    width: 380px;
    max-height: 70vh;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(24px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
    animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(26, 106, 255, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid rgba(26, 106, 255, 0.15);
}

.panel-header h3 {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header .fi {
    font-size: 1.2em;
}

.panel-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(26, 106, 255, 0.15);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(26, 106, 255, 0.2);
}

.panel-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.panel-close:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--light);
}

.panel-patents {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.panel-patent {
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin: 4px 0;
}

.panel-patent:hover {
    background: rgba(26, 106, 255, 0.08);
    border-color: rgba(26, 106, 255, 0.2);
    transform: translateX(4px);
}

.panel-patent-no {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.panel-patent-title {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.panel-more {
    text-align: center;
    padding: 14px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(26, 106, 255, 0.1);
    margin-top: 8px;
    font-style: italic;
}

/* Responsive */
@media (min-width: 1920px) {
    .patent-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }
}
