:root{
  --bg:#f4f6f8;
  --surface:#ffffff;
  --surface-soft:#f8fafc;
  --text:#1f2937;
  --muted:#667085;
  --subtle:#98a2b3;
  --line:#e5e9ee;
  --line-strong:#d5dbe3;
  --primary:#245d9f;
  --primary-dark:#1d4e86;
  --primary-soft:#edf4fb;
  --science:#2f7757;
  --science-soft:#edf7f1;
  --social:#9b5d1f;
  --social-soft:#fbf2e7;
  --danger:#b42318;
  --danger-soft:#fff1f0;
  --success:#28785b;
  --success-soft:#edf7f2;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(16,24,40,.05);
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html{background:var(--bg);-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{margin:0;min-width:320px;background:var(--bg);color:var(--text);font-family:"Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic UI",Meiryo,system-ui,-apple-system,sans-serif;line-height:1.6}
button,input,select{font:inherit}
button{color:inherit}
a{color:inherit}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible{outline:3px solid rgba(36,93,159,.18);outline-offset:2px}

.toast{position:fixed;z-index:100;left:50%;bottom:24px;transform:translate(-50%,10px);max-width:min(92vw,520px);padding:10px 14px;border-radius:9px;background:#20252c;color:#fff;font-size:13px;opacity:0;pointer-events:none;transition:opacity .16s ease,transform .16s ease;box-shadow:0 10px 30px rgba(0,0,0,.18)}
.toast.show{opacity:1;transform:translate(-50%,0)}

/* Login */
.auth-view{min-height:100svh;display:grid;place-items:center;padding:28px 18px;background:var(--bg)}
.login-box{width:min(100%,410px);background:var(--surface);padding:30px;border-radius:14px;box-shadow:var(--shadow)}
.login-brand{display:flex;align-items:center;gap:11px}
.brand-symbol{display:grid;place-items:center;width:42px;height:42px;border-radius:9px;background:var(--primary);color:#fff;font-size:13px;font-weight:800;letter-spacing:.04em}
.brand-symbol.small{width:34px;height:34px;border-radius:8px;font-size:11px}
.login-brand strong,.site-brand strong{display:block;font-size:15px;line-height:1.25}
.login-brand small,.site-brand small{display:block;margin-top:2px;color:var(--muted);font-size:10px;line-height:1.3}
.login-copy{margin:28px 0 20px}
.login-copy h1{margin:0 0 4px;font-size:25px;letter-spacing:-.03em;line-height:1.3}
.login-copy p{margin:0;color:var(--muted);font-size:13px}
.login-form{display:grid;gap:16px}
.field{display:grid;gap:7px}
.field>span{font-size:12px;font-weight:700;color:#344054}
.field input,.recording-controls input,.recording-controls select{width:100%;height:44px;border:1px solid var(--line-strong);border-radius:8px;background:#fff;color:var(--text);padding:0 12px;font-size:14px;transition:border-color .12s ease,box-shadow .12s ease}
.field input:focus,.recording-controls input:focus,.recording-controls select:focus{border-color:#8aaed5;box-shadow:0 0 0 3px rgba(36,93,159,.08);outline:none}
.password-field{position:relative}
.password-field input{padding-right:62px}
.password-toggle{position:absolute;right:5px;top:5px;height:34px;border:0;background:transparent;color:var(--primary);font-size:12px;font-weight:700;padding:0 9px;cursor:pointer}
.login-button{height:46px;border:0;border-radius:8px;background:var(--primary);color:#fff;font-size:14px;font-weight:700;cursor:pointer;transition:background .12s ease,transform .08s ease}
.login-button:hover{background:var(--primary-dark)}
.login-button:active{transform:translateY(1px)}
.login-button:disabled{opacity:.6;cursor:wait}
.form-error{margin:0;padding:10px 11px;border-radius:7px;background:var(--danger-soft);color:var(--danger);font-size:12px}

/* App shell */
.app-view{min-height:100svh}
.site-header{position:sticky;top:0;z-index:30;background:rgba(255,255,255,.98);border-bottom:1px solid var(--line)}
.header-inner{height:64px;max-width:1100px;margin:0 auto;padding:0 24px;display:flex;align-items:center;gap:28px}
.site-brand{display:flex;align-items:center;gap:9px;border:0;background:none;padding:0;cursor:pointer;flex:0 0 auto;text-align:left}
.brand-text{white-space:nowrap}
.desktop-nav{height:100%;display:flex;align-items:center;gap:4px;flex:1}
.nav-item{border:0;background:transparent;border-radius:7px;padding:8px 11px;color:#59606b;font-size:13px;cursor:pointer;transition:background .12s ease,color .12s ease}
.nav-item:hover{background:#f5f7fa;color:var(--text)}
.nav-item.active{background:var(--primary-soft);color:var(--primary);font-weight:700}
.account-area{display:flex;align-items:center;gap:12px}
.account-name{display:flex;align-items:center;gap:8px}
.account-name>span:last-child{display:grid;line-height:1.25}
.account-name strong{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.account-name small{font-size:10px;color:var(--muted)}
.user-initial{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:#eef1f4;color:#59606b;font-size:10px;font-weight:800}
.logout-button{border:0;background:transparent;padding:7px 4px;color:var(--muted);font-size:11px;cursor:pointer}
.logout-button:hover{color:var(--text);text-decoration:underline;text-underline-offset:3px}
.loading-bar{position:fixed;z-index:40;top:63px;left:0;right:0;height:2px;overflow:hidden;pointer-events:none}
.loading-bar span{display:block;width:34%;height:100%;background:var(--primary);transform:translateX(-120%)}
.loading-bar.active span{animation:loading 1.05s infinite ease-in-out}
@keyframes loading{50%{transform:translateX(150%)}100%{transform:translateX(330%)}}

.content{max-width:980px;margin:0 auto;padding:34px 24px 100px}
.page{display:none}
.page.active{display:block;animation:screenIn .12s ease-out}
@keyframes screenIn{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}

/* Hierarchy */
.home-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:24px;padding:0 2px}
.today-date{margin:0 0 2px;color:var(--primary);font-size:12px;font-weight:700}
.home-head h1,.page-heading h1{margin:0;color:#182230;font-size:27px;line-height:1.3;letter-spacing:-.035em}
.home-message,.page-heading p,.section-help{margin:5px 0 0;color:var(--muted);font-size:12px}
.student-meta{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.student-meta span{display:inline-flex;align-items:center;min-height:28px;padding:4px 9px;border-radius:7px;background:#eef1f4;color:#59606b;font-size:10px;font-weight:700}
.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:24px;padding:0 2px}
.page-heading.split{align-items:center}
.page-heading h1{font-size:26px}

/* Sections: only the primary action gets a stronger container */
.primary-section{background:var(--surface);border-radius:13px;padding:22px 22px 20px;box-shadow:var(--shadow)}
.primary-section::before{content:"";display:block;width:38px;height:3px;margin:-22px 0 18px;background:var(--primary);border-radius:0 0 3px 3px}
.content-section{background:var(--surface);border-radius:11px;padding:19px 20px}
.emphasis-section{box-shadow:var(--shadow)}
.section-title-row{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}
.section-title-row.compact{margin-bottom:8px}
.section-title-row h2{margin:0;font-size:16px;line-height:1.35;letter-spacing:-.02em}
.section-title-row>div{min-width:0}
.status-pill{display:inline-flex;align-items:center;justify-content:center;min-height:25px;padding:3px 9px;border-radius:999px;background:#eef1f4;color:#5d6672;font-size:10px;font-weight:800;white-space:nowrap}
.status-pill.open{background:var(--success-soft);color:var(--success)}
.status-pill.closed{background:#eef1f4;color:#5d6672}
.inline-link{border:0;background:none;color:var(--primary);padding:6px 0;font-size:11px;font-weight:700;cursor:pointer}
.inline-link:hover{text-decoration:underline;text-underline-offset:3px}
.home-columns{display:grid;grid-template-columns:1.4fr .8fr;gap:14px;margin-top:14px}
.page-block{margin-bottom:14px}

/* Lessons */
.lesson-list{display:grid}
.lesson-row{display:grid;grid-template-columns:72px 1fr auto;align-items:center;gap:16px;padding:14px 0;border-top:1px solid var(--line)}
.lesson-row:first-child{border-top:0;padding-top:3px}
.lesson-row:last-child{padding-bottom:2px}
.lesson-time{font-size:17px;font-weight:800;font-variant-numeric:tabular-nums;letter-spacing:-.02em;color:#1d2939}
.lesson-main{display:grid;gap:4px;min-width:0}
.lesson-main strong{font-size:14px;line-height:1.4}
.lesson-meta{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.lesson-main small{color:var(--muted);font-size:10px}
.subject-chip{display:inline-flex;align-items:center;min-height:20px;padding:2px 7px;border-radius:5px;background:#eef1f4;color:#59606b;font-size:9px;font-weight:800}
.subject-chip.science{background:var(--science-soft);color:var(--science)}
.subject-chip.social{background:var(--social-soft);color:var(--social)}
.lesson-link{display:inline-flex;align-items:center;justify-content:center;min-width:96px;height:38px;border-radius:7px;background:var(--primary);color:#fff;text-decoration:none;font-size:12px;font-weight:800;transition:background .12s ease,transform .08s ease}
.lesson-link:hover{background:var(--primary-dark)}
.lesson-link:active{transform:translateY(1px)}
.empty-state{padding:18px 14px;border-radius:8px;background:var(--surface-soft);color:var(--muted);font-size:12px;text-align:center}
.important-empty{background:var(--danger-soft);color:var(--danger)}

/* Compact summaries */
.compact-list{display:grid}
.compact-item{display:grid;grid-template-columns:88px 1fr;gap:12px;align-items:start;padding:9px 0;border-top:1px solid var(--line);font-size:12px}
.compact-item:first-child{border-top:0;padding-top:2px}
.compact-item:last-child{padding-bottom:2px}
.compact-item span{color:var(--muted)}
.compact-item strong{text-align:left;font-size:12px;font-weight:700;line-height:1.5}

/* Curriculum */
.curriculum-list{display:grid;gap:18px}
.week-block{background:#fff}
.week-title{padding:0 0 8px;border-bottom:1px solid var(--line);color:#344054;font-size:12px;font-weight:800}
.curriculum-item{display:grid;grid-template-columns:94px 1fr;gap:14px;align-items:start;padding:9px 0;border-bottom:1px solid #eef1f4;font-size:12px}
.curriculum-item:last-child{border-bottom:0}
.curriculum-item span{color:var(--muted)}
.curriculum-item strong{font-weight:650}
.curriculum-subject{display:inline-flex;width:max-content;max-width:100%;align-items:center;padding:2px 6px;border-radius:5px;background:#eef1f4;color:#59606b!important;font-size:10px;font-weight:800}
.curriculum-subject.science{background:var(--science-soft);color:var(--science)!important}
.curriculum-subject.social{background:var(--social-soft);color:var(--social)!important}
.no-data{margin:0;padding:10px 0;color:var(--muted);font-size:12px}

/* Registration */
.student-info-list{display:grid;grid-template-columns:repeat(4,1fr);background:var(--surface);border-radius:11px;padding:4px 18px;margin-bottom:14px}
.student-info-list>div{padding:14px 0}
.student-info-list>div+div{padding-left:18px;border-left:1px solid var(--line)}
.student-info-list span{display:block;margin-bottom:2px;color:var(--muted);font-size:10px}
.student-info-list strong{font-size:13px}
.period-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.period-card{background:var(--surface);border-radius:11px;padding:18px 19px}
.period-card.active-period{box-shadow:inset 3px 0 0 var(--primary)}
.period-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}
.period-title h4{margin:0;font-size:14px}
.registration-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 0;border-top:1px solid var(--line)}
.registration-row:first-of-type{border-top:0}
.registration-row strong{font-size:12px}
.day-badge{padding:2px 7px;border-radius:5px;background:#eef1f4;color:#59606b;font-size:10px;font-weight:700}

/* Recordings: list-first, easier to scan than a wall of cards */
.recording-controls{display:grid;grid-template-columns:auto minmax(220px,1fr);gap:10px 12px;margin-bottom:14px;padding:14px;background:var(--surface);border-radius:11px}
.segmented{display:flex;border-radius:8px;background:#eef1f4;padding:3px}
.segmented button{border:0;border-radius:6px;background:transparent;padding:0 13px;height:36px;color:#5b6470;font-size:12px;cursor:pointer}
.segmented button.active{background:#fff;color:var(--primary);font-weight:700;box-shadow:0 1px 3px rgba(16,24,40,.08)}
.search-wrap{position:relative}
.search-wrap svg{position:absolute;left:12px;top:50%;width:16px;height:16px;transform:translateY(-50%);fill:none;stroke:#87909d;stroke-width:1.8;stroke-linecap:round}
.search-wrap input{padding-left:36px}
.filter-row{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,minmax(0,180px));gap:8px}
.result-count{margin:14px 2px 8px;color:var(--muted);font-size:11px}
.recording-grid{display:grid;gap:7px}
.recording-card{display:grid;grid-template-columns:1fr auto;align-items:center;min-height:76px;background:var(--surface);border-radius:9px;color:inherit;text-decoration:none;padding:13px 15px;transition:background .12s ease,box-shadow .12s ease}
.recording-card:hover{background:#fbfcfd;box-shadow:0 1px 5px rgba(16,24,40,.06)}
.recording-card-body{min-width:0}
.recording-tags{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:6px}
.mini-tag{padding:2px 6px;border-radius:5px;background:#eef1f4;color:#606a76;font-size:9px;font-weight:700}
.mini-tag.science{background:var(--science-soft);color:var(--science)}
.mini-tag.social{background:var(--social-soft);color:var(--social)}
.recording-title{font-size:13px;font-weight:700;line-height:1.5}
.recording-footer{display:flex;align-items:center;gap:6px;padding-left:16px;color:var(--primary);font-size:11px;font-weight:700;white-space:nowrap}
.recording-footer span:last-child{font-size:14px;font-weight:400}

/* Notices */
.notice-list{display:grid;gap:8px}
.notice-card{position:relative;background:var(--surface);border-radius:10px;padding:17px 19px 17px 118px}
.notice-card.important{box-shadow:inset 3px 0 0 var(--danger)}
.notice-top{position:absolute;left:19px;top:18px;width:82px;display:grid;gap:5px;justify-items:start}
.notice-date{color:var(--muted);font-size:10px;font-variant-numeric:tabular-nums}
.importance{padding:2px 6px;border-radius:4px;background:#eef1f4;color:#667085;font-size:9px;font-weight:800}
.importance.high{background:var(--danger-soft);color:var(--danger)}
.notice-card h4{margin:0 0 6px;font-size:14px}
.notice-content{color:#4f5967;font-size:12px;line-height:1.75;white-space:pre-line}
.notice-content a{color:var(--primary);text-underline-offset:2px}
.notice-image{display:block;max-width:100%;max-height:520px;margin-top:12px;border-radius:6px}

/* Diagnostics */
.diagnostics{margin-top:24px;padding-top:10px;color:var(--muted)}
.diagnostics summary{cursor:pointer;font-size:10px;font-weight:700;user-select:none}
.debug-status{display:grid;gap:5px;margin-top:10px}
.debug-row{display:grid;grid-template-columns:18px 1fr auto;gap:7px;align-items:center;padding:7px 8px;border-radius:6px;background:#fff;font-size:11px}
.debug-row strong{font-size:11px}
.debug-row small{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:10px}
.debug-row.ok>span{color:var(--success)}
.debug-row.error>span{color:var(--danger)}
.debug-row.running>span{color:var(--primary)}
.debug-details{max-height:160px;overflow:auto;margin:7px 0 0;padding:9px 10px;border-radius:6px;background:#25282d;color:#e9eaec;font:10px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;word-break:break-word}
.app-diagnostics{max-width:520px;margin-top:22px;opacity:.72}
.login-diagnostics{margin-top:23px}
.skeleton-area:empty{min-height:58px;border-radius:7px;background:linear-gradient(90deg,#eef1f4 25%,#f7f8fa 42%,#eef1f4 60%);background-size:300% 100%;animation:skeleton 1.2s infinite}
@keyframes skeleton{from{background-position:100% 0}to{background-position:0 0}}
.mobile-nav{display:none}

@media(max-width:880px){
  .header-inner{padding:0 16px;gap:16px}
  .brand-text{display:none}
  .desktop-nav .nav-item{padding:8px 9px}
  .account-name>span:last-child{display:none}
  .recording-card{grid-template-columns:1fr auto}
  .student-info-list{grid-template-columns:1fr 1fr;padding:4px 15px}
  .student-info-list>div+div{border-left:0;padding-left:0}
  .student-info-list>div:nth-child(even){padding-left:15px;border-left:1px solid var(--line)}
  .student-info-list>div:nth-child(n+3){border-top:1px solid var(--line)}
}

@media(max-width:680px){
  .site-header{position:sticky}
  .header-inner{height:57px;padding:0 13px}
  .site-brand .brand-symbol.small{width:32px;height:32px}
  .brand-text{display:block}
  .desktop-nav{display:none}
  .account-area{margin-left:auto}
  .account-name{display:none}
  .logout-button{font-size:10px;padding:6px 3px}
  .loading-bar{top:56px}
  .content{padding:19px 13px calc(82px + env(safe-area-inset-bottom))}
  .home-head{margin-bottom:17px;padding:0 1px}
  .home-head h1{font-size:23px}
  .home-message{font-size:11px}
  .student-meta{display:none}
  .primary-section{padding:18px 15px 16px;border-radius:11px}
  .primary-section::before{margin:-18px 0 15px;width:32px}
  .content-section{padding:16px 15px;border-radius:10px}
  .home-columns{grid-template-columns:1fr;gap:10px;margin-top:10px}
  .section-title-row{margin-bottom:10px}
  .section-title-row h2{font-size:15px}
  .section-help{display:none}
  .lesson-row{grid-template-columns:58px 1fr;gap:10px 12px;padding:13px 0}
  .lesson-time{font-size:15px}
  .lesson-main strong{font-size:13px}
  .lesson-link{grid-column:1/-1;width:100%;height:40px;margin-top:1px}
  .compact-item{grid-template-columns:78px 1fr}
  .page-heading{margin-bottom:17px;padding:0 1px}
  .page-heading h1{font-size:23px}
  .page-heading p{font-size:11px}
  .page-heading.split{align-items:flex-start}
  .student-info-list{grid-template-columns:1fr 1fr;padding:2px 13px}
  .student-info-list>div{padding:11px 0}
  .student-info-list>div:nth-child(even){padding-left:13px}
  .period-grid{grid-template-columns:1fr;gap:9px}
  .period-card{padding:16px}
  .recording-controls{grid-template-columns:1fr;padding:11px;border-radius:10px}
  .segmented{width:100%}
  .segmented button{flex:1}
  .filter-row{grid-column:auto;grid-template-columns:1fr 1fr}
  .filter-row select:last-child{grid-column:1/-1}
  .recording-card{grid-template-columns:1fr auto;min-height:72px;padding:12px 13px}
  .recording-footer span:first-child{display:none}
  .notice-card{padding:15px}
  .notice-top{position:static;width:auto;display:flex;align-items:center;margin-bottom:7px}
  .notice-card.important{box-shadow:inset 3px 0 0 var(--danger)}
  .mobile-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;z-index:35;left:0;right:0;bottom:0;background:rgba(255,255,255,.98);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
  .mobile-nav button{position:relative;border:0;background:none;display:grid;place-items:center;gap:2px;color:#7b8490;padding:3px 0;cursor:pointer}
  .mobile-nav svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  .mobile-nav small{font-size:9px;font-weight:700}
  .mobile-nav button.active{color:var(--primary)}
  .mobile-nav button.active::before{content:"";position:absolute;top:-6px;width:24px;height:2px;border-radius:2px;background:var(--primary)}
  .toast{bottom:76px}
  .login-box{padding:24px 20px}
}

@media(prefers-reduced-motion:reduce){
  *{scroll-behavior:auto!important}
  .page.active,.loading-bar.active span,.skeleton-area:empty{animation:none!important}
}

/* =========================================================
   v7: mobile-first polish / unit grouping / account actions
   ========================================================= */

/* Registration actions */
.account-actions{margin-top:14px;background:var(--surface);border-radius:11px;padding:18px 19px}
.account-actions .section-title-row{margin-bottom:10px}
.action-list{display:grid;border-top:1px solid var(--line)}
.action-row{width:100%;min-height:64px;display:grid;grid-template-columns:38px 1fr 18px;gap:11px;align-items:center;border:0;border-bottom:1px solid var(--line);background:transparent;padding:10px 2px;text-align:left;cursor:pointer}
.action-row:hover{background:#fafbfc}
.action-row:disabled{opacity:.55;cursor:wait}
.action-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:var(--primary-soft);color:var(--primary)}
.action-icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.action-copy{display:grid;gap:1px;min-width:0}
.action-copy strong{font-size:13px}
.action-copy small{color:var(--muted);font-size:10.5px}
.action-chevron{color:var(--subtle);font-size:22px;line-height:1}

/* Recordings grouped by unit. Tints are intentionally muted. */
.recording-grid{display:grid;gap:10px}
.recording-unit{--unit-accent:#6786a7;--unit-soft:#f3f7fb;overflow:hidden;background:var(--surface);border-radius:10px;box-shadow:inset 3px 0 0 var(--unit-accent)}
.recording-unit.tone-0{--unit-accent:#5e83a7;--unit-soft:#f1f6fa}
.recording-unit.tone-1{--unit-accent:#6d8f78;--unit-soft:#f2f7f3}
.recording-unit.tone-2{--unit-accent:#9b7a55;--unit-soft:#faf6f1}
.recording-unit.tone-3{--unit-accent:#7d74a4;--unit-soft:#f5f3fa}
.recording-unit.tone-4{--unit-accent:#5f8d91;--unit-soft:#f1f7f7}
.recording-unit.tone-5{--unit-accent:#9a6f78;--unit-soft:#faf3f5}
.recording-unit.tone-6{--unit-accent:#7e865f;--unit-soft:#f6f7f1}
.recording-unit.tone-7{--unit-accent:#6e7f95;--unit-soft:#f3f5f8}
.recording-unit-head{position:relative;padding:12px 14px 11px;background:linear-gradient(90deg,var(--unit-soft),#fff 70%)}
.recording-unit-tags{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:5px}
.recording-unit-head h3{margin:0;padding-right:42px;font-size:14px;line-height:1.45;letter-spacing:-.01em}
.unit-count{position:absolute;right:14px;bottom:12px;color:var(--muted);font-size:10px;font-weight:700}
.recording-unit-videos{display:grid;border-top:1px solid var(--line)}
.unit-video-link{min-height:52px;display:grid;grid-template-columns:26px 1fr 20px;gap:8px;align-items:center;padding:8px 13px;color:inherit;text-decoration:none;border-bottom:1px solid #eef1f4}
.unit-video-link:last-child{border-bottom:0}
.unit-video-link:hover{background:#fbfcfd}
.video-play{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--unit-soft);color:var(--unit-accent);font-size:9px;padding-left:1px}
.video-link-copy{display:grid;gap:0;min-width:0}
.video-link-copy strong{font-size:12px;font-weight:750}
.video-link-copy small{color:var(--muted);font-size:9.5px}
.video-arrow{color:var(--primary);font-size:13px;text-align:right}

/* In-page sheets: no navigation/reload required */
body.sheet-open{overflow:hidden}
.sheet-backdrop{position:fixed;z-index:70;inset:0;background:rgba(22,28,36,.34);opacity:0;transition:opacity .17s ease}
.sheet-backdrop.open{opacity:1}
.bottom-sheet{position:fixed;z-index:71;left:50%;top:50%;width:min(92vw,560px);max-height:min(86svh,760px);display:flex;flex-direction:column;overflow:hidden;background:#fff;border-radius:14px;box-shadow:0 24px 70px rgba(12,20,30,.25);transform:translate(-50%,-47%) scale(.985);opacity:0;transition:transform .17s ease,opacity .17s ease}
.bottom-sheet.open{transform:translate(-50%,-50%) scale(1);opacity:1}
.sheet-handle{display:none;border:0}
.sheet-header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:20px 21px 14px;border-bottom:1px solid var(--line)}
.sheet-kicker{margin:0 0 2px;color:var(--primary);font-size:10px;font-weight:800}
.sheet-header h2{margin:0;font-size:19px;letter-spacing:-.02em}
.sheet-close{display:grid;place-items:center;width:36px;height:36px;border:0;border-radius:50%;background:#f2f4f6;color:#55606c;font-size:21px;cursor:pointer}
.sheet-body{overflow:auto;padding:18px 21px;overscroll-behavior:contain}
.sheet-note{margin:0 0 14px;color:var(--muted);font-size:11px;line-height:1.65}
.sheet-footer{display:flex;justify-content:flex-end;gap:8px;padding:12px 21px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff}
.primary-button,.secondary-button{min-height:43px;border-radius:8px;padding:0 16px;font-size:12px;font-weight:750;cursor:pointer}
.primary-button{border:1px solid var(--primary);background:var(--primary);color:#fff}
.secondary-button{border:1px solid var(--line-strong);background:#fff;color:#475467}
.primary-button:disabled,.secondary-button:disabled{opacity:.55;cursor:wait}
.secondary-button.wide{width:100%;margin-top:10px}
.inline-message{margin:12px 0 0;padding:9px 10px;border-radius:7px;background:#f3f5f7;color:#596273;font-size:11px}
.inline-message.error{background:var(--danger-soft);color:var(--danger)}
.inline-message.success{background:var(--success-soft);color:var(--success)}
.course-editor-rows{display:grid;gap:9px}
.course-edit-row{display:grid;grid-template-columns:104px 1fr 36px;gap:8px;align-items:end;padding:11px;border-radius:9px;background:#f8fafb}
.course-edit-row label{display:grid;gap:5px}
.course-edit-row label>span{color:#475467;font-size:10px;font-weight:700}
.course-edit-row select{width:100%;height:42px;border:1px solid var(--line-strong);border-radius:7px;background:#fff;padding:0 9px;font-size:12px}
.remove-course-row{width:36px;height:42px;border:0;border-radius:7px;background:#fff;color:#8b5252;font-size:20px;cursor:pointer}

@media(max-width:680px){
  /* Finger-friendly header and bottom nav */
  .header-inner{height:54px;padding:0 14px}
  .brand-text small{display:none}
  .site-brand .brand-symbol.small{width:30px;height:30px;border-radius:7px}
  .logout-button{min-width:44px;min-height:40px;font-size:10.5px}
  .loading-bar{top:53px}
  .content{padding:16px 12px calc(88px + env(safe-area-inset-bottom))}
  .page-heading,.home-head{margin-bottom:14px}
  .home-head h1,.page-heading h1{font-size:22px}
  .primary-section,.content-section,.account-actions{padding:15px 14px;border-radius:10px}

  /* Filters remain reachable without taking over the screen. */
  .recording-controls{gap:9px;padding:10px;margin:0 -1px 10px}
  .search-wrap input{height:43px}
  .filter-row{display:flex;grid-column:auto;gap:7px;overflow-x:auto;padding-bottom:2px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .filter-row::-webkit-scrollbar{display:none}
  .filter-row select,.filter-row select:last-child{grid-column:auto;flex:0 0 auto;width:auto;min-width:112px;height:40px;padding-right:28px}
  .result-count{margin:10px 2px 7px}
  .recording-grid{gap:9px}
  .recording-unit{border-radius:9px}
  .recording-unit-head{padding:11px 12px 10px}
  .recording-unit-head h3{font-size:13.5px}
  .unit-count{right:12px;bottom:10px}
  .unit-video-link{min-height:54px;padding:8px 11px}
  .video-link-copy strong{font-size:12px}
  .video-link-copy small{font-size:9.5px}

  .action-row{min-height:62px;padding:9px 0}
  .action-copy strong{font-size:12.5px}
  .action-copy small{font-size:10px}

  /* Bottom sheet behaves like a native mobile panel. */
  .bottom-sheet{--sheet-drag-y:0px;left:0;right:0;top:auto;bottom:0;width:100%;max-height:88svh;border-radius:15px 15px 0 0;transform:translateY(calc(100% + var(--sheet-drag-y)));opacity:1;transition:transform .26s cubic-bezier(.2,.78,.2,1)}
  .bottom-sheet.open{transform:translateY(var(--sheet-drag-y))}
  .bottom-sheet.dragging{transition:none;will-change:transform}
  .bottom-sheet.closing{transform:translateY(100%)}
  .sheet-handle{display:block;position:relative;width:72px;height:28px;min-height:28px;margin:0 auto;background:transparent;border-radius:14px;touch-action:none;cursor:grab}
  .sheet-handle::before{content:"";position:absolute;left:50%;top:9px;width:38px;height:4px;transform:translateX(-50%);border-radius:3px;background:#cbd3dc;transition:width .16s ease,background .16s ease}
  .sheet-handle:active{cursor:grabbing}
  .sheet-handle:active::before{width:46px;background:#aeb9c5}
  .sheet-header{padding:10px 15px 12px}
  .sheet-header h2{font-size:18px}
  .sheet-body{padding:14px 15px}
  .sheet-footer{position:sticky;bottom:0;padding:10px 15px calc(10px + env(safe-area-inset-bottom))}
  .sheet-footer>*{flex:1;min-height:46px}
  .course-edit-row{grid-template-columns:82px 1fr 38px;gap:7px;padding:9px}
  .course-edit-row select{height:44px;font-size:12px}
  .remove-course-row{width:38px;height:44px}
  #passwordSheet .field input{height:48px;font-size:16px}

  .mobile-nav{padding:4px 6px calc(5px + env(safe-area-inset-bottom));min-height:61px}
  .mobile-nav button{min-height:48px;gap:1px;padding:4px 0;border-radius:8px}
  .mobile-nav svg{width:20px;height:20px}
  .mobile-nav small{font-size:10.5px;line-height:1.2}
  .mobile-nav button.active::before{top:-4px;width:28px;height:2px}
}

@media(max-width:390px){
  .content{padding-left:10px;padding-right:10px}
  .course-edit-row{grid-template-columns:76px minmax(0,1fr) 36px;padding:8px;gap:6px}
  .recording-unit-head h3{padding-right:34px;font-size:13px}
}

/* v8: readable controls, explicit focus, compact responsive course choices. */
html{font-size:16px}
body{font-size:1rem}
:focus-visible{outline:3px solid #175cd3;outline-offset:3px}
button,input,select{font:inherit}
.field input,.search-wrap input,.filter-row select{font-size:1rem;min-height:44px}
.sheet-note,.inline-message,.action-copy small,.section-help,.home-message,.page-heading p,.compact-item,.registration-row,.secondary-button,.primary-button,.nav-item,.logout-button{font-size:.875rem;line-height:1.6}
.sheet-kicker,.mini-tag,.unit-count,.video-link-copy small,.mobile-nav small,.student-meta{font-size:.75rem}
.recording-unit-head h3,.video-link-copy strong,.action-copy strong{font-size:1rem;line-height:1.5}
.sheet-close,.password-toggle,.logout-button{min-height:44px;min-width:44px}
.sheet-footer{flex-wrap:wrap}
.sheet-footer button{height:auto;min-height:44px;padding:10px 14px;white-space:normal}
.course-option{display:block;text-align:left;width:100%;min-height:48px;border:1px solid #cbd5e1;background:#fff;color:#183b63;border-radius:6px;padding:12px;font-size:1rem;overflow-wrap:anywhere}
.course-option:hover:not(:disabled){background:#edf4fd;border-color:#175cd3}
.course-option:disabled{color:#596579;background:#f4f6f8;cursor:not-allowed}
.primary-button:disabled{cursor:not-allowed;background:#e5e9ef;color:#49566b;border-color:#cbd5e1;opacity:1}
.course-editor-rows h3{font-size:1rem;margin:10px 0}
.course-editor-rows .registration-row{gap:12px;align-items:center}
.course-editor-rows .registration-row span{min-width:0;overflow-wrap:anywhere}
.course-editor-rows .registration-row button{flex-shrink:0}
.recording-unit-head h3{overflow-wrap:anywhere}
.filter-row{max-width:100%}
.sheet-body{scroll-padding:16px}
@media(max-width:680px){
 .header-inner{height:auto;min-height:60px;gap:8px;flex-wrap:wrap;padding-block:6px}
 .account-area{gap:6px}.account-name{min-width:0}
 .sheet-footer button{flex:1 1 120px}
 .mobile-nav small{font-size:.75rem}
 .recording-unit-head h3{font-size:1rem}
 .filter-row select{font-size:1rem}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

.page.active{animation:none}
.app-version{font-size:12px;font-weight:400;color:#596579}
.course-day-tabs{display:flex;gap:5px;padding:5px;background:#edf1f6;border-radius:10px;overflow-x:auto;position:sticky;top:-14px;z-index:2}
.course-day-tabs button{flex:1;min-width:42px;min-height:44px;border:0;border-radius:7px;background:transparent;color:#526174;font-size:14px;white-space:nowrap;padding:8px}
.course-day-tabs button[aria-pressed="true"]{background:#fff;color:#174f91;box-shadow:0 1px 4px #183b631a;font-weight:700}
.course-candidates{display:grid;gap:8px;min-height:64px}
.course-option.selected{background:#edf4fd;border:2px solid #175cd3;padding:11px}
.course-day-tabs button:focus-visible{outline-offset:-3px}
.content,.sheet-body{overflow-x:clip}
.mobile-nav button{transition:color .18s ease,transform .18s cubic-bezier(.2,.8,.2,1)}
.mobile-nav button svg{transition:transform .2s cubic-bezier(.2,.8,.2,1)}
.mobile-nav svg,.action-icon svg{shape-rendering:geometricPrecision}
.mobile-nav svg *,.action-icon svg *{vector-effect:non-scaling-stroke}
.mobile-nav .play-mark{fill:currentColor;stroke:none}
.mobile-nav button::before{transition:width .2s ease,opacity .2s ease}
.mobile-nav button.active svg{transform:translateY(-1px) scale(1.06)}
.mobile-nav-indicator{display:none}

/* v8.5: cleaner recording library and a single sliding mobile indicator. */
#page-recordings .page-heading{margin-bottom:16px}
#page-recordings .page-heading h1{letter-spacing:-.035em}
.recording-controls{border:1px solid #e4eaf0;box-shadow:0 8px 28px rgba(30,55,82,.045)}
.segmented{position:relative;background:#e9eef4}
.segmented button{transition:color .18s ease,background-color .18s ease,box-shadow .18s ease}
.segmented button.active{color:#174f91;box-shadow:0 2px 7px rgba(23,79,145,.12)}
.result-count{text-align:right;font-weight:650;letter-spacing:.01em}
.recording-grid{gap:14px}
.recording-unit{border:1px solid #e6ebf0;border-radius:13px;box-shadow:0 5px 18px rgba(31,52,73,.055);transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
.recording-unit:hover{transform:translateY(-2px);border-color:#d6dfe8;box-shadow:0 10px 26px rgba(31,52,73,.09)}
.recording-unit-head{padding:16px 17px 14px;background:linear-gradient(125deg,var(--unit-soft),#fff 76%)}
.recording-unit-head::after{content:"";position:absolute;left:0;top:0;width:4px;height:100%;background:var(--unit-accent)}
.recording-unit-head h3{font-size:1.05rem;line-height:1.45;padding-right:62px}
.recording-unit-tags{gap:7px;margin-bottom:8px}
.mini-tag{padding:3px 8px;border-radius:999px;font-size:.75rem}
.unit-count{right:16px;bottom:15px;padding:3px 8px;border-radius:999px;background:#fff;color:#526174;font-size:.75rem;box-shadow:0 1px 4px rgba(31,52,73,.08)}
.recording-unit-videos{border-top:1px solid #e8edf2}
.unit-video-link{grid-template-columns:38px minmax(0,1fr) auto;min-height:68px;padding:10px 14px;gap:11px;transition:background-color .16s ease}
.unit-video-link:hover{background:var(--unit-soft)}
.video-play{width:36px;height:36px;background:var(--unit-soft);border:1px solid color-mix(in srgb,var(--unit-accent) 22%,transparent);font-size:11px;transition:transform .18s ease,background-color .18s ease}
.unit-video-link:hover .video-play{transform:scale(1.07);background:#fff}
.video-link-copy{gap:2px}
.video-link-copy strong{font-size:.95rem}
.video-link-copy small{font-size:.78rem}
.video-action{display:flex;align-items:center;gap:5px;color:var(--unit-accent);font-size:.78rem;font-weight:750;white-space:nowrap}
.video-action b{font-size:1.25rem;line-height:1;font-weight:500;transition:transform .16s ease}
.unit-video-link:hover .video-action b{transform:translateX(2px)}
@media(min-width:860px){
  .recording-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
  .recording-grid>.empty-state{grid-column:1/-1}
}
@media(max-width:680px){
  .mobile-nav{--nav-index:0}
  .mobile-nav button.active::before{display:none}
  .mobile-nav-indicator{display:block;position:absolute;z-index:2;left:0;top:0;width:20%;height:3px;pointer-events:none;transform:translateX(calc(var(--nav-index) * 100%));transition:transform .34s cubic-bezier(.22,.85,.24,1)}
  .mobile-nav-indicator::after{content:"";display:block;width:30px;height:3px;margin:auto;border-radius:0 0 4px 4px;background:var(--primary);box-shadow:0 1px 5px rgba(36,93,159,.2)}
  .recording-controls{border-radius:13px;padding:12px}
  .recording-unit{border-radius:12px}
  .recording-unit:hover{transform:none}
  .recording-unit-head{padding:14px 15px 13px}
  .unit-count{right:14px;bottom:13px}
  .unit-video-link{min-height:66px;padding:9px 13px}
}

/* v8.6: compact non-video pages; recordings stay grouped vertically by unit. */
.notice-card{padding:0}
.notice-summary{position:relative;min-height:70px;display:grid;grid-template-columns:94px minmax(0,1fr) 26px;gap:12px;align-items:center;padding:13px 15px 13px 19px;cursor:pointer;list-style:none}
.notice-summary::-webkit-details-marker{display:none}
.notice-summary::marker{display:none;content:""}
.notice-summary .notice-top{position:static;width:auto;display:grid;gap:5px;justify-items:start}
.notice-title{min-width:0;font-size:.95rem;line-height:1.55;overflow-wrap:anywhere}
.notice-chevron{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#f0f3f6;color:#617084;font-size:18px;transition:transform .22s cubic-bezier(.2,.8,.2,1),background-color .18s ease}
.notice-card[open] .notice-chevron{transform:rotate(180deg);background:#e5edf7;color:var(--primary)}
.notice-body{padding:0 19px 17px 125px;border-top:1px solid transparent}
.notice-card[open] .notice-body{border-top-color:#edf0f3;padding-top:13px}

@media(max-width:680px){
  /* The next card remains visible so the horizontal interaction is obvious. */
  .content{padding-top:12px}
  .page-heading,.home-head{margin-bottom:10px}
  .home-head h1,.page-heading h1{font-size:1.25rem;line-height:1.35}
  .primary-section,.content-section,.account-actions{padding:13px 12px}
  .home-columns{display:flex;gap:10px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding-inline:1px;padding:1px 1px 7px;margin-top:8px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .home-columns::-webkit-scrollbar,.curriculum-list::-webkit-scrollbar,.period-grid::-webkit-scrollbar{display:none}
  .home-columns>.content-section{flex:0 0 min(84vw,350px);scroll-snap-align:start}
  .curriculum-list{display:flex;gap:10px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding-inline:1px;padding:1px 1px 8px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .curriculum-list>.week-block{flex:0 0 min(84vw,350px);scroll-snap-align:start;background:var(--surface);border:1px solid #e5eaf0;border-radius:11px;padding:13px 14px;box-shadow:0 3px 12px rgba(31,52,73,.04)}
  .period-grid{display:flex;gap:10px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding-inline:1px;padding:1px 1px 8px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .period-card{flex:0 0 min(84vw,350px);scroll-snap-align:start;padding:14px}
  .account-actions{margin-top:7px}
  .action-row{min-height:56px}
  .notice-summary{min-height:64px;grid-template-columns:76px minmax(0,1fr) 26px;gap:8px;padding:10px 11px 10px 14px}
  .notice-summary .notice-top{margin:0}
  .notice-title{font-size:.9rem;line-height:1.45}
  .notice-body{padding:0 13px 14px}
  .notice-card[open] .notice-body{padding-top:12px}
}
