/* ================================================
   ONLY ToP - AI Conference Paper Search
   Clean Google-like Design with Purple Accent
   ================================================ */

:root {
    --primary: #7C3AED;
    --primary-dark: #6D28D9;
    --primary-light: #A78BFA;
    --primary-bg: #F5F3FF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg-white: #FFFFFF;
    --bg-gray: #F9FAFB;
    --border: #D1D5DB;
    --border-light: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-white);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Content Wrapper - Main + Sidebar */
.content-wrapper {
    display: flex;
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    gap: 24px;
    padding: 0 24px;
}

/* ================================================
   Top Navigation
   ================================================ */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.data-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.loaded {
    background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.nav-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

/* Help Button */
.nav-btn.help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--bg-gray);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-btn.help-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-light);
}

.nav-btn.login-btn {
    background: var(--primary);
    color: white;
}

.nav-btn.login-btn:hover {
    background: var(--primary-dark);
}

.nav-btn.logout-btn {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.nav-btn.logout-btn:hover {
    background: var(--border);
}

/* Unified sizing for nav buttons: Deadlines, Wiki, Discussion, Rankings, Contact, My Page */
.nav-btn.deadlines-btn,
.nav-btn.wiki-btn,
.nav-btn.discussion-btn,
.nav-btn.rankings-btn,
.nav-btn.contact-btn,
.nav-btn.mypage-btn {
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 100px;
    height: 36px;
    padding: 0 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* Purple color scheme for Deadlines, Wiki, Discussion, Rankings, Contact */
.nav-btn.deadlines-btn,
.nav-btn.wiki-btn,
.nav-btn.discussion-btn,
.nav-btn.rankings-btn,
.nav-btn.contact-btn {
    display: flex;
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid var(--primary-light);
}

.nav-btn.deadlines-btn:hover,
.nav-btn.wiki-btn:hover,
.nav-btn.discussion-btn:hover,
.nav-btn.rankings-btn:hover,
.nav-btn.contact-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Contact button hidden by default (shown on login) */
.nav-btn.contact-btn {
    display: none;
}

/* Gray color scheme for My Page (different from purple buttons) */
.nav-btn.mypage-btn {
    background: var(--bg-gray) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
}

.nav-btn.mypage-btn:hover {
    background: var(--primary-bg) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.user-info {
    display: none;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-info.show {
    display: flex;
}

/* ================================================
   Main Content
   ================================================ */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 40px 0;
}

/* ================================================
   Logo Section
   ================================================ */
.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 2rem;
    font-weight: 700;
}

.logo-highlight {
    position: relative;
    color: white;
    padding: 7px 1px 4px 1px;/*上→右→下→左 */
    letter-spacing: -0.02em;
    line-height: 0.85;
    display: inline-flex;
    background: transparent;  
}

.logo-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    right: -5px;
    bottom: 0;
    background: var(--primary);
    border-radius: var(--radius-sm);
    transform: skew(-4deg, 3deg);
    z-index: -1;
}



.logo-text {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ================================================
   Search Section
   ================================================ */
.search-section {
    display: block;
}

.search-container {
    margin-bottom: 32px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-white);
    border: 2px solid #B8BCC4;
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 20px;
    max-width: 720px;
    margin: 0 auto;
    transition: all 0.2s;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-primary);
}

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

.search-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.search-btn:hover {
    background: var(--primary-dark);
}

.search-limit-indicator {
    display: none;
    text-align: center;
    margin-top: 12px;
    padding: 8px 16px;
    background: #FEF3C7;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #92400E;
}

/* ================================================
   Bento Grid Filters (centered 2-column layout, 80% width)
   ================================================ */
.bento-grid {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.bento-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.bento-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.bento-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.bento-title-with-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
    flex-wrap: nowrap;  /* Prevents wrapping to next line */
}

.bento-title-with-actions .bento-title {
    margin-bottom: 0;
    white-space: nowrap;  /* Prevents title from wrapping */
}

.bento-title-with-actions .area-actions {
    margin: 0;
    border-top: none;
    white-space: nowrap;  /* Prevents buttons from wrapping */
    flex-shrink: 0;  /* Prevents buttons from shrinking */
    display: flex;
    align-items: center;  /* Align buttons vertically */
}

/* Additional rules to ensure no lines appear */
.bento-conferences .area-actions {
    display: flex;
    gap: 8px;
    border: none;
}

.bento-conferences .area-action-btn {
    flex: none;
    width: auto;
}

/* Year Filter */
.bento-year {
    width: 145px;
    flex-shrink: 0;
    flex-grow: 0;
}

.year-select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-white);
    cursor: pointer;
    color: var(--text-primary);
}

.year-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-bg);
}

/* Year Mode Buttons */
.year-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
}

.year-mode-buttons.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.year-mode-btn {
    flex: 1;
    padding: 6px 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.year-mode-btn:hover {
    background: var(--bg-gray);
    border-color: var(--primary-light);
    color: var(--primary);
}

.year-mode-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.area-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.area-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.area-checkbox:hover {
    background: var(--bg-gray);
    border-color: var(--border-light);
}

.area-checkbox input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.area-label {
    font-size: 13px;
    color: var(--text-primary);
}

.area-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.area-action-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.area-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.area-action-deselect:hover {
    background: var(--text-muted);
    border-color: var(--text-muted);
}

/* Conference Filter */
.bento-conferences {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 161px); /* 100% - year width (145px) - gap (16px) */
}


.conference-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Row container for multiple blocks */
.conference-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

/* Individual area block */
.conference-block {
    background: var(--bg-gray);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s;
    flex: 0 1 auto;
}

.conference-block:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

/* Items container within a block */
.conference-block-items {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.conference-area-header {
    padding: 5px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

/* Area header with checkbox */
.area-header-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.area-header-checkbox:hover {
    background: var(--primary-light);
    color: white;
}

.area-header-checkbox input {
    accent-color: var(--primary-dark);
    width: 12px;
    height: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.area-header-checkbox span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.area-header-checkbox.checked {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
}

.area-header-checkbox:not(.checked) {
    background: var(--bg-gray);
    color: var(--text-secondary);
    border-color: var(--border);
}

.conf-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid var(--border-light);
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.conf-checkbox:hover {
    background: var(--border-light);
    border-color: var(--border);
}

.conf-checkbox.checked {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.conf-checkbox input {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
}

/* ================================================
   Results Section
   ================================================ */
.results-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1.5px solid var(--border);
}

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

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

.results-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.recommended-paper-badge {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%) !important;
    color: white !important;
    font-size: 10px !important;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.load-more-btn {
    padding: 12px 40px;
    background: white;
    color: #7C3AED;
    border: 1.5px solid #7C3AED;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #7C3AED;
    color: white;
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Shared filter checkbox style */
.recent-only-filter,
.favorites-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    height: 38px;
    box-sizing: border-box;
}

.favorites-filter {
    display: none;
}

.recent-only-filter {
    position: relative;
}

.recent-only-filter input,
.favorites-filter input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.recent-only-label,
.favorites-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Tooltip for Recent Only */
.recent-only-filter::after {
    content: "ON: Show only papers from 2015 onwards\AOFF: Show papers from all years";
    white-space: pre-line;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    width: max-content;
    max-width: 250px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.recent-only-filter::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1F2937;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}

.recent-only-filter:hover::after,
.recent-only-filter:hover::before {
    opacity: 1;
}

/* Papers Grid */
.papers-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.paper-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.paper-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

/* DBLP-only papers (not in Firebase) - faded appearance */
.paper-card.dblp-only {
    opacity: 0.55;
    background: #F9FAFB;
    border-color: #E5E7EB;
    border-style: dashed;
}

.paper-card.dblp-only:hover {
    opacity: 0.75;
    border-color: #D1D5DB;
}

.paper-card.dblp-only .paper-title a {
    color: #6B7280;
}

.dblp-only-badge {
    background: #9CA3AF !important;
    color: white !important;
    font-size: 10px !important;
}

.paper-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    background: var(--primary);
    color: white;
}

.badge-year {
    background: var(--text-muted);
}

.paper-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
}

.paper-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.paper-title a:hover {
    color: var(--primary);
}

.paper-author {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.paper-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Per-paper Export Dropdown (search results) */
.paper-links .paper-export-wrapper {
    position: relative;
    display: inline-block;
}

.paper-links .paper-export-btn {
    cursor: pointer;
}

.paper-links .paper-export-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 130px;
    padding: 4px 0;
    margin-top: 4px;
}

.paper-links .paper-export-menu button {
    display: block;
    width: 100%;
    padding: 6px 12px;
    border: none;
    background: none;
    text-align: left;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.paper-links .paper-export-menu button:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.paper-link {
    padding: 6px 14px;
    background: var(--bg-white);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.paper-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* No Results / Loading */
.no-results, .loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.no-results p {
    font-size: 14px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Logic Controller: Loading Blocked Message */
.loading-blocked-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-blocked-message .loading-spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
    margin-bottom: 20px;
}

.loading-blocked-message p {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Highlight */
.highlight {
    background: var(--primary-bg);
    color: var(--primary-dark);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.highlight.fuzzy-highlight {
    background: #FEF3C7;
    color: #92400E;
    border-bottom: 1px dashed #F59E0B;
}

/* Info Box */
.info-box {
    background: var(--primary-bg);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 3px solid var(--primary);
    color: var(--primary-dark);
}

/* Refresh button for rankings overlay */
.refresh-btn-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.refresh-btn-small:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ================================================
   Responsive Design
   ================================================ */

/* Medium screens - adjust block sizing */
@media (max-width: 1200px) and (min-width: 901px) {
    .conference-block {
        padding: 6px;
    }

    .conference-area-header {
        font-size: 9px;
        padding: 4px 6px;
    }

    .conf-checkbox {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Small screens - more compact layout */
@media (max-width: 1100px) and (min-width: 901px) {
    .bento-grid {
        width: 85%;
    }

    .bento-year {
        width: 130px;
    }

    .bento-conferences {
        max-width: calc(100% - 146px); /* 130px + 16px gap */
    }
}

@media (max-width: 900px) and (min-width: 601px) {
    .bento-grid {
        width: 90%;
    }

    .bento-year {
        width: 120px;
    }

    .bento-conferences {
        max-width: calc(100% - 136px); /* 120px + 16px gap */
    }

    .conference-block {
        padding: 5px;
    }

    .conference-area-header {
        font-size: 9px;
        padding: 4px 6px;
    }

    .conf-checkbox {
        font-size: 11px;
        padding: 5px 8px;
        gap: 4px;
    }

    .conf-checkbox input {
        width: 12px;
        height: 12px;
    }
}

/* Tablet and mobile */
@media (max-width: 768px) {
    .main-content {
        padding: 24px 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .logo {
        flex-direction: column;
        gap: 8px;
        font-size: 1.5rem;
    }

    .search-bar {
        flex-wrap: wrap;
        border-radius: var(--radius-md);
        padding: 8px;
    }

    .search-icon {
        display: none;
    }

    .search-input {
        width: 100%;
        padding: 12px;
    }


    .search-btn {
        flex: 1;
        border-radius: var(--radius-sm);
    }

    .recent-only-filter,
    .favorites-filter {
        font-size: 13px;
        padding: 6px 10px;
        height: 34px;
    }

    /* Tooltip below on mobile */
    .recent-only-filter::after {
        bottom: auto;
        top: calc(100% + 8px);
    }

    .recent-only-filter::before {
        bottom: auto;
        top: calc(100% + 2px);
        border-top-color: transparent;
        border-bottom-color: #1F2937;
    }

    .bento-grid {
        flex-direction: column;
        align-items: center;
        width: 95%;
    }

    .bento-year {
        width: 100%;
        max-width: 300px;
    }

    .bento-conferences {
        width: 100%;
        max-width: 100%;
    }

    /* Block layout responsive - rows become columns on mobile */
    .conference-row {
        flex-direction: column;
    }

    .conference-block {
        width: 100%;
        flex: 0 0 auto;
    }

    .conference-block-items {
        justify-content: flex-start;
    }

    .conf-checkbox {
        font-size: 11px;
        padding: 4px 6px;
    }

    .area-header-checkbox {
        font-size: 10px;
    }

    .results-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Navigation responsive */
    .top-nav {
        flex-wrap: wrap;
        padding: 12px 16px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        gap: 8px;
    }

    .nav-left, .nav-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 13px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Touch targets for interactive elements */
    .paper-link,
    .comment-btn,
    .abstract-btn,
    .citation-btn,
    .pdf-btn,
    .paper-export-btn {
        min-height: 44px;
        padding: 10px 14px;
        display: inline-flex;
        align-items: center;
    }

    .search-btn {
        min-height: 44px;
    }

    .year-mode-btn {
        min-height: 40px;
        padding: 8px 12px;
    }

    .conf-checkbox {
        min-height: 36px;
        padding: 8px 10px;
    }

    /* Unified nav buttons responsive sizing */
    .nav-btn.deadlines-btn,
    .nav-btn.wiki-btn,
    .nav-btn.rankings-btn,
    .nav-btn.contact-btn,
    .nav-btn.mypage-btn {
        min-width: 85px;
        height: 44px;
        padding: 0 10px;
        font-size: 13px;
    }

    .data-status {
        font-size: 11px;
    }

    .user-info {
        font-size: 13px;
    }
}

/* Very small screens (phones) */
@media (max-width: 480px) {
    .top-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .nav-left {
        justify-content: center;
    }

    .nav-right {
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Unified nav buttons responsive sizing */
    .nav-btn.deadlines-btn,
    .nav-btn.wiki-btn,
    .nav-btn.rankings-btn,
    .nav-btn.contact-btn,
    .nav-btn.mypage-btn {
        min-width: 80px;
        height: 30px;
        padding: 0 10px;
        font-size: 12px;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    #userEmail {
        width: 100%;
        text-align: center;
        font-size: 12px;
    }

    .logo-section {
        margin-bottom: 24px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .search-bar {
        padding: 6px;
    }

    .search-input {
        font-size: 14px;
        padding: 10px;
    }

    .search-btn {
        font-size: 13px;
        padding: 10px 16px;
    }

    .bento-card {
        padding: 14px;
    }

    .bento-title {
        font-size: 12px;
    }

    .year-select {
        font-size: 13px;
        padding: 8px 10px;
    }

    .year-mode-btn {
        font-size: 10px;
        padding: 5px 6px;
    }

    .bento-title-with-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .area-action-btn {
        font-size: 11px;
        padding: 5px 10px;
    }

    .paper-card {
        padding: 14px;
    }

    .paper-header {
        gap: 6px;
    }

    .badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .paper-title {
        font-size: 14px;
    }

    .paper-author {
        font-size: 13px;
    }

    .paper-links {
        flex-wrap: wrap;
    }

    .paper-link {
        font-size: 12px;
        padding: 5px 10px;
    }

    .results-count {
        font-size: 13px;
    }

    .recent-only-filter,
    .favorites-filter {
        font-size: 13px;
        padding: 6px 10px;
        height: 34px;
    }

    .recommended-paper-badge {
        font-size: 9px !important;
    }
}

