/* Tokens: see docs/DESIGN.md. Cream is the page ground; white is for surfaces people read and act on. */
:root{--cream:#fbf8f1;--cream-deep:#f3ede1;--white:#ffffff;--text:#363c3f;--muted:#5f676c;--blue:#4f7594;--blue-deep:#3c5f7b;--pale:#eef4f8;--line:#dbe5ec;--gold:#c8ac70;--done:#3c8a6e}
*{box-sizing:border-box}
body{margin:0;color:var(--text);background:var(--cream);font-family:'Hiragino Kaku Gothic ProN','Yu Gothic','YuGothic',sans-serif;font-size:15px;line-height:1.8}
button,input{font:inherit}
button,a,input{touch-action:manipulation}
button{cursor:pointer}
button:disabled{cursor:default;opacity:.6}
h1,h2,.brand,.step-copy strong{font-family:'Hiragino Mincho ProN','Yu Mincho','YuMincho',serif;font-weight:500}
h1{font-size:28px;line-height:1.5;margin:0 0 12px}
h2{font-size:21px;line-height:1.6;margin:0 0 14px}
h1,h2{display:flex;align-items:center;gap:.45em}
p{margin:10px 0}
.icon{width:1.1em;height:1.1em;flex:0 0 auto;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
h1 .icon,h2 .icon{color:var(--blue);width:.9em;height:.9em}
.eyebrow{display:inline-flex;align-items:center;gap:6px;color:var(--blue);letter-spacing:1.5px;font-size:12px}
.small{font-size:13px;color:var(--muted)}

/* Header / footer */
header{background:var(--white);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:24px;min-height:84px;padding:0 max(28px,calc((100vw - 1200px)/2))}
.brand{display:block;text-decoration:none;color:var(--blue);font-size:23px;letter-spacing:1.6px;line-height:1.4;white-space:nowrap}
.brand small{display:block;font-size:10px;letter-spacing:1.5px;margin-top:4px;color:var(--muted)}
header nav{display:flex;gap:6px}
header nav button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:44px;padding:8px 14px;border:0;border-radius:6px;background:none;color:var(--blue);font-size:13px}
header nav button:hover{background:var(--pale)}
header nav button[aria-current=page]{background:var(--pale);color:var(--blue-deep);font-weight:600}
footer{display:flex;gap:20px;flex-wrap:wrap;border-top:1px solid var(--line);background:var(--white);padding:22px max(28px,calc((100vw - 1200px)/2));color:var(--muted);font-size:12px;letter-spacing:1px}
#app{min-height:100vh;display:flex;flex-direction:column}
main{flex:1 0 auto;width:100%;max-width:1200px;margin:0 auto;padding:40px 28px 72px}
.demo-note{padding:10px 24px;background:var(--cream-deep);font-size:12px}

/* Buttons */
.primary,.outline,.text-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:46px;border-radius:6px;font-size:14px;text-decoration:none}
.primary{border:1px solid var(--blue);background:var(--blue);color:var(--white);padding:11px 24px}
.primary:hover{background:var(--blue-deep);border-color:var(--blue-deep)}
.outline{border:1px solid var(--blue);background:var(--white);color:var(--blue);padding:11px 22px}
.outline:hover{background:var(--pale)}
.text-button{border:0;background:none;color:var(--blue);padding:8px 0;min-height:44px}
input{width:100%;border:1px solid var(--line);border-radius:6px;padding:12px;background:var(--white);color:var(--text)}
input:focus,button:focus-visible,a:focus-visible,summary:focus-visible{outline:2px solid var(--blue);outline-offset:3px}

/* Home */
.welcome{margin-bottom:28px}
.welcome p{color:var(--muted);margin:0}
.course-card{display:grid;grid-template-columns:38% 1fr;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--white)}
.course-cover{background:var(--cream-deep);display:flex;justify-content:center;align-items:center;min-height:300px;padding:32px}
.course-booklet{display:block;width:100%;max-width:300px;height:auto;object-fit:contain}
.course-copy{padding:36px 40px;display:flex;flex-direction:column;justify-content:center}
.course-copy .primary{align-self:flex-start}
.progress-label{display:flex;justify-content:space-between;font-size:13px;color:var(--muted)}
progress{display:block;width:100%;height:6px;border:0;border-radius:3px;margin:8px 0 26px;background:var(--pale);overflow:hidden}
progress::-webkit-progress-bar{background:var(--pale)}
progress::-webkit-progress-value{background:var(--blue)}
progress::-moz-progress-bar{background:var(--blue)}
.below{margin-top:44px}
.step-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
.step-card{display:block;min-width:0;padding:0;text-align:left;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--white);color:var(--text)}
.step-card:hover{border-color:var(--blue);box-shadow:0 4px 14px rgba(60,95,123,.12)}
.chapter-cover{display:block;width:100%;height:auto;aspect-ratio:1672/941;object-fit:cover;background:var(--cream-deep)}
.step-copy{display:grid;gap:4px;padding:16px 20px 18px}
.step-copy strong{font-size:19px;line-height:1.6}
.step-meta{display:flex;justify-content:space-between;align-items:center;font-size:13px;color:var(--muted)}
.step-meta .go{display:inline-flex;align-items:center;gap:5px;color:var(--blue)}

/* Curriculum (page and lesson sidebar share the markup) */
.course-heading{display:flex;align-items:center;justify-content:space-between;gap:20px}
.course-count{font-size:13px;white-space:nowrap;color:var(--blue)}
.search-label{display:grid;grid-template-columns:auto 1fr;align-items:center;column-gap:6px;font-size:13px;margin:18px 0 26px;max-width:600px}
.search-label input{grid-column:1/-1;margin-top:6px}
.catalog{max-width:960px}
.chapter{border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--white);margin-bottom:16px}
.chapter-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:12px;padding:14px 18px;background:var(--pale)}
.chapter-stage{display:inline-flex;align-items:center;gap:6px;color:var(--blue);font-size:12px;letter-spacing:1px}
.chapter-head h2{grid-column:1;font-size:16px;margin:2px 0 0;min-width:0;overflow-wrap:anywhere}
.chapter-count{grid-column:2;grid-row:1/span 2;font-size:12px;color:var(--blue);white-space:nowrap}
.lesson{display:flex;align-items:center;gap:14px;width:100%;padding:14px 18px;border:0;border-top:1px solid var(--line);background:var(--white);color:var(--text);text-align:left;font-size:14px}
.lesson:hover{background:var(--cream)}
.lesson[aria-current=step]{background:var(--pale);box-shadow:inset 3px 0 var(--blue)}
.lesson-thumb{width:128px;height:72px;object-fit:cover;flex:0 0 auto;border-radius:5px;background:var(--pale)}
.lesson-title{min-width:0;overflow-wrap:anywhere}
.status{display:inline-flex;color:#b9c7d2}
.status.done{color:var(--done)}

/* Lesson viewer */
.learning-layout{display:grid;grid-template-columns:300px minmax(0,1fr);gap:32px;align-items:start}
.curriculum{min-width:0;position:sticky;top:16px;max-height:calc(100vh - 32px);overflow:auto}
.curriculum .chapter{margin-bottom:10px}
.curriculum .chapter-head{padding:10px 12px}
.curriculum .chapter-head h2{font-size:14px}
.curriculum .lesson{padding:11px 12px;font-size:13px;line-height:1.7;gap:10px}
.curriculum .lesson-thumb{display:none}
.mobile-curriculum>summary{display:none}
.lesson-content{min-width:0}
.player-heading{margin-bottom:18px}
.player-heading h1{font-size:24px;margin-top:6px}
.video-shell{aspect-ratio:16/9;background:var(--text);border-radius:8px;overflow:hidden}
.video-shell video,.video-shell iframe{width:100%;height:100%;display:block;border:0}
.lesson-actions{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 0;border-bottom:1px solid var(--line)}
.lesson-actions p{margin:0}
.lesson-actions button{white-space:nowrap}
.lesson-navigation{display:flex;justify-content:space-between;gap:15px;margin-top:22px}

/* Bonuses / account */
.bonus-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;margin-top:24px;overflow-wrap:anywhere}
.bonus-card{padding:26px;border:1px solid var(--line);border-radius:10px;background:var(--white)}
.bonus-card h2{font-size:20px}
.account{max-width:520px}
.account>p{margin-bottom:30px}
.account h2{margin-top:10px}
.logout{margin-top:36px}

/* Entry (login, password change) */
.entry{max-width:520px;margin:48px auto;padding:24px}
.entry>.brand{text-align:center}
.entry-paper{margin-top:36px;padding:34px;border:1px solid var(--line);border-radius:10px;background:var(--white)}
.entry h1{font-size:24px}
.entry-help{display:flex;gap:8px;align-items:flex-start;margin:22px 0 0;font-size:13px;color:var(--muted)}
.entry-help .icon{margin-top:.3em;color:var(--blue)}
.entry [role=alert],.form-error{font-size:13px;padding:12px;border-radius:6px;background:var(--cream-deep)}
form{display:grid;gap:18px;margin-top:22px}
form label{display:grid;gap:7px;font-size:13px}
.loading{padding:80px;text-align:center}
/* Shown only when a progress save ended with an unknown result */
.record-status{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 20px;margin-top:16px;padding:16px 20px;border:1px solid var(--gold);border-radius:8px;background:var(--cream-deep);font-size:13px}
.record-status p{display:flex;gap:8px;align-items:flex-start;margin:0}
.record-status .icon{margin-top:.3em;color:var(--blue)}
#message:empty{display:none}
#message{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--text);color:var(--white);font-size:13px;border-radius:6px;padding:14px 22px;max-width:calc(100vw - 32px);width:max-content;z-index:10}

@media(max-width:900px){
  header{flex-wrap:wrap;gap:12px;padding:16px 24px}
  .learning-layout{grid-template-columns:1fr;gap:18px}
  .curriculum{position:static;max-height:none;order:1}
  .mobile-curriculum>summary{display:flex;align-items:center;gap:8px;cursor:pointer;color:var(--blue);background:var(--white);border:1px solid var(--line);border-radius:6px;padding:12px 15px;font-size:14px;margin-bottom:12px}
  .course-copy{padding:28px}
  .lesson-actions{flex-wrap:wrap}
}
@media(max-width:600px){
  header{padding:14px 16px}
  .brand{font-size:18px;letter-spacing:1px}
  header nav{width:100%;justify-content:space-between;gap:0}
  header nav button{flex-direction:column;gap:2px;padding:6px 8px;font-size:11px;min-width:64px}
  header nav button .icon{width:1.4em;height:1.4em}
  main{padding:26px 16px 48px}
  h1{font-size:23px}
  .course-card{grid-template-columns:1fr}
  .course-cover{min-height:0;padding:22px}
  .course-booklet{max-width:200px}
  .course-copy{padding:22px}
  .course-copy .primary{align-self:stretch}
  .step-grid,.bonus-grid{grid-template-columns:1fr;gap:16px}
  .course-heading{display:block}
  .lesson{padding:13px 14px;gap:10px}
  .lesson-thumb{width:96px;height:54px}
  .player-heading h1{font-size:20px}
  .lesson-actions button,.lesson-navigation button{flex:1}
  .entry{padding:16px;margin:24px auto}
  .entry-paper{padding:24px;margin-top:26px}
  footer{padding:18px 16px;flex-direction:column;gap:4px}
  #message{bottom:16px}
}
