:root { color-scheme: light; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; color: #1c3028; background: #f5f9f7; }
button { font: inherit; cursor: pointer; }
.site-header { position: relative; z-index: 1; height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 max(30px, calc((100vw - 1180px) / 2)); background: #fff; border-bottom: 1px solid #dce9e2; font-size: 18px; font-weight: 650; }
.site-header img { border-radius: 8px; }
.login-state .site-header { display: none; }
.header-divider { color: #9bafa2; font-weight: 400; padding: 0 3px; }
.site-main { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 48px 24px; }
.login-state .site-main { min-height: 100svh; place-items: center start; padding: 48px max(24px, calc((100vw - 1160px) / 2)); background: #d5e0cf url('reading-nook-desktop.png') center center / cover no-repeat; }
.login-tool { width: min(100%, 370px); padding: 22px 26px 24px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 24px; background: rgba(238, 246, 237, .38); box-shadow: 0 18px 54px rgba(16, 45, 28, .13); backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px); text-align: center; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; padding-bottom: 17px; border-bottom: 1px solid rgba(50, 87, 65, .16); text-align: left; }
.login-brand img { border-radius: 8px; flex: none; }
.login-brand strong, .login-brand span { display: block; }
.login-brand strong { font-size: 18px; line-height: 1.4; }
.login-brand span { color: #526f5b; font-size: 13px; }
.login-heading h1 { margin: 0; font-size: 21px; font-weight: 650; line-height: 1.45; }
.supporting { margin: 5px 0 16px; color: #284435; font-size: 13px; line-height: 1.6; }
.supporting span { padding: 0 4px; color: #9b7848; }
.qr-area { text-align: center; }
.qr-frame { width: 230px; height: 230px; margin: 0 auto; padding: 7px; display: grid; place-items: center; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(40, 91, 62, .12); }
.qr-frame img { display: block; width: 216px; height: 216px; object-fit: contain; }
.pairing-line { margin-top: 14px; color: #284435; font-size: 14px; }
.pairing-line strong { margin-left: 6px; color: #1c3028; font-size: 19px; letter-spacing: 1px; }
.status { min-height: 22px; margin: 7px 0 0; color: #255b40; font-size: 13px; }
.remember-choice { display: block; margin: 14px 0 0; color: #284435; font-size: 13px; }
.remember-choice input { vertical-align: middle; margin-right: 6px; accent-color: #287657; }
.secondary-button { min-height: 38px; padding: 0 16px; border: 1px solid #78ae92; border-radius: 6px; background: #fff; color: #21644e; }
.secondary-button:hover, .secondary-button:focus-visible { background: #e8f4ec; }
.primary-button { min-height: 38px; padding: 0 16px; border: 1px solid #287657; border-radius: 6px; background: #287657; color: #fff; }
.primary-button:hover, .primary-button:focus-visible { background: #205f47; }
.login-tool .secondary-button { margin-top: 12px; }
.login-success { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; overflow: hidden; background: #d5e0cf; opacity: 0; }
.login-success.is-visible { opacity: 1; animation: forest-enter .28s ease-out both; }
.success-light { position: absolute; inset: 0; background: url('reading-nook-desktop.png') center center / cover no-repeat; }
.login-success.is-visible .success-light { animation: forest-settle 1.15s ease-out both; }
.success-content { position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 24px 34px; color: #173a2b; background: rgba(244, 249, 239, .84); border: 1px solid rgba(255, 255, 255, .72); border-radius: 8px; box-shadow: 0 18px 54px rgba(17, 46, 28, .16); backdrop-filter: blur(12px); text-align: center; }
.success-content img { border-radius: 11px; }
.success-content strong { font-size: 26px; }
.success-content span { color: #51685c; font-size: 14px; }
.login-success.is-visible .success-content { animation: welcome-rise .7s ease-out both; }
@keyframes forest-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes forest-settle { from { transform: scale(1.055); filter: brightness(1.12); } to { transform: scale(1); filter: brightness(1); } }
@keyframes welcome-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.viewer-app { width: min(100%, 1480px); }
body:not(.login-state) .site-main { display: block; padding: 24px; }
.viewer-app { margin: 0 auto; }
.viewer-top { display: flex; align-items: center; justify-content: flex-end; gap: 20px; padding-bottom: 10px; }
.viewer-top h1 { font-size: 30px; }
.viewer-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 26px; padding-top: 8px; }
.viewer-layout.single-program { grid-template-columns: minmax(0, 1fr); }
.program-nav { border-right: 1px solid #d3e5da; padding-right: 22px; }
.program-nav h2, .viewer-content h2 { margin: 0 0 16px; font-size: 22px; }
.program-button { display: block; width: 100%; padding: 14px 12px; border: 0; border-radius: 6px; background: none; text-align: left; color: #1c3028; }
.program-button:hover, .program-button:focus-visible, .program-button.active { background: #e2f1e9; }
.program-name { display: block; font-weight: 600; line-height: 1.5; }
.program-meta, .muted { display: block; margin-top: 4px; color: #5e6e65; font-size: 13px; }
.program-update { color: #a3532e; font-size: 12px; }
.viewer-message { margin: 22px 0; color: #52635b; }
#player-section { margin: 0 0 34px; }
#viewer-video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 70vh; background: #13211a; }
.player-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
#viewer-video:fullscreen { width: 100vw; height: 100vh; max-height: none; object-fit: contain; }
#playing-title { margin: 14px 0 0; font-size: 20px; }
.lesson-complete { margin: 18px 0; padding: 20px 0; border-top: 1px solid #d3e5da; border-bottom: 1px solid #d3e5da; }
.lesson-complete strong { display: block; font-size: 19px; }
.lesson-complete span { display: block; margin-top: 7px; color: #52635b; font-size: 14px; }
.complete-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.resource-section { padding: 24px 0; border-top: 1px solid #d3e5da; }
.resource-section h3 { margin: 0 0 12px; font-size: 18px; }
.resource-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 4px; border: 0; border-bottom: 1px solid #e2ebe6; background: none; text-align: left; color: #1c3028; }
.resource-row:hover, .resource-row:focus-visible { background: #edf5f0; }
.resource-row:focus-visible, .program-button:focus-visible { outline: 2px solid #397b6b; outline-offset: -2px; }
.resource-row span:last-child { flex: none; color: #287657; font-size: 13px; }
.resource-row-title { min-width: 0; overflow-wrap: anywhere; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; margin-top: 22px; }
.watch-layout.files-only { display: block; }
.watch-layout.files-only .watch-main { display: none; }
.watch-main, .resource-sidebar { min-width: 0; }
.player-placeholder { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; aspect-ratio: 16 / 9; padding: 24px; background: #e9efed; color: #28473d; font-size: 14px; overflow: hidden; }
.player-placeholder img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .23; }
.player-placeholder h3, .player-placeholder button { position: relative; margin: 0; }
.player-placeholder h3 { font-size: 20px; text-align: center; overflow-wrap: anywhere; }
.resource-tabs { display: flex; border-bottom: 1px solid #d3e5da; }
.resource-tabs button { flex: 1; min-width: 0; min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: none; padding: 10px 4px; line-height: 1.5; font-size: 13px; color: #5e6e65; }
.resource-tabs button[aria-selected="true"] { color: #21644e; border-bottom-color: #287657; font-weight: 600; }
.resource-sidebar .resource-section { padding: 16px 0; border: 0; max-height: 74vh; overflow-y: auto; }
#lesson-search { width: 100%; margin-bottom: 12px; height: 36px; padding: 6px 10px; border: 1px solid #cfddd5; border-radius: 4px; font: inherit; font-size: 13px; }
.group-title { margin: 18px 0 4px; font-size: 13px; color: #60766b; }
.lesson-row { gap: 10px; padding: 12px 6px; align-items: flex-start; border-left: 3px solid transparent; }
.lesson-row.active { background: #e7f1ed; border-left-color: #397b6b; }
.lesson-number { flex: 0 0 22px; color: #758a80; font-size: 13px; }
.lesson-cover { width: 64px; height: 40px; object-fit: cover; border-radius: 3px; flex: none; }
.lesson-copy { flex: 1; min-width: 0; }
.lesson-copy .resource-row-title { display: block; font-size: 14px; line-height: 1.5; }
.lesson-copy small { display: block; font-size: 12px; color: #5e766a; margin-top: 5px; }
.player-actions { flex-wrap: wrap; gap: 10px; align-items: center; }
.player-actions label { margin-right: auto; font-size: 13px; }
.player-actions select { padding: 6px; border: 1px solid #bfd3c8; border-radius: 4px; font: inherit; background: #fff; }
.reading-section, .notes-section { border-top: 1px solid #d3e5da; padding: 24px 0; }
.reading-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.reading-heading h3 { margin: 0; font-size: 18px; }
.reading-controls { display: flex; align-items: center; gap: 7px; }
.reading-controls button { min-width: 30px; height: 30px; border: 1px solid #b7c6bd; border-radius: 4px; background: #fff; color: #253d32; font-size: 13px; }
.reading-controls button[aria-pressed="true"] { outline: 2px solid #287657; outline-offset: 2px; }
.reading-swatch[data-theme="leaf"] { background: #e8f1e9; }
.reading-swatch[data-theme="night"] { background: #252c28; }
.lesson-text { padding: 22px; font-size: 18px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; color: #283d32; }
.lesson-text[data-theme="leaf"] { background: #e8f1e9; }
.lesson-text[data-theme="night"] { background: #252c28; color: #e4eae5; }
#note-input { width: 100%; min-height: 140px; resize: vertical; font: inherit; line-height: 1.7; padding: 14px; border: 1px solid #c3d7ca; border-radius: 6px; background: #fff; color: #283d32; }
.note-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 13px; color: #657b6e; }
.note-actions span { margin-right: auto; }
button:disabled { opacity: .5; cursor: default; }
@media (max-width: 1150px) { .watch-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; } .viewer-layout { grid-template-columns: 160px minmax(0, 1fr); gap: 18px; } .lesson-cover { width: 56px; height: 36px; } }
.guide-main { width: min(100% - 48px, 560px); margin: 0 auto; padding: 110px 0 60px; text-align: center; }
.guide-brand { border-radius: 18px; }
.guide-main h1 { margin-top: 28px; font-size: 30px; }
.guide-main p { color: #52635b; font-size: 17px; line-height: 1.8; }
.guide-main .guide-note { margin-top: 30px; color: #7a4e38; font-size: 15px; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .site-header { height: 64px; padding: 0 22px; font-size: 16px; }
  .site-main { display: block; padding: 28px 16px 72px; }
  .login-state .site-main { min-height: 100svh; display: grid; place-items: start center; padding: clamp(24px, 8svh, 72px) 16px 72px; background-image: url('reading-nook-mobile.png'); background-position: center center; }
  .login-tool { width: min(100%, 286px); margin: 0 auto; padding: 14px 16px 16px; border-radius: 22px; }
  .login-brand { margin-bottom: 12px; padding-bottom: 12px; }
  .login-brand img { width: 40px; height: 40px; }
  .login-heading h1 { font-size: 19px; }
  .supporting { margin-bottom: 12px; }
  .qr-frame { width: 176px; height: 176px; }
  .qr-frame img { width: 162px; height: 162px; }
  .remember-choice { margin-top: 10px; }
  .success-light { background-image: url('reading-nook-mobile.png'); }
  .success-content { width: min(100% - 40px, 310px); padding: 24px 18px; }
  .guide-main { padding-top: 72px; }
  .viewer-top h1 { font-size: 25px; }
  .viewer-layout { display: block; }
  .program-nav { border-right: 0; border-bottom: 1px solid #d3e5da; padding: 0 0 18px; margin-bottom: 25px; }
  #program-list { display: flex; gap: 8px; overflow-x: auto; }
  #program-list { scrollbar-width: none; }
  #program-list::-webkit-scrollbar { display: none; }
  .program-button { flex: 0 0 200px; }
  .watch-layout { display: block; }
  .resource-sidebar .resource-section { max-height: none; }
  .player-placeholder h3 { font-size: 17px; }
  .lesson-cover { display: block; }
  .lesson-text { padding: 16px; }
  .viewer-content h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-success.is-visible, .login-success.is-visible .success-light, .login-success.is-visible .success-content { animation: none; }
}
