.subjects-page { min-height: calc(100vh - 66px); background: #fbfcff; }
.subjects-wrap { width: min(1400px, calc(100% - 64px)); margin: 0 auto; }
.subjects-page [hidden] { display: none !important; }
.subject-message i { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.subjects-hero { position: relative; height: 184px; overflow: hidden; border-bottom: 1px solid #eef1f6; background: #fff var(--hero-image) center / cover no-repeat; }
.subjects-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 55%, rgba(248,250,255,.08) 100%); pointer-events: none; }
.hero-content { position: relative; z-index: 1; padding-top: 12px; }
.hero-content .breadcrumb { height: 24px; }
.hero-content h1 { margin: 15px 0 11px; color: #121c36; font-size:29px; line-height: 1; font-weight: 850; letter-spacing: -.05em; }
.hero-content > p { margin: 0; color: #526079; font-size:17px; line-height: 1.65; }

.subjects-content { position: relative; padding: 0 0 38px; }
.stats-card { position: relative; z-index: 2; min-height: 92px; margin: -22px auto 27px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #e0e5ee; border-radius: 13px; background: rgba(255,255,255,.97); box-shadow: 0 8px 24px rgba(26,42,78,.07); }
.stat-item { position: relative; display: flex; align-items: center; justify-content: center; gap: 18px; }
.stat-item + .stat-item::before { content: ""; position: absolute; top: 23px; bottom: 23px; left: 0; width: 1px; background: #e8ebf1; }
.stat-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: #f2f5ff; color: #4163ec; }
.stat-icon svg { width: 27px; height: 27px; stroke-width: 1.7; }
.stat-star { background: #fff8e8; color: #f0a616; }
.stat-item p { margin: 0; }
.stat-item p strong, .stat-item p span { display: block; }
.stat-item p strong { margin-bottom: 5px; color: #3157e5; font-size:23px; line-height: 1; font-weight: 820; }
.stat-item p span { color: #58667d; font-size:15px; }

.subject-category-section h2, .section-heading h2 { margin: 0; color: #162038; font-size:21px; font-weight: 820; letter-spacing: -.035em; }
.category-tools { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.category-tabs { display: flex; align-items: center; gap: 9px; overflow-x: auto; }
.category-tabs button { height: 30px; padding: 0 17px; border: 1px solid #e5e9f0; border-radius: 99px; background: #fff; color: #4f5c72; font-size:14px; white-space: nowrap; transition: .18s ease; }
.category-tabs button:hover { border-color: #bdcaf8; color: #3157e5; }
.category-tabs button.active { border-color: transparent; background: linear-gradient(135deg, #7091fb, #7e86ef); box-shadow: 0 4px 11px rgba(77,102,222,.18); color: #fff; font-weight: 700; }
.subject-search { position: relative; flex: 0 0 255px; height: 36px; }
.subject-search input { width: 100%; height: 100%; padding: 0 39px 0 14px; border: 1px solid #dce2eb; border-radius: 7px; outline: 0; background: #fff; color: #26334c; font-size:15px; transition: border-color .2s, box-shadow .2s; }
.subject-search input::placeholder { color: #98a2b3; }
.subject-search input:focus { border-color: #6e89ef; box-shadow: 0 0 0 3px rgba(64,94,230,.08); }
.subject-search svg { position: absolute; top: 10px; right: 12px; width: 17px; height: 17px; color: #5e6c86; }

.subject-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.subject-card { position: relative; min-width: 0; min-height: 150px; padding: 26px 18px 15px; display: grid; grid-template-columns: 50px minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 15px; border: 1px solid #e4e8ef; border-radius: 12px; background: #fff; box-shadow: 0 5px 16px rgba(25,41,72,.04); color: inherit; text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s; }
.subject-card:hover { border-color: #bfcdfb; box-shadow: 0 10px 22px rgba(37,56,101,.09); transform: translateY(-2px); }
.course-icon, .popular-icon { display: grid; place-items: center; border-radius: 50%; color: #fff; }
.course-icon { width: 50px; height: 50px; box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 5px 11px rgba(36,54,92,.11); }
.course-icon svg { width: 27px; height: 27px; stroke-width: 1.7; }
.course-icon b { display: flex; align-items: center; gap: 0; font-size:24px; font-weight: 550; letter-spacing: -.1em; }
.course-icon b i { font-style: normal; }
.tone-blue { background: linear-gradient(145deg, #5593f7, #2f66dc); }
.tone-purple { background: linear-gradient(145deg, #b26cf4, #7b37d6); }
.tone-green { background: linear-gradient(145deg, #7dd4ae, #39a678); }
.tone-mint { background: linear-gradient(145deg, #70cea0, #2a9a68); }
.tone-orange { background: linear-gradient(145deg, #f7bb70, #ed8b28); }
.tone-pink { background: linear-gradient(145deg, #f580be, #df48a0); }
.course-copy { min-width: 0; padding-top: 1px; }
.course-copy h3 { margin: 0 0 7px; color: #182238; font-size:20px; font-weight: 760; letter-spacing: -.025em; white-space: nowrap; }
.course-copy p { margin: 0; overflow: hidden; color: #68758a; font-size:13px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.teacher-count { align-self: end; padding: 5px 9px; border-radius: 99px; background: #f1f5ff; color: #315bd9; font-size:13px; white-space: nowrap; }
.course-arrow { align-self: end; justify-self: end; color: #64728d; font-size:23px; font-weight: 300; }
.subject-empty { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #dce2ec; border-radius: 12px; background: #fff; color: #8590a2; font-size:15px; }
.subject-empty strong { color: #4a566b; font-size:17px; }
.all-subjects-button { width: 100%; min-height: 60px; margin-top: 14px; padding: 0 34px; display: flex; align-items: center; gap: 15px; border: 0; border-radius: 10px; background: linear-gradient(105deg, #eff4ff, #f2f4ff); text-align: left; }
.all-book { color: #3c61e5; }
.all-book svg { width: 24px; height: 24px; }
.all-subjects-button > span:nth-child(2) { flex: 1; }
.all-subjects-button strong, .all-subjects-button small { display: block; }
.all-subjects-button strong { margin-bottom: 2px; color: #26334d; font-size:15px; }
.all-subjects-button small { color: #748095; font-size:13px; }
.all-subjects-button > b { color: #4e5f80; font-size:23px; font-weight: 300; transition: transform .2s; }
.all-subjects-button.expanded > b { transform: rotate(180deg); }

.popular-section { margin-top: 25px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-heading a { color: #647189; font-size:14px; text-decoration: none; }
.section-heading a span { margin-left: 4px; font-size:21px; vertical-align: -1px; }
.recommended-section .section-heading a { color: #3157e5; font-weight: 650; }
.popular-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.popular-card { min-width: 0; min-height: 60px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; border: 1px solid #e3e7ef; border-radius: 9px; background: #fff; box-shadow: 0 4px 12px rgba(26,41,75,.035); }
.rank { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #f0f3fa; color: #34405a; font-size:14px; font-weight: 750; }
.rank-1 { background: #fff3d9; color: #b87b16; }.rank-2 { background: #f2f3f7; color: #647086; }.rank-3 { background: #fff0e6; color: #b36a36; }
.popular-icon { width: 31px; height: 31px; flex: 0 0 auto; font-size:15px; }
.popular-card p { min-width: 0; flex: 1; margin: 0; }
.popular-card p strong, .popular-card p small { display: block; }
.popular-card p strong { margin-bottom: 3px; color: #27334a; font-size:14px; }
.popular-card p small { color: #7a8699; font-size:13px; white-space: nowrap; }
.trend { color: #198858; font-size:13px; white-space: nowrap; }.trend.down { color: #456ed9; }

.recommended-section { margin-top: 25px; }
.teacher-carousel { position: relative; padding-right: 20px; }
.recommended-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.recommended-card { min-width: 0; min-height: 182px; padding: 14px; display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 15px; border: 1px solid #e1e6ee; border-radius: 11px; background: #fff; box-shadow: 0 5px 16px rgba(25,41,72,.04); }
.recommended-card > img { width: 98px; height: 116px; object-fit: cover; object-position: 50% 24%; border-radius: 48px 48px 16px 16px; background: #eff2f6; }
.recommended-copy { min-width: 0; }
.recommended-name { display: flex; align-items: center; gap: 6px; }
.recommended-name h3 { margin: 0; color: #182238; font-size:17px; font-weight: 750; white-space: nowrap; }
.subject-badge { padding: 3px 6px; border: 1px solid currentColor; border-radius: 4px; background: #f3f6ff; color: #3e65e6; font-size:13px; }
.subject-badge.tone-purple { background: #f7f1ff; color: #8651cf; }.subject-badge.tone-green, .subject-badge.tone-mint { background: #effaf5; color: #318768; }
.heart-button { width: 25px; height: 25px; margin-left: auto; padding: 3px; border: 0; background: transparent; color: #8795ac; }
.heart-button svg { width: 18px; height: 18px; }.heart-button.selected svg { fill: #ff7796; stroke: #ff6489; }
.tutor-rating { margin: 8px 0 6px; font-size:14px; }.tutor-rating b { color: #f2a516; }.tutor-rating span { color: #8490a4; }
.tutor-career { margin: 0 0 8px; overflow: hidden; color: #657188; font-size:13px; white-space: nowrap; text-overflow: ellipsis; }
.tutor-intro { min-height: 31px; margin: 0 0 9px; color: #4f5b70; font-size:14px; line-height: 1.55; word-break: keep-all; }
.recommended-copy > a { height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid #7790ee; border-radius: 5px; color: #3157e5; font-size:13px; font-weight: 650; text-decoration: none; }
.carousel-next { position: absolute; top: 50%; right: -18px; width: 42px; height: 42px; padding: 10px; border: 1px solid #e1e5ed; border-radius: 50%; background: #fff; box-shadow: 0 5px 16px rgba(26,43,78,.08); color: #33415c; transform: translateY(-50%); }
.carousel-next svg { width: 20px; height: 20px; }

@media (max-width: 1200px) {
    .subjects-wrap { width: min(1120px, calc(100% - 40px)); }
    .subject-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .recommended-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .popular-grid { overflow-x: auto; grid-template-columns: repeat(5, 240px); padding-bottom: 5px; }
}

@media (max-width: 780px) {
    .subjects-wrap { width: calc(100% - 28px); }
    .subjects-hero { height: 174px; background-position: 65% center; }
    .subjects-hero::after { background: linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.75) 65%, rgba(255,255,255,.35)); }
    .stats-card { grid-template-columns: 1fr 1fr; margin-top: -15px; }
    .stat-item { min-height: 76px; gap: 10px; }.stat-item:nth-child(3)::before { display: none; }.stat-icon { width: 42px; height: 42px; }.stat-item p strong { font-size:20px; }
    .category-tools { align-items: stretch; flex-direction: column; gap: 12px; padding: 12px 0 16px; }.subject-search { flex-basis: 36px; width: 100%; }.category-tabs { padding-bottom: 3px; }
    .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }.subject-card { min-height: 145px; padding: 20px 13px 13px; grid-template-columns: 44px minmax(0,1fr); gap: 10px; }.course-icon { width: 44px; height: 44px; }.course-copy h3 { font-size:18px; }.course-copy p { font-size:13px; }
    .recommended-grid { grid-template-columns: 1fr; }.teacher-carousel { padding-right: 0; }.carousel-next { display: none; }
}

/* Readable supporting copy for subjects and teacher cards. */
.category-tabs button{font-size:16px}
.subject-search input{font-size:17px}
.course-copy p{color:#59677c;font-size:16px;line-height:1.6;white-space:normal}
.teacher-count{font-size:15px}
.all-subjects-button strong{font-size:17px}
.all-subjects-button small{color:#657287;font-size:15px}
.section-heading a{font-size:16px}
.popular-card p strong{font-size:16px}
.popular-card p small{color:#657287;font-size:15px}
.trend{font-size:14px}
.subject-badge{font-size:14px}
.tutor-career{color:#59677c;font-size:15px}
.tutor-intro{min-height:40px;font-size:16px;line-height:1.65}
.recommended-copy>a{height:36px;font-size:16px}

@media(max-width:780px){.subject-card{min-height:165px}.course-copy p{font-size:15px}.popular-grid{grid-template-columns:repeat(5,270px)}}
