@font-face {
    font-display: swap;
    font-family: 'TwemojiCountryFlags';
    font-style: normal;
    font-weight: normal;
    src: url('fonts/TwemojiCountryFlags.woff2') format('woff2');
}

body {
    background-color: #f9fafb;
    color: #111827;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.035em;
    margin: 0;
    min-height: 100vh;
    padding: 0;
}

button, select {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.035em;
}

h1, h2, .proper-name {
    letter-spacing: 0.035em;
}

.stat-value {
    letter-spacing: 0.05em;
}

a {
    text-decoration: none;
}

.site-header {
    align-items: center;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header .logo img {
    height: 32px;
    margin-right: 0.5rem;
}

.site-nav {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.site-nav a {
    align-items: center;
    color: #374151;
    display: flex;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-nav a:hover {
    color: #1d4ed8;
}

.site-nav svg {
    height: 18px;
    margin-right: 0.5rem;
    stroke-width: 2;
    width: 18px;
}

.container {
    margin: 0 auto;
    padding: 2rem;
    width: 950px;
}

.title {
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    width: 100%;
}

.title h1 {
    color: #1d4ed8;
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

table {
    background: white;
    border-collapse: collapse;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    overflow: hidden;
    width: 100%;
}

thead {
    background-color: #e0f2fe;
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: center;
    vertical-align: middle;
}

th {
    color: #1d4ed8;
}

tbody tr:hover {
    background-color: #f3f4f6;
}

.rank {
    text-align: center;
    width: 60px;
}

.score,
.logo {
    width: 120px;
}

.numerical-rank {
    color: #2563eb;
    font-size: x-large;
    font-weight: 800;
}

a.school-link {
    color: #2563eb;
    text-decoration: none;
}

.progress-circle {
    display: inline-block;
    height: 50px;
    position: relative;
    width: 50px;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle circle.bg {
    fill: none;
    stroke: #cbd5e1;
    stroke-width: 4;
}

.progress-circle circle.progress {
    fill: none;
    stroke: #2563eb;
    stroke-linecap: round;
    stroke-width: 4;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
    left: 50%;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    user-select: none;
    white-space: nowrap;
}

.site-footer {
    background-color: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: auto;
    padding: 1rem 2rem;
    text-align: left;
}

.school-logo {
    height: 50px;
    object-fit: cover;
}

.name {
    line-height: 1.25;
    text-align: left;
}

.proper-name {
    font-size: 105%;
    font-weight: 700;
}

.location {
    font-size: 0.8rem;
    font-weight: 600;
}

.profile-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.profile-header img.profile-photo {
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-top: 2rem;
    max-height: 400px;
    object-fit: cover;
    width: 100%;
}

.profile-top {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.profile-logo {
    border-radius: 50%;
    flex-shrink: 0;
    height: 75px;
    margin-right: 1rem;
    object-fit: cover;
    width: 75px;
}

.profile-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.5;
}

.profile-text h1 {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    padding-bottom: 0.6rem;
    width: 100%;
}

.profile-info {
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

.profile-ranking {
    align-items: center;
    background-color: #e0f2fe;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
}

.profile-ranking-label {
    font-size: 1rem;
    font-weight: 600;
}

.profile-ranking-value {
    color: #1d4ed8;
    display: flex;
    font-size: 1.25rem;
    font-weight: bold;
    gap: 2.5rem;
    justify-content: center;
}

.profile-ranking-value>div {
    text-align: center;
}

.profile-ranking-value>div>div:first-child {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.profile-ranking-value>div>div:last-child {
    color: #1d4ed8;
    font-size: 1.5rem;
    font-weight: 800;
}

.profile-other-rankings {
    align-items: center;
    background-color: #e0f2fe;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
}

.profile-other-label {
    font-size: 1rem;
    font-weight: 600;
}

.profile-other-value {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-end;
}

.other-ranking-item {
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #374151;
    display: flex;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.other-ranking-item:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.other-ranking-item .ranking-number {
    color: #2563eb;
    font-weight: 800;
}

@media (max-width: 900px) {
    .profile-supplementary-rankings {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .profile-supplementary-value {
        justify-content: center;
    }

    .supplementary-ranking-item {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
}

.stats-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(12, 1fr);
}

.stat-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    grid-column: span 3;
    padding: 2rem 1.5rem 2rem 1.5rem;
    position: relative;
    text-align: center;
}

.stat-title {
    color: #2563eb;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.7rem;
}

.stat-value {
    color: #111827;
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.stat-source {
    color: #9ca3af;
    font-size: 0.7rem;
    margin-top: 0.5rem;
}

.flag-icon {
    font-family: 'TwemojiCountryFlags', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    font-size: 0.9rem;
    line-height: 1;
    vertical-align: middle;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.pagination-btn {
    background-color: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    max-width: 150px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.pagination-btn:disabled {
    background-color: #9ca3af;
    border-color: #9ca3af;
    color: #f3f4f6;
    cursor: not-allowed;
}

.page-numbers {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.page-number-btn {
    background-color: #ffffff;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 40px;
    padding: 0.5rem 0.75rem;
    text-align: center;
    transition: all 0.2s ease;
}

.page-number-btn:hover {
    background-color: #2563eb;
    color: white;
}

.page-number-btn.active {
    background-color: #2563eb;
    color: white;
}

.page-info {
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
}

.back-to-top-btn {
    background-color: #2563eb;
    border: none;
    border-radius: 50%;
    bottom: 2rem;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    height: 40px;
    opacity: 0;
    position: fixed;
    right: 2rem;
    transition: all 0.3s ease;
    visibility: hidden;
    width: 40px;
    z-index: 1000;
}

.back-to-top-btn:hover {
    background-color: #1d4ed8;
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-width: 400px;
    min-width: 280px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    width: calc(50% - 1rem);
}

.card:hover {
    border-color: #2563eb;
}

.card-cover {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    height: 160px;
    object-fit: cover;
    width: 100%;
}

.card-content {
    align-items: center;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
}

.card-content h2 {
    color: #1d4ed8;
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.card-type {
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.card-btn {
    background-color: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 80px;
}

.subscores-toggle-btn {
    width: 100px;
}

.paper-btn {
    justify-content: center;
    width: 180px;
}

.card-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

@media (max-width: 900px) {
    .card {
        max-width: 100%;
        width: 100%;
    }

    .card-grid {
        gap: 1rem;
    }
}

.profile-subscores {
    align-items: flex-end;
    background: #f3f6fa;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1.5rem 1rem 1.5rem 1rem;
}

.profile-subscore {
    align-items: center;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    max-width: 120px;
    min-width: 90px;
}

.profile-subscore-label {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

@media (max-width: 900px) {
    .profile-subscores-row {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem 0.5rem 0.5rem 0.5rem;
    }

    .profile-subscore {
        max-width: 100px;
        min-width: 80px;
    }

    .profile-subscore-label {
        font-size: 0.85rem;
    }
}

.subscores-panel-row {
    background: #f3f6fa;
    border-bottom: 1px solid #e5e7eb;
}

.subscores-panel {
    align-items: flex-end;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    padding: 1rem 1rem 0.5rem 2rem;
}

.subscore-bar-row.inline {
    align-items: center;
    display: flex;
    flex: 1 1 33%;
    flex-direction: row;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    max-width: 340px;
    min-width: 0;
}

.subscore-bar-row.inline .subscore-bar-track {
    height: 7px;
    margin: 0;
    max-width: 80px;
    min-width: 48px;
    width: 40%;
}

.subscore-bar-row.inline .subscore-bar-value {
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.2em;
    margin-right: 0.2em;
    text-align: right;
    width: 2.5em;
}

.subscore-bar-row.inline .subscore-bar-label {
    color: #2563eb;
    flex: 1 1 0;
    font-size: 0.8rem;
    font-weight: 600;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .subscore-bar-row.inline {
        flex: 1 1 100%;
        gap: 0.4rem;
        max-width: 100%;
    }

    .subscore-bar-row.inline .subscore-bar-track {
        max-width: 60px;
        min-width: 36px;
        width: 35%;
    }

    .subscore-bar-row.inline .subscore-bar-label {
        font-size: 0.85rem;
    }
}

.subscores-tabs-wrapper {
    width: 100%;
}

.subscores-tabs-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    margin-bottom: 0.2rem;
}

.subscores-tab-btn {
    background: #e5e7eb;
    border: none;
    border-radius: 6px 6px 0 0;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    padding: 0.3rem 1rem;
    transition: background 0.2s, color 0.2s;
}

.subscores-tab-btn.active,
.subscores-tab-btn:focus {
    background: #fff;
}

.subscores-panel.hidden {
    display: none !important;
}

.subscore-bar-stacked {
    align-items: stretch;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    margin-bottom: 0.3rem;
    max-width: 220px;
    min-width: 0;
}

.subscore-bar-stacked.empty {
    visibility: hidden;
}

.subscore-bar-label {
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subscore-bar-barrow {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 0.3rem;
}

.subscore-bar-stacked .subscore-bar-track {
    background: #e5e7eb;
    border-radius: 6px;
    flex-shrink: 0;
    height: 6px;
    margin: 0;
    width: 100px;
}

.subscore-bar-stacked .subscore-bar-fill {
    background: #2563eb;
    border-radius: 6px;
    display: block;
    height: 100%;
    transition: width 0.3s;
}

.subscore-bar-stacked .subscore-bar-value {
    color: #374151;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
    text-align: left;
    width: 2em;
}

@media (max-width: 900px) {
    .subscore-bar-stacked {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .subscore-bar-stacked .subscore-bar-track {
        max-width: 40px;
        min-width: 24px;
        width: 40px;
    }

    .subscore-bar-label {
        font-size: 0.85rem;
    }

    .subscore-bar-stacked .subscore-bar-value {
        font-size: 0.85rem;
    }
}

.profile-spider-chart-container {
    background: #f3f6fa;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    margin-bottom: 1.5rem;
    padding: 1rem;
}

.profile-spider-chart-wrapper {
    align-items: center;
    display: flex;
    grid-column: 1 / -1;
    justify-content: center;
}

#profile-spider-chart {
    max-height: 400px;
    max-width: 100%;
    width: 100%;
}

.profile-strengths {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    grid-column: 1 / -1;
}

.strength-item {
    background: #ffffff;
    border-left: 4px solid #2563eb;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex: 1;
    padding: 0.9rem;
}

.strength-item:nth-child(1) {
    border-left-color: #10b981;
}

.strength-item:nth-child(2) {
    border-left-color: #ef4444;
}

.strength-label {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.strength-value {
    color: #111827;
    font-size: 0.95rem;
    font-weight: 600;
}

@media (max-width: 900px) {
    .profile-spider-chart-container {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .profile-spider-chart-wrapper {
        grid-column: 1 / -1;
    }

    #profile-spider-chart {
        max-height: 350px;
        max-width: 100%;
    }

    .profile-strengths {
        flex-direction: column;
        gap: 0.75rem;
        grid-column: 1 / -1;
    }

    .strength-item {
        padding: 0.75rem;
    }

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

    .strength-value {
        font-size: 0.9rem;
    }
}

.title-row {
    margin-bottom: 2rem;
}

.state-desc {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 2rem;
    margin-top: -0.9rem;
}

.methodology-desc {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 3rem;
    margin-top: -0.9rem;
}

.methodology-flex {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.category-details {
    background: #f3f6fa;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    flex: 1 1 320px;
    max-width: 350px;
    min-width: 280px;
    padding: 1.5rem 2rem;
}

.category-details h2 {
    color: #2563eb;
    font-weight: 800;
}

.pie-chart-container {
    align-items: center;
    display: flex;
    flex: 1 1 400px;
    justify-content: center;
    max-width: 480px;
    min-width: 320px;
}

.pie-legend {
    display: flex;
    justify-content: center;
    margin: 2rem 0 0 0;
}

.icon-book {
    margin-right: 0.2em;
}

.paper-btn {
    align-items: center;
    display: flex;
    gap: 0.5em;
}

.map {
    padding-bottom: 0.5rem;
    padding-top: 0.5rem;
}

@media (max-width: 900px) {
    .stats-grid {
        gap: 1rem;
        grid-template-columns: 1fr !important;
    }

    .stat-card,
    .stat-card.stat-stretch {
        border-radius: 0.7rem;
        grid-column: span 1 !important;
        padding: 1rem;
    }

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

    .stat-title {
        font-size: 1rem;
    }
}

.stat-card.stat-stretch {
    grid-column: span 4;
}

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.error-number {
    font-size: 8rem;
    font-weight: 900;
    color: #1d4ed8;
    margin: 0;
    line-height: 1;
}

.error-message {
    font-size: 1.25rem;
    color: #374151;
    margin-top: 1.5rem;
    font-weight: 500;
}

.back-home {
    margin-top: 2rem;
}

.back-home a {
    display: inline-block;
    width: auto;
}

@media (max-width: 900px) {
    .error-number {
        font-size: 6rem;
    }

    .error-message {
        font-size: 1.25rem;
    }
}

.profile-label {
    display: block;
    font-size: 1.06rem;
    font-weight: 600;
    color: #1d4ed8;
}