/* ============================================
   HappySchool — YouTube-style theme (light + dark)
   ============================================ */

:root {
    /* Light theme (default) */
    --bg-page:        #f9f9f9;
    --bg-surface:     #ffffff;
    --bg-surface-2:   #f2f2f2;
    --bg-elevated:    #ffffff;
    --bg-hover:       rgba(0, 0, 0, 0.05);
    --bg-chip:        rgba(0, 0, 0, 0.05);
    --bg-chip-hover:  rgba(0, 0, 0, 0.10);
    --text-primary:   #0f0f0f;
    --text-secondary: #606060;
    --text-muted:     #909090;
    --border:         #e5e5e5;
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.08);
    --accent:         #ff5a3c;
    --accent-hover:   #ff7256;
    --tag-light_pressure:  #2a9d8f;
    --tag-play_learning:   #e07a5f;
    --tag-experiential:    #3d7ea6;
    --tag-inquiry:         #6a4c93;
    --tag-outdoor:         #2f9e44;
    --tag-arts:            #d64550;
    --tag-eca:             #b36b39;
    --tag-alternative:     #7d6608;
    --tag-positive_edu:    #c2185b;
    --tag-wellbeing:       #00897b;
    --tag-facilities:      #7b1fa2;
    --tag-staff_ratio:     #0277bd;
    --header-h:       56px;
    --sidebar-w:      240px;
    --sidebar-w-mini: 72px;
    --content-max-w:  1600px;
}

[data-theme="dark"] {
    --bg-page:        #0f0f0f;
    --bg-surface:     #181818;
    --bg-surface-2:   #272727;
    --bg-elevated:    #1f1f1f;
    --bg-hover:       rgba(255, 255, 255, 0.10);
    --bg-chip:        rgba(255, 255, 255, 0.10);
    --bg-chip-hover:  rgba(255, 255, 255, 0.20);
    --text-primary:   #f1f1f1;
    --text-secondary: #aaaaaa;
    --text-muted:     #717171;
    --border:         #303030;
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei",
                 "Noto Sans TC", Roboto, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s, color 0.2s;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

button {
    font-family: inherit;
    cursor: pointer;
    border: 0;
    background: transparent;
    color: inherit;
}

img { max-width: 100%; display: block; }

/* ============================================
   HEADER (YouTube-style top bar)
   ============================================ */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.app-header__start {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 200px;
}

.app-header__center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 720px;
    margin: 0 auto;
}

.app-header__end {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: flex-end;
}

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: background 0.15s;
    font-size: 20px;
}
.icon-btn:hover { background: var(--bg-hover); }

.brand {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}
.brand__num {
    background: var(--accent);
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
}
.brand__name { color: var(--text-primary); }
.brand img {
    display: block;
    height: auto;
    max-width: 170px;
}
.brand__name em {
    color: var(--accent);
    font-style: normal;
    font-weight: 700;
}

/* Search */
.search {
    display: flex;
    width: 100%;
    max-width: 600px;
    border: 1px solid var(--border);
    border-radius: 40px;
    overflow: hidden;
    background: var(--bg-surface-2);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within {
    border-color: #1c62b9;
    box-shadow: 0 0 0 1px #1c62b9 inset;
}
.search input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0 16px;
    height: 40px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}
.search__btn {
    width: 64px;
    background: var(--bg-chip);
    color: var(--text-primary);
    border-left: 1px solid var(--border);
    font-size: 18px;
    transition: background 0.15s;
}
.search__btn:hover { background: var(--bg-chip-hover); }

.theme-toggle {
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 18px;
}
.theme-toggle:hover { background: var(--bg-hover); }

/* ============================================
   LAYOUT
   ============================================ */
.app-body {
    display: flex;
    padding-top: var(--header-h);
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px 0;
    transition: transform 0.2s;
    z-index: 90;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar__section {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar__section:last-child { border-bottom: 0; }

.sidebar__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 4px;
    margin: 0;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 12px;
    height: 40px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: background 0.15s;
    position: relative;
}
.sidebar__link:hover { background: var(--bg-hover); }
.sidebar__link.is-active {
    background: var(--bg-chip);
    font-weight: 600;
}
.sidebar__link.is-active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.sidebar__icon { font-size: 20px; width: 24px; text-align: center; }
.sidebar__count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-chip);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Mini sidebar (collapsed) */
.app-body.is-sidebar-mini .sidebar {
    width: var(--sidebar-w-mini);
}
.app-body.is-sidebar-mini .sidebar__link span:not(.sidebar__icon) { display: none; }
.app-body.is-sidebar-mini .sidebar__count { display: none; }
.app-body.is-sidebar-mini .sidebar__title { display: none; }
.app-body.is-sidebar-mini .main { margin-left: var(--sidebar-w-mini); }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 24px 24px 80px;
    max-width: 100%;
    transition: margin-left 0.2s;
}

.main__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.main__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}
.main__subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 4px 0 0;
}

/* ============================================
   FILTER CHIPS (YouTube-style)
   ============================================ */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.chip {
    padding: 8px 14px;
    background: var(--bg-chip);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
    white-space: nowrap;
}
.chip:hover { background: var(--bg-chip-hover); }
.chip.is-active {
    background: var(--text-primary);
    color: var(--bg-page);
}
.chip__count {
    margin-left: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}
.chip.is-active .chip__count { color: var(--bg-chip); }

/* Tag chips (with colors) */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-chip);
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.tag-chip:hover { background: var(--bg-chip-hover); }
.tag-chip--active { color: #fff; }
.tag-chip--active.tag-light_pressure  { background: var(--tag-light_pressure); }
.tag-chip--active.tag-play_learning   { background: var(--tag-play_learning); }
.tag-chip--active.tag-experiential    { background: var(--tag-experiential); }
.tag-chip--active.tag-inquiry         { background: var(--tag-inquiry); }
.tag-chip--active.tag-outdoor         { background: var(--tag-outdoor); }
.tag-chip--active.tag-arts            { background: var(--tag-arts); }
.tag-chip--active.tag-eca             { background: var(--tag-eca); }
.tag-chip--active.tag-alternative     { background: var(--tag-alternative); }
.tag-chip--active.tag-positive_edu    { background: var(--tag-positive_edu); }
.tag-chip--active.tag-wellbeing       { background: var(--tag-wellbeing); }
.tag-chip--active.tag-facilities      { background: var(--tag-facilities); }
.tag-chip--active.tag-staff_ratio     { background: var(--tag-staff_ratio); }

/* ============================================
   HOME: GOODSCHOOL ARTICLE DIRECTORY
   ============================================ */
.home-gs__cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.home-gs__col {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
}
.home-gs__col-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text-primary);
}
.home-gs__list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}
.home-gs__list li {
    margin-bottom: 8px;
}
.home-gs__list a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.45;
    display: block;
}
.home-gs__list a:hover {
    color: var(--accent);
    text-decoration: underline;
}
.home-gs__title { color: inherit; }
.home-gs__school {
    color: var(--text-secondary);
    font-size: 13px;
}
.home-gs__empty {
    color: var(--text-secondary);
    font-size: 14px;
    flex: 1;
}
.home-gs__more {
    display: inline-block;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}
.home-gs__more:hover { text-decoration: underline; }

/* ============================================
   SCHOOL CARD GRID (YouTube-style)
   ============================================ */
.school-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px 16px;
}
@media (min-width: 1200px) {
    .school-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
}

.school-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.15s;
}
.school-card:hover .school-card__thumb { border-radius: 0; }
.school-card:hover .school-card__title { color: var(--accent); }

.school-card__thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-surface-2);
    border-radius: 12px;
    overflow: hidden;
    transition: border-radius 0.15s;
}
.school-card__thumb {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: #fff;
    font-weight: 700;
    transition: border-radius 0.15s;
    background: linear-gradient(135deg, var(--accent), #ffaa8c);
}
.school-card__thumb--kg        { background: linear-gradient(135deg, #f4a261, #e76f51); }
.school-card__thumb--primary   { background: linear-gradient(135deg, #2a9d8f, #264653); }
.school-card__thumb--secondary { background: linear-gradient(135deg, #8338ec, #3a86ff); }

/* 23:33 — GS article photo overlay (when school has Goodschool articles) */
.school-card__thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* 外框：白邊 + 陰影，看起來像證件照更有質感 */
    border: 10px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}
/* 依 tier 變色邊框，方便分辨幼稚園/小學/中學 */
.school-card__thumb--kg .school-card__thumb-img       { border-color: #f4a261; }
.school-card__thumb--primary .school-card__thumb-img  { border-color: #2a9d8f; }
.school-card__thumb--secondary .school-card__thumb-img { border-color: #3a86ff; }
.school-card__thumb-emoji {
    position: relative;
    z-index: 0;
}

.school-card__duration {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.school-card__bookmark {
    position: absolute;
    top: 8px; right: 8px;
    width: 36px; height: 36px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    backdrop-filter: blur(4px);
}
.school-card:hover .school-card__bookmark,
.school-card__bookmark.is-on { opacity: 1; }
.school-card__bookmark.is-on { background: var(--accent); }
.school-card__bookmark:hover { transform: scale(1.1); }

/* L-1: Goodschool 徽章 — 有 GS 文章的學校 */
.school-card__gs-badge {
    position: absolute;
    bottom: 8px; left: 8px;
    background: #ff6b1a;
    color: #fff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    z-index: 2;
}
[data-theme="dark"] .school-card__gs-badge {
    background: #ff8c4a;
}
.school-card:hover .school-card__gs-badge {
    background: #e85a0e;
}

.school-card__body {
    display: flex;
    gap: 12px;
    padding: 12px 0 0;
}
.school-card__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    color: var(--text-primary);
}
.school-card__info {
    flex: 1;
    min-width: 0;
}
.school-card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 4px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.school-card__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}
.school-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.school-card__tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
}
.school-card__tag--more { background: var(--bg-chip); color: var(--text-secondary); }
.school-card__tag.tag-light_pressure  { background: var(--tag-light_pressure); }
.school-card__tag.tag-play_learning   { background: var(--tag-play_learning); }
.school-card__tag.tag-experiential    { background: var(--tag-experiential); }
.school-card__tag.tag-inquiry         { background: var(--tag-inquiry); }
.school-card__tag.tag-outdoor         { background: var(--tag-outdoor); }
.school-card__tag.tag-arts            { background: var(--tag-arts); }
.school-card__tag.tag-eca             { background: var(--tag-eca); }
.school-card__tag.tag-alternative     { background: var(--tag-alternative); }
.school-card__tag.tag-positive_edu    { background: var(--tag-positive_edu); }
.school-card__tag.tag-wellbeing       { background: var(--tag-wellbeing); }
.school-card__tag.tag-facilities      { background: var(--tag-facilities); }
.school-card__tag.tag-staff_ratio     { background: var(--tag-staff_ratio); }

/* ============================================
   SCHOOL DETAIL (YouTube watch-page)
   ============================================ */
.watch {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    max-width: 1500px;
    margin: 0 auto;
}
@media (max-width: 1024px) {
    .watch { grid-template-columns: 1fr; }
}

.watch__primary { min-width: 0; }

.watch__hero {
    aspect-ratio: 21 / 9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(135deg, var(--accent), #ffaa8c);
}
.watch__hero--kg        { background: linear-gradient(135deg, #f4a261, #e76f51); }
.watch__hero--primary   { background: linear-gradient(135deg, #2a9d8f, #264653); }
.watch__hero--secondary { background: linear-gradient(135deg, #8338ec, #3a86ff); }
.watch__hero--no-photo  { grid-template-columns: 1fr; }
.watch__hero-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 32px;
    color: #fff;
    background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, transparent 60%);
    min-width: 0;
}
.watch__hero-tier {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    opacity: 0.9;
}
.watch__hero-name {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.2;
}
.watch__hero-district {
    font-size: 14px;
    opacity: 0.9;
}
.watch__hero-photo {
    position: relative;
    background: rgba(0,0,0,0.12);
    overflow: hidden;
}
.watch__hero-photo a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}
.watch__hero-photo a::after {
    content: "↗";
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.watch__hero-photo a:hover::after {
    opacity: 1;
}
.watch__hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
    /* 外框：白邊襯托，截圖不那麼搶眼 */
    border: 10px solid #f09e6c;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}
.watch__hero-photo a:hover img {
    transform: scale(1.05);
}
@media (max-width: 720px) {
    .watch__hero {
        grid-template-columns: 1fr;
        aspect-ratio: 4 / 3;
    }
    .watch__hero-photo {
        aspect-ratio: 16 / 9;
    }
}

.watch__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
}
.watch__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-chip);
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
    cursor: pointer;
}
.watch__action:hover { background: var(--bg-chip-hover); }
.watch__action.is-on { background: var(--accent); color: #fff; }
.watch__action.is-on:hover { background: var(--accent-hover); }
.watch__action--bookmark { background: var(--text-primary); color: var(--bg-page); }
.watch__action--bookmark:hover { background: #444; }
[data-theme="dark"] .watch__action--bookmark:hover { background: #ccc; color: #0f0f0f; }

.watch__channel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 8px 0 16px;
}
.watch__channel-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ffaa8c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}
.watch__channel-info { flex: 1; min-width: 0; }
.watch__channel-name { font-size: 16px; font-weight: 600; }
.watch__channel-sub  { font-size: 12px; color: var(--text-secondary); }

.watch__section {
    background: var(--bg-surface-2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.watch__section h3 {
    margin: 0 0 8px;
    font-size: 16px;
}
.watch__section p {
    margin: 0 0 8px;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.watch__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.watch__table th,
.watch__table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.watch__table thead th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.watch__table tbody th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface-2);
}
.watch__table tbody td {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.watch__full-note {
    font-size: 13px;
    color: var(--text-secondary);
}
.watch__table--full {
    margin-top: 4px;
}
.watch__table--full tbody th {
    width: 38%;
    white-space: normal;
    word-break: break-word;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface-2);
}
.watch__table--full tbody td {
    white-space: pre-wrap;
    word-break: break-word;
    font-weight: 500;
}
.watch__table--full tbody td a {
    word-break: break-all;
}
.watch__section--evidence {
    border-left: 3px solid #10b981;
}
.evidence-list {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}
.evidence-tag {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}
.evidence-tag__label {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}
.evidence-tag__items {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}
.evidence-tag__items li {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-left: 2px solid var(--border);
    padding-left: 10px;
}

.watch__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.watch__fact {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}
.watch__fact-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.watch__fact-value {
    font-size: 16px;
    font-weight: 600;
}

.happy-gauge {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}
.happy-gauge__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.happy-gauge__score {
    text-align: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--score-color) 12%, transparent);
    border: 2px solid var(--score-color);
    min-width: 80px;
}
.happy-gauge__pct {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--score-color);
}
.happy-gauge__grade {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.happy-gauge__bars { display: flex; flex-direction: column; gap: 10px; }
.happy-gauge__row {
    display: grid;
    grid-template-columns: 130px 1fr 24px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.happy-gauge__label { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.happy-gauge__icon { font-size: 16px; }
.happy-gauge__bar {
    height: 10px;
    background: var(--bg-chip);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}
.happy-gauge__bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}
.happy-gauge__bar.is-on .happy-gauge__bar-fill { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.happy-gauge__mark { text-align: center; font-size: 16px; color: var(--text-secondary); }
.happy-gauge__bar.is-on + .happy-gauge__mark,
.happy-gauge__row:has(.is-on) .happy-gauge__mark { color: #10b981; font-weight: 700; }

.indicator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.indicator-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    text-decoration: none;
    transition: all 0.15s;
}
.indicator-chip:hover { border-color: var(--text-muted); }
.indicator-chip__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
    background: var(--bg-chip);
}
.indicator-chip--on .indicator-chip__dot { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.indicator-chip__label { font-size: 12px; color: var(--text-primary); line-height: 1.25; }
.indicator-chip--off .indicator-chip__label { color: var(--text-muted); }

.lang-switch {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 2px;
    margin-right: 8px;
}
.lang-switch__btn {
    padding: 4px 10px;
    font-size: 12px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.15s;
}
.lang-switch__btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.lang-switch__btn.is-on { background: var(--accent); color: #fff; font-weight: 600; }

.compare-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
}
.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.compare-table th,
.compare-table td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.compare-table thead th {
    background: var(--bg-chip);
    border-bottom: 2px solid var(--border);
}
.compare-th-label,
.compare-row-label {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-chip);
    width: 140px;
    min-width: 140px;
    position: sticky;
    left: 0;
    z-index: 1;
}
.compare-th-school { min-width: 220px; }
.compare-school-link { color: var(--text-primary); text-decoration: none; display: block; }
.compare-school-link:hover .compare-school-name { color: var(--accent); }
.compare-school-tier { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.compare-school-name { font-size: 16px; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
.compare-school-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.compare-cell-long {
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 13px;
}
.compare-score {
    display: flex;
    align-items: center;
    gap: 10px;
}
.compare-score__pct {
    font-size: 22px;
    font-weight: 700;
    min-width: 60px;
}
.compare-score__bar {
    flex: 1;
    height: 8px;
    background: var(--bg-chip);
    border-radius: 4px;
    overflow: hidden;
}
.compare-score__fill { height: 100%; border-radius: 4px; }

.watch__action--compare { background: var(--bg-chip); color: var(--text-primary); }
.watch__action--compare.is-on { background: var(--accent); color: #fff; }
.watch__action--compare:hover { background: var(--bg-chip-hover); }
.watch__action--compare.is-on:hover { background: var(--accent-hover); }

.watch__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.watch__upnext {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 16px;
    position: sticky;
    top: calc(var(--header-h) + 16px);
}
.watch__upnext h3 {
    margin: 0 0 12px;
    font-size: 16px;
}
.upnext-card {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.15s;
}
.upnext-card:hover { background: var(--bg-hover); }
.upnext-card__thumb {
    width: 168px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    background: linear-gradient(135deg, #2a9d8f, #264653);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.upnext-card__info {
    flex: 1;
    min-width: 0;
}
.upnext-card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.upnext-card__meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 64px 16px;
    color: var(--text-secondary);
}
.empty-state__icon { font-size: 64px; margin-bottom: 16px; }
.empty-state__title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 0 0 8px; }

/* ============================================
   HOME DISCLAIMER BANNER
   ============================================ */
.home-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.home-disclaimer span:first-child {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ============================================
   HERO SECTION (homepage intro)
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--accent), #ffaa8c);
    color: #fff;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.hero h1 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
}
.hero p {
    margin: 0;
    font-size: 15px;
    opacity: 0.95;
    max-width: 720px;
}
.hero__stats {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.hero__stat-num { font-size: 24px; font-weight: 700; }
.hero__stat-lbl { font-size: 12px; opacity: 0.9; }

/* ============================================
   DISCLAIMER OFFSET (sidebar is fixed, disclaimer needs left clearance)
   ============================================ */
@media (min-width: 769px) {
    .site-disclaimer {
        margin-left: var(--sidebar-w);
    }
}

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 768px) {
    :root { --sidebar-w: 240px; }
    .sidebar { transform: translateX(-100%); }
    .app-body.is-sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; padding: 16px; }
    .app-header__center { padding: 0 8px; }
    .brand { font-size: 16px; }
    .hero { padding: 20px; }
    .hero h1 { font-size: 22px; }
}

/* ============================================
   DISCLAIMER
   ============================================ */
.site-disclaimer {
    background: var(--bg-surface);
    border-top: 3px solid var(--border);
    border-left: 4px solid var(--accent);
    padding: 0 24px;
    position: relative;
}
.site-disclaimer__inner {
    max-width: 1100px;
    margin: 0 auto;
}
.site-disclaimer__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: left;
    border-radius: 8px;
    transition: background 0.15s;
}
.site-disclaimer__toggle:hover {
    background: var(--bg-hover);
    padding-left: 8px;
}
.site-disclaimer__icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--bg-chip);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.site-disclaimer__toggle:hover .site-disclaimer__icon {
    background: var(--accent);
    color: #fff;
}
.site-disclaimer__title {
    font-weight: 600;
    color: var(--text-primary);
}
.site-disclaimer__arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
    margin-left: auto;
    color: var(--text-secondary);
}
.site-disclaimer__body {
    padding-bottom: 20px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 12px;
}
.site-disclaimer__body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* ============================================
   GOODSCHOOL ATTRIBUTION
   ============================================ */
.site-gs-attribution {
    text-align: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.site-gs-attribution p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}
.site-gs-attribution a {
    color: var(--accent);
    text-decoration: none;
}
.site-gs-attribution a:hover {
    text-decoration: underline;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-primary);
    color: var(--bg-page);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
    box-shadow: var(--shadow-md);
}
.toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   SEARCH: combined results (schools + articles)
   ============================================ */
.search-section {
    margin-bottom: 32px;
}
.search-section__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

/* Tier pill (shared with goodschool pages) */
.gs-tier-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}
.gs-tier-pill.tier-kg        { background: #ff6b1a; }
.gs-tier-pill.tier-primary   { background: #4caf50; }
.gs-tier-pill.tier-secondary { background: #2196f3; }

