:root{--ink:#402b21;--muted:#856e5f;--paper:#fffdfa;--cream:#fff8ee;--line:#eadbca;--orange:#cf793f;--orange-dark:#a6502a;--green:#4f7756;--shadow:0 18px 55px rgba(92,56,28,.09);--rad:20px}
*{box-sizing:border-box}html{font-family:ui-rounded,"Trebuchet MS",system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:#fff8ef}body{margin:0;min-height:100vh}button,input{font:inherit}button{cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}input:focus-visible,button:focus-visible{outline:3px solid #d8a05e;outline-offset:2px}button{touch-action:manipulation}
.topbar{height:84px;position:sticky;top:0;z-index:15;background:rgba(255,253,248,.97);border-bottom:1px solid #eddfce;display:flex;align-items:center;gap:24px;padding:0 clamp(12px,2.4vw,34px);backdrop-filter:blur(16px)}.brand{display:flex;align-items:center;gap:10px;min-width:230px}.brand-icon{width:53px;height:53px;background:#fde4bf;border-radius:18px;display:grid;place-items:center;overflow:hidden;border:1px solid #f2cd9a}.brand-icon img{width:90%;height:90%;object-fit:contain}.brand-name{display:flex;flex-direction:column;line-height:1.08;gap:5px}.brand-name strong{font-size:20px;font-weight:900;letter-spacing:-.8px}.brand-name span{color:#a56f42;letter-spacing:.7px;font-size:11px;font-weight:900;text-transform:uppercase}.topbar-status{width:min(290px,28vw);margin:auto}.progress-text{font-size:12px;font-weight:800;color:#765f4d;margin-bottom:8px}.progress-track{height:9px;border-radius:99px;background:#f0e6d8;overflow:hidden}.progress-track>div{height:100%;background:linear-gradient(90deg,#91af75,#4f7756);width:0%;border-radius:inherit;transition:width .35s}.topbar-actions{display:flex;gap:9px;align-items:center}.text-button,.icon-button{border:1px solid var(--line);background:white;color:#6f4f39;border-radius:12px;min-height:39px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:8px 12px;font-weight:800;font-size:12px}.text-button:hover,.icon-button:hover,.small-button:hover{background:#fff2e1}.icon-button{width:41px;height:41px;padding:7px}.mobile-menu{display:none}
.sidebar-backdrop{display:none}.app-shell{display:grid;grid-template-columns:288px minmax(0,1fr);min-height:calc(100vh - 84px)}.sidebar{background:#fffdf8;border-right:1px solid #e9decd;position:sticky;top:84px;height:calc(100vh - 84px);display:flex;flex-direction:column;min-width:0;overflow:hidden}.sidebar-intro{padding:26px 20px 13px}.eyebrow{font-size:10px;font-weight:900;letter-spacing:2px;color:#be7a49}.sidebar h2{font-size:22px;margin:8px 0 5px;letter-spacing:-.7px}.sidebar-intro p{color:var(--muted);font-size:12px;line-height:1.45;margin:0}.search-wrap{border:1px solid #e6dacc;border-radius:12px;background:white;display:flex;gap:8px;align-items:center;margin:6px 16px 12px;padding:9px 10px}.search-wrap svg{height:16px;width:16px;color:#a58b74;flex:none}.search-wrap input{min-width:0;width:100%;border:0;background:transparent;outline:none;font-size:12px;color:#4a382b}.filter-list{display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 13px}.filter-chip{border-radius:999px;font-size:10px;font-weight:800;padding:7px 10px;border:1px solid #e6d9c9;background:white;color:#796758}.filter-chip.active{background:#d88851;color:white;border-color:#d88851}.sidebar-count{padding:0 18px 10px;color:#9a826d;font-size:10px;font-weight:800}.lesson-list{overflow:auto;flex:1;padding:0 12px 14px;scrollbar-color:#dec7ad transparent;scrollbar-width:thin}.lesson-tile{width:100%;display:grid;grid-template-columns:43px minmax(0,1fr) 21px;gap:8px;align-items:center;text-align:left;border:1px solid transparent;padding:9px 8px;border-radius:14px;background:transparent;color:#584338;margin-bottom:4px}.lesson-tile:hover{background:#fff1de}.lesson-tile.selected{background:#fff0dc;border-color:#eccc9f}.lesson-thumb{width:42px;height:42px;border-radius:11px;overflow:hidden;border:1px solid #ecdcc7;background:white}.lesson-thumb img{width:100%;height:100%;object-fit:cover;object-position:center 30%;transform:scale(1.3)}.lesson-meta{min-width:0;display:flex;flex-direction:column;gap:5px}.lesson-meta b{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.lesson-meta small{font-size:10px;color:#ac8264}.lesson-check{width:20px;height:20px;border:1px solid #ddc4ab;border-radius:50%;display:grid;place-items:center;font-size:11px;color:white}.lesson-check.done{background:var(--green);border-color:var(--green)}.sidebar-footer{padding:13px 17px;border-top:1px solid var(--line);font-size:10px;color:#a17556;font-weight:900}.sidebar-footer .smallmuted{color:#aa9b8e;font-weight:600}.tiny-flower{font-size:17px;color:#d38649}
.main-content{min-width:0;max-width:1540px;width:100%;padding:26px clamp(15px,2.5vw,38px) 44px;margin:0 auto;background:radial-gradient(ellipse at 70% 0,#fff2e1 0,transparent 45%)}.lesson-header{display:flex;justify-content:space-between;gap:16px;align-items:end;margin-bottom:20px}.lesson-header h1{font-weight:950;letter-spacing:-1.1px;font-size:clamp(24px,3vw,35px);margin:5px 0 6px;line-height:1.12}.lesson-subtitle{color:#806b5b;font-size:13px;line-height:1.5}.lesson-header-actions{display:flex;align-items:center;gap:10px;flex:none}.type-chip{font-size:11px;font-weight:900;background:#e5efdb;color:#55764e;padding:9px 12px;border:1px solid #d1dfc4;border-radius:20px;white-space:nowrap}.work-layout{display:grid;grid-template-columns:minmax(0,1fr) 288px;gap:21px;align-items:start}.art-column{background:var(--paper);border:1px solid #eadbca;border-radius:var(--rad);padding:14px 14px 7px;box-shadow:var(--shadow);min-width:0}.board-toolbar{display:flex;justify-content:space-between;align-items:center;gap:9px;margin-bottom:12px}.board-toolbar-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.board-label{font-size:11px;font-weight:800;color:#8e765f;white-space:nowrap}.green-indicator{width:8px;height:8px;display:inline-block;background:#6b9c60;border-radius:50%;margin-right:5px}.small-button{font-size:11px;background:white;border:1px solid #e8d8c7;color:#6b5441;border-radius:9px;padding:7px 10px;font-weight:900}.small-button.danger{color:#a34f3c}.board-scroll{overflow:auto;border-radius:14px;background:#f9eee2;display:flex;justify-content:center;align-items:flex-start;border:1px solid #eee5d9;max-height:min(77vh,870px);padding:11px}.board-frame{width:min(100%,660px);position:relative;flex:0 0 auto;overflow:hidden;background:white;box-shadow:0 4px 17px rgba(56,36,22,.10);border-radius:6px;user-select:none}.board-frame.zoomed{width:990px;max-width:none}.board-frame img#worksheetImage{display:block;width:100%;height:auto;pointer-events:none;user-select:none;-webkit-user-drag:none}.board-frame canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair;mix-blend-mode:multiply}.board-caption{font-size:10px;color:#a1836d;display:flex;justify-content:space-between;gap:10px;padding:10px 3px 4px}.tools-column{display:flex;flex-direction:column;gap:14px}.tool-card{border-radius:18px;background:#fffcf6;border:1px solid #ead9c4;padding:16px;box-shadow:0 7px 23px rgba(91,49,21,.035)}.tool-card-title{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:950;margin-bottom:14px;letter-spacing:-.25px}.tool-card-title span{width:25px;height:25px;border-radius:9px;display:grid;place-items:center;font-size:10px;color:#a36339;background:#ffeed5}.tool-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.tool-btn{min-height:65px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:white;border:1px solid #e9dbc8;border-radius:11px;color:#74604d;font-weight:900;font-size:11px}.tool-btn svg{width:19px;height:19px}.tool-btn.active{border:2px solid #c78548;background:#fff0d9;color:#9f552a}.tool-btn.wide{grid-column:span 2;min-height:40px;flex-direction:row}.palette-label{margin:17px 0 9px;font-size:11px;color:#8f7863;font-weight:900}.color-palette{display:flex;gap:8px;flex-wrap:wrap}.color-dot{width:28px;height:28px;border:2px solid white;box-shadow:0 0 0 1px #dfd2c4;border-radius:50%}.color-dot.selected{box-shadow:0 0 0 3px #885e38}.size-row{display:flex;align-items:center;gap:9px;margin-top:18px}.size-row label,.size-row span{font-size:11px;font-weight:800;color:#7b6654}.size-row input{min-width:0;flex:1;accent-color:#bf7647}.tool-hint{font-size:11px;line-height:1.5;background:#fff2e0;padding:9px 10px;border-radius:10px;margin:15px 0 0;color:#8a6348}.minor-text{font-size:11px;color:#897365;line-height:1.5;margin:-7px 0 10px}.teacher-note{border:1px dashed #e4d6c1;padding:12px 14px;border-radius:13px;color:#99816a;background:#fffdf9;font-size:11px;line-height:1.5}.teacher-note strong{color:#7a6551}.teacher-note p{margin:4px 0 0}.lesson-navigation{display:flex;justify-content:space-between;gap:12px;margin:23px 0}.nav-button{display:flex;align-items:center;justify-content:center;gap:8px;padding:14px 18px;border-radius:13px;font-weight:950;border:1px solid #dec9b2;font-size:12px}.nav-button.secondary{background:#fffdf7;color:#7e6149}.nav-button.primary{background:#55805a;color:white;border-color:#55805a;box-shadow:0 5px 17px #49774d26}.nav-button.primary.done{background:#d28a48;border-color:#d28a48}.nav-button svg{width:16px;height:16px}.toast{position:fixed;bottom:27px;left:50%;transform:translate(-50%,40px);opacity:0;pointer-events:none;background:#483126;color:white;padding:12px 18px;border-radius:13px;font-size:13px;font-weight:800;box-shadow:0 10px 30px #402a2840;z-index:60;transition:all .2s}.toast.show{transform:translate(-50%,0);opacity:1}
.settings-dialog{width:min(450px,calc(100% - 32px));border:1px solid #e2cdb5;border-radius:19px;padding:24px;background:#fffdf8;color:#594538;box-shadow:0 20px 50px #39271a37}.settings-dialog::backdrop{background:#39291e8c}.dialog-header{display:flex;justify-content:space-between;align-items:center;gap:10px}.dialog-header h2{margin:0;font-size:21px}.settings-dialog p{line-height:1.5;font-size:13px;color:#796655}.dialog-action{display:block;width:100%;text-align:center;margin:11px 0;padding:13px;border:1px solid #e3d6c8;border-radius:12px;background:white;color:#664d37;font-weight:850;font-size:12px;cursor:pointer}.dialog-action.warning{color:#ad5548}.file-import{position:relative;overflow:hidden}.file-import input{position:absolute;inset:0;opacity:0;cursor:pointer}.settings-dialog small{color:#a18d7c;font-size:11px}
@media(min-width:1380px){.work-layout{grid-template-columns:minmax(0,1fr) 310px}.topbar{padding-left:24px}}
@media(max-width:1180px){.app-shell{grid-template-columns:250px minmax(0,1fr)}.work-layout{grid-template-columns:minmax(0,1fr)}.tools-column{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}.teacher-note{grid-column:1/-1}.main-content{padding:20px}.board-scroll{max-height:75vh}.tool-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.tool-btn.wide{grid-column:span 1;flex-direction:column;min-height:65px}.topbar-status{width:220px}}
@media(max-width:790px){.app-shell{display:block}.sidebar{position:fixed;z-index:32;left:0;top:0;height:100dvh;width:min(335px,88vw);transform:translateX(-105%);transition:transform .23s;border-right:1px solid #d9c3a5;box-shadow:0 0 20px #33201320}.sidebar.open{transform:translateX(0)}.sidebar-backdrop{position:fixed;inset:0;background:#291b1480;z-index:30;display:none}.sidebar-backdrop.show{display:block}.mobile-menu{display:grid}.topbar{height:70px;gap:10px}.brand{min-width:0;flex:1}.brand-icon{height:41px;width:41px;border-radius:13px}.brand-name strong{font-size:16px}.brand-name span{font-size:9px}.topbar-status{display:none}.topbar-actions .quiet{display:none}.main-content{padding:19px 14px 40px}.lesson-header{align-items:start}.lesson-header-actions{flex-direction:column;align-items:end;gap:7px}.lesson-header-actions .type-chip{display:none}.lesson-header-actions .text-button{white-space:nowrap;font-size:11px;padding:7px 8px}.lesson-header h1{font-size:26px}.lesson-subtitle{font-size:12px}.board-scroll{max-height:75vh}.sidebar-intro{padding-top:25px}.tools-column{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:580px){.main-content{padding:15px 8px 36px}.lesson-header{padding:0 7px}.lesson-header-actions{align-self:center}.lesson-header h1{font-size:22px}.lesson-subtitle{max-width:290px}.art-column{padding:8px;border-radius:15px}.board-label{display:none}.board-toolbar{justify-content:flex-end;margin:3px 3px 8px}.board-scroll{padding:4px}.board-frame{border-radius:2px}.tools-column{display:flex}.tool-card{padding:14px}.lesson-navigation{gap:6px}.nav-button{padding:12px 9px;font-size:10px}.nav-button.primary{flex:1}.teacher-note{order:3}.tool-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.tool-btn{min-height:60px}.tool-btn.wide{grid-column:span 1}.board-caption{font-size:9px}.brand-icon{display:none}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

/* Pencil color selection: consistent for pencil, brush and dot tools. */
.pencil-tool-label{display:inline-flex;gap:7px;align-items:center}
.pencil-color-preview{display:inline-block;width:13px;height:13px;border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 1px #aa947e;flex-shrink:0}
.color-dot{width:32px;height:32px;cursor:pointer;transition:transform .14s,box-shadow .14s}
.color-dot:focus-visible,.custom-color-wrap:focus-within{outline:3px solid #476b9a;outline-offset:3px}
.color-dot.selected{box-shadow:0 0 0 3px #6d4c34;transform:scale(1.08)}
.custom-color-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:12px}
.custom-color-wrap{display:inline-flex;gap:7px;align-items:center;font-size:11px;font-weight:850;background:#fff;border:1px solid #e8d8c7;padding:5px 8px;border-radius:10px;cursor:pointer}
.custom-color-wrap.selected{border-color:#8d633e;box-shadow:0 0 0 2px #bfa284}
.custom-color-wrap input[type=color]{width:30px;height:26px;border:0;padding:0;background:none;cursor:pointer}
.current-color-name{font-size:11px;color:#826c59;font-weight:750}
