/* Handwriting Board */
.handwriting-board-card {
    container-type: size;
    background: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(255,251,235,0.96));
    border-color: rgba(245,158,11,0.42);
    color: #0f172a;
}
.handwriting-board-card .js-widget-resize-handle {
    opacity: 1;
    border-radius: 1.2rem 0 2.2rem 0;
    background: rgba(255, 237, 213, 0.88);
    width: 44px;
    height: 44px;
    bottom: 0;
    right: 0;
    z-index: 45;
    touch-action: none;
    user-select: none;
}
.handwriting-board-card .js-widget-resize-handle::after {
    width: 13px;
    height: 13px;
    border-bottom-color: rgba(15,23,42,0.72);
    border-right-color: rgba(15,23,42,0.72);
}
.handwriting-board-card .js-widget-drag-handle {
    position: absolute;
    border: 0;
    background: transparent;
    opacity: 0;
    margin: 0;
    padding: 0;
    z-index: 6;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.handwriting-board-card .hwb-drag-edge-top {
    top: 0;
    left: 0;
    right: 0;
    height: 2.75rem;
    border-radius: 1.8rem 1.8rem 0 0;
}
.handwriting-board-card .hwb-drag-edge-left {
    top: 2.75rem;
    bottom: 2.25rem;
    left: 0;
    width: 2rem;
}
.handwriting-board-card .hwb-drag-edge-right {
    top: 2.75rem;
    bottom: 3.25rem;
    right: 0;
    width: 2rem;
}
.handwriting-board-card .hwb-drag-edge-bottom {
    left: 0;
    right: 3.25rem;
    bottom: 0;
    height: 2.25rem;
    border-radius: 0 0 0 1.8rem;
}
.handwriting-board-card .js-widget-ctrl {
    position: absolute !important;
    top: -0.625rem !important;
    right: -0.625rem !important;
    z-index: 35;
}
.handwriting-board-card.is-minimized .handwriting-board-widget {
    display: none !important;
}
.handwriting-board-card.is-minimized .js-minimized-label {
    color: #0f172a !important;
}
.handwriting-board-card:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0 !important;
    padding: clamp(0.6rem, 1.5vw, 1.1rem) !important;
}
.handwriting-board-widget {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    gap: 0.45rem;
    border-radius: 1.4rem;
    background: #fff7ed;
    padding: clamp(0.55rem, 1.6cqw, 0.85rem);
    position: relative;
    z-index: 10;
    overflow: hidden;
    pointer-events: none;
}
.handwriting-board-widget * {
    pointer-events: none;
}
.handwriting-board-widget canvas,
.handwriting-board-widget button,
.handwriting-board-widget input,
.handwriting-board-widget select,
.handwriting-board-widget a {
    pointer-events: auto;
}
.handwriting-board-card .js-widget-resize-handle {
    touch-action: none;
    user-select: none;
}
.hwb-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    border-radius: 1.1rem;
    background: rgba(255,255,255,0.82);
    border: 1px solid rgba(251,191,36,0.36);
    padding: 0.45rem;
    box-shadow: 0 10px 22px rgba(15,23,42,0.08);
}
.hwb-tool-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(251,191,36,0.3);
    padding: 0.35rem;
    box-shadow: 0 8px 18px rgba(15,23,42,0.07);
}
.hwb-tool-menu[hidden], .hwb-controls-panel[hidden] {
    display: none !important;
}
.hwb-controls-panel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
}
.handwriting-board-widget.is-controls-collapsed {
    gap: 0.35rem;
}
.hwb-controls-toggle {
    min-width: 2.25rem;
    padding-inline: 0.55rem;
    font-size: 1rem;
}
.hwb-tabs, .hwb-subtools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.hwb-subtools {
    border-radius: 1rem;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(251,191,36,0.28);
    padding: 0.35rem;
}
.hwb-board-style-tools {
    background: rgba(255,255,255,0.58);
}
.hwb-mode-tools {
    background: rgba(255,255,255,0.82);
}
.hwb-title {
    font-size: clamp(0.86rem, 2.5cqw, 1.1rem);
    font-weight: 950;
    color: #78350f;
    margin-right: auto;
}
.hwb-control, .hwb-btn {
    border: 1px solid rgba(148,163,184,0.35);
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: clamp(0.68rem, 1.9cqw, 0.82rem);
    font-weight: 900;
    padding: 0.42rem 0.62rem;
    min-height: 2.25rem;
}
.hwb-btn {
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(15,23,42,0.08);
}
.hwb-btn.is-active {
    background: #f97316;
    border-color: #f97316;
    color: #ffffff;
}
.hwb-tab.is-active {
    background: #78350f;
    border-color: #78350f;
    color: #ffffff;
}
.hwb-print-tab, .hwb-fullscreen-tab {
    min-width: 2.35rem;
    padding-inline: 0.56rem;
}
.hwb-print-tab svg, .hwb-fullscreen-tab svg {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}
.hwb-board {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    border-radius: 1.15rem;
    border: 1px solid rgba(148,163,184,0.3);
    background: #ffffff;
    touch-action: none;
}
.hwb-ghost-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}
.hwb-ghost-line {
    position: absolute;
    left: 4rem;
    right: 1.3rem;
    white-space: pre-wrap;
    color: #111827;
    line-height: 1;
}
.hwb-ghost-line-fitted {
    white-space: pre;
    overflow: hidden;
    text-overflow: clip;
}
.hwb-ghost-svg {
    position: absolute;
    left: 4rem;
    right: 1.3rem;
    width: calc(100% - 5.3rem);
    overflow: visible;
    color: #111827;
}
.hwb-phonics-hint {
    align-items: center;
    min-height: 2.75rem;
    max-width: 28rem;
    border: 1px solid rgba(14,165,233,0.22);
    border-radius: 999px;
    background: #eff6ff;
    color: #075985;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.25;
    padding: 0.55rem 0.85rem;
}
.hwb-board.is-print-preview .hwb-canvas {
    display: none;
}
.hwb-print-preview {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: none;
    overflow: auto;
    background: rgba(15,23,42,0.1);
    padding: 1rem;
    pointer-events: auto;
    touch-action: auto;
    overscroll-behavior: contain;
}
.hwb-board.is-print-preview .hwb-print-preview {
    display: block;
}
.hwb-paper {
    margin: 0 auto;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 16px 32px rgba(15,23,42,0.22);
    padding: 0.55in;
    width: min(100%, 8.27in);
    min-height: 11.2in;
}
.hwb-paper.us_letter { width: min(100%, 8.5in); min-height: 11in; }
.hwb-paper.landscape { width: min(100%, 11.2in); min-height: 8.1in; }
.hwb-paper.us_letter.landscape { width: min(100%, 11in); min-height: 8.5in; }
.hwb-paper-title {
    font-size: 1.4rem;
    font-weight: 950;
    margin-bottom: 0.2rem;
}
.hwb-paper-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.35rem 0 0.6rem;
    font-weight: 800;
}
.hwb-paper-instructions {
    margin-bottom: 0.55rem;
    font-weight: 750;
}
.hwb-paper-lines {
    position: relative;
    border-radius: 0.15rem;
    overflow: hidden;
}
.hwb-prompt-row {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 4;
    padding: 0.55rem 0.75rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.55));
}
.hwb-prompt {
    width: 100%;
    border: 1px solid rgba(148,163,184,0.28);
    border-radius: 999px;
    background: rgba(255,255,255,0.88);
    color: #0f172a;
    font-weight: 900;
    padding: 0.45rem 0.85rem;
}
.hwb-lines {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.hwb-print-lines-svg {
    display: block;
    width: 100%;
    height: auto;
}
.hwb-canvas {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}
.hwb-board.hide-prompt .hwb-prompt-row {
    display: none;
}
.hwb-board.hide-ghost .hwb-ghost-layer {
    display: none;
}
.hwb-print-only { display: none; }
.hwb-board.bg-white { background: #ffffff; }
.hwb-board.bg-cream { background: #fff7ed; }
.hwb-board.bg-yellow { background: #fef9c3; }
.hwb-board.bg-blue { background: #eff6ff; }

/* Shared online/offline layout: the paper uses the available board space. */
.handwriting-board-widget{pointer-events:auto;background:linear-gradient(140deg,#edf5fc,#faf2e9);padding:10px;gap:7px;container-type:size;container-name:handwriting}
.handwriting-board-widget [hidden]{display:none!important}.handwriting-board-widget textarea,.handwriting-board-widget label,.handwriting-board-widget summary,.handwriting-board-widget dialog,.handwriting-board-widget dialog *{pointer-events:auto}
.hwb-toolbar{flex:none;padding:7px 9px;gap:8px;border-color:#dce4ed;border-radius:16px;box-shadow:0 3px 10px #334c6010}.hwb-title{font:900 clamp(12px,2.1cqw,18px)/1.2 Nunito,system-ui,sans-serif;color:#365470}.hwb-toolbar .hwb-tabs{gap:5px}.hwb-toolbar .hwb-btn{font-size:11px;min-height:34px;box-shadow:none}.hwb-tab.is-active{background:#708aa7;border-color:#708aa7}.hwb-print-tab::after{content:'Make worksheet';margin-left:6px;font-size:11px}.hwb-print-tab{display:flex;align-items:center}.hwb-fullscreen-tab{display:flex;align-items:center}.hwb-controls-toggle{margin-left:auto}.hwb-control,.hwb-btn{font-family:Nunito,system-ui,sans-serif}.hwb-btn:disabled{opacity:.45;cursor:default}.handwriting-board-widget :focus-visible{outline:3px solid #9675bd;outline-offset:3px}
.hwb-controls-panel{position:absolute;left:10px;right:10px;top:60px;bottom:10px;z-index:30;overflow:auto;overscroll-behavior:contain;border:1px solid #d6e0e9;border-radius:19px;background:#fffaf3;padding:14px;box-shadow:0 14px 50px #31496530;display:block}.hwb-options-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:10px;color:#3c5671;font:900 16px system-ui}.hwb-subtools{margin:9px 0;padding:11px;border-color:#e3e5e9;gap:8px}.hwb-control{font-size:12px;border-radius:11px;font-weight:700}.hwb-controls-panel textarea{flex:1 1 100%;min-height:70px;resize:vertical;font:14px/1.4 system-ui}.hwb-control input[type=range]{accent-color:#7d91b0;width:100px}.hwb-help{margin:5px 0;font:11px/1.5 system-ui;color:#718195}.hwb-file-tools{background:#edf2f8}.hwb-file-tools label{display:flex;align-items:center;gap:8px}.hwb-file-tools input[type=file]{max-width:210px}.hwb-status{flex:none;min-height:14px;font:10px/1.4 system-ui;color:#6b8295;padding:0 5px}.hwb-trace-nav{display:flex;gap:9px;align-items:center;justify-content:center;flex:none;font:11px system-ui}.hwb-trace-nav button{font-size:10px;min-height:28px;padding:4px 10px}.hwb-board{flex:1;min-height:0;border-radius:14px;box-shadow:inset 0 1px 3px #30485a08}.hwb-controls-panel .hwb-mode-tools{display:flex}.hwb-print-preview{padding:12px;background:#e8eef4}.hwb-preview-sheet{margin:0 auto 16px;position:relative;overflow:hidden;flex:none;box-shadow:0 4px 18px #30445b20}.hwb-paper{box-sizing:border-box;position:relative;min-height:0;margin:0;max-width:none;overflow:hidden;box-shadow:none;color:#172033}.hwb-paper-title{font-size:22px;font-weight:400;line-height:27px;margin:0 0 6px;overflow-wrap:anywhere}.hwb-paper-meta{display:flex;justify-content:space-between;font:12px/19px Arial,sans-serif;height:19px;margin:0 0 10px}.hwb-paper-instructions{font:12px/17px Arial,sans-serif;margin:0 0 8px;overflow-wrap:anywhere}.hwb-page-number{position:absolute;bottom:24px;left:0;right:0;text-align:center;font:10px Arial;color:#64748b}.hwb-font-dialog{border:1px solid #d4dfeb;border-radius:20px;padding:20px;max-width:min(650px,90vw);max-height:80vh;color:#324b61;background:#fffaf3;font:13px/1.5 system-ui}.hwb-font-dialog::backdrop{background:#263b5544}.hwb-font-dialog pre{white-space:pre-wrap;font:10px/1.4 monospace}.hwb-font-dialog summary{cursor:pointer;padding:8px}.handwriting-board-card.hwb-modern-card{background:#e6edf5!important;border-color:#cbd9e7!important;padding:6px!important}.handwriting-board-card.hwb-modern-card .hwb-drag-edge-top,.handwriting-board-card.hwb-modern-card .hwb-drag-edge-bottom{height:7px}.handwriting-board-card.hwb-modern-card .hwb-drag-edge-left,.handwriting-board-card.hwb-modern-card .hwb-drag-edge-right{width:7px}.handwriting-board-card.hwb-modern-card>.js-widget-resize-handle{height:25px;width:25px}.handwriting-board-card.hwb-modern-card .js-widget-ctrl{z-index:40}.hwb-modern-card .hwb-toolbar{padding-right:54px}.hwb-modern-card .hwb-controls-panel{z-index:45}.hwb-modern-card.is-minimized .handwriting-board-widget{display:none!important}.handwriting-board-card.hwb-is-fullscreen{position:fixed!important;inset:0!important;width:100vw!important;height:100dvh!important;z-index:99999!important;border-radius:0!important;transform:none!important}
body.handwriting-board-standalone .standalone-stage{padding:8px!important;min-height:0;align-items:stretch;overflow:hidden}body.handwriting-board-standalone .hwb-standalone-card{width:100%!important;height:100%!important;min-height:0;max-height:100%!important;max-width:1500px;margin:auto;flex:1}body.handwriting-board-standalone .hwb-standalone-card .hwb-toolbar{padding-right:9px}body.handwriting-board-standalone.sa-fullscreen-active .hwb-standalone-card{max-width:none}
@container handwriting (max-width:680px){.hwb-title{width:100%;font-size:13px}.hwb-toolbar .hwb-tabs{margin-right:auto}.hwb-controls-panel{top:85px}.hwb-print-tab::after{font-size:9px}.hwb-toolbar .hwb-btn{font-size:10px;padding:5px 8px}.hwb-status{font-size:9px}}
@media(prefers-reduced-motion:reduce){.handwriting-board-widget *{transition:none!important}}

.hwb-lines{width:100%;height:100%}

.hwb-quick-tools{margin:0;padding:4px 6px;border:0;background:#ffffff70;flex:none;gap:5px}.hwb-quick-tools .hwb-btn,.hwb-quick-tools .hwb-control{font-size:11px;min-height:30px;padding:5px 11px;box-shadow:none}
