@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=Noto+Sans+TC:wght@400;500;700&display=swap");

:root {
    --bg: #edeff3;
    --panel: #ffffff;
    --fg: #1f1f1f;
    --muted: #5f6368;
    --line: #d7dbe5;
    --brand: #5f01d1;
    --brand-dark: #4a00a7;
    --link: #3d38cf;
    --link-hover: #7a1de0;
    --font-sans: "Noto Sans TC", "Noto Sans SC", "Segoe UI", Arial, sans-serif;
    --space: clamp(1rem, 3vw, 1.8rem);
    --wrap: min(1200px, 100% - 2 * var(--space));
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--fg);
    background: linear-gradient(180deg, #efe6ff 0, #f1f3f7 180px, var(--bg) 181px);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: var(--link);
}

a:hover {
    color: var(--link-hover);
}

.wrap {
    width: var(--wrap);
    margin-inline: auto;
}

.site-header {
    background: #ffffff;
    border-bottom: 1px solid #d5dae5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-row1 {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding-block: 0.7rem;
}

.brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo {
    width: 300px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.header-search-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

.header-search-form {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    margin: 0;
}

.header-search-input {
    width: 100%;
    height: 2.2rem;
    padding: 0 0.7rem;
    border: 1px solid #c0c4cc;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.88rem;
    background: #f8f9fc;
    color: #2e2e2e;
    min-width: 0;
}

.header-search-input:focus {
    outline: none;
    background: #fff;
    border-color: #5f01d1;
}

.header-search-select {
    height: 2.2rem;
    padding: 0 0.4rem;
    border: 1px solid #c0c4cc;
    border-right: none;
    font-size: 0.85rem;
    background: #f0f1f5;
    color: #2e2e2e;
}

.header-search-btn {
    height: 2.2rem;
    width: 2.2rem;
    border: 1px solid #c0c4cc;
    border-radius: 0 4px 4px 0;
    background: #5f01d1;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
}

.header-search-btn:hover {
    background: #4a00a7;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.header-right a {
    display: inline-block;
    padding: 0.28rem 0.6rem;
    font-size: 0.82rem;
    line-height: 1;
    border-radius: 4px;
    color: #2e2e2e;
    text-decoration: none;
    border: 1px solid #c5cad6;
    background: #fff;
}

.header-right a:hover {
    background: #f0ebff;
    color: #5f01d1;
    border-color: #d5b8ff;
}

.header-right a.lang-active {
    color: #fff;
    background: #5f01d1;
    border-color: #5f01d1;
}

.header-row2 {
    border-top: 1px solid #eef0f5;
    background: #f9fafc;
}

.header-subnav {
    display: flex;
    gap: 0;
    padding-block: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

.header-subnav::-webkit-scrollbar {
    display: none;
}

.nav-close-btn {
    display: none;
}

/* ── Hamburger button ── */
.header-row2-top {
    display: none;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 5px;
    flex-shrink: 0;
    align-self: center;
    transition: background 0.15s;
}

.hamburger-btn:hover {
    background: #f0ebff;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    background: #4a5568;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.hamburger-btn[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-subnav a {
    display: inline-block;
    padding: 0.32rem 0.85rem;
    font-size: 0.88rem;
    color: #3f4659;
    text-decoration: none;
    border-radius: 4px;
    white-space: nowrap;
}

.header-subnav a:hover {
    background: #ede8ff;
    color: #5f01d1;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #c5cad6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.search-suggestions a {
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    color: #2e2e2e;
    text-decoration: none;
    border-bottom: 1px solid #f0f1f5;
}

.search-suggestions a:hover {
    background: #f6f3ff;
    color: #5f01d1;
}

.search-suggestions a:last-child {
    border-bottom: none;
}

@media (max-width: 700px) {
    .header-row1 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-search-form {
        order: 3;
        width: 100%;
        min-width: 0;
    }

    .header-search-input {
        border-right: 1px solid #c0c4cc;
        border-radius: 4px;
        flex: 1;
        min-width: 0;
    }

    .header-search-select {
        display: none;
    }

    .header-search-btn {
        border-radius: 4px;
        flex-shrink: 0;
    }

    .header-right {
        gap: 0.25rem;
    }

    .header-right a {
        padding: 0.22rem 0.45rem;
        font-size: 0.78rem;
    }

}

@media (max-width: 480px) {
    .site-logo {
        width: 200px;
        height: auto;
    }
}

.nav-main a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.lang-switch {
    display: flex;
    gap: 0.35rem;
}

.lang-switch a {
    display: inline-block;
    padding: 0.26rem 0.52rem;
    font-size: 0.78rem;
    line-height: 1;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.lang-switch a:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lang-switch a.lang-active {
    color: var(--brand-dark);
    background: #fff;
    border-color: #fff;
    font-weight: 700;
}

.main-content {
    flex: 1;
    margin-top: 1rem;
    margin-bottom: 2rem;
    padding: 1.2rem 1.35rem 2rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(31, 31, 31, 0.05);
}

.home-search-block {
    margin-bottom: 0.9rem;
    padding: 0.9rem;
    border: 1px solid #d8ddef;
    border-radius: 8px;
    background: #f8f9ff;
    overflow-x: auto;
}

.home-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    gap: 0.55rem;
}

.search-input,
.search-select,
.search-btn {
    border: 1px solid #bec6df;
    border-radius: 6px;
    font: inherit;
    height: 2.35rem;
}

.search-input,
.search-select {
    background: #fff;
    color: #2b2b2b;
    padding: 0 0.75rem;
}

.search-btn {
    border-color: #5f01d1;
    background: #5f01d1;
    color: #fff;
    font-weight: 700;
    padding: 0 1rem;
    cursor: pointer;
}

.search-btn:hover {
    background: #4a00a7;
}

.search-result-block {
    margin-top: 0.75rem;
}

.search-list {
    margin-top: 0.55rem;
}

.home-banner {
    margin-bottom: 1rem;
    border: 1px solid #ceb8ff;
    border-left: 5px solid #7a25e8;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    background: linear-gradient(90deg, #f5efff, #fbf9ff);
}

.banner-title {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #4a00a7;
}

.banner-text {
    margin: 0;
    color: #4e5564;
    font-size: 0.93rem;
}

.home-layout {
    display: grid;
    gap: 1rem;
}

.portal-shell {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) 280px;
    gap: 1rem;
    align-items: start;
}

.portal-left,
.portal-right {
    position: sticky;
    top: 0.8rem;
}

.portal-menu {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid #d5daea;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.portal-menu li + li {
    border-top: 1px solid #edf0f7;
}

.portal-menu a {
    display: block;
    padding: 0.68rem 0.8rem;
    text-decoration: none;
    color: #2e2e2e;
    font-size: 0.92rem;
}

.portal-menu a:hover {
    background: #f6f3ff;
    color: #4b2cd1;
}

.portal-search {
    margin-bottom: 0.8rem;
}

.portal-top-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.portal-tab {
    text-decoration: none;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid #d5daea;
    color: #3f4659;
    background: #fff;
    font-size: 0.86rem;
}

.portal-tab-active,
.portal-tab:hover {
    background: #5f01d1;
    color: #fff;
    border-color: #5f01d1;
}

/* ── Homepage Explore Featured (Magazine Style) ── */
.explore-featured {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.explore-featured-main {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e6e9f2;
    border-radius: 10px;
    overflow: hidden;
}

.explore-featured-img-link {
    display: block;
    overflow: hidden;
}

.explore-featured-img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #f7f8fb;
}

.explore-featured-img-placeholder {
    width: 100%;
    height: 220px;
    background: #f0f3f8;
}

.explore-featured-img-placeholder--sm {
    height: 80px;
}

.explore-featured-main-body {
    padding: 0.85rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.explore-featured-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e2538;
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

.explore-featured-title:hover {
    color: #7b04c4;
}

.explore-featured-meta {
    font-size: 0.78rem;
    color: #888;
}

.explore-featured-side {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.explore-featured-side-item {
    display: flex;
    gap: 0.6rem;
    background: #fff;
    border: 1px solid #e6e9f2;
    border-radius: 8px;
    padding: 0.6rem;
    flex: 1;
}

.explore-featured-side-img-link {
    flex-shrink: 0;
    display: block;
    overflow: hidden;
    border-radius: 6px;
}

.explore-featured-side-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    background: #f7f8fb;
}

.explore-featured-side-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.explore-featured-side-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e2538;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.explore-featured-side-title:hover {
    color: #7b04c4;
}

.explore-featured-side-meta {
    font-size: 0.75rem;
    color: #888;
}

.tier-districts-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tier-district-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.district-list-box {
    border: 1px solid #d0d7e2;
    border-top: 2px solid #1a5fb4;
    background: #fff;
}

.district-dl {
    margin: 0;
    padding: 0.3rem 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 0.4rem;
    font-size: 0.82rem;
}

.district-item {
    margin: 0;
    padding: 0.2rem 0;
}

.district-item a {
    font-size: 16px;
    color: #1a5fb4;
    text-decoration: none;
}

.district-item a:hover {
    text-decoration: underline;
    color: #0d47a1;
}

.portal-tier-card {
    min-height: 88px;
    display: flex;
    align-items: center;
}

.portal-right-card + .portal-right-card {
    margin-top: 0.8rem;
}

@media (min-width: 940px) {
    .home-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        align-items: start;
    }
}

@media (min-width: 700px) and (max-width: 939px) {
    .home-layout {
        grid-template-columns: 1fr 260px;
        align-items: start;
    }

    .home-sidebar {
        grid-template-columns: 1fr;
    }

    .view-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.home-sidebar {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: 1fr;
}

.sidebar-card {
    border: 1px solid #d5daea;
    border-radius: 8px;
    background: #fff;
}

.sidebar-title {
    margin: 0;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #434b5d;
    border-bottom: 1px solid #e8ebf3;
    background: #f8f9fc;
}

.sidebar-list {
    margin: 0;
    padding: 0.3rem 0.85rem 0.55rem;
    list-style: none;
}

.sidebar-list li {
    padding: 0.45rem 0;
    border-bottom: 1px solid #eef0f6;
    color: #545b6c;
    font-size: 0.9rem;
}

.sidebar-list li:last-child {
    border-bottom: none;
}

.sidebar-list a {
    text-decoration: none;
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 2.8vw, 1.85rem);
    font-weight: 700;
    color: #272727;
}

.school-net-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #f8e8ff 0%, #f0d4ff 100%);
    border: 1px solid #d9a3f0;
    border-radius: 25px;
    padding: 0.4rem 1rem 0.4rem 0.75rem;
    margin-bottom: 1rem;
}
.school-net-label {
    font-size: 0.85rem;
    color: #5f01d1;
    font-weight: 600;
}
.school-net-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #5f01d1;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.2s;
}
.school-net-num:hover {
    background: #3a0091;
}

.lead {
    margin: 0 0 1.25rem;
    color: #494d58;
    max-width: 46rem;
    font-size: 1rem;
    padding: 0.85rem 1rem;
    background: #f6f8ff;
    border-left: 4px solid #7a25e8;
    border-radius: 0 6px 6px 0;
}

.muted {
    color: var(--muted);
    font-size: 0.92rem;
}

.section-heading {
    margin: 0 0 0.7rem;
    color: #4f5562;
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.breadcrumb ol {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0.3rem 0.45rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: #6a7080;
}

.breadcrumb li:not(:last-child)::after {
    content: ">";
    margin-left: 0.45rem;
    color: #a8afbf;
}

.breadcrumb a {
    color: #5a47bd;
    text-decoration: none;
}

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

.tier-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.8rem;
}

@media (min-width: 700px) {
    .tier-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.tier-card {
    display: block;
    text-decoration: none;
    color: #282828;
    padding: 1rem 1.1rem;
    border: 1px solid #ccd2df;
    border-top: 4px solid #7a25e8;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f8faff);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tier-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(66, 56, 177, 0.12);
}

.tier-card-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.district-list,
.school-list {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
    border: 1px solid #d5daea;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.district-region + .district-region {
    margin-top: 1rem;
}

.district-region-title {
    margin-bottom: 0.45rem;
    color: #4a00a7;
}

/* explore.php: tab navigation - Yahoo style */
.explore-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    padding: 0;
    border: 1px solid #ccc;
    border-bottom: none;
    background: #f0f0f0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.explore-tab {
    background: #f0f0f0;
    border: none;
    border-right: 1px solid #ccc;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    transition: background 0.2s ease;
    flex: 1;
    text-align: center;
}

.explore-tab:last-child {
    border-right: none;
}

.explore-tab:hover {
    background: #e8e8e8;
}

.explore-tab.active {
    background: #fff;
    color: #7b04c4;
    border-bottom: 2px solid #fff;
    margin-bottom: -1px;
}

.explore-tab .tab-count {
    font-weight: 400;
    color: #999;
    margin-left: 4px;
}

.explore-tab.active .tab-count {
    color: #7b04c4;
}

.explore-content {
    border: 1px solid #ccc;
    background: #fff;
    padding: 1rem;
    border-radius: 0 0 8px 8px;
    animation: fadeIn 0.3s ease;
}

.explore-tab-content {
    display: flex;
    flex-direction: column;
}

.explore-tab-content[style="display:none"] {
    display: none !important;
}

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

.district-list li + li,
.school-list li + li {
    border-top: 1px solid #e6e9f2;
}

.district-list li > a,
.school-list > li > a {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    align-items: baseline;
    padding: 0.78rem 0.95rem;
    color: #2e2e2e;
    text-decoration: none;
}

/* search.php result rows: one-line title, truncate with ellipsis.
   Scoped to span so block titles (parentabc_article.php h1) wrap in full. */
span.article-title {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* explore.php: one row — title left (ellipsis), meta right */
.explore-list > li.explore-item .explore-item__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1rem;
    padding: 0.78rem 0.95rem;
}

.explore-list .explore-item__title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2e2e2e;
    text-decoration: none;
}

.explore-list .explore-item__meta {
    flex: 0 0 auto;
    max-width: 48%;
    text-align: right;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.d-count {
    flex: 0 0 auto;
    text-align: right;
    color: #697083;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    max-width: 40%;
    gap: 0.3rem;
}

.district-list li > a:hover,
.school-list > li > a:hover {
    background: #f6f3ff;
}

.district-list li > a:hover .d-name,
.school-list > li > a:hover {
    color: #4b2cd1;
}

.explore-list .explore-item:hover {
    background: #f6f3ff;
}

.explore-list .explore-item:hover .explore-item__title {
    color: #4b2cd1;
}

.school-link-inline {
    color: inherit;
    text-decoration: none;
}
.school-link-inline:hover {
    text-decoration: underline;
}

.primary-school-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border: 1px solid #d5daea;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    font-size: 0.93rem;
}

.primary-school-table th,
.primary-school-table td {
    padding: 0.62rem 0.75rem;
    border-bottom: 1px solid #e6e9f2;
    text-align: left;
    vertical-align: top;
}

.primary-school-table thead th {
    background: #f4f6fc;
    color: #4a5262;
    font-weight: 700;
}

.primary-school-table tbody tr:hover {
    background: #f8f5ff;
}

.primary-school-table tbody tr:last-child td {
    border-bottom: none;
}

.primary-school-table td a {
    text-decoration: none;
    color: #3d38cf;
}

.primary-school-table td a:hover {
    text-decoration: underline;
}

.back-link {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.back-link a {
    text-decoration: none;
    color: #5a47bd;
}

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

.detail-block {
    margin-top: 1rem;
}

.school-logo-block {
    margin: 0.8rem 0 1rem;
}

.school-logo-img {
    max-width: 140px;
    max-height: 140px;
    width: auto;
    height: auto;
    border: 1px solid #d5daea;
    border-radius: 10px;
    background: #fff;
    padding: 0.35rem;
}

.article-hero {
    margin-top: 0.8rem;
}

.article-hero-img {
    width: min(100%, 860px);
    display: block;
    margin: 0 auto;
    border: 1px solid #d5daea;
    border-radius: 10px;
    background: #fff;
    padding: 0.35rem;
}

.article-hero-caption {
    margin: 0.45rem 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}

.article-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}

.article-gallery-item {
    margin: 0;
    text-align: center;
}

.article-gallery-img {
    width: 100%;
    max-width: 220px;
    border: 1px solid #d5daea;
    border-radius: 10px;
    background: #fff;
    padding: 0.3rem;
}

.article-gallery-caption {
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.article-school-link {
    color: #3d38cf;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-school-link:hover {
    color: #7a1de0;
}

@media (min-width: 560px) {
    .article-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 860px) {
    .article-gallery {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 3rem;
}

.lightbox-overlay[hidden] {
    display: none !important;
}

.lightbox-content {
    max-width: min(1100px, 100%);
    max-height: 100%;
    text-align: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: min(78vh, 860px);
    border-radius: 8px;
    background: #111;
}

.lightbox-caption {
    margin-top: 0.55rem;
    color: #fff;
    font-size: 0.95rem;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    border: none;
    color: #fff;
    background: rgba(20, 20, 20, 0.6);
    cursor: pointer;
    border-radius: 999px;
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
    line-height: 1;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    font-size: 2rem;
    line-height: 1;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.kv {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d5daea;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    font-size: 0.94rem;
}

.kv th,
.kv td {
    text-align: left;
    vertical-align: top;
    padding: 0.64rem 0.9rem;
    border-bottom: 1px solid #e6e9f2;
}

.kv tr:last-child th,
.kv tr:last-child td {
    border-bottom: none;
}

.kv th {
    width: 11rem;
    max-width: 35%;
    color: #565d6e;
    font-weight: 600;
    background: #f7f8fb;
}

.kv a {
    color: #3d38cf;
    word-break: break-all;
}

.detail-more {
    margin-top: 1rem;
    background: #fbfbff;
    border: 1px solid #d5daea;
    border-radius: 8px;
    padding: 0.7rem 0.95rem;
}

.detail-more summary {
    cursor: pointer;
    color: #4f5562;
    font-weight: 700;
}

.detail-more .kv {
    margin-top: 0.7rem;
}

@media (max-width: 560px) {
    .home-search-form {
        grid-template-columns: 1fr;
    }

    .search-btn {
        width: 100%;
    }

    .main-content {
        padding: 1rem 0.85rem 1.5rem;
    }

    .kv th,
    .kv td {
        display: block;
        width: 100%;
        max-width: none;
    }

    .kv th {
        padding-bottom: 0.2rem;
    }

    .kv td {
        padding-top: 0;
    }

    .primary-school-table {
        font-size: 0.88rem;
    }

    .primary-school-table th,
    .primary-school-table td {
        padding: 0.52rem 0.55rem;
    }

    .portal-shell {
        grid-template-columns: 1fr;
    }

    .portal-left,
    .portal-right {
        position: static;
    }

    .explore-featured {
        grid-template-columns: 1fr;
    }

    .tier-districts-grid {
        grid-template-columns: 1fr;
    }

    /* ── Advanced search mobile ── */
    .adv-search-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.2rem;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .adv-search-tabs::-webkit-scrollbar {
        display: none;
    }

    .adv-search-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.3rem 0.75rem;
        font-size: 0.85rem;
    }

    .adv-search-form {
        padding: 0.7rem;
    }

    .adv-search-kw-row .search-input {
        width: 100%;
        display: block;
    }

    .adv-filter-row {
        flex-direction: column;
        gap: 0.55rem;
    }

    .adv-filter-group {
        min-width: 0;
        width: 100%;
    }

    .adv-filter-checkboxes {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.2rem 0.6rem;
        max-height: none;
        padding-bottom: 2px;
    }

    .adv-filter-checkboxes::-webkit-scrollbar {
        display: none;
    }

    .adv-checkbox-label {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .adv-search-actions {
        margin-top: 0.7rem;
    }

    .adv-search-actions .search-btn {
        width: 100%;
    }

    /* ── Homepage layout mobile ── */
    .home-layout {
        grid-template-columns: 1fr !important;
    }

    .home-sidebar {
        grid-template-columns: 1fr 1fr;
    }

    /* ── Browse table mobile ── */
    .primary-school-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .primary-school-table th,
    .primary-school-table td {
        white-space: nowrap;
    }

    /* ── View cards/magazine mobile ── */
    .view-cards {
        grid-template-columns: 1fr 1fr;
    }

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

    .mag-feature {
        grid-template-columns: 1fr;
    }

    .mag-feature__img {
        height: 180px;
    }

    .mag-feature__body {
        padding: 0.85rem;
    }

    .mag-item {
        flex-direction: column;
    }

    .mag-item__img {
        width: 100%;
        height: 120px;
    }
}

.site-footer {
    margin-top: auto;
    padding-block: 0.8rem 1.8rem;
}

.site-footer .muted {
    margin: 0;
    font-size: 0.79rem;
    color: #7a8091;
}

.footer-copy {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0 0 0.3rem;
    font-size: 0.82rem;
    color: #555;
}

.footer-links a {
    color: #7b04c4;
    text-decoration: none;
}

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

.footer-link-sep {
    margin: 0 0.4rem;
    color: #b6b9c4;
}

/* ── About page ── */
.about-hero {
    background: linear-gradient(135deg, #7b04c4 0%, #4f32a0 100%);
    color: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
}

.about-hero h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.about-hero .lead {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

.about-content {
    width: 100%;
    max-width: 100%;
}

.main-content > .about-content > .wrap,
.main-content > .about-hero > .wrap {
    width: 100%;
    max-width: 100%;
    padding-inline: 0;
}

.about-content h2 {
    font-size: 1.2rem;
    color: #4f5562;
    margin: 1.8rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #ede8f5;
}

.about-content h2:first-child {
    margin-top: 0;
}

.about-content p {
    margin: 0.6rem 0;
    line-height: 1.75;
    color: #3a3f4b;
}

.about-content ul {
    margin: 0.6rem 0;
    padding-left: 1.4rem;
}

.about-content li {
    margin: 0.35rem 0;
    line-height: 1.65;
    color: #3a3f4b;
}

.about-copy hr {
    margin: 1.8rem 0;
    border: 0;
    border-top: 1px solid #ede8f5;
}

.about-partner-logo {
    margin: 1rem 0 1.2rem;
}

.about-partner-logo a {
    display: inline-block;
}

.about-partner-logo img {
    display: block;
    width: 250px;
    height: 68px;
}

.about-site-list {
    margin: 0.6rem 0;
    padding-left: 1.4rem;
}

.about-site-list li {
    margin: 0.35rem 0;
    line-height: 1.65;
}

/* ── Explore view switcher ── */
.explore-viewbar {
    display: flex;
    gap: 4px;
    margin-bottom: 0.8rem;
    padding: 4px;
    background: #f0f0f0;
    border-radius: 8px;
    width: fit-content;
    margin-left: auto;
}

.view-btn {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.view-btn:hover {
    background: #e4e4e4;
    color: #333;
}

.view-btn.active {
    background: #fff;
    color: #7b04c4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ── CARD view ── */
.view-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
    padding: 0.5rem 0;
}

.article-card {
    background: #fff;
    border: 1px solid #e6e9f2;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    box-shadow: 0 4px 16px rgba(123,4,196,0.12);
    transform: translateY(-2px);
}

.article-card__img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #f7f8fb;
}

.article-card__img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0eeff;
}

.card-placeholder-icon {
    font-size: 2.5rem;
}

.article-card__body {
    padding: 0.9rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-card__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 0.4rem;
    display: block;
}

.article-card__title:hover {
    color: #7b04c4;
}

.article-card__meta {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.article-card__excerpt {
    font-size: 0.82rem;
    color: #555;
    line-height: 1.6;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── MAGAZINE view ── */
.view-magazine {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0.5rem 0;
}

.mag-feature {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    background: #fff;
    border: 1px solid #e6e9f2;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.mag-feature__img {
    display: block;
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: #f7f8fb;
}

.mag-feature__img-link {
    display: block;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.mag-feature__body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mag-feature__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    display: block;
}

.mag-feature__title:hover {
    color: #7b04c4;
}

.mag-feature__meta {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.7rem;
    line-height: 1.5;
}

.mag-feature__excerpt {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mag-item {
    display: flex;
    gap: 0.7rem;
    background: #fff;
    border: 1px solid #e6e9f2;
    border-radius: 8px;
    padding: 0.7rem;
    align-items: flex-start;
}

.mag-item__img {
    flex-shrink: 0;
    width: 90px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
    background: #f7f8fb;
    display: block;
}

.mag-item__body {
    flex: 1;
    min-width: 0;
}

.mag-item__title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    line-height: 1.4;
    display: block;
    margin-bottom: 0.25rem;
}

.mag-item__title:hover {
    color: #7b04c4;
}

.mag-item__meta {
    font-size: 0.76rem;
    color: #888;
    line-height: 1.5;
}

/* ── THUMB view ── */
.view-thumb-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.5rem 0;
}

/* ── Explore image helpers ── */
.explore-thumb-img {
    height: 160px;
    object-fit: cover;
    display: block;
}

.mag-feature__img-link {
    display: block;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.mag-item__img-link {
    display: block;
    flex-shrink: 0;
}

/* ── District Quick Links on Homepage ── */
.district-quick-section {
    padding: 1.2rem 0 0.4rem;
    border-top: 1px solid #e8e4f0;
}

.district-quick-heading {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.6rem;
}

.district-quick-region {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.district-quick-region-label {
    font-size: 0.78rem;
    color: #718096;
    min-width: 52px;
    flex-shrink: 0;
}

.district-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.3rem;
}

.district-pill {
    font-size: 0.8rem;
    color: #2b6cb0;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.05rem 0.25rem;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.district-pill:hover {
    background: #ebf4ff;
    color: #2c5282;
    text-decoration: underline;
}

/* ── Advanced search form ──────────────────────────────────────────────── */
.adv-search-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.adv-search-tab {
    padding: 0.35rem 1.1rem;
    border: 1px solid #bec6df;
    border-radius: 6px 6px 0 0;
    background: #eef1f8;
    color: #4a5568;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: -1px;
}

.adv-search-tab:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.adv-search-tab.active {
    background: #f8f9ff;
    color: #5f01d1;
    border-bottom-color: #f8f9ff;
}

.adv-search-form {
    border: 1px solid #bec6df;
    border-radius: 0 8px 8px 8px;
    background: #f8f9ff;
    padding: 0.9rem;
    overflow-x: hidden;
}

.adv-search-kw-row {
    margin-bottom: 0.75rem;
}

.adv-search-kw-row .search-input {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.adv-search-panel {
    display: none;
}

.adv-search-panel.active {
    display: block;
}

.adv-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.75rem;
}

.adv-filter-group {
    min-width: 140px;
}

.adv-filter-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.adv-filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    max-height: 120px;
    overflow-y: auto;
}

.adv-checkbox-label {
    font-size: 0.82rem;
    color: #2d3748;
    cursor: pointer;
    white-space: nowrap;
}

.adv-checkbox-label input {
    margin-right: 0.2rem;
    accent-color: #5f01d1;
}

.adv-loading-hint {
    font-size: 0.8rem;
}

.adv-search-actions {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dde3f0;
}

.adv-search-actions .search-btn {
    min-width: 120px;
}

/* ── Search results page ───────────────────────────────────────────────── */
.search-page-header {
    margin-bottom: 1.2rem;
}

.search-page-header .page-title {
    margin-bottom: 0.25rem;
}

.search-page-header .muted {
    font-size: 0.88rem;
}

.article-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
    background: #e8f5e9;
    color: #2e7d32;
    vertical-align: middle;
    margin-left: 0.4rem;
    white-space: nowrap;
}

/* ── Homepage ParentABC feature ───────────────────────────────────── */
.home-parentabc {
    margin-bottom: 0.9rem;
}

/* contained card box — mirrors adv-search-form design language */
.home-pabc-wrap {
    background: #f8f9ff;
    border: 1px solid #bec6df;
    border-radius: 0 8px 8px 8px;
    overflow: hidden;
}

/* section header */
.home-pabc-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e4e8f4;
    background: #fff;
}

.home-pabc-hdr-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.home-pabc-hdr-bar {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    background: linear-gradient(180deg, #5f01d1, #7a25e8);
    flex-shrink: 0;
}

.home-pabc-hdr-copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.home-pabc-hdr-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: #1e2538;
    line-height: 1.2;
}

.home-pabc-hdr-sub {
    margin: 0;
    font-size: 0.78rem;
    color: #888;
}

.home-pabc-hdr-more {
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a5fb4;
    text-decoration: none;
    padding: 0.25rem 0;
}

.home-pabc-hdr-more:hover {
    color: #4b2cd1;
    text-decoration: underline;
}

/* section body */
.home-pabc-body {
    padding: 0.85rem 1rem 1rem;
}

/* category pills with tier-dot */
.home-pabc-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.home-pabc-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.8rem 0.28rem 0.55rem;
    border: 1px solid #d0d7e8;
    border-radius: 999px;
    background: #fff;
    color: #434b5d;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.14s ease;
}

.home-pabc-pill:hover {
    border-color: #7a25e8;
    color: #5f01d1;
    background: #f6f2ff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(95, 1, 209, 0.1);
}

.home-pabc-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7a25e8;
    flex-shrink: 0;
}

.home-pabc-pill--kg .home-pabc-pill-dot { background: #12a594; }
.home-pabc-pill--primary .home-pabc-pill-dot { background: #1a5fb4; }
.home-pabc-pill--secondary .home-pabc-pill-dot { background: #e8842c; }
.home-pabc-pill--special .home-pabc-pill-dot { background: #d63384; }
.home-pabc-pill--parent .home-pabc-pill-dot { background: #e0245e; }
.home-pabc-pill--mainland .home-pabc-pill-dot { background: #b56a0f; }

.home-pabc-pill-label {
    flex: 1;
}

.home-pabc-pill-new {
    font-size: 0.6rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #e0245e, #c9184a);
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
}

/* featured article cards — 2×2 grid */
.home-pabc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
}

.home-pabc-card {
    position: relative;
    display: flex;
    border: 1px solid #dce0ee;
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: box-shadow 0.14s ease, transform 0.14s ease;
}

.home-pabc-card:hover {
    box-shadow: 0 5px 16px rgba(95, 1, 209, 0.13);
    transform: translateY(-2px);
    border-color: #c0bde8;
}

.home-pabc-card-bar {
    width: 4px;
    background: #7a25e8;
    flex-shrink: 0;
}

.home-pabc-card--all .home-pabc-card-bar { background: #7a25e8; }
.home-pabc-card--kg .home-pabc-card-bar { background: #12a594; }
.home-pabc-card--primary .home-pabc-card-bar { background: #1a5fb4; }
.home-pabc-card--secondary .home-pabc-card-bar { background: #e8842c; }
.home-pabc-card--special .home-pabc-card-bar { background: #d63384; }
.home-pabc-card--parent .home-pabc-card-bar { background: #e0245e; }
.home-pabc-card--mainland .home-pabc-card-bar { background: #b56a0f; }

.home-pabc-card-body {
    flex: 1 1 auto;
    padding: 0.65rem 0.8rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.home-pabc-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.home-pabc-card-cat {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 600;
    color: #5f01d1;
    background: #f1ecfb;
    border-radius: 999px;
    padding: 0.1rem 0.48rem;
}

.home-pabc-card-tier {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    color: #fff;
    border-radius: 999px;
    padding: 0.1rem 0.48rem;
    background: #7a25e8;
}

.home-pabc-card-tier--kg { background: #12a594; }
.home-pabc-card-tier--primary { background: #1a5fb4; }
.home-pabc-card-tier--secondary { background: #e8842c; }
.home-pabc-card-tier--special { background: #d63384; }
.home-pabc-card-tier--parent { background: #e0245e; }
.home-pabc-card-tier--mainland { background: #b56a0f; }

.home-pabc-card-title {
    margin: 0.05rem 0 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e2538;
    line-height: 1.4;
}

.home-pabc-card:hover .home-pabc-card-title {
    color: #5f01d1;
}

.home-pabc-card-summary {
    margin: 0;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-pabc-card-cta {
    margin-top: auto;
    padding-top: 0.3rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: #1a5fb4;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.home-pabc-card:hover .home-pabc-card-cta {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 700px) {
    .home-pabc-grid {
        grid-template-columns: 1fr;
    }

    .home-pabc-hdr {
        flex-wrap: wrap;
    }
}

/* ============================================================
   選校通 28school — AI 選校主題（Reddit 風格覆寫）
   ============================================================ */

:root {
    --bg: #dae0e6;
    --panel: #ffffff;
    --fg: #1a1a1b;
    --muted: #5f6368;
    --line: #edeff3;
    --brand: #ff4500;
    --brand-dark: #e03d00;
    --brand-light: #fff0eb;
    --link: #0079d3;
    --link-hover: #005f9e;
}

body {
    background: var(--bg);
}

a {
    color: var(--link);
}

a:hover {
    color: var(--link-hover);
}

/* ── 頂欄 ─────────────────────────────────────────────── */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #d2d8e0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-row1 {
    gap: 0.75rem 1.1rem;
    padding-block: 0.6rem;
}

.header-row1-left {
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    text-decoration: none;
    line-height: 1;
}

.brand-logo {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--brand);
}

.brand-badge {
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    background: var(--brand);
    border-radius: 6px;
    padding: 0.14rem 0.36rem;
}

.header-search-input {
    border-radius: 4px 0 0 4px;
    background: #f3f5f8;
    border-color: #cbd2dd;
}

.header-search-input:focus {
    background: #fff;
    border-color: var(--brand);
}

.header-search-btn {
    height: 2.2rem;
    width: auto;
    flex-shrink: 0;
    padding: 0 0.95rem;
    border: 1px solid var(--brand);
    border-left: none;
    border-radius: 0 4px 4px 0;
    background: var(--brand);
    color: #fff;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.header-search-btn:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.header-right a {
    display: inline-block;
    min-width: 2.1rem;
    text-align: center;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: 0.82rem;
    color: #5f6368;
    text-decoration: none;
}

.header-right a:hover {
    background: #f2f3f5;
    color: var(--link);
}

.header-right .lang-active {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 800;
}

.header-row2 {
    margin-top: 0;
}

.header-subnav {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    overflow-x: auto;
    padding-block: 0.15rem 0.55rem;
}

.header-subnav a {
    display: inline-block;
    padding: 0.34rem 0.7rem;
    border-radius: 999px;
    color: #44484d;
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.header-subnav a:hover {
    background: #f0f1f3;
    color: var(--link);
}

.header-subnav .nav-active {
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

.header-subnav .nav-active:hover {
    background: var(--brand-dark);
    color: #fff;
}

/* ── AI Hero（首頁 + AI 頁頭）─────────────────────────── */
.ai-hero {
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ff4500 0%, #ff6a00 45%, #ffb100 100%);
    border-radius: 10px;
    padding: 1.4rem 1.5rem;
    color: #fff;
    box-shadow: 0 8px 24px rgba(255, 69, 0, 0.28);
}

.ai-hero-title {
    margin: 0 0 0.4rem;
    font-size: clamp(1.4rem, 3.4vw, 2rem);
    font-weight: 800;
    line-height: 1.25;
}

.ai-hero-sub {
    margin: 0 0 1.1rem;
    font-size: 0.96rem;
    opacity: 0.94;
}

.ai-hero-inner {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.ai-hero-text {
    flex: 1 1 380px;
}

.ai-hero-feats {
    flex: 1 1 380px;
    display: grid;
    gap: 0.7rem;
}

.ai-hero-feat {
    display: grid;
    grid-template-columns: 7.2rem 1fr;
    gap: 0.6rem;
    align-items: baseline;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.84rem;
}

.ai-hero-feat strong {
    font-weight: 800;
}

.ai-hero-feat span {
    opacity: 0.92;
}

.ai-hero-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.ai-hero-cta {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.92rem;
    text-decoration: none;
    background: #fff;
    color: var(--brand);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.ai-hero-cta:hover {
    background: #ffe9d8;
    color: var(--brand-dark);
}

.ai-hero-cta--ghost {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.ai-hero-cta--ghost:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
}

/* ── 首頁學段卡 ─────────────────────────────────────── */
.tier-cards {
    margin: 0 0 1rem;
}

.tier-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid #e4e7ec;
    border-top: 4px solid var(--brand);
    border-radius: 10px;
    background: #fff;
    color: #1a1a1b;
}

.tier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.09);
    border-top-color: var(--brand-dark);
    color: #1a1a1b;
}

.tier-card-emoji {
    font-size: 1.6rem;
    line-height: 1;
}

.tier-card-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: inherit;
}

.tier-card-sub {
    font-size: 0.82rem;
    color: var(--muted);
}

.tier-card-go {
    color: var(--link);
    font-weight: 700;
}

/* ── 首頁主版面 ─────────────────────────────────────── */
.home-layout {
    display: grid;
    gap: 1rem;
}

@media (min-width: 860px) {
    .home-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        align-items: start;
    }
}

.home-feed {
    min-width: 0;
}

.home-side {
    display: grid;
    gap: 0.9rem;
}

.feed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
}

.feed-head .section-heading {
    margin: 0;
    color: #44484d;
}

.feed-more {
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--link);
}

.feed-more:hover {
    color: var(--link-hover);
}

.post-feed {
    display: grid;
    gap: 0.55rem;
}

.post-card {
    display: flex;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 0.6rem;
    transition: box-shadow 0.12s ease;
}

.post-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.post-thumb {
    flex-shrink: 0;
    width: 104px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f5f8;
    display: block;
}

.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-thumb-ph {
    display: block;
    width: 100%;
    height: 100%;
}

@media (max-width: 560px) {
    .post-thumb {
        width: 82px;
        height: 60px;
    }
}

.post-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    justify-content: center;
}

.post-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.4;
}

.post-title a {
    color: #1a1a1b;
    text-decoration: none;
}

.post-title a:hover {
    color: var(--link);
}

.post-meta {
    font-size: 0.76rem;
    color: var(--muted);
}

/* 區域快速連結 */
.feed-head--districts {
    margin-top: 1.2rem;
}

.tier-districts-compact {
    display: grid;
    gap: 0.6rem;
}

@media (min-width: 700px) {
    .tier-districts-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.8rem;
    }
}

.tier-district-compact {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
}

.tier-district-compact-title {
    display: block;
    font-weight: 800;
    font-size: 0.95rem;
    color: #1a1a1b;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.tier-district-compact-link {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.5rem;
    font-size: 0.8rem;
}

.tier-district-compact-link a {
    color: var(--link);
    text-decoration: none;
}

.tier-district-compact-link a:hover {
    text-decoration: underline;
}

/* ── 側欄 ───────────────────────────────────────────── */
.side-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 0.9rem 1rem;
}

.side-card-title {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #44484d;
}

.side-card-sub {
    margin: 0 0 0.7rem;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
}

.side-card-btn {
    display: block;
    text-align: center;
    padding: 0.5rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    font-size: 0.86rem;
    text-decoration: none;
}

.side-card-btn:hover {
    background: var(--brand-dark);
    color: #fff;
}

.side-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.84rem;
    color: #4a4f57;
    line-height: 1.7;
}

.side-list--link a {
    text-decoration: none;
    color: var(--link);
}

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

.side-pabc-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.2rem;
}

.side-pabc-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.34rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: #2f3339;
    font-size: 0.86rem;
}

.side-pabc-item a:hover {
    background: #f5f6f8;
}

.side-pabc-label {
    font-weight: 500;
}

.side-pabc-new {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--brand);
    border: 1px solid var(--brand);
    border-radius: 999px;
    padding: 0 0.35rem;
}

/* ── AI 流程表單 ────────────────────────────────────── */
.ai-steps {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.9rem 0;
}

.ai-step {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.36rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e4e7ec;
    font-size: 0.8rem;
    color: #6a7080;
}

.ai-step--on {
    border-color: var(--brand);
}

.ai-step--current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 800;
}

.ai-step-num {
    font-weight: 800;
}

.ai-error {
    background: #ffe9e4;
    border: 1px solid #ffb3a0;
    color: #b3261e;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.ai-form {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 1.2rem 1.3rem;
    display: grid;
    gap: 1rem;
}

.ai-field {
    display: grid;
    gap: 0.4rem;
}

.ai-field-label {
    font-size: 0.84rem;
    font-weight: 800;
    color: #2f3339;
}

.ai-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-pill {
    position: relative;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: 1px solid #cfd4dc;
    background: #fff;
    color: #44484d;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.ai-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-pill:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.ai-pill:has(input:checked) {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 800;
}

.ai-grid2 {
    display: grid;
    gap: 1rem;
}

@media (min-width: 700px) {
    .ai-grid2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ai-select,
.ai-text {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.7rem;
    border: 1px solid #cbd2dd;
    border-radius: 8px;
    font-size: 0.92rem;
    color: #2f3339;
    background: #fff;
}

.ai-select:focus,
.ai-text:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.14);
}

.ai-submit {
    display: inline-block;
    justify-self: start;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    border: none;
    background: var(--brand);
    color: #fff;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

.ai-submit:hover {
    background: var(--brand-dark);
    color: #fff;
}

.ai-submit--ghost {
    background: #fff;
    color: var(--brand);
    border: 1px solid var(--brand);
}

.ai-submit--ghost:hover {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.ai-submit--link {
    background: transparent;
    color: var(--link);
    border: none;
    padding-inline: 0;
}

.ai-submit--link:hover {
    color: var(--link-hover);
    background: transparent;
}

/* ── AI 結果（step2）────────────────────────────────── */
.ai-count {
    margin: 0.2rem 0 0.4rem;
    font-size: 0.92rem;
    font-weight: 700;
}

.ai-hint {
    margin: 0 0 0.4rem;
    font-size: 0.82rem;
}

.ai-none {
    padding: 1.2rem 1.3rem;
    background: #fff;
    border: 1px dashed #c9cfd9;
    border-radius: 10px;
    color: #5f6368;
}

.ai-match-list {
    display: grid;
    gap: 0.6rem;
}

.ai-match-card {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    transition: border-color 0.12s ease;
}

.ai-match-card:has(input:checked) {
    border-color: var(--brand);
    background: #fffaf7;
}

.ai-match-check {
    display: flex;
    align-items: center;
}

.ai-match-check input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--brand);
}

.ai-match-logo {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 1px solid #e4e7ec;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-match-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ai-match-no-logo {
    font-size: 0.62rem;
    color: #a2a7b0;
    text-align: center;
    padding: 0.2rem;
}

.ai-match-body {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 0.25rem;
}

.ai-match-name {
    font-size: 0.98rem;
    font-weight: 800;
    color: #1a1a1b;
    text-decoration: none;
    line-height: 1.35;
}

.ai-match-name:hover {
    color: var(--link);
}

.ai-match-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

.ai-reasons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.ai-chip {
    display: inline-block;
    padding: 0.16rem 0.5rem;
    border-radius: 999px;
    background: #f0f2f5;
    color: #555b63;
    font-size: 0.72rem;
}

.ai-chip--ok {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.ai-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.4rem;
}

.ai-actions-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #000;
    white-space: nowrap;
}

/* ── AI 報告（step3）────────────────────────────────── */
.ai-result-for {
    margin: 0.3rem 0 0.8rem;
    padding: 0.7rem 0.9rem;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #44484d;
}

.ai-auto-note {
    margin: 0 0 0.8rem;
    font-size: 0.84rem;
    color: var(--brand);
    font-weight: 700;
}

.ai-school-block {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 1.2rem 1.3rem;
    margin-bottom: 1rem;
}

.ai-school-head {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.ai-school-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fff;
    padding: 0.2rem;
}

.ai-school-head-text {
    flex: 1;
    min-width: 0;
}

.ai-school-name {
    margin: 0 0 0.2rem;
    font-size: 1.25rem;
    font-weight: 800;
}

.ai-school-meta {
    font-size: 0.82rem;
    color: var(--muted);
}

.ai-view-profile {
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--link);
    white-space: nowrap;
}

.ai-sec-title {
    margin: 1.1rem 0 0.5rem;
    font-size: 0.88rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #44484d;
    border-bottom: 2px solid var(--brand-light);
    padding-bottom: 0.3rem;
}

.ai-sec-title:first-child {
    margin-top: 0;
}

.ai-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
    font-size: 0.88rem;
}

.ai-facts dt {
    font-weight: 700;
    color: #555b63;
}

.ai-facts dd {
    margin: 0;
    word-break: break-word;
}

.ai-article {
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.6rem;
    background: #fdfefe;
    border-left: 4px solid var(--brand);
}

.ai-article-title {
    font-weight: 800;
    font-size: 0.9rem;
    color: #1a1a1b;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.ai-article-title:hover {
    color: var(--link);
}

.ai-article-excerpt {
    margin: 0;
    font-size: 0.84rem;
    color: #4a4f57;
    line-height: 1.6;
}

/* 比較表 */
.ai-compare-wrap {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 1.2rem 1.3rem;
    margin-bottom: 1rem;
}

.ai-compare-title {
    margin: 0 0 0.7rem;
    font-size: 1rem;
    font-weight: 800;
}

.ai-table-scroll {
    overflow-x: auto;
}

.ai-compare {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.ai-compare th,
.ai-compare td {
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid #edeff3;
    text-align: left;
    vertical-align: top;
}

.ai-compare thead th {
    font-weight: 800;
    background: #f7f8fa;
}

.ai-compare tbody th {
    font-weight: 700;
    color: #555b63;
    white-space: nowrap;
    background: #fafbfc;
}

.ai-note {
    background: #fff7e6;
    border: 1px solid #ffe1a1;
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
}

.ai-note .ai-sec-title {
    border-bottom-color: transparent;
    margin-top: 0;
    color: #8a5a00;
}

.ai-note p {
    margin: 0;
    font-size: 0.88rem;
    color: #6b4d11;
    line-height: 1.6;
}

.ai-disclaimer {
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.6;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin: 0 0 1rem;
}

/* ── 中性化舊有紫色主題殘留 ───────────────────────── */
.lead {
    background: #f6f7f8;
    border-left-color: var(--brand);
}

.district-list,
.school-list {
    border-color: #e4e7ec;
}

.district-region-title {
    color: #44484d;
}

.district-list li > a:hover,
.school-list > li > a:hover {
    background: #f6f7f8;
}

.district-list li > a:hover .d-name {
    color: var(--link);
}

.back-link a {
    color: var(--link);
}

.school-link-inline {
    color: var(--link);
}

/* ── 頁首（Reddit feed 頭）────────────────────────── */
.feed-head .page-title {
    margin: 0;
}

/* 首頁區域列旁的 AI 連結 */
.dist-link-row {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

a.dist-ai-link,
.tier-district-compact-link a.dist-ai-link,
.district-list li > a.dist-ai-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    padding: 0.08rem 0.45rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: background 0.12s ease;
}

a.dist-ai-link:hover,
.tier-district-compact-link a.dist-ai-link:hover,
.district-list li > a.dist-ai-link:hover {
    background: var(--brand-dark);
    color: #fff;
    text-decoration: none;
}

/* 區域瀏覽頁的 AI 分析 CTA */
.ai-analysis-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.4rem 0 1.1rem;
    padding: 0.65rem 1rem;
    background: #fff;
    border: 1px solid var(--brand);
    border-radius: 10px;
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.ai-analysis-cta:hover {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.ai-analysis-cta-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 0.8rem;
}

/* 卡片內的摘要與次資訊 */
.post-excerpt {
    margin: 0;
    font-size: 0.84rem;
    color: #4a4f57;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-sub {
    font-size: 0.76rem;
    color: var(--muted);
}

.net-link {
    color: var(--link);
    text-decoration: none;
}

.net-link:hover {
    text-decoration: underline;
}

/* 探校稿徽章 */
.badge-article {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-size: 0.66rem;
    font-weight: 800;
    vertical-align: 0.12em;
    white-space: nowrap;
}

/* 書籍封面列的標誌占位 */
.post-thumb-ph--logo {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: #fff;
}

/* ── 學層書籤（explore / parentabc 共用）─────────── */
.tabs-pill {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0.6rem 0 1rem;
}

.tabs-pill-tab {
    display: inline-block;
    padding: 0.42rem 1.05rem;
    border-radius: 999px;
    border: 1px solid #cfd4dc;
    background: #fff;
    color: #44484d;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.tabs-pill-tab:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.tabs-pill-tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.parentabc-tier-tabs {
    margin-bottom: 1rem;
}

/* ── 選校學堂：左側分類＋文章列表 ──────────────────── */
.parentabc-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 1.6rem;
    align-items: start;
    margin-top: 0.4rem;
}

.parentabc-side {
    position: sticky;
    top: 1rem;
}

.parentabc-side-title {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7a7f87;
}

.parentabc-side-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.parentabc-side-list a {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
    color: #454a52;
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 4px;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.parentabc-side-list a:hover {
    background: #f2f5f9;
    border-left-color: var(--brand);
    color: var(--brand);
}

.parentabc-section {
    margin-bottom: 1.5rem;
    scroll-margin-top: 1rem;
}

.parentabc-cat-head {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #2a2d31;
    border-bottom: 2px solid #eef0f3;
    padding-bottom: 0.35rem;
}

.parentabc-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: #8a8f96;
    margin-left: 0.45rem;
}

.parentabc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.parentabc-item a {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #eef1f5;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
}

.parentabc-item a:hover {
    background: #f6f9fc;
}

.parentabc-item-idx {
    flex: 0 0 1.8em;
    text-align: right;
    font-size: 0.78rem;
    color: #b0b5bc;
    font-variant-numeric: tabular-nums;
    padding-top: 0.15rem;
}

.parentabc-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.parentabc-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1b;
    line-height: 1.4;
}

.parentabc-item a:hover .parentabc-item-title {
    color: var(--link);
}

.parentabc-item-summary {
    font-size: 0.82rem;
    color: #646a72;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parentabc-item-arrow {
    flex: 0 0 auto;
    color: var(--brand);
    font-size: 0.85rem;
    padding-top: 0.15rem;
}

@media (max-width: 820px) {
    .parentabc-layout {
        grid-template-columns: 1fr;
    }
    .parentabc-side {
        position: static;
    }
    .parentabc-side-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    .parentabc-side-list a {
        border-left: none;
        border: 1px solid #e4e7ec;
        border-radius: 999px;
    }
}

@media (max-width: 620px) {
    .parentabc-item-summary {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

/* ── 探索／學校列表進場間距 ──────────────────────── */
.explore-feed {
    margin-top: 0.2rem;
}

.school-post-feed {
    margin-top: 0.2rem;
}

/* ── AI 報告文字顏色加固（避免在任何容器下變白）────── */
.ai-school-name,
.ai-school-name a {
    color: #1a1a1b;
}

.ai-facts dt {
    color: #555b63;
}

.ai-facts dd {
    color: #272727;
}

/* ── 學校資料／搜尋／探校文章頁（Reddit 風格）────────── */
.home-search-block {
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.home-search-block .section-heading {
    color: #44484d;
}

.search-input,
.search-select {
    border-color: #e4e7ec;
}

.search-btn {
    background: var(--brand);
    border-color: var(--brand);
    border-radius: 999px;
}

.search-btn:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.school-net-badge {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.school-net-label {
    color: var(--muted);
}

.school-net-num {
    background: var(--brand);
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
}

.school-net-num:hover {
    background: var(--brand-dark);
}

.kv {
    border: 1px solid #e4e7ec;
    border-radius: 10px;
}

.kv th,
.kv td {
    border-bottom-color: #edeff3;
}

.kv th {
    color: #55585f;
    background: #f6f7f8;
}

.kv a {
    color: var(--link);
}

.kv a:hover {
    color: var(--link-hover);
}

.detail-more {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
}

.detail-more summary {
    color: #44484d;
}

.school-list > li > a:hover {
    color: var(--link);
}

.article-school-link {
    color: var(--link);
}

.article-school-link:hover {
    color: var(--link-hover);
}

.breadcrumb a {
    color: var(--link);
}

.breadcrumb a:hover {
    color: var(--link-hover);
}

.school-logo-img,
.article-hero-img,
.article-gallery-img {
    border-color: #e4e7ec;
}

/* ── AI 模式選擇器（Step 2）─────────────────────────── */
.ai-mode-selector {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.8rem 0;
    flex-wrap: wrap;
}

.ai-mode-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #44484d;
    white-space: nowrap;
}

.ai-mode-opt {
    cursor: pointer;
}

.ai-mode-opt input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ai-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid #cfd4dc;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #6f7680;
    background: #fff;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    white-space: nowrap;
    cursor: pointer;
}

.ai-mode-opt input:checked + .ai-mode-pill {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* 真 AI pill 未選時稍微不同色，但已選後兩款外觀一致 */
.ai-mode-pill--real {
    color: #a05020;
    border-color: #e0a070;
}

.ai-mode-opt input:checked + .ai-mode-pill--real {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ── 揀選模式 Pills（Step 2 底部）─────────────────── */
.ai-pick-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.8rem 0;
    flex-wrap: wrap;
}

.ai-pick-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #44484d;
    white-space: nowrap;
}

.ai-pick-opt {
    cursor: pointer;
}

.ai-pick-opt input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ai-pick-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid #cfd4dc;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #6f7680;
    background: #fff;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    white-space: nowrap;
    cursor: pointer;
}

.ai-pick-opt input:checked + .ai-pick-pill {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ── 真 AI 分析報告（Step 3）─────────────────────────── */
.ai-real-block {
    background: linear-gradient(135deg, #fffcf8, #fff9f4);
    border: 1.5px solid #ffb380;
    border-radius: 12px;
    padding: 1.5rem 1.6rem;
    margin-bottom: 1.8rem;
    box-shadow: 0 2px 12px rgba(255, 100, 30, 0.08);
}

.ai-real-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff8c40, #ff6b20);
    border: none;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 1.1rem;
    letter-spacing: 0.03em;
}

.ai-real-content {
    font-size: 0.95rem;
    line-height: 1.9;
    color: #2a2a2a;
}

.ai-real-content[hidden] {
    display: none;
}

.ai-real-content h2 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #cc4400;
    margin: 1.2rem 0 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1.5px solid #ffd9b3;
}

.ai-real-content h2:first-child {
    margin-top: 0;
}

.ai-real-content h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #994400;
    margin: 0.9rem 0 0.35rem;
}

.ai-real-content p {
    margin: 0.35rem 0;
}

.ai-real-content ul {
    margin: 0.4rem 0;
    padding-left: 1.4rem;
}

.ai-real-content li {
    margin: 0.25rem 0;
}

.ai-real-content strong {
    color: #cc4400;
    font-weight: 700;
}

.ai-real-content em {
    color: #666;
    font-style: italic;
}

/* ── 手機版導航：漢堡選單（確保在桌面 CSS 之後）───────── */
@media (max-width: 700px) {
    .header-row2-top {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-block: 0.4rem;
        width: 100%;
    }

    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-row2 {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding-inline: 0;
        max-width: none;
    }

    .header-subnav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
    }

    .header-subnav.open {
        display: flex;
    }

    .nav-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 199;
        background: rgba(0,0,0,0.3);
    }

    .header-subnav.open ~ .nav-backdrop {
        display: block;
    }

    .nav-close-btn {
        display: none;
        position: fixed;
        top: 0.5rem;
        right: 0.5rem;
        width: 2.2rem;
        height: 2.2rem;
        border: none;
        border-radius: 50%;
        background: #f0f0f5;
        color: #444;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        z-index: 201;
    }

    .header-subnav.open ~ .nav-close-btn {
        display: flex;
    }

    .header-subnav a {
        display: block;
        padding: 0.75rem 1.1rem;
        border-bottom: 1px solid #f0f0f5;
        font-size: 0.95rem;
        color: #2e2e2e;
        white-space: nowrap;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .header-subnav a:hover {
        background: #f6f3ff;
        color: #5f01d1;
    }
}

/* ── 真 AI 分析：等候動畫 ─────────────────────────── */
.ai-real-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 3rem 1rem;
}

.ai-real-loading .ld {
    font-size: 3rem;
    color: #5f01d1;
}

.ai-real-loading .ld::after {
    background: currentColor;
}

.ai-real-loading-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #5f01d1;
    letter-spacing: 0.02em;
}
