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

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary: #3b82f6;
    --accent: #f59e0b;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 4rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Search */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    border: none;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    outline: none;
}

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 1rem 1.5rem;
    display: block;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg);
}

.search-result-item .name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.search-result-item .details {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 4rem;
    padding: 2rem;
    background: var(--white);
    box-shadow: var(--shadow);
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Top Universities Section */
.top-universities {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.top-universities h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.top-universities .universities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* University cards with images */
.university-card.with-image {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.university-card.with-image > a {
    text-decoration: none;
    color: inherit;
}

.university-card.with-image .uni-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.university-card.with-image .uni-image-placeholder {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    letter-spacing: 2px;
}

.university-card.with-image .card-content {
    padding: 1rem 1.5rem 1.5rem;
}

.university-card.with-image .card-header {
    margin-bottom: 0.5rem;
}

.university-card.with-image:hover {
    transform: translateY(-4px);
}

.university-card.with-image .compare-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* States List */
.states-list {
    padding: 3rem 2rem;
    background: var(--white);
}

.states-list h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
    transition: gap 0.3s ease;
}

.state-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: all 0.2s;
}

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

.state-link span {
    font-size: 0.875rem;
    color: var(--text-light);
}

.state-link:hover span {
    color: rgba(255,255,255,0.8);
}

/* State Page */
.state-page {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.state-page h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.state-count {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.universities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    transition: gap 0.3s ease;
}

.university-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    display: block;
}

.university-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.rank-badge {
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.card-header h3 {
    font-size: 1rem;
    line-height: 1.4;
}

.card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.acceptance-badge {
    background: #dcfce7;
    color: #166534;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* University Page */
.university-page {
    padding: 3rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.university-header {
    text-align: center;
    margin-bottom: 2rem;
}

.university-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.university-location {
    color: var(--text-light);
    font-size: 1.125rem;
}

.acceptance-highlight {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border-left: 4px solid;
    box-shadow: var(--shadow);
}

.acceptance-rate {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
}

.acceptance-label {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0.5rem 0;
}

.selectivity {
    font-size: 1.125rem;
    font-weight: 600;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    transition: gap 0.3s ease;
}

.metric {
    background: var(--white);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.metric-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.back-link {
    margin-top: 3rem;
    text-align: center;
}

.back-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background: var(--text);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
}

/* ============================================
   COMPARE BAR
   ============================================ */
.compare-bar {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    max-width: 90vw;
    width: auto;
}

.compare-bar.active {
    bottom: 0;
}

@media (max-width: 768px) {
    .compare-bar {
        left: 0;
        right: 0;
        transform: none;
        max-width: 100%;
        width: 100%;
        bottom: -150px;
    }

    .compare-bar.active {
        bottom: 0;
    }
}

.compare-items {
    display: flex;
    gap: 0.5rem;
}

.compare-item {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compare-item .remove-btn {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    opacity: 0.7;
}

.compare-item .remove-btn:hover {
    opacity: 1;
}

.compare-bar button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.compare-bar .compare-now-btn {
    background: var(--white);
    color: var(--primary);
}

.compare-bar .clear-btn {
    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.3);
}

.compare-btn {
    background: var(--bg);
    border: 2px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.2s;
}

.compare-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.compare-btn.added {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Compare Modal */
.compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.compare-modal.active {
    opacity: 1;
    visibility: visible;
}

.compare-modal-content {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.compare-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.compare-modal h2 {
    margin-bottom: 1.5rem;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
}

.compare-table th,
.compare-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.compare-table th {
    background: var(--bg);
    font-weight: 600;
}

.compare-table tr:hover td {
    background: var(--bg);
}

/* ============================================
   ACCEPTANCE RATE GAUGE
   ============================================ */
.acceptance-gauge {
    width: 160px;
    height: 160px;
    position: relative;
    margin: 0 auto 1rem;
}

.acceptance-gauge svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.gauge-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 12;
}

.gauge-progress {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 339;
    stroke-dashoffset: 339;
    transition: stroke-dashoffset 1.5s ease;
}

.gauge-progress.most-selective { stroke: #dc2626; }
.gauge-progress.highly-selective { stroke: #ea580c; }
.gauge-progress.selective { stroke: #eab308; }
.gauge-progress.less-selective { stroke: #16a34a; }

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-text .rate {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.gauge-text .label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* ============================================
   SAT/ACT RANGE CHART
   ============================================ */
.score-range-section {
    margin-top: 2rem;
}

.score-range-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.score-chart {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.score-chart-label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
}

.score-chart-label span {
    font-weight: 400;
    color: var(--text-light);
}

.range-track {
    height: 24px;
    background: var(--bg);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.range-bar {
    position: absolute;
    top: 4px;
    height: 16px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 8px;
    left: 0;
    width: 0;
    transition: all 1s ease;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ============================================
   SIMILAR UNIVERSITIES
   ============================================ */
.similar-universities {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.similar-universities h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    transition: gap 0.3s ease;
}

/* ============================================
   STATE PAGE ENHANCEMENTS
   ============================================ */
.state-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.state-stat {
    text-align: center;
}

.state-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.state-stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.state-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    transition: gap 0.3s ease;
}

.highlight-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s;
}

.highlight-card:hover {
    transform: translateY(-2px);
}

.highlight-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.highlight-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.highlight-value {
    font-size: 0.875rem;
    opacity: 0.9;
}

.state-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--white);
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .universities-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .similar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .state-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    /* Base */
    body {
        font-size: 14px;
    }

    /* Navigation */
    .navbar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }

    .navbar .logo {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.875rem;
    }

    /* Hero Section */
    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .search-container {
        max-width: 100%;
    }

    #search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }

    .search-results {
        max-height: 60vh;
        border-radius: 8px;
    }

    .search-result-item {
        padding: 0.875rem 1rem;
    }

    .search-result-item .name {
        font-size: 0.95rem;
    }

    .search-result-item .details {
        font-size: 0.8rem;
    }

    /* Stats Bar */
    .stats-bar {
        padding: 1.5rem 1rem;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat {
        min-width: 80px;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* University Cards Grid */
    .top-universities,
    .states-list {
        padding: 2rem 1rem;
    }

    .top-universities h2,
    .states-list h2 {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .universities-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* University Card with Image */
    .university-card.with-image {
        border-radius: 10px;
    }

    .university-card.with-image .uni-image {
        height: 140px;
        border-radius: 10px 10px 0 0;
    }

    .university-card.with-image .card-content {
        padding: 0.875rem 1rem 1rem;
    }

    .university-card.with-image .card-header h3 {
        font-size: 1rem;
    }

    .university-card.with-image .compare-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .rank-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .acceptance-badge {
        font-size: 0.75rem;
    }

    /* States Grid */
    .states-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .state-link {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* University Detail Page */
    .university-page {
        padding: 1.5rem 1rem;
    }

    .university-header h1 {
        font-size: 1.35rem;
        line-height: 1.3;
    }

    .university-header .compare-btn {
        margin-top: 0.75rem;
    }

    .university-location {
        font-size: 0.9rem;
    }

    /* Acceptance Gauge */
    .acceptance-gauge {
        width: 130px;
        height: 130px;
    }

    .gauge-text .rate {
        font-size: 1.5rem;
    }

    .gauge-text .label {
        font-size: 0.65rem;
    }

    .selectivity-label {
        font-size: 0.85rem !important;
    }

    /* Acceptance Highlight (fallback) */
    .acceptance-highlight {
        padding: 1.25rem;
    }

    .acceptance-rate {
        font-size: 2.25rem;
    }

    /* Metrics Grid */
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .metric {
        padding: 0.875rem;
    }

    .metric-label {
        font-size: 0.75rem;
    }

    .metric-value {
        font-size: 1rem;
    }

    /* Score Range Charts */
    .score-range-section {
        padding: 1.25rem;
        margin: 1.5rem 0;
    }

    .score-range-section h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .score-chart {
        margin-bottom: 1.25rem;
    }

    .score-chart-label {
        font-size: 0.8rem;
    }

    .range-labels {
        font-size: 0.65rem;
    }

    /* Similar Universities */
    .similar-universities {
        margin: 1.5rem 0;
        padding: 1.25rem;
    }

    .similar-universities h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .similar-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .similar-grid .university-card {
        padding: 1rem;
    }

    .similar-grid .card-header h3 {
        font-size: 0.9rem;
    }

    /* State Page */
    .state-page {
        padding: 1.5rem 1rem;
    }

    .state-page h1 {
        font-size: 1.35rem;
    }

    .state-count {
        font-size: 0.9rem;
    }

    /* State Stats */
    .state-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin: 1.5rem 0;
    }

    .state-stat {
        padding: 1rem;
    }

    .state-stat-value {
        font-size: 1.5rem;
    }

    .state-stat-label {
        font-size: 0.7rem;
    }

    /* State Highlights */
    .state-highlights {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .highlight-card {
        padding: 1rem;
    }

    .highlight-label {
        font-size: 0.65rem;
    }

    .highlight-name {
        font-size: 0.95rem;
    }

    .highlight-value {
        font-size: 0.8rem;
    }

    /* State Filters */
    .state-filters {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .filter-group {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .filter-group select {
        flex: 1;
        margin-left: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Compare Bar - Mobile Layout */
    .compare-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        border-radius: 12px 12px 0 0;
        align-items: stretch;
    }

    .compare-items {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .compare-item {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
        max-width: calc(50% - 0.25rem);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .compare-bar-buttons {
        display: flex;
        gap: 0.5rem;
        width: 100%;
    }

    .compare-bar button {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        flex: 1;
    }

    /* Compare Modal */
    .compare-modal-content {
        width: 95%;
        max-width: none;
        margin: 0.5rem;
        padding: 1rem;
        max-height: 90vh;
    }

    .compare-modal h2 {
        font-size: 1.1rem;
    }

    .compare-table {
        font-size: 0.75rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .compare-table th,
    .compare-table td {
        padding: 0.5rem;
        min-width: 100px;
    }

    .compare-modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 28px;
        height: 28px;
        font-size: 1.25rem;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
        font-size: 0.8rem;
    }

    /* Back Link */
    .back-link {
        margin-top: 1.5rem;
    }

    .back-link a {
        font-size: 0.9rem;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.25rem;
    }

    .stats-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .stat {
        width: 100%;
        padding: 0.75rem;
        background: var(--bg);
        border-radius: 8px;
    }

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

    .state-stats {
        grid-template-columns: 1fr;
    }

    .compare-table th,
    .compare-table td {
        min-width: 80px;
        font-size: 0.7rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .university-card:hover,
    .university-card.with-image:hover {
        transform: none;
    }

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

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

    .state-link:hover {
        background: var(--bg);
    }
}

/* ============================================
   LANDSCAPE ORIENTATION - PHONES
   ============================================ */
@media (max-width: 896px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 2rem;
    }

    .hero h1 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .hero p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .stats-bar {
        padding: 1rem;
        gap: 2rem;
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .stat {
        min-width: auto;
        padding: 0;
        background: none;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .universities-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .similar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .states-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .university-page {
        padding: 1rem 2rem;
    }

    .acceptance-gauge {
        width: 100px;
        height: 100px;
    }

    .gauge-text .rate {
        font-size: 1.25rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .compare-bar {
        flex-direction: row;
        padding: 0.75rem 1rem;
    }

    .compare-modal-content {
        max-height: 95vh;
        padding: 1rem;
    }

    .compare-modal h2 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .state-highlights {
        grid-template-columns: repeat(2, 1fr);
    }

    .state-filters {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .filter-group {
        width: auto;
    }
}

/* ============================================
   SAFE AREA (NOTCH) SUPPORT
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .navbar {
        padding-left: max(2rem, env(safe-area-inset-left));
        padding-right: max(2rem, env(safe-area-inset-right));
    }

    .hero {
        padding-left: max(2rem, env(safe-area-inset-left));
        padding-right: max(2rem, env(safe-area-inset-right));
    }

    .compare-bar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }

    .compare-bar.active {
        bottom: 0;
    }

    footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
        padding-left: max(2rem, env(safe-area-inset-left));
        padding-right: max(2rem, env(safe-area-inset-right));
    }

    @media (max-width: 768px) {
        .navbar {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        .hero {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        .top-universities,
        .states-list,
        .university-page,
        .state-page {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        .compare-bar {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        footer {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
    }
}

/* ============================================
   TABLET-SPECIFIC STYLES (iPad)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero {
        padding: 3rem 2rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .universities-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .top-universities .universities-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .university-card.with-image .uni-image {
        height: 150px;
    }

    .states-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .acceptance-gauge {
        width: 140px;
        height: 140px;
    }

    .gauge-text .rate {
        font-size: 1.75rem;
    }

    .compare-modal-content {
        max-width: 700px;
    }

    .state-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .state-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* iPad Pro Landscape */
@media (min-width: 1025px) and (max-width: 1366px) {
    .universities-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .top-universities .universities-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .states-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
