/* ============================
   Reset & Base
   ============================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #06b6d4;
    --accent-dark: #0891b2;
    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.12);
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-hero: linear-gradient(135deg, #1e3a8a 0%, #2563eb 45%, #06b6d4 100%);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================
   Hero
   ============================ */
.hero {
    position: relative;
    padding: 64px 24px 96px;
    overflow: hidden;
    color: #fff;
    text-align: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
    z-index: -2;
}

.hero-bg::before,
.hero-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.hero-bg::before {
    width: 500px;
    height: 500px;
    background: #06b6d4;
    top: -150px;
    right: -100px;
}

.hero-bg::after {
    width: 600px;
    height: 600px;
    background: #7c3aed;
    bottom: -250px;
    left: -150px;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-bottom: 24px;
}

.badge-icon {
    font-size: 16px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 20px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    line-height: 1.6;
    opacity: 0.95;
    max-width: 640px;
    margin: 0 auto 40px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* ============================
   Controls
   ============================ */
.controls-section {
    margin-top: -56px;
    position: relative;
    z-index: 10;
    padding: 0 0 32px;
}

.controls-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.search-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 16px 48px 16px 52px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-alt);
    border: 2px solid transparent;
    border-radius: var(--radius);
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.clear-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.clear-btn:hover {
    background: var(--border-strong);
    color: var(--text);
}

.clear-btn svg {
    width: 14px;
    height: 14px;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 11px 36px 11px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-alt);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    outline: none;
}

.filter-select:focus {
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.filter-select:hover:not(:focus) {
    border-color: var(--border-strong);
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    height: 44px;
}

.reset-btn:hover {
    background: var(--bg-alt);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.reset-btn svg {
    width: 16px;
    height: 16px;
}

.results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.results-count {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.results-count strong {
    color: var(--text);
    font-weight: 700;
}

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

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.view-btn:hover {
    color: var(--text);
}

.view-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================
   Country Grid
   ============================ */
.main-content {
    padding-bottom: 64px;
}

.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 22px;
    margin-top: 32px;
}

.country-grid.list-view {
    grid-template-columns: 1fr;
}

.country-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    animation: fadeInUp 0.4s ease-out backwards;
}

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

.country-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.country-card .flag-wrapper {
    position: relative;
    width: 100%;
    height: 160px;
    background: var(--bg-alt);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.country-card .flag-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.04));
    pointer-events: none;
}

.country-card .flag {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.country-card .flag-emoji-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.country-card:hover .flag {
    transform: scale(1.04);
}

.country-card .card-body {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.country-card .card-head {
    margin-bottom: 2px;
}

.country-card .card-titles {
    flex: 1;
    min-width: 0;
}

.country-card .flag-emoji-corner {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 22px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    padding: 2px 6px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
}

.country-card .flag-emoji-fallback.empty {
    font-size: 4rem;
    opacity: 0.5;
}

.country-card .info-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.country-card .info-row {
    display: flex;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 0;
    align-items: baseline;
}

.country-card .info-label {
    font-weight: 500;
    color: var(--text-light);
    min-width: 88px;
    flex-shrink: 0;
    font-size: 11px;
}

.country-card .info-value {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.country-card .info-sub {
    font-size: 10px;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 4px;
}

.country-card .card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.country-card .card-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.country-card .card-badge.un {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

.country-card .card-badge.landlocked {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.country-card .card-badge.disputed {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.country-card .card-badge.dep {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.country-card .card-memberships {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.country-card .card-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-dark);
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.country-card .card-chip.more {
    background: var(--bg-alt);
    color: var(--text-muted);
}

.country-card .card-footer-hint {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    font-weight: 500;
}

.country-card .country-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    line-height: 1.3;
}

.country-card .country-german-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.2;
}

.country-card .country-region {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    padding: 3px 10px;
    border-radius: 100px;
    margin-bottom: 12px;
    align-self: flex-start;
}

.country-card .info-row {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 3px 0;
    align-items: center;
}

.country-card .info-label {
    font-weight: 500;
    color: var(--text-light);
    min-width: 72px;
    flex-shrink: 0;
}

.country-card .info-value {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* List view variant */
.country-grid.list-view .country-card {
    flex-direction: row;
    align-items: center;
    max-height: 120px;
}

.country-grid.list-view .flag-wrapper {
    width: 160px;
    height: 120px;
    flex-shrink: 0;
}

.country-grid.list-view .card-body {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    padding: 16px 20px;
}

.country-grid.list-view .country-name {
    width: 100%;
    margin-bottom: 0;
    font-size: 1.05rem;
}

.country-grid.list-view .country-region {
    margin-bottom: 0;
}

.country-grid.list-view .info-row {
    flex: 1;
    min-width: 180px;
}

/* ============================
   Loading / Empty / Error
   ============================ */
.loading-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 1.35rem;
    color: var(--text);
    margin-bottom: 8px;
    font-weight: 700;
}

.empty-state p {
    font-size: 15px;
    max-width: 400px;
    margin: 0 auto;
}

.retry-btn {
    margin-top: 20px;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.retry-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ============================
   Load More
   ============================ */
.load-more-wrapper {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    padding: 14px 40px;
    background: var(--surface);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.load-more-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================
   Modal
   ============================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: modalFade 0.25s ease-out;
}

@keyframes modalFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-xl);
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.modal-close:hover {
    background: var(--surface);
    transform: rotate(90deg);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-flag {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: var(--bg-alt);
}

.modal-flag-emoji-fallback {
    width: 100%;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9rem;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.modal-body {
    padding: 32px;
}

.modal-header {
    margin-bottom: 28px;
}

.modal-country-name {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    line-height: 1.15;
}

.modal-flag-emoji {
    font-size: 1.6rem;
    vertical-align: middle;
    margin-left: 6px;
}

.modal-subtitle {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-official {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
    font-style: italic;
}

.modal-info-card .sub-value {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

/* Code grid (country codes) */
.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.code-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    text-align: center;
}

.code-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.code-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    letter-spacing: 0.05em;
}

/* Language / Currency / Demonym grid */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.lang-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    transition: var(--transition);
}

.lang-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.lang-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.lang-native {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-style: italic;
}

.lang-code {
    font-size: 11px;
    color: var(--text-light);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Flag description text */
.modal-flag-desc {
    background: var(--bg-alt);
    border-left: 3px solid var(--primary);
    padding: 14px 18px;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Links row */
.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.map-link.secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
}

.map-link.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Primary capital star */
.cap-primary {
    color: #f59e0b;
    font-size: 0.85em;
    margin-left: 4px;
}

/* Gini chart (mini bar chart) */
.gini-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 160px;
    padding: 16px 12px 8px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow-x: auto;
}

.gini-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 42px;
    height: 100%;
    justify-content: flex-end;
}

.gini-bar {
    width: 26px;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 8px;
    transition: opacity 0.2s;
}

.gini-bar-wrap:hover .gini-bar {
    opacity: 0.85;
}

.gini-year {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.gini-val {
    font-size: 12px;
    color: var(--text);
    font-weight: 700;
}

/* Flag color palette */
.flag-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    transition: var(--transition);
}

.palette-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.palette-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.palette-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.palette-hex {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    font-family: 'SFMono-Regular', Consolas, monospace;
}

.palette-pct {
    font-size: 10px;
    color: var(--text-muted);
}

/* Hint text under sections */
.modal-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: -8px 0 16px;
}

.modal-hint code {
    background: var(--bg-alt);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--primary);
}

/* Update info at the bottom */
.modal-update-info {
    margin-top: 24px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.modal-update-info a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.modal-update-info a:hover {
    text-decoration: underline;
}

.modal-country-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 100px;
    background: var(--bg-alt);
    color: var(--text-muted);
}

.modal-tag.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.modal-info-card {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 16px 18px;
    border: 1px solid var(--border);
}

.modal-info-card .label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-info-card .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.modal-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 24px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text);
}

.map-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
}

.map-link:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================
   Footer
   ============================ */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 768px) {
    .hero {
        padding: 48px 20px 80px;
    }

    .hero-stats {
        gap: 24px;
    }

    .controls-card {
        padding: 20px;
    }

    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .reset-btn {
        grid-column: 1 / -1;
    }

    .country-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .country-grid.list-view .flag-wrapper {
        width: 100px;
        height: 80px;
    }

    .country-grid.list-view .country-card {
        max-height: none;
    }

    .modal-body {
        padding: 24px 20px;
    }

    .modal-flag {
        height: 200px;
    }

    .modal-country-name {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .filters {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        gap: 20px;
    }
}
