/* Shared Cairn palette. Both Library and Learning Path use these tokens. */
:root{--ink:#213c35;--muted:#58675d;--green:#285c48;--line:#e1e5dd;--paper:#f6f7f2;--surface:#fff;--gold:#d5bd86;--soft:#edf2e9;--canvas:#f6f7f2;font-family:-apple-system,BlinkMacSystemFont,"Noto Sans Thai","Segoe UI",sans-serif}
.login-error{margin:0;padding:24px;background:var(--paper);line-height:1.65}.login-error .auth-screen{margin:8vh auto;box-sizing:border-box}.auth-brand{font-size:12px;letter-spacing:.18em;font-weight:700;color:var(--green)}.login-error h1{font-size:clamp(24px,5vw,32px);line-height:1.4;overflow-wrap:anywhere}.auth-description{color:var(--muted)}.auth-actions{display:flex;flex-wrap:wrap;gap:12px;margin:28px 0 20px}.auth-screen .auth-secondary{background:var(--soft);color:var(--ink)}.auth-actions a:focus-visible{outline:3px solid var(--green);outline-offset:4px}.auth-hint{font-size:13px;color:var(--muted);border-top:1px solid var(--line);padding-top:20px}@media(max-width:480px){.login-error{padding:16px}.login-error .auth-screen{margin:5vh auto;padding:24px}.auth-actions{flex-direction:column}.auth-actions a{text-align:center}}
.auth-screen{margin:12vh auto;padding:32px;max-width:480px;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:20px}.auth-screen a{display:inline-block;padding:12px 18px;background:var(--green);color:white;border-radius:10px;text-decoration:none}

/* Shared app shell: identical geometry for Library and Learning Paths. */
#siteNavigation{position:sticky;top:0;z-index:30;flex-shrink:0}
.site-header{height:72px;padding:0 clamp(20px,3vw,48px);display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:20px;background:var(--surface);border-bottom:1px solid var(--line);color:var(--ink);font-size:14px;line-height:1.5}
.site-brand{display:flex;align-items:center;gap:10px;justify-self:start;font-size:26px;font-weight:650;letter-spacing:-1px;color:var(--ink);text-decoration:none;white-space:nowrap}
.site-brand-dot{color:#8a7142;margin-left:-9px}.site-mark{width:26px;display:flex;flex-direction:column;align-items:center;gap:3px}.site-mark i{display:block;background:var(--green);height:6px;border-radius:60% 45% 40% 40%}.site-mark i:nth-child(1){width:11px;transform:rotate(-10deg)}.site-mark i:nth-child(2){width:19px;transform:rotate(5deg)}.site-mark i:nth-child(3){width:26px}
.site-links{display:flex;align-items:center;gap:8px;margin:0;padding:0}
.site-links a{display:flex;align-items:center;gap:9px;padding:12px 16px;min-height:46px;border-radius:9px;text-decoration:none;font-size:14px;font-weight:500;color:var(--muted);white-space:nowrap}
.site-links a:hover{background:var(--paper);color:var(--ink)}.site-links a[aria-current=page]{background:var(--soft);color:var(--green);font-weight:650;box-shadow:inset 0 -2px var(--green)}
.site-header svg,.site-drawer svg{width:20px;height:20px;flex:none}
.navigation-toggle,.site-drawer .drawer-heading button{display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);cursor:pointer}
.site-header .navigation-toggle{display:none}
.site-header .auth-account{position:relative;justify-self:end;font-size:13px;line-height:1.6}
.auth-account summary{list-style:none;display:grid;place-items:center;width:44px;height:44px;cursor:pointer;border:1px solid var(--line);border-radius:50%;background:var(--paper);color:var(--green)}.auth-account summary::-webkit-details-marker{display:none}
.account-panel{position:absolute;right:0;top:calc(100% + 12px);width:min(310px,calc(100vw - 32px));padding:20px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 36px #213c351a}
.account-caption{margin:0 0 6px;color:var(--muted);font-size:11px}.account-email{display:block;overflow-wrap:anywhere;color:var(--ink)}.account-panel button{display:block;width:100%;margin-top:18px;padding:12px;min-height:44px;font:inherit;border:1px solid var(--line);border-radius:8px;background:var(--paper);color:var(--ink);cursor:pointer}
.site-header a:focus-visible,.site-header button:focus-visible,.auth-account summary:focus-visible,.site-drawer a:focus-visible,.site-drawer button:focus-visible{outline:3px solid #547d69;outline-offset:3px}
.site-drawer{position:fixed;inset:0 auto 0 0;margin:0;width:min(320px,calc(100vw - 48px));height:100dvh;max-width:none;max-height:none;padding:24px 20px;border:0;border-right:1px solid var(--line);border-radius:0;background:var(--surface);color:var(--ink);box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain}
.site-drawer::backdrop{background:#142e2766;backdrop-filter:none}.site-drawer[open]{animation:drawer-enter .18s ease-out}
.drawer-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:28px}.drawer-heading h2{margin:0;font-size:20px;font-weight:600;letter-spacing:0}
.site-drawer .site-links{flex-direction:column;align-items:stretch;gap:8px}.site-drawer .site-links a{padding:14px 16px;min-height:52px;font-size:15px}
.navigation-open,.navigation-open body{overflow:hidden}
.library-page .library-main{margin:0 auto;width:100%;max-width:1536px;padding:0 clamp(20px,4vw,64px)}
.library-main .topbar{height:56px}.library-main .intro{padding-top:32px}
.path-save-status{display:flex;align-items:center;gap:12px;flex-basis:100%;font-size:11px}.path-save-status .draft-badge{color:var(--green);border-color:var(--line)}.path-save-status .save-state{color:var(--muted)}
.path-page{height:100dvh;min-height:0;overflow:hidden}.path-page .workspace{height:auto;min-height:0;overflow:auto;flex:1}.path-page .path-manager{flex-shrink:0}.path-page .viewport{min-height:260px}
@keyframes drawer-enter{from{transform:translateX(-100%)}to{transform:translateX(0)}}
@media(max-width:899px){.site-header{height:64px;padding:0 16px;grid-template-columns:1fr auto 1fr;gap:12px}.site-header .navigation-toggle{display:grid;justify-self:start}.site-brand{justify-self:center;font-size:25px}.desktop-navigation{display:none}.site-header .auth-account{grid-column:3}.site-header .site-brand{grid-column:2;grid-row:1}}
@media(max-width:700px){.storage-copy{display:none}}
@media(max-width:680px){.path-page{height:auto;min-height:100dvh;overflow:visible}.path-page .workspace{overflow:visible;flex:none;min-height:0}.path-page .viewport{min-height:300px}.library-page .library-main{padding:0 20px}.library-main .topbar{height:48px}}
@media(prefers-reduced-motion:reduce){.site-drawer[open]{animation:none}}
/* Home and contextual mobile titles share the existing authenticated shell. */
.site-context{display:none}
.site-links a[aria-current=page]{box-shadow:none;background:#dfeade}
.library-page .library-main{padding-top:24px}
@media(max-width:899px){.site-header .site-brand{display:none}.site-context{display:block;grid-column:2;grid-row:1;font-size:18px;font-weight:600}.library-page .library-main{padding:16px}.site-links a{padding-inline:12px}}

/* Signed-out welcome. Scoped to the replaced auth shell, never the private UI. */
body.auth-landing{display:block;height:auto;min-height:100svh;overflow:visible;margin:0;background:#f7f8f3;color:var(--ink);font-size:15px;line-height:1.65}
.welcome-shell{min-height:100svh;display:flex;flex-direction:column;padding:0 clamp(20px,5vw,80px)}
.welcome-shell *{box-sizing:border-box}
.welcome-header,.welcome-main,.welcome-footer{width:100%;max-width:1200px;margin-inline:auto}
.welcome-header{display:flex;justify-content:space-between;align-items:center;gap:20px;min-height:96px;border-bottom:1px solid #dce3d8}
.welcome-brand{display:inline-flex;align-items:center;gap:10px;font-size:29px;font-weight:700;letter-spacing:-1.3px;color:var(--ink);text-decoration:none}
.welcome-dot{margin-left:-10px;color:#907a4c}.welcome-brand .site-mark{margin-right:2px}
.welcome-about{display:inline-flex;align-items:center;gap:14px;min-height:44px;color:var(--muted);font-size:14px;text-decoration:none}
.welcome-about span{font-size:20px}.welcome-about:hover{color:var(--green);text-decoration:underline;text-underline-offset:5px}
.welcome-main{flex:1}
.welcome-hero{display:grid;grid-template-columns:1.05fr 1fr;align-items:center;gap:clamp(32px,5vw,76px);padding:64px 0 48px}
.welcome-eyebrow{display:flex;align-items:center;gap:10px;margin:0 0 25px;color:#52684e;font-size:10px;font-weight:650;letter-spacing:2px}
.welcome-eyebrow>span{width:7px;height:7px;background:#71865d;border-radius:50%;flex:none;box-shadow:0 0 0 5px #e8eedf}
.welcome-copy h1{margin:0;color:#233c32;font-size:clamp(40px,4.8vw,68px);font-weight:600;line-height:1.32;letter-spacing:-2px}
.welcome-copy h1 em{font-style:normal;color:#5b7953}
.welcome-lead{margin:26px 0 30px;font-size:17px;line-height:1.9;color:#5b685d;max-width:450px}
.welcome-login{display:inline-flex;align-items:center;justify-content:center;gap:14px;min-height:54px;padding:13px 25px;color:#263d34;background:#fff;border:1px solid #acb9a6;border-radius:12px;box-shadow:0 3px 0 #e2e7dc;text-decoration:none;font-size:16px;font-weight:550;transition:background .15s,border-color .15s,box-shadow .15s}
.welcome-login svg{height:22px;width:22px;flex:none}.welcome-login:hover{background:#f0f4eb;border-color:#5b7953;box-shadow:0 4px 12px #263d3410}
.welcome-access{display:flex;align-items:center;gap:7px;margin:16px 0 0;font-size:12px;color:#65735f}
.welcome-access svg{width:15px;height:15px;flex:none}
.welcome-shell a:focus-visible{outline:3px solid #285c48;outline-offset:5px}
.welcome-visual{margin:0;min-width:0;max-width:510px;width:100%;justify-self:end}
.welcome-board{height:430px;position:relative;isolation:isolate;border:1px solid #d8e3d0;border-radius:26px 26px 100px 26px;background-color:#eaf0e2;background-image:radial-gradient(#bdcbb3 .8px,transparent .8px);background-size:22px 22px;box-shadow:inset 0 0 70px 25px #eaf0e2}
.welcome-board-heading{display:flex;align-items:center;justify-content:space-between;margin:24px 26px;color:#586c4f;font-size:10px;font-weight:600;letter-spacing:1.9px}.welcome-board-star{font-size:27px;line-height:1}
.welcome-trail{position:absolute;inset:0;width:100%;height:100%;z-index:-1}
.welcome-note{position:absolute;display:flex;align-items:center;gap:13px;padding:16px 18px;border:1px solid #d7dfcd;border-radius:14px;background:#fffefa;box-shadow:0 9px 22px #354d3210;width:72%}
.welcome-note-icon{width:44px;height:52px;display:grid;place-items:center;flex:none;background:#eee5cd;border:1px solid #e2d5b1;border-radius:5px 9px 9px 5px;color:#716038;box-shadow:inset 4px 0 #e3d6b2}
.welcome-note-icon svg{width:23px;height:23px}.welcome-note>div{min-width:0}
.welcome-note small{display:block;font-size:9px;letter-spacing:1.4px;font-weight:650;color:#667257;line-height:1.4}
.welcome-note strong{display:block;margin:4px 0;font-size:clamp(13px,1.35vw,17px);font-weight:600;line-height:1.5;color:#2c4338}
.welcome-note div>span{display:block;color:#66705f;font-size:11px;line-height:1.5}
.welcome-book{top:78px;left:5%;transform:rotate(-4deg)}
.welcome-course{top:190px;right:4%;transform:rotate(3deg)}
.welcome-course .welcome-note-icon{background:#e4eaf1;border-color:#ccd7e0;color:#526c84;box-shadow:none;border-radius:9px}
.welcome-goal{bottom:48px;left:7%;width:74%;padding:14px 16px;background:#285c48;border-color:#285c48;transform:rotate(-2deg)}
.welcome-goal .welcome-note-icon{width:35px;height:35px;background:#ffffff12;border:0;box-shadow:none;border-radius:50%;color:#f0f4e8}
.welcome-goal small{color:#d1e2c8;font-size:8px}.welcome-goal strong{color:#fffefa;font-size:clamp(12px,1.25vw,16px);margin-bottom:0}
.welcome-stones{position:absolute;right:4%;bottom:36px;display:flex;flex-direction:column;align-items:center;gap:4px;transform:rotate(6deg);z-index:-1}
.welcome-stones i{display:block;background:#9cac85;width:37px;height:15px;border-radius:60% 42% 38% 46%;transform:rotate(-9deg)}
.welcome-stones i:nth-child(2){width:54px;height:20px;background:#aebc9b;transform:rotate(5deg)}
.welcome-stones i:nth-child(3){width:70px;height:22px;background:#c2cbb3;transform:rotate(-2deg)}
.welcome-board-caption{position:absolute;bottom:18px;left:26px;color:#657455;font-size:8px;letter-spacing:1.3px;font-weight:600}
.welcome-visual figcaption{margin:17px 4px 0;text-align:center;font-size:11px;color:#68715e;line-height:1.6}
.welcome-features{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:28px;padding:31px 0 36px;border-top:1px solid #dce3d8}
.welcome-features article{display:flex;align-items:flex-start;gap:14px}
.welcome-feature-number{color:#526747;font-size:11px;line-height:30px;letter-spacing:1px}
.welcome-features h2{margin:0 0 6px;font-size:16px;line-height:1.75;font-weight:600;letter-spacing:0}
.welcome-features p{margin:0;color:#66705f;font-size:13px;line-height:1.8}
.welcome-footer{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:70px;padding:20px 0;border-top:1px solid #dce3d8;font-size:12px;color:#65715e}
.welcome-footer a{display:inline-flex;align-items:center;min-height:44px;color:inherit;text-underline-offset:4px}
@media(max-width:1000px){.welcome-hero{gap:32px;padding-top:48px}.welcome-copy h1{font-size:48px}.welcome-lead{font-size:16px}.welcome-wide-break{display:none}.welcome-note{padding:14px 12px;gap:10px}.welcome-note strong{font-size:14px}.welcome-goal strong{font-size:13px}.welcome-features{gap:20px}.welcome-features article{gap:10px}}
@media(max-width:760px){.welcome-shell{padding-inline:24px}.welcome-header{min-height:78px}.welcome-brand{font-size:26px}.welcome-about{font-size:13px;gap:9px}.welcome-hero{grid-template-columns:1fr;padding:42px 0 36px;gap:38px}.welcome-copy{max-width:510px;width:100%;margin:auto}.welcome-eyebrow{font-size:9px;letter-spacing:1.6px;margin-bottom:24px}.welcome-copy h1{font-size:clamp(39px,8.5vw,54px);letter-spacing:-1.5px}.welcome-lead{margin:22px 0 26px;max-width:440px;font-size:16px}.welcome-login{width:100%;font-size:15px}.welcome-access{justify-content:center;font-size:11px}.welcome-visual{justify-self:center;max-width:460px}.welcome-board{height:405px;border-radius:22px 22px 75px 22px}.welcome-note strong{font-size:15px}.welcome-goal strong{font-size:14px}.welcome-board-heading{margin:22px}.welcome-book{top:74px}.welcome-course{top:179px}.welcome-features{grid-template-columns:1fr;gap:24px;padding:27px 0}.welcome-features article{gap:18px}.welcome-features h2{font-size:16px;margin-bottom:2px}.welcome-features p{font-size:13px}.welcome-footer{align-items:flex-start;gap:10px;flex-wrap:wrap;font-size:11px;min-height:0}.welcome-footer>span{padding:12px 0}}
@media(max-width:360px){.welcome-shell{padding-inline:20px}.welcome-copy h1{font-size:38px}.welcome-board{height:375px}.welcome-note{padding:12px 10px;gap:8px;width:78%}.welcome-note-icon{width:34px;height:44px}.welcome-note strong{font-size:13px}.welcome-note div>span{font-size:10px}.welcome-course{top:165px}.welcome-goal{left:5%;width:83%;bottom:46px}.welcome-goal strong{font-size:12px}.welcome-goal .welcome-note-icon{width:28px;height:28px}.welcome-stones{right:0}.welcome-visual figcaption{font-size:10px}}
@media(prefers-reduced-motion:reduce){.welcome-login{transition:none}}
