:root {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-subtle: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-light: #eff6ff;
    --accent-glow: rgba(37,99,235,0.12);
    --green: #059669;
    --green-light: #ecfdf5;
    --green-bg: #dcfce7;
    --amber: #d97706;
    --amber-light: #fffbeb;
    --amber-bg: #fef3c7;
    --red: #dc2626;
    --red-light: #fef2f2;
    --purple: #7c3aed;
    --purple-light: #f5f3ff;
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 20px 40px -12px rgba(15,23,42,0.1);
    --shadow-card-hover: 0 20px 40px -12px rgba(37,99,235,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== BACKGROUND ===== */
.bg-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-blob {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35;
    animation: blobMove 22s ease-in-out infinite alternate;
}
.bg-blob:nth-child(1) {
    width: 550px; height: 550px;
    background: radial-gradient(circle, rgba(37,99,235,0.2), transparent 70%);
    top: -180px; left: -80px;
}
.bg-blob:nth-child(2) {
    width: 450px; height: 450px;
    background: radial-gradient(circle, rgba(5,150,105,0.12), transparent 70%);
    bottom: -100px; right: -100px;
    animation-delay: -8s; animation-duration: 26s;
}
@keyframes blobMove {
    0% { transform: translate(0,0) scale(1); }
    50% { transform: translate(30px,-20px) scale(1.04); }
    100% { transform: translate(-15px,15px) scale(0.97); }
}
.bg-noise {
    position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.022;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px;
}

.page-wrapper { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; min-height: 100vh; }

/* ===== HEADER ===== */
header {
    padding: 18px 0; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 100;
    background: rgba(248,250,252,0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    margin: 0 -24px; padding-left: 24px; padding-right: 24px;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.back-link {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    transition: all 0.2s; border: 1px solid transparent;
}
.back-link:hover { color: var(--accent); background: var(--accent-light); border-color: rgba(37,99,235,0.1); }
.back-link svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-logo { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.04em; color: var(--text-primary); text-decoration: none; }
.brand-logo .dotcom { color: var(--accent); }
.tool-label {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    padding: 3px 10px; border-radius: 20px;
    background: var(--accent-light); color: var(--accent); border: 1px solid rgba(37,99,235,0.1);
}
.header-right { display: flex; align-items: center; gap: 12px; }
.nav-link {
    color: var(--text-secondary); text-decoration: none; font-size: 0.82rem; font-weight: 600;
    display: flex; align-items: center; gap: 6px; padding: 7px 14px;
    border-radius: var(--radius-sm); border: 1px solid transparent; transition: all 0.2s;
}
.nav-link:hover { color: var(--accent); background: var(--accent-light); border-color: rgba(37,99,235,0.1); }
.nav-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== SEARCH HERO ===== */
.search-hero { text-align: center; padding: 52px 0 28px; max-width: 680px; margin: 0 auto; }
.search-hero h1 {
    font-family: 'Inter', sans-serif; font-size: clamp(1.9rem, 4.5vw, 2.7rem);
    font-weight: 900; line-height: 1.15; margin-bottom: 14px; letter-spacing: -0.04em;
}
.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--green), var(--purple));
    background-size: 200% 200%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; animation: gradShift 6s ease-in-out infinite;
}
@keyframes gradShift { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }
.search-subtitle { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 28px; }
.search-box { position: relative; width: 100%; margin-bottom: 18px; }
.search-box input {
    width: 100%; padding: 16px 48px 16px 50px;
    background: rgba(255,255,255,0.88); border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-size: 0.95rem; font-weight: 500; outline: none;
    box-shadow: var(--shadow-sm); transition: all 0.3s; backdrop-filter: blur(8px); font-family: inherit;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-md); background: #fff; }
.search-icon {
    position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; stroke: var(--text-muted); fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.2s;
}
.search-box input:focus ~ .search-icon { stroke: var(--accent); }
.clear-btn {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: var(--border-subtle); color: var(--text-muted); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 15px; line-height: 1; transition: all 0.2s;
}
.clear-btn:hover { background: #cbd5e1; color: var(--text-secondary); }
.clear-btn.visible { display: flex; }

/* Suggested Tags */
.suggested-tags { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.suggested-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-right: 4px; }
.suggested-tag {
    padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.7); font-size: 0.78rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.suggested-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 12px; margin-bottom: 8px; padding: 0 0 16px; border-bottom: 1px solid var(--border-subtle);
}
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
    padding: 6px 16px; border-radius: 20px; border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.7); font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.filter-pill:hover { border-color: var(--border-hover); background: #fff; }
.filter-pill.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); box-shadow: 0 3px 10px rgba(15,23,42,0.15); }
.sort-wrapper { display: flex; align-items: center; gap: 8px; }
.sort-wrapper label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.sort-wrapper select {
    padding: 6px 32px 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
    font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    outline: none; cursor: pointer; font-family: inherit; appearance: none;
    transition: border-color 0.2s;
}
.sort-wrapper select:focus { border-color: var(--accent); }

/* ===== RESULTS INFO ===== */
.results-info { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; margin-bottom: 16px; min-height: 20px; padding: 8px 0; }
.results-info strong { color: var(--text-secondary); font-weight: 700; }

/* ===== GRID ===== */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }

/* ===== JOURNAL CARD ===== */
.journal-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl); padding: 24px 22px 20px;
    display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
    transition: all 0.35s cubic-bezier(0.16,1,0.3,1);
    position: relative; overflow: hidden;
    opacity: 0; transform: translateY(16px);
}
.journal-card.visible { opacity: 1; transform: translateY(0); }
.journal-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), #60a5fa);
    opacity: 0; transition: opacity 0.3s;
}
.journal-card:hover { transform: translateY(-6px); border-color: var(--border-hover); box-shadow: var(--shadow-card-hover); }
.journal-card:hover::before { opacity: 1; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.oa-badge {
    font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 3px 9px; border-radius: 20px; flex-shrink: 0; white-space: nowrap;
}
.oa-badge.yes { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.oa-badge.no { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border-subtle); }
.apc-badge {
    font-size: 0.6rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-left: 6px;
}
.apc-badge.free { background: var(--green-light); color: var(--green); }
.apc-badge.paid { background: var(--amber-light); color: var(--amber); }

.card-title {
    font-family: 'Inter', sans-serif; font-size: 1.05rem; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1.3; color: var(--text-primary);
    margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.card-pub { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; margin-bottom: 18px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-pub .country-flag { font-size: 1rem; line-height: 1; }

/* Stats Row */
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-box { text-align: center; padding: 10px 6px; border-radius: var(--radius-sm); background: #f8fafc; border: 1px solid #f1f5f9; }
.stat-val {
    font-family: 'Inter', sans-serif; font-size: 1.15rem; font-weight: 800;
    letter-spacing: -0.03em; color: var(--text-primary); line-height: 1.2;
}
.stat-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* Topics */
.card-topics { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 18px; }
.topic-tag {
    font-size: 0.67rem; font-weight: 600; padding: 3px 9px; border-radius: 6px;
    background: var(--accent-light); color: var(--accent); border: 1px solid rgba(37,99,235,0.08);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}

/* Card Actions */
.card-actions { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--border-subtle); margin-top: auto; }
.compare-check {
    display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.78rem;
    font-weight: 600; color: var(--text-muted); transition: color 0.2s; user-select: none;
}
.compare-check:hover { color: var(--text-secondary); }
.compare-check input { display: none; }
.check-box {
    width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-hover);
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
    background: #fff; flex-shrink: 0;
}
.check-box svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity 0.2s; }
.compare-check input:checked ~ .check-box { background: var(--accent); border-color: var(--accent); }
.compare-check input:checked ~ .check-box svg { opacity: 1; }
.compare-check input:checked ~ .check-label { color: var(--accent); }

.detail-btn {
    font-size: 0.8rem; font-weight: 700; color: var(--accent); background: none;
    border: none; cursor: pointer; display: flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: var(--radius-sm); transition: all 0.2s; font-family: inherit;
}
.detail-btn:hover { background: var(--accent-light); }
.detail-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.detail-btn:hover svg { transform: translateX(2px); }

/* ===== SKELETON ===== */
.skeleton-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl); padding: 24px 22px 20px;
}
.skeleton-card .sk-row {
    background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf1 50%, #f1f5f9 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px;
}
.skeleton-card .sk-badge { width: 70px; height: 20px; margin-bottom: 14px; }
.skeleton-card .sk-title { width: 85%; height: 18px; margin-bottom: 8px; }
.skeleton-card .sk-sub { width: 60%; height: 14px; margin-bottom: 20px; }
.skeleton-card .sk-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
.skeleton-card .sk-stat { height: 58px; border-radius: var(--radius-sm); background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf1 50%, #f1f5f9 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-card .sk-tags { width: 90%; height: 24px; margin-bottom: 18px; }
.skeleton-card .sk-footer { width: 50%; height: 14px; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ===== INITIAL / EMPTY / ERROR STATES ===== */
.initial-state, .empty-state, .error-state {
    text-align: center; padding: 60px 20px; grid-column: 1 / -1;
}
.initial-state svg, .empty-state svg, .error-state svg {
    width: 56px; height: 56px; stroke: var(--text-muted); fill: none;
    stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 18px; opacity: 0.4;
}
.initial-state h3, .empty-state h3, .error-state h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.initial-state p, .empty-state p, .error-state p { font-size: 0.9rem; color: var(--text-muted); max-width: 400px; margin: 0 auto; }
.initial-icon {
    width: 80px; height: 80px; border-radius: 50%; background: var(--accent-light);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
}
.initial-icon svg { width: 36px; height: 36px; stroke: var(--accent); opacity: 1 !important; margin: 0 !important; }
.error-state svg { stroke: var(--red); opacity: 0.5 !important; }
.retry-btn {
    margin-top: 18px; padding: 10px 24px; border-radius: var(--radius-sm);
    background: var(--accent); color: #fff; border: none; cursor: pointer;
    font-size: 0.85rem; font-weight: 700; font-family: inherit; transition: background 0.2s;
}
.retry-btn:hover { background: var(--accent-dark); }

/* ===== LOAD MORE ===== */
.load-more-wrap { text-align: center; margin: 12px 0 40px; }
.load-more-btn {
    padding: 12px 32px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
    background: #fff; color: var(--text-secondary); font-size: 0.88rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s; font-family: inherit; box-shadow: var(--shadow-sm);
}
.load-more-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-md); }
.load-more-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== COMPARE BAR ===== */
.compare-bar {
    position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
    background: var(--text-primary); color: #fff; padding: 14px 24px;
    border-radius: var(--radius-lg); display: flex; align-items: center; gap: 20px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25); z-index: 200;
    transition: bottom 0.4s cubic-bezier(0.16,1,0.3,1);
    white-space: nowrap;
}
.compare-bar.visible { bottom: 28px; }
.compare-bar-info { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; }
.compare-bar-info svg { width: 18px; height: 18px; stroke: rgba(255,255,255,0.6); fill: none; stroke-width: 1.5; }
.compare-bar-info span { color: #60a5fa; font-weight: 800; }
.compare-bar-actions { display: flex; align-items: center; gap: 8px; }
.compare-clear-btn {
    padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,0.15);
    background: transparent; color: rgba(255,255,255,0.7); font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.compare-clear-btn:hover { border-color: rgba(255,255,255,0.3); color: #fff; }
.compare-go-btn {
    padding: 8px 20px; border-radius: var(--radius-sm); border: none;
    background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.compare-go-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.compare-go-btn:not(:disabled):hover { background: var(--accent-dark); }

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500; background: rgba(15,23,42,0.5);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-content {
    background: #fff; border-radius: var(--radius-xl); width: 100%;
    max-height: 85vh; overflow-y: auto; position: relative;
    box-shadow: 0 32px 64px rgba(0,0,0,0.15);
    transform: translateY(20px) scale(0.97); transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.modal-overlay.open .modal-content { transform: translateY(0) scale(1); }
.modal-detail { max-width: 680px; }
.modal-compare { max-width: 960px; }
.modal-close {
    position: sticky; top: 0; float: right; width: 36px; height: 36px;
    border-radius: 50%; border: none; background: rgba(255,255,255,0.9);
    color: var(--text-secondary); font-size: 20px; cursor: pointer; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm); transition: all 0.2s; margin: 16px 16px 0 0;
}
.modal-close:hover { background: #f1f5f9; color: var(--text-primary); }

/* Detail Modal Inner */
.detail-header { padding: 32px 32px 0; }
.detail-badges { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.detail-title {
    font-family: 'Inter', sans-serif; font-size: 1.5rem; font-weight: 900;
    letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 10px;
}
.detail-pub-info { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }
.detail-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 24px 32px; }
.detail-stat {
    text-align: center; padding: 16px 10px; border-radius: var(--radius-md);
    background: #f8fafc; border: 1px solid #f1f5f9;
}
.detail-stat-val { font-family: 'Inter', sans-serif; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); }
.detail-stat-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.detail-section { padding: 0 32px 24px; }
.detail-section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px; }
.detail-topics-list { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-topic {
    font-size: 0.78rem; font-weight: 600; padding: 5px 12px; border-radius: 8px;
    background: var(--accent-light); color: var(--accent); border: 1px solid rgba(37,99,235,0.08);
}
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-info-item { padding: 12px; border-radius: var(--radius-sm); background: #f8fafc; border: 1px solid #f1f5f9; }
.detail-info-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.detail-info-value { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); word-break: break-all; }
.detail-info-value a { color: var(--accent); text-decoration: none; }
.detail-info-value a:hover { text-decoration: underline; }
.chart-canvas-wrap { background: #f8fafc; border: 1px solid #f1f5f9; border-radius: var(--radius-md); padding: 20px; }
.chart-canvas-wrap canvas { width: 100% !important; height: 180px !important; }
.detail-visit-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; border-radius: var(--radius-md);
    background: var(--accent); color: #fff; text-decoration: none;
    font-size: 0.88rem; font-weight: 700; transition: all 0.2s; border: none; cursor: pointer; font-family: inherit;
    margin-top: 8px;
}
.detail-visit-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.detail-visit-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.detail-loading { text-align: center; padding: 60px 20px; color: var(--text-muted); font-weight: 600; }

/* Compare Modal Inner */
.compare-table-wrap { overflow-x: auto; padding: 24px; }
.compare-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 500px; }
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; }
.compare-table th { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: #f8fafc; position: sticky; top: 0; }
.compare-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.compare-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.compare-table td:first-child { font-weight: 700; color: var(--text-secondary); white-space: nowrap; font-size: 0.8rem; }
.compare-table .col-journal { min-width: 180px; }
.compare-table .col-journal .journal-name { font-weight: 800; font-size: 0.9rem; color: var(--text-primary); display: block; margin-bottom: 4px; }
.best-val { color: var(--green) !important; font-weight: 800 !important; position: relative; }
.compare-chart-cell canvas { width: 100% !important; height: 100px !important; }
.compare-visit-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px;
    border-radius: var(--radius-sm); background: var(--accent-light); color: var(--accent);
    font-size: 0.78rem; font-weight: 700; text-decoration: none; transition: all 0.2s; border: none; cursor: pointer; font-family: inherit;
}
.compare-visit-btn:hover { background: #dbeafe; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--text-primary); color: #fff; padding: 14px 20px;
    border-radius: var(--radius-md); font-size: 0.83rem; font-weight: 600;
    box-shadow: 0 12px 36px rgba(0,0,0,0.2); transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1); max-width: 340px;
    display: flex; align-items: center; gap: 10px;
}
.toast.show { transform: translateX(0); }
.toast svg { width: 18px; height: 18px; stroke: #60a5fa; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ===== FOOTER ===== */
footer {
    margin-top: auto; border-top: 1px solid var(--border-subtle);
    padding: 24px 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.footer-left { font-size: 0.8rem; color: var(--text-muted); }
.footer-left a { color: var(--text-secondary); text-decoration: none; font-weight: 700; transition: color 0.2s; }
.footer-left a:hover { color: var(--accent); }
.footer-api { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .container { padding: 0 16px; }
    header { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
    .search-hero { padding: 36px 0 20px; }
    .tools-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: flex-start; }
    .compare-bar { left: 16px; right: 16px; transform: none; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 12px 16px; }
    .compare-bar.visible { bottom: 16px; }
    .detail-header, .detail-section { padding-left: 20px; padding-right: 20px; }
    .detail-stats-grid { padding: 20px; }
    .detail-title { font-size: 1.25rem; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { max-width: 100%; }
    footer { flex-direction: column; text-align: center; }
    .nav-link span { display: none; }
}