:root { font: 17px system-ui, sans-serif; color: #161619; background: #f1f0f5; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible { outline: 2px solid #2688ed; outline-offset: 3px; }
header { display: flex; align-items: center; gap: 16px; min-height: 80px; margin: 0 3%; border-bottom: 1px solid #dedde3; }
header h1 { font-size: clamp(1.2rem, 3vw, 2rem); margin: 0; }
header strong { margin-inline: auto; background: #e2e3e9; color: #087dcc; border-radius: 36px; padding: .55em 1em; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(25px, 8vw, 104px) 11.5%; padding: 7.4vw 6.5vw; }
.book { display: grid; text-align: left; padding: 0; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.cover { display: grid; place-content: center; width: 100%; aspect-ratio: 3 / 4; border-radius: 5px 18px 18px 5px; background: #fbfaf2; box-shadow: 2px 4px 10px #0002; }
.cover::before { content: ''; width: clamp(25px, 10vw, 110px); aspect-ratio: 3 / 5; background: #202023; box-shadow: 1px 3px 5px #0003; }
.new .cover { color: #1581e8; border: 2px dashed #ceced4; background: transparent; box-shadow: none; border-radius: 18px; text-align: center; gap: 1em; }
.new .cover::before { content: '+'; font-size: 1.8rem; border: 2px solid #6689ee; border-radius: 50%; display: grid; place-content: center; width: 1.8em; aspect-ratio: 1; margin: auto; background: none; box-shadow: none; }
.tab { display: flex; align-items: center; min-height: 48px; gap: 14px; padding: 0 2%; background: #eaebf0; }
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 4px 2%; background: white; border-bottom: 1px solid #eeedf0; gap: 6px; }
.bar button { min-height: 36px; min-width: 35px; padding: 3px 6px; }
.bar button[aria-pressed=true] { background: #e7f2ff; color: #056bd2; }
.bar.secondary { min-height: 48px; }
.swatches, .history, .zoom { display: flex; align-items: center; gap: 5px; }
.bar .swatch { min-width: 25px; min-height: 25px; width: clamp(25px, 3vw, 32px); height: clamp(25px, 3vw, 32px); padding: 0; border-radius: 100%; background: var(--swatch); }
.bar .swatch[aria-pressed=true] { outline: 1px solid #222; outline-offset: 2px; }
.workspace { display: flex; flex: 1; min-height: 0; }
.paper-scroll { flex: 1; overflow: auto; }
canvas { display: block; margin-inline: auto; background: white; touch-action: none; }
.page-list { width: min(30%, 235px); flex: none; padding: 12px; overflow: auto; background: #f5f5f7; }
.page-list button { width: 100%; padding: 12px 4px; }
.page-list button[aria-current=true] { background: #dceaff; }
#status { position: fixed; bottom: 10px; left: 10px; padding: 8px 12px; background: #222; color: white; border-radius: 8px; }
@media (max-width: 540px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar.secondary { flex-wrap: wrap; }
}

.editor { position: relative; height: 100dvh; display: flex; flex-direction: column; }
.editor-brand { height: 36px; flex: none; padding: 7px 22px; font-size: 18px; font-weight: 650; background: #eaebf0; }
.editor > .bar:not(.secondary) { min-height: 66px; display: grid; grid-template-columns: repeat(19, minmax(0, 1fr)); padding-inline: 1.2%; gap: 0; }
.editor > .bar:not(.secondary) button { justify-self: center; }
.editor > .bar [data-tool=pen] { grid-column: 4; }
.editor > .bar [data-tool=highlight] { grid-column: 5; }
.editor > .bar [data-tool=eraser] { grid-column: 6; }
.editor > .bar [data-action=shapes] { grid-column: 7; }
.editor > .bar [data-action=add] { grid-column: 17; }
@media (max-width: 680px) {
  .editor > .bar:not(.secondary) { display:flex; overflow-x:auto; justify-content:flex-start; flex-shrink:0; }
  .editor > .bar:not(.secondary) > button { flex:none; }
}
.bar > button svg { width: 32px; height: 32px; display: block; }
.bar svg, .shape-panel svg { stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.shape-quick { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; order: 1; }
.shape-quick:not([hidden]) { display: flex; justify-content: space-between; }
.secondary.shape-mode .swatches, .secondary.shape-mode [aria-label=Spessore] { display: none; }
.secondary .zoom { order: 2; }
.shape-quick button { flex: 0 0 42px; }
.shape-quick svg { display: block; width: 31px; height: 31px; }
.shape-panel { z-index: 1; position: absolute; top: 164px; left: min(17%, 190px); width: min(358px, 90vw); max-height: min(820px, 70dvh); overflow: auto; border-radius: 28px; background: #fdfdfd; padding: 34px 22px 22px; box-shadow: 0 6px 35px #0002; }
.shape-panel h3 { margin: 17px 10px 7px; font-size: 15px; color: #777; font-weight: 400; }
.shape-options { display: grid; grid-template-columns: repeat(4, 1fr); }
.shape-options button { display: grid; place-items: center; min-height: 88px; }
.shape-options button:hover, .shape-quick button:hover { background: #ecf4ff; }
.shape-options img, .shape-options svg { display: block; width: 48px; height: 48px; object-fit: contain; }
@media (max-width: 540px) {
  .shape-panel { left: 5%; }
}

.tab { padding: 0 12px; height: 48px; gap: 4px; }
.tab > button { padding: 5px; }
.tab > button svg { display: block; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; }
.tabs { display: flex; align-self: flex-end; flex: 1; overflow: auto; scrollbar-width: none; }
.notebook-tab { display: flex; flex: 0 1 262px; min-width: 110px; height: 36px; border-radius: 15px 15px 0 0; }
.notebook-tab[data-active=true] { background: white; }
.notebook-tab button:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notebook-tab button:last-child { width: 42px; flex: none; }
.page-list { width: min(31%, 344px); padding: 0; background: #f2f2f2; border-right: 1px solid #ddd; }
.page-list-heading { height: 50px; border-bottom: 1px solid #ddd; display: grid; place-items: center; }
.page-list-heading svg { height: 22px; width: 22px; fill: none; stroke: #2685ed; stroke-width: 2; }
.page-options { padding: 20px 6%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.page-options button { display: grid; place-items: center; gap: 10px; padding: 0; font-size: 16px; }
.page-options button[aria-current=true] { background: transparent; }
.page-options canvas { width: min(100%, 108px); border: 1px solid #c8c8c8; touch-action: auto; }
.page-options button[aria-current=true] canvas { outline: 2px solid #2585ef; outline-offset: -2px; }

.cover-image { background-size: 100% 100%; }
.cover-image::before { content: none; }
.creator { min-height: 100dvh; background: #f3f2f7; }
.creator-top { min-height: 382px; position: relative; padding-top: 36px; border-radius: 0 0 27px 27px; background: radial-gradient(ellipse at 55% 20%, #edeafb 5%, transparent 55%), radial-gradient(ellipse at 92% 24%, #f8e2ed, transparent 40%), linear-gradient(105deg, white 27%, #f9f2fd); box-shadow: 0 4px 7px #0002; }
.creator-brand { position: absolute; top: 8px; left: 22px; font-weight: 650; }
.creator-close { position: absolute; top: 48px; right: 3%; font-size: 33px; width: 42px; line-height: 1.35; }
.creator-main { display: grid; grid-template-columns: 22.5% 23.5% 43%; gap: 1%; padding: 86px 4% 40px; align-items: end; }
.creator-main > button { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 0 0 10px; position: relative; font-size: clamp(12px, 1.7vw, 18px); }
.creator-main > button[aria-pressed=true] { font-weight: 650; }
.creator-main > button[aria-pressed=true]::after { content: ''; width: 26px; height: 4px; background: #46a6ec; border-radius: 6px; position: absolute; bottom: 0; }
.creator-main img { width: min(12vw, 132px); aspect-ratio: 3 / 4; border-radius: 10px; }
.creator-paper-preview { width: min(10vw, 110px); aspect-ratio: 3 / 4; box-shadow: 2px 3px 8px #0002; }
.creator-settings { width: min(100%, 408px); margin-left: 4%; display: grid; gap: 8px; }
.creator-settings input { border: 0; border-bottom: 1px solid #e0dce7; outline: none; padding: 8px 0 14px; background: transparent; font-size: clamp(16px, 2.2vw, 24px); }
.creator-size { border: 1px solid #d7d2df; border-radius: 12px; padding: 10px 15px; background: #ffffff60; font-size: clamp(11px, 1.7vw, 18px); }
.creator-submit { justify-self: center; margin-top: 29px; padding: 10px 16px; width: 80%; min-height: 54px; color: #fff; font-size: clamp(14px, 2.25vw, 25px); border-radius: 99px; background: linear-gradient(95deg, #25c5f3, #7872fa, #c53dd0); }
.creator-options { padding: 44px 0 40px 5.4%; overflow: hidden; }
.creator-options h2 { margin: 0 0 16px; font-weight: 500; font-size: 20px; }
.creator-colors { display: flex; gap: clamp(8px, 2.5vw, 27px); margin-bottom: 32px; }
.creator-colors button, .creator-custom-color { width: 33px; height: 33px; border-radius: 50%; border: 1px solid #d0cfd3; padding: 0; }
.creator-colors button[aria-pressed=true] { border-color: #1688e9; }
.creator-custom-color { display: grid; place-items: center; border-color: currentColor; cursor: pointer; font-size: 25px; line-height: 1; position: relative; overflow: hidden; }
.creator-custom-color input { cursor: pointer; position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.creator-strip { display: flex; gap: 3.8vw; overflow-x: auto; scrollbar-width: none; padding-right: 5vw; padding-bottom: 2px; }
.creator-strip > button { position: relative; padding: 0; flex: 0 0 clamp(94px, 15.9vw, 176px); text-align: center; font-size: 16px; }
.creator-strip img, .paper-card { width: 100%; aspect-ratio: 176 / 228; display: block; }
.creator-strip img { border-radius: 17px; aspect-ratio: 3 / 4; }
.paper-card { border: 1px solid #d5d4d8; margin-bottom: 5px; }
.creator-strip > button[aria-pressed=true] > :first-child { outline: 1px solid #53a9ec; outline-offset: -1px; }
.creator-strip > button[aria-pressed=true]::after { content: '✓'; position: absolute; right: 10px; bottom: 8px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #3189ec; }
.paper-strip > button[aria-pressed=true]::after { bottom: 37px; color: #3389d5; border: 2px solid #49a7e9; background: #fff; }
.creator-options .model-heading { margin-top: 82px; }
.creator-model { margin: 0 5.4% 32px 0; padding: 20px 8px 50px 30px; background: #f8f8f8; border: 1px solid #dcdce1; border-radius: 18px; }
.creator-model h3 { margin: 0 0 20px; font-size: 18px; font-weight: 500; }
.creator-model-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: min(1.5vw, 16px); }
.creator-model-row button { width: 100%; aspect-ratio: 3 / 4; border: 1px solid #0001; border-radius: 0; }
.creator-cover-group { padding-bottom: 38px; margin-bottom: 44px; border-bottom: 1px solid #dbdae0; }
.creator-cover-group h2 { margin-bottom: 22px; }
@media (max-width: 640px) {
  .creator-top { min-height: 0; }
  .creator-main { padding-top: 64px; padding-bottom: 20px; grid-template-columns: 22% 26% 47%; }
  .creator-settings { margin-left: 0; }
  .creator-submit { margin-top: 8px; width: 100%; min-height: 36px; }
  .creator-options .model-heading { margin-top: 42px; }
  .creator-model { padding: 16px 12px; }
}

.creator-main > button:first-child img { width: min(11vw, 122px); }
.creator-format { position: relative; }
.creator-size { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 46px; }
.format-arrow { margin-left: auto; color: #888; }
.creator-format-list { position: absolute; inset: calc(100% + 8px) 0 auto; z-index: 2; padding: 16px 24px; border-radius: 18px; background: #fff; box-shadow: 0 12px 35px #0002; }
.creator-format-list button { display: flex; width: 100%; align-items: center; min-height: 49px; text-align: left; padding: 8px; gap: 12px; }
.creator-format-list button small { margin-left: auto; color: #929294; font-size: 13px; }
.creator-format-list button[aria-pressed=true]::after { content: '✓'; color: #2384ea; margin-left: auto; }
.format-heading { color: #929294; padding-left: 8px; margin: 10px 0 3px; }
@media (max-width: 640px) {
  .creator-main { padding-top: 64px; grid-template-columns: 22% 26% 47%; }
  .creator-format-list { inset-inline: auto 0; width: min(280px, 90vw); }
}

.ink-panel, .color-panel { z-index: 2; position: absolute; background: #fdfdfd; border-radius: 27px; box-shadow: 0 6px 36px #0002; }
.ink-panel { width: min(407px, calc(100vw - 28px)); top: 162px; left: 14px; padding: 27px 32px 30px; }
.ink-panel[data-type=highlight] { left: min(46px, 5vw); }
.ink-panel::before, .color-panel::before { content: ''; position: absolute; top: -7px; width: 15px; height: 15px; border-radius: 3px; transform: rotate(45deg); background: inherit; }
.ink-panel::before { left: min(169px, 44%); }
.ink-panel[data-type=highlight]::before { left: min(196px, 49%); }
.ink-panel h2 { margin: 0 0 38px; font-size: 22px; text-align: center; font-weight: 550; }
.ink-panel h3 { margin: 25px 0 12px; font-size: 20px; font-weight: 450; }
.ink-modes { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 3px; margin-inline: -11px; }
.ink-modes button, .ink-styles button { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 2px; font-size: 15px; }
.ink-modes button { min-height: 70px; color: #777; }
.ink-modes svg { width: 34px; height: 34px; color: #19191a; }
.ink-panel svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ink-modes [aria-pressed=true], .ink-modes [aria-pressed=true] svg, .ink-styles [aria-pressed=true] { color: #267fe8; }
.ink-modes [aria-pressed=true] svg { fill: #8bd3ff; }
.ink-panel .ink-demo { width: 100%; height: 108px; stroke: #19191a; stroke-width: 5; }
.ink-styles { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px 10px; }
.ink-styles button span { display: grid; place-items: center; width: 100%; height: 42px; border: 1px solid #d4d4d7; border-radius: 11px; }
.ink-styles button[aria-pressed=true] span { border-color: #2684ed; }
.ink-styles button svg { width: 90%; height: 100%; color: #151516; stroke-width: 4; }
.ink-styles button { min-width:0; width:100%; }
.ink-style-label { max-width:100%; font-size:13px; line-height:1.35; overflow-wrap:anywhere; }
.ink-caps { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ink-caps button span { height: 66px; }
.ink-caps button svg { stroke-width: 9; }
.ink-range { display: grid; grid-template-columns: 1fr auto; gap: 14px; font-size: 20px; }
.ink-range input { grid-column: 1 / -1; width: 100%; accent-color: #2787ed; }
.color-panel { --panel-width: min(336px, calc(100vw - 24px)); width: var(--panel-width); top: 223px; left: clamp(12px, calc(var(--anchor-x) - var(--panel-width) / 2), calc(100vw - var(--panel-width) - 12px)); padding: 29px 25px; border-radius: 22px; max-height: calc(100dvh - 239px); overflow-y: auto; }
.color-panel h2 { margin: 0 7px 20px; font-size: 22px; font-weight: 550; }
.ink-grid { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); }
.ink-grid button { border-radius: 0; aspect-ratio: 1.06; padding: 0; }
.ink-grid button[aria-pressed=true] { box-shadow: inset 0 0 0 2px #fff; }
.ink-color-field { display: flex; align-items: center; gap: 15px; margin: 30px 7px 45px; }
.ink-color-field input[type=color] { width: 60px; height: 60px; border-radius: 13px; border: 0; padding: 0; cursor: pointer; background: transparent; }
.ink-color-field input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.ink-color-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 13px; }
.ink-color-field input[type=text] { width: 110px; border: 0; background: transparent; }
.ink-swatches { display: grid; grid-template-columns: repeat(5,1fr); justify-items: center; gap: 21px 10px; }
.ink-swatches button { position: relative; padding: 0; width: 33px; height: 33px; border-radius: 50%; box-shadow: 0 2px 5px #0003; }
.ink-swatches button[aria-pressed=true]::after { content: '✓'; color: white; text-shadow: 0 1px 2px #000; }
@media (max-width: 540px) {
  .ink-panel { padding: 20px 22px; max-height: calc(100dvh - 172px); overflow-y: auto; }
  .color-panel { top: 242px; max-height: calc(100dvh - 255px); }
}

.bar .swatch[aria-pressed=true] { background: var(--swatch); }
@media (min-width: 800px) {
  .bar.secondary:not(.shape-mode) { position: relative; }
  .secondary:not(.shape-mode) .swatches { position: absolute; left: 30.5%; gap: 25px; }
  .secondary:not(.shape-mode) [aria-label=Spessore] { position: absolute; left: 55.4%; gap: 15px; }
  .secondary .swatch { width: 32px; height: 32px; }
}
.secondary [aria-label=Spessore] button { font-size: 0; display: grid; place-items: center; background: transparent; }
.secondary [aria-label=Spessore] button::after { content: ''; width: 32px; height: 3px; background: #858587; border-radius: 12px; }
.secondary [aria-label=Spessore] button:nth-child(2)::after { height: 10px; }
.secondary [aria-label=Spessore] button:nth-child(3)::after { height: 18px; }
.secondary [aria-label=Spessore] button[aria-pressed=true]::after { background: #18181a; }

.workspace { position: relative; }
.ruler-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ruler-overlay > svg { width: 100%; height: 100%; display: block; overflow: hidden; }
.ruler-face, .ruler-dial { pointer-events: all; touch-action: none; }
.ruler-face { fill: #c1c1c4; fill-opacity: .21; cursor: move; }
.ruler-marks, .ruler-dial-marks { pointer-events: none; }
.ruler-marks path, .ruler-dial-marks path { stroke: #737374; stroke-width: 1; }
.ruler-marks .ruler-zero { stroke: #151516; stroke-width: 2.7; }
.ruler-overlay text { font: 16px system-ui, sans-serif; text-anchor: middle; fill: #232324; user-select: none; }
.ruler-dial { cursor: ew-resize; }
.ruler-dial circle { fill: #fff; fill-opacity: .93; }
.ruler-dial-marks .ruler-cardinal { stroke: #64a3da; stroke-width: 1.35; }
.ruler-face:focus-visible, .ruler-dial:focus-visible { outline: 2px solid #2688ed; }
.editor > .bar [data-action=ruler] { grid-column: 8; }
.editor > .bar [data-action=ruler][aria-pressed=true] { background: transparent; color: #172127; }
[data-action=ruler][aria-pressed=true] .ruler-icon-body { fill: #87d3f5; }

.editor > .bar [data-action=calculator] { grid-column: 9; }
[data-action=calculator][aria-pressed=true] .calc-icon-body { fill: #80cafa; }
dialog.calculator { border: 0; color: #18181a; padding: 39px 21px 45px; width: min(616px, calc(100vw - 24px)); height: min(608px, calc(100dvh - 24px)); max-height: none; max-width: none; border-radius: 28px; background: #fdfdfd; overflow: auto; }
dialog.calculator.expanded { width: min(740px, calc(100vw - 24px)); }
dialog.calculator::backdrop { background: #00000017; }
.calc-grip { position: absolute; left: calc(50% - 34px); top: 3px; width: 68px; height: 27px; display: grid; place-items: center; cursor: move; touch-action: none; }
.calc-grip::after { content: ''; width: 53px; height: 5px; border-radius: 9px; background: #d7d7d7; }
.calc-top { display: flex; align-items: center; justify-content: space-between; height: 49px; margin: 0 -6px 14px; }
.calc-top > button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; font-size: 32px; font-weight: 300; }
.calc-top svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.calc-modes { display: flex; gap: 16px; }
.calc-modes > * { border-radius: 30px; padding: 7px 14px; font-size: 18px; }
.calc-modes button { border: 1px solid transparent; }
.calc-modes button[aria-pressed=true] { background: #297ef2; color: #fff; }
.calc-modes .calc-hand { position: relative; border: 1px solid #e3e3e3; opacity: 1; }
.calc-modes .calc-hand[aria-pressed=true] { border-color: #297ef2; }
.calc-hand i { position: absolute; right: -7px; top: -9px; width: 21px; height: 21px; border-radius: 50%; background: #ffb52e; color: white; font-style: normal; line-height: 21px; }
.calc-display { height: 158px; border: 1px solid #ddd; background: #f0f0f0; border-radius: 11px; display: flex; flex-direction: column; justify-content: end; padding: 10px 11px 14px; text-align: right; }
.calc-display output, .calc-expression { overflow: hidden; white-space: nowrap; }
.calc-display output { display: block; font-size: 42px; font-weight: 550; }
.calc-expression { color: #797979; font-size: 20px; }
.calc-keys { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 18px 10px; padding: 21px 5px 0; }
.calc-keys[hidden] { display: none; }
.calc-keys button { height: 42px; padding: 0; border-radius: 23px; background: #f2f2f2; box-shadow: inset 0 -1px 0 #d6d6d6; font-size: 19px; }
.calc-keys button:active { background: #e1e8f4; }
.calc-keys button:is([data-key="0"],[data-key="1"],[data-key="2"],[data-key="3"],[data-key="4"],[data-key="5"],[data-key="6"],[data-key="7"],[data-key="8"],[data-key="9"],.calc-accent) { font-size: 24px; }
.calc-keys button[aria-pressed=true], .calc-keys .calc-accent { color: #227fe9; }
.calc-keys .calc-equals { color: #fff; background: linear-gradient(#5cbcf7,#237cee); box-shadow: inset 0 -1px #0760ba; }
.calc-handwriting { display: grid; grid-template-columns: minmax(0,1fr) 64px; height: 303px; border: 1px solid #ddd; border-radius: 0 0 11px 11px; overflow: hidden; }
.calc-handwriting[hidden] { display: none; }
.calc-paper-wrap { position: relative; min-width: 0; background: #f7f7f7; }
.calc-paper { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.calc-placeholder { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #a5a5a5; font-size: 20px; pointer-events: none; }
.calc-hand-actions { display: grid; grid-template-rows: repeat(3,minmax(0,1fr)); border-left: 1px solid #e5e5e5; background: #fff; }
.calc-hand-actions button { display: grid; place-items: center; padding: 0; border: 0; border-bottom: 1px solid #efefef; border-radius: 0; background: #fff; color: #2b83f1; font-size: 30px; }
.calc-hand-actions button:last-child { border-bottom: 0; }
.calc-hand-actions svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.calc-hand-actions [data-calc=equals] { color: #fff; background: #2b83f1; font-weight: 600; }
.calc-hand-actions [data-calc=pen].erasing { color: #e04b4b; }
.calc-resize { position: absolute; right: 11px; bottom: 8px; font-size: 29px; line-height: 1; padding: 2px; }
.calculator.history-open :is(.calc-display,.calc-keys,.calc-modes,.calc-handwriting,[data-calc=history]) { display: none; }
.calc-history { height: calc(100% - 62px); overflow: auto; text-align: right; padding-inline: 5px; }
.calc-history section { padding: 0 0 3px; border-bottom: 1px solid #ddd; margin-bottom: 14px; }
.calc-history button { display: block; width: 100%; text-align: right; font-size: 23px; padding: 10px 0; overflow-wrap: anywhere; }
.calc-date, .calc-empty { color: #828282; padding-top: 5px; }
.eraser-warning { margin: 10px 0 0; color: #a32324; font-size: 12px; line-height: 1.35; }
@media (max-width: 580px), (max-height: 690px) {
  dialog.calculator { padding: 26px 10px 30px; height: min(470px, calc(100dvh - 20px)); border-radius: 19px; }
  .calc-top { margin-bottom: 7px; }
  .calc-modes { gap: 5px; }
  .calc-modes > * { font-size: clamp(11px, 3.5vw, 16px); padding: 6px 8px; }
  .calc-display { height: 100px; }
  .calc-display output { font-size: 32px; }
  .calc-handwriting { height: 250px; grid-template-columns: minmax(0,1fr) 52px; }
  .calc-placeholder { font-size: 16px; }
  .calc-hand-actions button { font-size: 26px; }
  .calc-hand-actions svg { width: 24px; height: 24px; }
  .calc-keys { gap: 8px 5px; padding: 12px 1px 0; }
  .calc-keys button, .calc-keys button:is([data-key],.calc-accent) { height: 35px; font-size: clamp(12px, 4vw, 19px); }
}

dialog.page-picker { border: 0; width: min(976px, calc(100vw - 28px)); height: min(800px, calc(100dvh - 28px)); max-width: none; max-height: none; padding: 24px 0 12px; border-radius: 28px; color: #151517; background: #f2f2f2; overflow-y: auto; }
dialog.page-picker::backdrop { background: #0003; }
.page-picker h2 { margin: 3px 0 40px; text-align: center; font-size: 21px; font-weight: 550; }
.page-picker-close { position: absolute; left: 26px; top: 17px; width: 44px; height: 44px; font-size: 32px; font-weight: 300; line-height: 1; color: #767678; }
.page-picker-mode-row { display: flex; position: relative; justify-content: center; align-items: center; margin: 0 32px 45px; }
.page-picker-modes { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); width: min(728px, 82%); border: 1px solid #d9d9d9; border-radius: 30px; }
.page-picker-modes button { min-height: 38px; padding: 3px 5px; border-radius: 30px; font-size: clamp(11px, 1.7vw, 17px); }
.page-picker-modes button[aria-pressed=true] { background: #2b83f1; color: white; }
.page-picker-import { position: absolute; right: -14px; width: 41px; height: 41px; display: grid; place-items: center; padding: 4px; border-radius: 50%; background: #4ca5e9; color: white; }
.page-picker-import svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.page-picker-palette { display: flex; justify-content: space-between; align-items: center; margin: 0 17px 32px 32px; gap: 12px; }
.page-picker-palette h3 { margin: 0; font-size: 21px; font-weight: 530; }
.page-picker-colors { display: flex; align-items: center; gap: clamp(8px, 2.4vw, 26px); }
.page-picker-colors button { width: 33px; height: 33px; border-radius: 50%; border: 1px solid #d2d2d2; padding: 0; }
.page-picker-colors button[aria-pressed=true] { border-color: #3286eb; }
.page-picker-strip { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-auto-columns: 163px; gap: 35px 16px; overflow-x: auto; scrollbar-width: none; padding: 0 32px; }
.page-picker-strip > button { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0; min-width: 0; min-height: 255px; text-align: center; font-size: 16px; }
.page-picker-preview { display: block; width: 100%; flex: none; aspect-ratio: 3/4; border: 1px solid #d4d4d8; background: white; }
.page-picker-plus { display: grid; place-items: center; color: #2c85ed; font-size: 45px; font-weight: 300; border-color: transparent; }
.page-picker-error { position: sticky; bottom: 2px; margin: 8px 15px 0; padding: 8px; color: #a32324; background: #fff; text-align: center; }
@media (max-width: 650px), (max-height: 840px) {
  dialog.page-picker { height: auto; }
  .page-picker h2 { margin-bottom: 22px; }
  .page-picker-mode-row { margin-bottom: 20px; }
  .page-picker-palette { flex-wrap: wrap; margin-bottom: 17px; }
  .page-picker-strip { grid-auto-columns: clamp(95px, 20vw, 130px); gap: 16px 10px; padding-bottom: 7px; }
  .page-picker-strip > button { min-height: 0; font-size: 13px; }
}

.ink-panel[data-type=eraser] { left: min(105px, 10vw); padding-top: 17px; }
.ink-panel[data-type=eraser]::before { left: min(196px, 49%); }
.ink-panel[data-type=eraser] h2 { margin-bottom: 21px; }
.ink-panel[data-type=eraser] h3 { font-size: 15px; color: #838384; margin: 0 0 16px; }
.ink-panel[data-type=eraser] label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 20px; min-height: 41px; }
.ink-panel[data-type=eraser] label + h3 { margin-top: 44px; }
.ink-panel[data-type=eraser] input { appearance: none; width: 54px; height: 27px; margin: 0; border-radius: 30px; background: #e6e6e8; position: relative; cursor: pointer; flex: none; }
.ink-panel[data-type=eraser] input:checked { background: #2d81f1; }
.ink-panel[data-type=eraser] input::after { content: ''; position: absolute; left: 2px; top: 2px; width: 23px; height: 23px; background: white; border-radius: 50%; }
.ink-panel[data-type=eraser] input:checked::after { left: 29px; }
.secondary.eraser-mode .swatches { display: none; }
.secondary.eraser-mode [aria-label=Spessore] button::after { width: 14px; height: 14px; border-radius: 50%; }
.secondary.eraser-mode [aria-label=Spessore] button:nth-child(2)::after { width: 23px; height: 23px; }
.secondary.eraser-mode [aria-label=Spessore] button:nth-child(3)::after { width: 34px; height: 34px; }

.editor > .bar:not(.secondary) [data-tool=eraser][aria-pressed=true] { background: transparent; color: #19191b; }
[data-tool=eraser][aria-pressed=true] .eraser-tip { fill: #89d4f9; }
.secondary .history [data-action] svg { display: block; width: 32px; height: 26px; stroke-width: 2.2; }
.secondary .history [data-action] { color: #48484c; }
@media (min-width: 800px) {
  .editor > .bar:not(.secondary) { position: relative; }
  .editor > .bar:not(.secondary) > button { position: absolute; grid-area: auto; left: var(--tool-x); top: 50%; transform: translate(-50%, calc(-50% + 4px)); }
  .editor > .bar [data-action=pages] { --tool-x: 3.87%; }
  .editor > .bar [data-tool=pen] { --tool-x: 17.09%; }
  .editor > .bar [data-tool=highlight] { --tool-x: 22.39%; }
  .editor > .bar [data-tool=eraser] { --tool-x: 27.79%; }
  .editor > .bar [data-action=shapes] { --tool-x: 33.09%; }
  .editor > .bar [data-action=ruler] { --tool-x: 38.49%; }
  .editor > .bar [data-action=calculator] { --tool-x: 43.88%; }
  .editor > .bar [data-action=add] { --tool-x: 85.34%; }
  .secondary:not(.shape-mode) > .history:first-child { margin-left: 34px; gap: 10px; }
  .secondary.eraser-mode [aria-label=Spessore] { left: 28%; }
}

.editor > .bar [data-action=stickers] { grid-column: 16; --tool-x: 79.9%; }
.editor > .bar [data-action=stickers][aria-pressed=true] { background: transparent; color: #2d7ce3; }
[data-action=stickers][aria-pressed=true] .sticker-icon-body { fill: #83c7ff; }
.sticker-panel { position: absolute; z-index: 2; inset: 0 0 min(82px, 6dvh) auto; width: min(418px, 54vw); display: flex; flex-direction: column; overflow: hidden; background: #f5f5f5; box-shadow: -5px 3px 17px #0001; }
.sticker-panel[hidden] { display: none; }
.sticker-search { display: flex; align-items: center; gap: 8px; min-height: 48px; margin: 11px 16px 19px; padding: 0 13px; border-radius: 30px; border: 1px solid #d3d3d3; background: #fdfdfd; }
.sticker-search svg { flex: none; width: 25px; height: 25px; fill: none; stroke: #79797a; stroke-width: 1.5; }
.sticker-search input { width: 100%; min-width: 0; border: 0; background: none; color: #222; font-size: 18px; }
.sticker-categories { padding: 0 12px 10px; text-align: center; white-space: nowrap; overflow: auto; }
.sticker-categories button { width: min(268px, 100%); border-radius: 30px; padding: 5px 15px; background: #2a82f0; color: white; font-size: 16px; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-content: start; gap: 13px 24px; padding: 13px 14px; overflow: auto; flex: 1; }
.sticker-grid button { border-radius: 0; padding: 0; min-width: 0; aspect-ratio: 1; background: #ededee; }
.sticker-grid button:disabled { opacity: 1; }
.sticker-grid img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sticker-empty { margin: auto 12px; text-align: center; color: #6d6d72; }
.sticker-footer { padding: 22px 10px; display: grid; justify-items: center; background: #fff; box-shadow: 0 -1px 8px #0001; }
.sticker-footer:has(> :not([hidden])) { min-height: 96px; }
.sticker-footer:not(:has(> :not([hidden]))) { display: none; }
.sticker-download { width: min(271px, 100%); min-height: 51px; border-radius: 30px; color: white; background: linear-gradient(110deg,#377cf8,#fa39cf); font-size: 24px; }
.sticker-remove { background: #fff2f2; color: #a62629; padding: 10px 15px; }
@media (max-width: 650px) {
  .sticker-search { margin: 7px; padding-inline: 6px; }
  .sticker-search input { font-size: 13px; }
  .sticker-grid { gap: 7px; padding: 7px; }
}


.library { min-height: 100dvh; background: #f1f0f5; }
.library-brand { height: 36px; padding: 7px 22px; font-size: 18px; font-weight: 650; }
.library-header { position: relative; min-height: 84px; margin: 0 2.4%; }
.library-header strong { position: absolute; left: 50%; transform: translateX(-50%); }
.library-primary { display: flex; gap: 14px; margin-left: auto; }
.library svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; display: block; }
.library-primary button, .library-tools button { padding: 7px; }
.library-tools { min-height: 67px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 0 2.3%; }
.library .grid { padding-top: 15px; row-gap: clamp(32px, 9vw, 106px); align-items: start; }
.library-book { min-width: 0; }
.library-book > .book { display: block; width: 100%; position: relative; }
.library-book-label { display: flex; align-items: center; gap: 8px; margin-top: 15px; font-size: clamp(13px, 2vw, 19px); overflow-wrap: anywhere; }
.library-book-label button { flex: none; padding: 0 8px 4px; font-weight: 700; }
.library-book time { display: block; margin-top: 5px; font-size: 15px; color: #717177; }
.library .selecting .library-book .cover { filter: brightness(.82); }
.library .selecting .library-book > button::after { content: ''; position: absolute; width: 24px; height: 24px; bottom: 16px; left: 50%; translate: -50%; border: 2px solid white; border-radius: 50%; display: grid; place-items: center; color: white; }
.library .selecting .library-book > button[aria-pressed=true]::after { content: '✓'; background: #2d86ef; }
.library-search { padding: 10px 7% 0; }
.library-search input { width: 100%; border: 1px solid #d8d7dd; background: #fff; border-radius: 18px; padding: 9px 15px; }
.library-popover { position: fixed; z-index: 2; width: min(385px, 90vw); padding: 16px 20px; border-radius: 23px; background: #f6f5f8; box-shadow: 0 7px 24px #0003; }
.library-popover h2, .library-dialog h2 { margin: 0 0 16px; text-align: center; font-size: 21px; }
.library-popover button { display: block; width: 100%; text-align: left; padding: 13px; background: #fff; }
.library-popover button + button { border-top: 1px solid #eee; }
.library-dialog { border: 0; border-radius: 17px; padding: 24px; width: min(430px, 90vw); background: #fff; }
.library-dialog::backdrop { background: #0004; }
.library-dialog input { width: 100%; padding: 8px; border: 1px solid #d8d7dd; border-radius: 8px; }
.library-dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 17px; }
.library-dialog button { padding: 8px; color: #1778d8; }
.library-trash-list { max-height: 55dvh; overflow: auto; }
.library-trash-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px; border-bottom: 1px solid #eee; }
@media (max-width: 540px) {
  .library-header strong { position: static; transform: none; padding: 5px 8px; font-size: 14px; margin: 0; }
  .library-primary { gap: 2px; }
}

.library-tools { position: relative; }
.library-tools .library-sidebar-toggle { position: absolute; left: 2.3%; }
.library.has-sidebar { --sidebar-width: min(276px, 38vw); padding-left: var(--sidebar-width); }
.library.has-sidebar .library-sidebar-toggle { visibility: hidden; }
.library.has-sidebar .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(32px, 9vw, 106px) 23%; }
.library-sidebar { position: fixed; inset: 36px auto 0 0; z-index: 1; width: var(--sidebar-width); background: #f8f8f8; box-shadow: 2px 0 9px #0001; padding: 12px 17px; overflow-y: auto; }
.library-sidebar-tools { display: flex; justify-content: space-between; align-items: center; }
.library-sidebar-tools button { color: #117cd6; padding: 9px; }
.library-sidebar-tools svg { width: 25px; height: 25px; }
.library-sidebar h2 { font-size: 21px; font-weight: 500; margin: 9px 10px 17px; }
.library-folder-list button, .library-document-list button, .library-destinations button { display: flex; align-items: center; text-align: left; gap: 9px; width: 100%; min-height: 49px; padding: 6px; overflow-wrap: anywhere; }
.library-folder-list button[aria-current=true] { color: #1c7ed6; background: #eaeaec; }
.library-sidebar .library-folder-list svg { color: #167fd9; width: 23px; height: 23px; flex: none; }
.library-document-list button { padding-left: 18px; }
.library-document-list svg { width: 25px; height: 25px; flex: none; }
.library-destinations { max-height: 45dvh; overflow: auto; }
.library-destinations button + button { border-top: 1px solid #eee; }
.library-dialog.folder-name-dialog { width: min(474px, 90vw); border-radius: 27px; padding: 27px 0 0; }
.folder-name-dialog h2 { margin-bottom: 20px; font-weight: 550; }
.folder-name-dialog input { display: block; width: calc(100% - 60px); margin: 0 30px 40px; padding: 10px 13px; font-size: 20px; background: #f3f3f3; border-radius: 12px; }
.folder-name-dialog .library-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 0; border-top: 1px solid #e2e2e2; }
.folder-name-dialog .library-dialog-actions button { height: 76px; border-radius: 0; font-size: 22px; }
.folder-name-dialog .library-dialog-actions button:first-child { color: #171719; border-right: 1px solid #e2e2e2; }
@media (max-width: 620px) {
  .library.has-sidebar .grid { grid-template-columns: 1fr; }
  .library-sidebar { padding-inline: 8px; }
  .library-sidebar h2, .library-sidebar button { font-size: 14px; }
}

.library-dialog.merge-dialog { width: min(768px, calc(100vw - 24px)); height: min(1017px, calc(100dvh - 24px)); max-width: none; max-height: none; border-radius: 28px; padding: 31px 32px 0; overflow: hidden; }
.merge-dialog[open] { display: flex; flex-direction: column; }
.merge-dialog h2 { font-size: 21px; font-weight: 550; margin: 0 40px 41px; }
.merge-dialog > p { margin: 0 0 12px; color: #87878a; }
.merge-dialog .merge-close { position: absolute; top: 19px; right: 24px; font-size: 32px; font-weight: 300; color: #888; }
.merge-list { overflow: auto; flex: 1; }
.merge-list button { display: grid; grid-template-columns: 28px 62px minmax(0,1fr); align-items: center; gap: 26px; min-height: 126px; width: 100%; padding: 13px 0; text-align: left; color: #171719; }
.merge-order { display: grid; place-items: center; width: 27px; height: 27px; border: 2px solid #949498; border-radius: 50%; font-size: 15px; }
.merge-list button[aria-pressed=true] .merge-order { background: #2e82ef; color: #fff; border-color: #2e82ef; }
.merge-cover { width: 61px; aspect-ratio: 3/4; background: #faf8ed center / 100% 100%; }
.merge-meta { display: grid; align-content: space-between; align-self: stretch; padding: 6px 0; overflow-wrap: anywhere; font-size: 21px; }
.merge-meta time { font-size: 16px; color: #858588; }
.merge-footer { display: grid; justify-items: center; padding: 14px 0; min-height: 76px; box-shadow: 0 -3px 12px #0001; margin-inline: -32px; }
.merge-footer button { width: min(292px, 80%); color: #fff; background: #2d82f1; border-radius: 30px; font-size: 23px; font-weight: 550; }
.merge-footer button:disabled { background: #d4d4d4; opacity: 1; }
.merge-error { color: #a42628; margin: 0 10px 7px; }
@media (max-width: 530px) {
  .library-dialog.merge-dialog { padding-inline: 15px; }
  .merge-list button { gap: 10px; min-height: 96px; grid-template-columns: 28px 46px minmax(0,1fr); }
  .merge-cover { width: 46px; }
  .merge-meta { font-size: 16px; }
  .merge-footer { margin-inline: -15px; }
}

.backup-dialog h2 { margin-bottom: 33px; }
.backup-dialog > .backup-hint { white-space: pre-line; line-height: 2; margin-bottom: 20px; }
.backup-dialog .merge-footer { position: relative; }
.backup-dialog .merge-footer button:not(.backup-all) { width: min(340px, 58%); background: linear-gradient(110deg,#377cf8,#fa39cf); }
.backup-dialog .merge-footer button:not(.backup-all):disabled { background: #d4d4d4; }
.backup-dialog .merge-footer .backup-all { position: absolute; width: auto; left: 21px; top: 21px; display: flex; gap: 9px; align-items: center; padding: 3px 6px; background: transparent; color: #19191a; font-size: 17px; }
.backup-all::before { content: ''; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #999; border-radius: 50%; }
.backup-all[aria-pressed=true]::before { content: '✓'; border-color: #2c84ed; background: #2c84ed; color: #fff; }

.editor > .bar [data-action=export] { grid-column: 18; --tool-x: 91%; }
.export-panel { position: absolute; top: 164px; right: 14px; z-index: 4; width: min(407px, calc(100vw - 28px)); max-height: calc(100dvh - 180px); overflow-y: auto; padding: 32px 32px 42px; border-radius: 26px; background: #fdfdfd; box-shadow: 0 8px 30px #0002; }
.export-panel h2 { margin: 0 0 30px; text-align: center; font-size: 21px; font-weight: 550; }
.export-close { position: absolute; top: 23px; left: 23px; font-size: 32px; line-height: 1; padding: 5px 10px; }
.export-formats { display: flex; justify-content: space-between; gap: 12px; padding: 0 10px 32px; }
.export-formats button { position: relative; clip-path: polygon(0 0,66% 0,100% 29%,100% 100%,0 100%); display: grid; place-content: center; gap: 0; width: 82px; height: 98px; border-radius: 5px; background: #ba3941; color: #fff; font-weight: 650; }
.export-formats button::before { content: ''; position: absolute; right: 0; top: 0; width: 34%; height: 29%; background: #fff5; border-radius: 0 0 0 4px; }
.export-formats button[aria-pressed=true]::after { content: '✓'; position: absolute; left: calc(50% - 10px); bottom: 6px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: #8f3038; background: white; font-size: 15px; }
.export-formats button:nth-child(2) { background: #f9aa58; }
.export-formats button:nth-child(3) { background: #6cc9f1; }
.export-formats small { font-size: 12px; }
.export-row { display: flex; align-items: center; justify-content: space-between; min-height: 73px; width: 100%; font-size: 20px; padding: 0; gap: 10px; }
.export-row[hidden] { display: none; }
.export-row input[type=text] { width: 48%; border: 0; background: transparent; font-size: 17px; text-align: right; }
.export-count { font-size: 17px; }
.export-quality { margin: 24px 0 42px; padding: 22px 0 0; border: 0; font-size: 20px; }
.export-quality legend { padding: 0; }
.export-quality label, .export-pages label { display: flex; align-items: center; gap: 10px; min-height: 61px; }
.export-quality label[hidden] { display: none; }
.export-quality input, .export-pages input { width: 20px; height: 20px; margin: 0; accent-color: #2f86ef; }
.export-pages { max-height: 180px; overflow: auto; }
.export-pages label { min-height: 40px; }
.export-watermark input { appearance: none; position: relative; width: 54px; height: 27px; border-radius: 30px; background: #ddd; margin: 0; }
.export-watermark input:checked { background: #2d81f1; }
.export-watermark input::after { content: ''; position: absolute; left: 2px; top: 2px; width: 23px; height: 23px; background: white; border-radius: 50%; }
.export-watermark input:checked::after { left: 29px; }
.export-submit { display: block; min-height: 48px; width: 100%; margin-top: 13px; color: white; border-radius: 30px; background: linear-gradient(110deg,#377cf8,#fa39cf); font-size: 22px; }
.export-error { color: #ad282d; }
.export-save-status { font-size:14px; line-height:1.4; overflow-wrap:anywhere; }
.export-save-download { display:block; width:100%; min-height:40px; margin-top:10px; border:1px solid #bcc9da; border-radius:24px; color:#2768be; }
.export-save-download[hidden],.export-save-status[hidden] { display:none; }

.library-popover.library-create-menu { width: min(330px, calc(100vw - 20px)); border-radius: 26px; padding: 17px 27px; background: #fdfdfd; }
.library-create-menu button { display: flex; align-items: center; min-height: 81px; gap: 22px; padding: 9px 0; font-size: clamp(18px, 2.1vw, 24px); font-weight: 630; background: transparent; }
.library-create-menu button + button { border: 0; }
.library-create-menu button span { display: grid; place-items: center; width: 49px; height: 49px; border-radius: 50%; background: #2d85ed; color: #fff; flex: none; }
.library-create-menu button:nth-child(2) span { background: #33c15c; }
.library-create-menu button:nth-child(3) span { background: #16bbea; }
.library-create-menu button:nth-child(4) span { background: #ff9b10; }
.library-create-menu button svg { width: 28px; height: 28px; stroke-width: 1.65; }

.export-panel.is-selecting { padding: 32px 22px 0; }
.export-panel.is-selecting > :not(.export-selection) { display: none; }
.export-selection h2 { margin-bottom: 28px; }
.export-pages { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 20px 11px; max-height: min(340px, 52dvh); padding: 2px 0 22px; }
.export-pages label { position: relative; flex-direction: column; min-width: 0; gap: 10px; cursor: pointer; }
.export-pages input { position: absolute; inset: 0; z-index: 1; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.export-page-tile { width: 100%; aspect-ratio: 176 / 246; position: relative; display: grid; align-items: center; border: 2px solid #ddd; background: #fff; }
.export-page-tile canvas { width: 100%; height: 100%; object-fit: contain; }
.export-pages input:checked + .export-page-tile { border-color: #2a82ef; }
.export-pages input:focus-visible + .export-page-tile { outline: 2px solid #245cab; outline-offset: 1px; }
.export-page-mark { display: none; position: absolute; right: 7px; bottom: 7px; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #fff; background: #2b83ed; }
.export-pages input:checked + .export-page-tile .export-page-mark { display: grid; }
.export-select-all { display: block; width: calc(100% + 44px); margin: 39px -22px 0; padding: 20px 10px; min-height: 75px; border-radius: 0; box-shadow: 0 -2px 10px #0001; font-size: 23px; font-weight: 550; }


.page-option { position: relative; min-width: 0; }
.page-option > button:first-child { width: 100%; }
.page-option .page-option-more { position: absolute; right: max(3px, calc((100% - 108px) / 2 + 6px)); bottom: 32px; width: 28px; height: 15px; border-radius: 12px; background: #e5e6e8; color: #2c7cdf; font-size: 11px; line-height: 1; letter-spacing: 0; }
.page-context { position: fixed; z-index: 5; width: min(180px, 45vw); border-radius: 14px; padding: 5px; background: #fff; box-shadow: 0 6px 25px #0002; }
.page-context button { display: block; width: 100%; padding: 10px; text-align: left; font-size: 15px; }
.page-context button + button { border-top: 1px solid #eee; }
.page-context button:last-child { color: #a32a2e; }

.pdf-password label { display: grid; gap: 7px; }
.pdf-password-message { color: #55565a; }

.library-book.book-drop-target > .book { outline: 3px solid #2f86ed; outline-offset: 5px; }

.library-popover.appearance-panel { width: min(407px, calc(100vw - 20px)); border-radius: 27px; padding: 71px 21px 0; background: #f1f0f5; }
.appearance-panel h2 { margin: 0 38px 16px; font-weight: 550; }
.appearance-panel button.appearance-back { position: absolute; top: 63px; left: 16px; width: 45px; text-align: center; padding: 0 0 4px; background: transparent; font-size: 34px; line-height: 1; }
.appearance-options { border-radius: 28px; overflow: hidden; }
.appearance-options button { display: flex; justify-content: space-between; align-items: center; border-radius: 0; min-height: 66px; padding: 0 17px; font-size: 21px; }
.appearance-options button + button { border: 0; }
.appearance-options button[aria-pressed=true]::after { content: '✓'; color: #347fe8; font-size: 28px; }

:root[data-theme=dark] {
  color-scheme: dark;
  --dark-base: #1c1c20;
  --dark-chrome: #26262b;
  --dark-surface: #2d2d33;
  --dark-field: #393940;
  --dark-line: #48484f;
  --dark-text: #f2f2f5;
  --dark-muted: #b0b0bb;
  background: var(--dark-base);
  color: var(--dark-text);
}
[data-theme=dark] :is(.library,.creator,.workspace) { background: var(--dark-base); }
[data-theme=dark] :is(.editor-brand,.tab,.page-list,.library-sidebar,.sticker-panel,.creator-model) { background: var(--dark-chrome); }
[data-theme=dark] :is(.bar,.notebook-tab[data-active=true],.shape-panel,.ink-panel,.color-panel,.export-panel,.page-context,.sticker-footer,.creator-format-list,.library-popover,.library-popover.library-create-menu,.library-popover.appearance-panel,.library-dialog,dialog.calculator,dialog.page-picker) {
  background: var(--dark-surface);
  color: var(--dark-text);
}
[data-theme=dark] :is(.library-popover button,.library-search input,.folder-name-dialog input,.sticker-search,.sticker-grid button,.calc-display,.calc-keys button:not(.calc-equals),.creator-size) { background: var(--dark-field); color: var(--dark-text); }
[data-theme=dark] :is(.library-create-menu button,.appearance-panel button.appearance-back) { background: transparent; }
[data-theme=dark] :is(.library-header,.library-popover button,.library-dialog input,.page-list,.page-list-heading,.bar,.creator-model,.creator-settings input,.creator-size,.page-context button,.calc-display,.calc-modes .calc-hand,.sticker-search,.ink-styles button span,.merge-list button,.page-picker-modes,.library-trash-list > div,.library-destinations button) { border-color: var(--dark-line); }
[data-theme=dark] :is(.creator-settings input,.sticker-search input,.export-row input,.merge-list button,.folder-name-dialog .library-dialog-actions button:first-child,.backup-dialog .merge-footer .backup-all,.ink-modes svg,.ink-styles button svg) { color: var(--dark-text); }
[data-theme=dark] :is(.library-book time,.creator-format-list small,.format-heading,.shape-panel h3,.ink-modes button,.merge-meta time,.merge-dialog > p,.pdf-password-message,.calc-expression,.calc-date,.calc-empty,.sticker-empty) { color: var(--dark-muted); }
[data-theme=dark] .creator-top { background: radial-gradient(ellipse at 58% 15%, #35304a, transparent 70%), linear-gradient(105deg,#27272d,#342630); }
[data-theme=dark] :is(.library-header strong,.library-folder-list button[aria-current=true],.bar button[aria-pressed=true]:not(.swatch)) { background: #354361; color: #add1ff; }
[data-theme=dark] .calc-keys button.calc-accent:not(.calc-equals) { color: #83bbff; }
[data-theme=dark] .ink-panel .ink-demo { stroke: var(--dark-text); }
[data-theme=dark] .secondary .history [data-action] { color: var(--dark-muted); }
[data-theme=dark] .bar > button svg circle[fill=white] { fill: var(--dark-surface); }

.page-list-heading { display: flex; justify-content: space-evenly; align-items: stretch; }
.page-list-heading button { display: grid; place-items: center; position: relative; width: 40%; padding: 0; }
.page-list-heading button svg { stroke: currentColor; }
.page-list-heading button[aria-pressed=true] { color: #2782ef; }
.page-list-heading button[aria-pressed=true]::after { content: ''; position: absolute; bottom: 0; height: 3px; width: 23px; background: currentColor; border-radius: 4px; }
.page-options[hidden] { display: none; }
.outline-content { padding: 12px; }
.outline-content.outline-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100% - 50px); padding: 0 7px 16px; text-align: center; }
.outline-empty img { width: min(192px, 88%); }
.outline-empty p { max-width: 194px; margin: 42px auto 80px; color: #707074; line-height: 1.25; }
.page-list .outline-create { width: auto; max-width: 100%; min-height: 41px; padding: 4px 12px; color: #fff; background: linear-gradient(110deg,#377cf8,#fa39cf); border-radius: 30px; font-size: clamp(14px,1.9vw,20px); }
.outline-entries > div { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 3px; border-bottom: 1px solid #d0d0d4; }
.outline-entries button:first-child { display: grid; text-align: left; gap: 3px; overflow-wrap: anywhere; padding-inline: 7px; }
.outline-entries button:last-child { padding-inline: 8px; color: #2a7fdf; }
.outline-entries small { font-size: 13px; color: #777; }
.outline-content:not(.outline-empty) .outline-create { display: block; margin: 15px auto 0; }
[data-theme=dark] .outline-empty img { mix-blend-mode: luminosity; opacity: .65; }
[data-theme=dark] :is(.outline-empty p,.outline-entries small) { color: var(--dark-muted); }

.editor > .bar [data-action=search] { grid-column: 13; --tool-x: 63.85%; }
.note-search { position: absolute; top: 164px; right: 14px; z-index: 4; width: min(407px, calc(100vw - 28px)); max-height: calc(100dvh - 180px); overflow: auto; padding: 16px; border-radius: 24px; background: #fdfdfd; box-shadow: 0 8px 28px #0002; }
.note-search-head, .note-search-head label { display: flex; align-items: center; gap: 8px; }
.note-search-head label { flex: 1; min-width: 0; border: 1px solid #d7d7da; border-radius: 28px; padding: 5px 12px; background: #f5f5f6; }
.note-search-head input { width: 100%; min-width: 0; background: transparent; border: 0; padding: 7px 0; }
.note-search-head svg { width: 23px; height: 23px; flex: none; fill: none; stroke: #747478; stroke-width: 1.7; }
.note-search-head > button { font-size: 27px; line-height: 1; padding: 6px; }
.note-search-results button { display: grid; gap: 6px; width: 100%; padding: 13px 7px; text-align: left; overflow-wrap: anywhere; border-bottom: 1px solid #ddd; }
.note-search-results small, .note-search-status { color: #66666c; }
.note-search-status { margin: 12px 6px 2px; }
.note-search-status:empty { display: none; }
[data-theme=dark] .note-search { background: var(--dark-surface); color: var(--dark-text); }
[data-theme=dark] .note-search-head label { background: var(--dark-field); border-color: var(--dark-line); }
[data-theme=dark] :is(.note-search-results small,.note-search-status) { color: var(--dark-muted); }

.library-dialog.exam-dialog { width: min(448px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: 27px; padding: 33px 16px 32px; }
.exam-dialog h2 { margin-bottom: 29px; font-weight: 550; }
.exam-month { display: flex; align-items: center; justify-content: space-between; font-size: 21px; }
.exam-month button { color: #67676c; padding: 0 17px; font-size: 34px; line-height: 1.2; }
.exam-calendar { display: grid; grid-template-columns: repeat(7,1fr); align-items: center; text-align: center; margin-top: 18px; }
.exam-calendar span { color: #838388; height: 30px; }
.exam-calendar button { position: relative; min-height: 52px; padding: 4px; color: inherit; border-radius: 19px; font-size: 16px; }
.exam-calendar button[aria-pressed=true] { background: #e5f0ff; color: #1f73d5; }
.exam-calendar button:is(.today,.has-exam)::after { content: ''; position: absolute; width: 7px; height: 7px; bottom: 6px; left: calc(50% - 3.5px); border-radius: 50%; background: #c5c5c8; }
.exam-calendar button.has-exam::after { background: #2d82f0; }
.exam-results { min-height: 224px; padding: 35px 8px 15px; text-align: center; }
.exam-results img { width: 140px; }
.exam-results p { margin: 9px auto 0; color: #858589; font-size: 15px; }
.exam-results button { display: grid; gap: 4px; width: 100%; text-align: left; border-bottom: 1px solid #ddd; color: inherit; overflow-wrap: anywhere; }
.exam-results button small { color: #777; }
.exam-dialog button.exam-add { display: block; margin: 29px auto 0; width: min(312px, 91%); min-height: 54px; border-radius: 30px; background: #2d83f1; color: #fff; font-size: 20px; }
.exam-form { display: grid; padding: 0 16px; gap: 18px; }
.exam-form label { display: grid; gap: 7px; }
.exam-error { color: #ad282d; }
[data-theme=dark] .exam-results img { opacity: .7; }
[data-theme=dark] :is(.exam-results p,.exam-results small,.exam-calendar span) { color: var(--dark-muted); }

.secondary .finger-mode { font: inherit; font-size: 12px; width: 34px; padding: 2px; border-radius: 5px; }
.secondary .finger-mode[aria-pressed=true] { color: #0876e1; background: #e6f1ff; }

.paper-scroll > canvas + canvas { margin-top: 18px; }
.paper-scroll { overflow-anchor: none; }

@media (min-width: 800px) { .secondary .finger-mode { position: absolute; left: 20%; top: 6px; } }
.ink-advanced { margin-block: 8px; font-size: 14px; }

.object-actions { position: absolute; top: 8px; right: 12px; display: flex; gap: 6px; padding: 4px; border: 1px solid #ddd; border-radius: 9px; background: white; box-shadow: 0 2px 8px #0002; z-index: 2; font-size: 14px; }
.object-actions[hidden] { display: none; }
.object-actions button { padding: 8px; }

[data-theme=dark] .object-actions { background: var(--dark-surface); color: var(--dark-text); border-color: var(--dark-line); }

.viewport-ink { position: absolute; margin: 0; pointer-events: none; background: transparent; z-index: 0; }
.viewport-ink[hidden] { display: none; }
.ruler-overlay { z-index: 1; }

.ink-panel canvas.ink-demo { background: transparent; touch-action: auto; }

.object-actions { flex-wrap: wrap; max-width: calc(100% - 24px); }
.sticker-footer { flex-wrap: wrap; gap: 8px; }

.editor > .bar [data-action=selectobjects] { --tool-x:49.2%; grid-column:10; }
.secondary.select-mode :is(.swatches,[aria-label=Spessore]) { display:none; }

#save-status { position: fixed; bottom: 10px; right: 10px; max-width: min(500px,90vw); z-index: 8; padding: 8px 12px; border-radius: 8px; background: #fff; color: #333; box-shadow: 0 2px 8px #0002; font-size: 13px; }
#save-status[hidden] { display: none; }
#save-status button { color: #0876e1; padding: 6px; }

#save-status:not([data-error=true]) { pointer-events:none; }
.selection-tools { display:flex; align-items:center; gap:8px; margin-left:auto; }
.selection-tools[hidden] { display:none; }
.selection-tools button { font-size:14px; }
.recognition-dialog,.text-editor-dialog { border:0; border-radius:18px; padding:24px; width:min(680px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; background:#fff; color:#222; }
.recognition-dialog h2,.text-editor-dialog h2 { margin-top:0; }
.recognition-dialog p { font-size:14px; line-height:1.4; }
.recognition-preview { display:block; max-width:100%; max-height:200px; object-fit:contain; margin:12px auto; border:1px solid #ddd; }
.recognition-dialog textarea,.text-editor-dialog textarea { display:block; width:100%; min-height:120px; font:18px system-ui; margin:12px 0; padding:10px; border:1px solid #ccc; border-radius:8px; }
.recognition-actions,.text-editor-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.recognition-dialog button,.text-editor-dialog button { padding:8px 12px; background:#edf4ff; color:#086aca; }
[data-theme=dark] :is(.recognition-dialog,.text-editor-dialog) { background:var(--dark-surface); color:var(--dark-text); }
@media (max-width:540px) {
  .object-actions { flex-wrap:nowrap; overflow-x:auto; white-space:nowrap; }
  .object-actions > * { flex:none; }
}

/* iPad chrome measured from U02; iPadOS supplies its own status row. */
.editor { --main-bottom:82px; --chrome-bottom:118px; }
.editor > .tab { height:34px; min-height:34px; flex:none; padding:0 10px; }
.editor .tab > button { padding:3px; }
.editor .tab > button svg { width:20px; height:20px; }
.editor .notebook-tab { height:26px; border-radius:12px 12px 0 0; font-size:12px; }
.editor .notebook-tab button:last-child { width:30px; }
.editor > .bar:not(.secondary) { height:48px; min-height:48px; flex:none; display:flex; position:relative; padding:0 12px; }
.editor > .bar:not(.secondary) > button { position:absolute; left:var(--tool-x); top:50%; transform:translate(-50%,-50%); }
.editor .bar button { min-width:30px; min-height:30px; padding:3px; }
.editor .bar > button svg { width:24px; height:24px; }
.editor > .bar [data-action=pages] { --tool-x:2.7%; }
.editor > .bar [data-tool=pen] { --tool-x:11.9%; }
.editor > .bar [data-tool=highlight] { --tool-x:15.6%; }
.editor > .bar [data-tool=eraser] { --tool-x:19.3%; }
.editor > .bar [data-action=shapes] { --tool-x:23%; }
.editor > .bar [data-action=ruler] { --tool-x:26.8%; }
.editor > .bar [data-action=calculator] { --tool-x:30.5%; }
.editor > .bar [data-action=selectobjects] { --tool-x:34.3%; }
.editor > .bar [data-action=image] { --tool-x:38%; }
.editor > .bar [data-action=text] { --tool-x:41.7%; }
.editor > .bar [data-action=search] { --tool-x:74.9%; }
.editor > .bar [data-action=stickers] { --tool-x:86.1%; }
.editor > .bar [data-action=add] { --tool-x:89.8%; }
.editor > .bar [data-action=export] { --tool-x:93.6%; }
.editor > .bar.secondary { height:36px; min-height:36px; padding:0 12px; flex:none; position:relative; }
.editor .secondary .history [data-action] svg { width:24px; height:20px; }
.editor .secondary:not(.shape-mode) > .history:first-child { margin-left:28px; gap:8px; }
.editor .secondary:not(.shape-mode) .swatches { left:36.4%; gap:18px; }
.editor .secondary:not(.shape-mode) [aria-label=Spessore] { left:54.2%; gap:12px; }
.editor .secondary .swatch { width:24px; height:24px; min-width:24px; min-height:24px; }
.editor .secondary [aria-label=Spessore] button::after { width:24px; height:2px; }
.editor .secondary [aria-label=Spessore] button:nth-child(2)::after { height:7px; }
.editor .secondary [aria-label=Spessore] button:nth-child(3)::after { height:13px; }
.editor .secondary.eraser-mode [aria-label=Spessore] { left:28%; }
.editor .secondary.eraser-mode [aria-label=Spessore] button::after { width:10px; height:10px; }
.editor .secondary.eraser-mode [aria-label=Spessore] button:nth-child(2)::after { width:17px; height:17px; }
.editor .secondary.eraser-mode [aria-label=Spessore] button:nth-child(3)::after { width:24px; height:24px; }
.editor .secondary .finger-mode { top:3px; font-size:10px; }
.editor .secondary .zoom { font-size:11px; gap:0; }
.editor :is(.ink-panel,.shape-panel,.export-panel,.note-search) { top:calc(var(--main-bottom) + 8px); max-height:calc(100dvh - var(--main-bottom) - 20px); }
.editor .color-panel { top:calc(var(--chrome-bottom) + 8px); max-height:calc(100dvh - var(--chrome-bottom) - 20px); }
@media (max-width:900px) {
  .editor > .bar:not(.secondary) { overflow-x:auto; gap:14px; scrollbar-width:thin; }
  .editor > .bar:not(.secondary) > button { position:static; transform:none; flex:none; }
  .editor > .bar.secondary { height:auto; min-height:36px; flex-wrap:wrap; gap:6px; padding:3px 8px; }
  .editor .secondary:not(.shape-mode) > .history:first-child { margin-left:0; }
  .editor .secondary:not(.shape-mode) :is(.swatches,[aria-label=Spessore]),.editor .secondary .finger-mode { position:static; }
  .editor .secondary:not(.shape-mode) .swatches { gap:8px; }
  .editor .secondary:not(.shape-mode) [aria-label=Spessore] { gap:4px; }
  .editor .secondary .zoom { margin-left:auto; }
}

/* Native pen sheet from U03/U05: 300 CSS px, five tips, one pressure slider,
   one advanced sheet with the eight ZDDrawingPen parameters. */
.editor .ink-panel { width:min(300px,calc(100vw - 28px)); padding:34px 30px 30px; max-height:calc(100dvh - var(--main-bottom) - 20px); overflow-y:auto; border-radius:26px; }
.editor .ink-panel h2 { margin:0; font-size:18px; font-weight:600; }
.ink-panel-head { position:relative; display:grid; place-items:center; min-height:30px; margin-bottom:24px; }
.ink-panel-head h2 { margin:0 !important; }
.ink-back { position:absolute; left:-14px; top:50%; transform:translateY(-50%); width:30px; height:30px; display:grid; place-items:center; padding:0; }
.ink-back svg { width:20px; height:20px; }
.editor .ink-panel h3 { margin:24px 0 10px; font-size:17px; font-weight:500; }
.editor .ink-panel .ink-modes { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:2px; margin:0 -8px 6px; }
.editor .ink-panel .ink-modes button { min-height:74px; color:#7b7b80; font-size:12.5px; line-height:1.15; gap:4px; padding:1px; }
.editor .ink-panel .ink-modes button span { white-space:nowrap; }
.editor .ink-panel .ink-modes svg { width:30px; height:30px; }
.editor .ink-panel .ink-modes [aria-pressed=true] { color:#2d81f1; }
.editor .ink-panel .ink-modes [aria-pressed=true] svg { fill:#8bd3ff; }
.ink-panel .ink-demo { display:block; width:100%; height:62px; margin:0; }
.editor .ink-panel .ink-tip-range { display:grid; grid-template-columns:1fr auto; align-items:center; gap:8px 10px; margin-top:18px; font-size:16.5px; }
.editor .ink-panel .ink-tip-range input { grid-column:1 / -1; width:100%; margin-top:6px; accent-color:#2d81f1; }
.ink-more { display:flex; width:100%; min-height:50px; align-items:center; justify-content:space-between; gap:10px; padding:0; font-size:17px; text-align:left; color:#171719; }
.ink-more span:last-child { color:#8c8c91; font-size:23px; font-weight:300; line-height:1; }
.ink-section-label { margin:24px 0 4px; color:#9b9ba0; font-size:13px; }
.ink-switch { display:flex; min-height:46px; align-items:center; justify-content:space-between; gap:10px; font-size:17px; }
.ink-switch input { appearance:none; width:48px; height:26px; margin:0; border-radius:30px; background:#e6e6e8; position:relative; cursor:pointer; flex:none; }
.ink-switch input:checked { background:#2d81f1; }
.ink-switch input::after { content:''; position:absolute; left:2px; top:2px; width:22px; height:22px; background:#fff; border-radius:50%; }
.ink-switch input:checked::after { left:24px; }
.ink-advanced-list { display:grid; gap:8px; }
.ink-advanced-row { display:grid; grid-template-columns:1fr auto; align-items:start; gap:5px 8px; font-size:15px; margin-bottom:4px; }
.ink-advanced-row span { line-height:1.25; }
.ink-advanced-row output { font-size:14px; color:#3a3a3d; }
.ink-advanced-row input { grid-column:1 / -1; width:100%; accent-color:#2d81f1; margin:2px 0 0; }
.ink-reset { display:block; margin:18px 0 0; padding:4px 0; color:#2d81f1; font-size:15px; }
.ink-note { margin:0 0 16px; color:#707075; font-size:13px; line-height:1.45; }
.ink-primary { display:block; width:100%; min-height:40px; border-radius:22px; background:#2d81f1; color:#fff; font-size:14px; }
.eraser-size { display:grid; grid-template-columns:1fr auto; align-items:center; gap:6px 10px; margin:0 0 10px; font-size:15px; }
.eraser-size input { grid-column:1 / -1; width:100%; accent-color:#2d81f1; }
.eraser-size output { font-size:13px; color:#5d5d62; }
[data-theme=dark] .ink-more { color:var(--dark-text); }
[data-theme=dark] .ink-switch input { background:var(--dark-field); }
[data-theme=dark] .ink-switch input:checked { background:#2d81f1; }
[data-theme=dark] .ink-note, [data-theme=dark] .ink-section-label, [data-theme=dark] .ink-advanced-row output { color:var(--dark-muted); }
@media (max-width:540px) {
  .editor .ink-panel { padding:18px 22px 22px; }
  .ink-panel-head { margin-bottom:12px; }
}
.calc-correction { width:calc(100% - 24px); margin:0 12px 4px; border:0; border-bottom:1px solid #dedee2; background:transparent; color:inherit; font:18px system-ui; padding:6px; }
.calc-correction[hidden],.calc-recognition-status[hidden] { display:none; }
.calc-recognition-status { font-size:11px; margin:0 16px 4px; color:#626268; }
.calculator .calc-display { position:relative; }
.calculator.handwriting .calc-expression { opacity:0; }
.calculator .calc-correction { position:absolute; left:8px; top:8px; width:calc(100% - 16px); margin:0; height:32px; }
.calculator .calc-recognition-status { position:absolute; left:12px; top:44px; margin:0; }

/* Pages form a horizontal document. Vertical scrolling belongs to each tall page. */
.workspace { overflow:hidden; position:relative; }
.paper-scroll { display:flex; align-items:flex-start; gap:18px; padding-inline:5%; }
.paper-scroll > canvas { flex:none; margin:0; transform:translateX(var(--page-pull,0px)); }
.paper-scroll > canvas + canvas { margin-top:0; }
.workspace > .viewport-ink { transform:translateX(var(--page-pull,0px)); }
.page-pull-hint { position:absolute; right:8px; top:45%; width:120px; padding:10px; border-radius:12px; background:#f0f1f5; color:#666970; font-size:12px; text-align:center; pointer-events:none; }
.page-pull-hint[hidden] { display:none; }
.selection-filters { display:flex; align-items:center; gap:9px; }
.selection-filters svg { display:block; width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linejoin:round; stroke-linecap:round; }
.selection-filters button[aria-pressed=true] { color:#2685ed; background:transparent; }
.selection-filters button[aria-pressed=false] { color:#a5a5a9; }
.secondary.select-mode .selection-tools { flex-wrap:wrap; }
.editor .secondary.select-mode { height:auto; min-height:36px; }
.editor > .bar [data-action=cursor] { --tool-x:7%; }
.editor[data-selection-mode=cursor] .active-paper { cursor:default; }
.selection-filters[hidden] { display:none; }
html,body { touch-action:pan-x pan-y; overscroll-behavior:none; }
.library-brand{display:flex;align-items:center;gap:8px}.library-brand img{object-fit:contain;border-radius:7px}
.bar button[role=switch][aria-checked=true]{background:#e7f2ff;color:#056bd2}
.editor > .bar [data-action=theme]{--tool-x:97.3%;grid-column:20}
.editor > .bar [data-action=paper-math]{--tool-x:45.4%;grid-column:12}
.editor > .bar [data-action=scribble-erase]{--tool-x:49.1%;grid-column:13}
.creator-colors,.page-picker-colors{flex-wrap:wrap}
.paper-color-controls{display:flex;flex:1 0 100%;gap:10px;justify-content:center}
.creator-colors .paper-color-controls button,.page-picker-colors .paper-color-controls button{width:auto;height:36px;padding:6px 12px;border:1px solid #bfc7d2;border-radius:8px;font-size:14px;white-space:nowrap}
.paper-color-controls button[aria-expanded=true]{background:#e7f2ff;color:#056bd2}
.paper-palette.color-panel{position:fixed;z-index:60;max-height:calc(100dvh - var(--chrome-bottom,118px) - 20px);}
.page-picker .paper-palette h2{text-align:left;margin:0 7px 20px;font-size:22px;font-weight:550}
.paper-math-pending{position:absolute;bottom:36px;left:50%;transform:translateX(-50%);z-index:44;pointer-events:none;border-radius:16px;background:#fff;padding:7px 14px;box-shadow:0 2px 12px #243b5326;color:#465a70;font:13px system-ui}
.workspace:not([data-pulling=true]) > .paper-scroll > canvas,.workspace:not([data-pulling=true]) > .viewport-ink { transition:transform 220ms cubic-bezier(.18,.8,.25,1); }
.workspace[data-pulling=true] > .paper-scroll > canvas,.workspace[data-pulling=true] > .viewport-ink { transition:none; }

.paper-math-review{position:absolute;bottom:36px;left:50%;transform:translateX(-50%);z-index:45;display:flex;align-items:center;gap:8px;flex-wrap:wrap;max-width:calc(100% - 24px);width:620px;padding:12px;background:#fff;border:1px solid #cad3df;border-radius:12px;box-shadow:0 5px 24px #243b5326;font:14px system-ui}.paper-math-review label{flex:1;min-width:180px}.paper-math-review input{width:100%;box-sizing:border-box;font:18px system-ui;padding:6px;border:1px solid #bdc8d5;border-radius:5px}.paper-math-review button{padding:8px;border:1px solid #ccd6e3;border-radius:6px;background:#edf4ff;color:#26456e}.paper-math-review [role=status]{flex-basis:100%;font-size:12px;color:#566477}

.writing-dialog{width:min(1120px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:20px;border:1px solid #d9dee7;border-radius:18px;background:#f7f8fb;color:#202632;overflow:auto;font:14px system-ui;overscroll-behavior:contain}
.writing-dialog::backdrop{background:#20273566}.writing-dialog header{margin:0 0 12px;min-height:44px;justify-content:space-between}.writing-dialog h2{font-size:22px;margin:0 0 10px}.writing-dialog h3{font-size:17px;margin:0 0 6px}.writing-dialog button{padding:8px 11px;background:#eaf1fb;color:#276bba;border-radius:9px;min-height:36px}.writing-dialog button[aria-pressed=true]{background:#2d81f1;color:#fff}.writing-dialog input:not([type=checkbox]),.writing-dialog select,.writing-dialog textarea{border:1px solid #ccd4e0;border-radius:8px;padding:7px;background:#fff;color:#202632;max-width:100%;font:inherit}.writing-dialog input[type=number]{width:85px;margin-left:8px}.writing-dialog textarea{display:block;width:100%;min-height:75px;margin:10px 0;resize:vertical}.writing-dialog canvas{display:block;max-width:100%;height:auto}.writing-controls,.writing-tabs,.writing-variants{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin:9px 0}.writing-tabs{padding-bottom:8px;border-bottom:1px solid #dce1e9}.writing-tabs button{font-size:13px}.writing-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.writing-card{min-width:0;background:#fff;border:1px solid #dce1e9;border-radius:12px;padding:10px}.writing-card h3{display:inline;margin-right:8px;overflow-wrap:anywhere}.writing-card>span{font-size:11px;color:#65758b}.writing-card .writing-controls button,.writing-variants button{padding:5px 6px;font-size:11px;min-height:30px}.writing-pad{width:100%;border:1px solid #ccd9e9;border-radius:8px;margin:8px 0;touch-action:none;user-select:none;-webkit-user-select:none}.writing-wide{grid-column:1/-1}.writing-hint,.writing-status{color:#52647c;font-size:13px;line-height:1.5}.writing-preview{margin-top:20px;border-top:1px solid #dce1e9;padding-top:15px}.writing-preview canvas,.writing-conversion>canvas{width:100%;border:1px solid #dce1e9;border-radius:8px;margin:12px 0}.writing-source{white-space:pre-wrap;max-height:120px;overflow:auto}.writing-conversion{width:min(880px,calc(100vw - 24px))}.writing-dialog [hidden]{display:none!important}
[data-theme=dark] .writing-dialog{background:var(--dark-field,#242833);color:var(--dark-text,#e5e8f0)}[data-theme=dark] .writing-card{background:#292f3a;border-color:#465064}[data-theme=dark] .writing-hint,[data-theme=dark] .writing-status,[data-theme=dark] .writing-card>span{color:#becce0}[data-theme=dark] .writing-dialog button{background:#33435d;color:#b9d7ff}
@media(max-width:950px){.writing-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:520px){.writing-grid{grid-template-columns:minmax(0,1fr)}.writing-dialog{padding:12px}.writing-controls{align-items:stretch}.writing-controls select,.writing-controls input:not([type=checkbox]){min-width:0}.writing-dialog h2{font-size:20px}}
.writing-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin}.writing-tabs button{flex:none}.writing-dialog summary{cursor:pointer;padding:5px 0;color:#276bba}.writing-controls>details{font-size:12px}.writing-controls>details[open]{flex-basis:100%}.writing-controls>details input{margin-right:6px}.writing-hint{margin:6px 0}.writing-controls>span[aria-live]{font-size:12px;align-self:center}.writing-controls>button[aria-label="Pagina precedente"],.writing-controls>button[aria-label="Pagina successiva"]{font-size:21px;padding:2px 12px}.writing-controls select{font-size:13px}

/* Full-page capture follows the supplied Penvy setup reference. The notebook
   and its conversion engine keep their existing appearance and behaviour. */
dialog.writing-setup{position:fixed;inset:0;margin:0;width:100vw;height:100dvh;max-width:none;max-height:none;padding:0;border:0;border-radius:0;overflow:hidden;background:#0f131b;color:#e8ecf4;font:15px Arial,system-ui,sans-serif;color-scheme:dark}
.writing-setup::backdrop{background:#0f131b}.writing-setup button{color:#b1bfff;border-radius:5px;background:transparent;font:inherit}.writing-setup button:disabled{opacity:.4}.ws-header{height:76px;max-width:720px;padding:0 8px;margin:auto;display:flex;align-items:center;gap:16px}.ws-header>button{font-size:26px;font-weight:300;padding:4px;min-width:24px}.ws-brand{font:italic 600 23px Georgia,serif;color:#a9baff;white-space:nowrap;letter-spacing:-.6px}.ws-progress{display:flex;gap:6px;flex:1;min-width:100px}.ws-progress span{height:4px;flex:1;background:linear-gradient(to right,#4358dc var(--progress),#343d50 var(--progress));border-radius:3px}.ws-caption{font-size:13px;color:#abb9d3;font-weight:600;white-space:nowrap}.ws-scroll{height:calc(100dvh - 76px);overflow-y:auto;overscroll-behavior:contain;scrollbar-color:#8d929d #0f131b}.ws-main{width:min(1240px,calc(100% - 64px));margin:42px auto 110px}.ws-main>h1{font-size:16px;line-height:1.4;font-weight:400;color:#abb9d3;margin:0 0 26px}.ws-row{display:flex;align-items:flex-start;gap:20px;margin-bottom:16px;min-width:0}.ws-letter{width:94px;flex:none;align-self:flex-start;text-align:center;padding-top:60px;color:#a8afbf;font:italic 62px Arial,sans-serif;overflow-wrap:anywhere}.ws-variants{display:grid;grid-template-columns:repeat(5,minmax(180px,1fr));gap:8px;min-width:0;flex:1;overflow-x:auto;padding-bottom:3px;scrollbar-width:thin;scrollbar-color:#3b465f transparent}.ws-box{min-width:0;display:flex;align-items:center;flex-direction:column;gap:6px}.ws-pad{display:block;width:100%;height:auto;background:#f3f5f9;border:1px solid #b5bdcc;border-radius:6px;touch-action:none;user-select:none;-webkit-user-select:none;cursor:crosshair}.ws-box>button{font-size:12px;padding:3px 8px;min-height:24px}.ws-row:has(.ws-wide) .ws-variants{grid-template-columns:repeat(5,var(--wide-width,340px))}.ws-wide .ws-pad{min-height:180px;max-height:206px;object-fit:fill}.ws-row:has(.ws-wide) .ws-letter{font-size:24px;line-height:1.3;padding-top:45px}.ws-footer{position:absolute;bottom:0;left:0;right:0;min-height:82px;padding:20px max(32px,calc((100vw - 1240px)/2));display:flex;align-items:center;gap:12px;background:linear-gradient(transparent,#0f131b 14%);pointer-events:none}.ws-footer>*{pointer-events:auto}.ws-status{flex:1;font-size:12px;color:#9caac4}.ws-footer .ws-next{width:224px;min-height:46px;border:1px solid #343f55;border-radius:13px;background:#181e2a;color:#b1bfff;font-weight:600}.ws-footer .ws-next:not(:disabled){background:#3d55d7;border-color:#3d55d7;color:#fff}.ws-footer>button:not(.ws-next){font-size:12px;padding:6px}.writing-setup [hidden]{display:none!important}
@media(max-width:1100px){.ws-main{width:calc(100% - 40px)}.ws-letter{width:70px}.ws-variants{grid-template-columns:repeat(5,210px)}.ws-row{gap:12px}.ws-header{max-width:720px}.ws-footer{padding-inline:24px}}
@media(max-width:600px){.ws-header{gap:9px;height:66px;padding:0 12px}.ws-brand{font-size:20px}.ws-caption{font-size:11px;max-width:115px;white-space:normal}.ws-progress{min-width:50px;gap:3px}.ws-scroll{height:calc(100dvh - 66px)}.ws-main{width:calc(100% - 24px);margin-top:24px}.ws-letter{width:32px;font-size:42px;padding-top:60px}.ws-row{gap:8px;margin-bottom:20px}.ws-variants{grid-template-columns:repeat(5,230px);gap:10px}.ws-pad{border-radius:6px}.ws-footer{padding:18px 16px;min-height:80px}.ws-footer .ws-next{width:150px;flex:none}.ws-status{font-size:11px}.ws-main>h1{font-size:14px}.ws-row:has(.ws-wide) .ws-letter{font-size:14px;word-break:break-word}.ws-row:has(.ws-wide) .ws-variants{grid-template-columns:repeat(5,320px)}}

.ws-row:has(.ws-wide) .ws-variants{grid-template-columns:repeat(5,var(--wide-width,340px))}
.writing-setup .ws-continue-partial{display:block;max-width:100%;margin:28px auto 0;padding:13px 22px;min-height:46px;border:1px solid #4358dc;border-radius:13px;background:#181e2a;color:#b1bfff;font-size:14px;cursor:pointer}.writing-setup .ws-continue-partial:disabled{cursor:default}
.writing-source{display:inline-flex;align-items:center;gap:6px;font-size:12px}.writing-source select{font:inherit;color:inherit;background:var(--panel,#fff);border:1px solid #8998b5;border-radius:7px;padding:7px;max-width:180px}.writing-source[hidden]{display:none!important}
[data-theme=dark] .writing-source select{background:var(--dark-field,#242833);color:var(--dark-text,#e5e8f0);border-color:var(--dark-line,#596476)}

/* Match the visible viewport even when Safari's toolbars, keyboard or page
   offset make the layout viewport larger. Only the paper list may scroll. */
dialog.writing-setup{top:var(--ws-top,0px);left:var(--ws-left,0px);right:auto;bottom:auto;width:var(--ws-width,100vw);height:var(--ws-height,100dvh);overflow:clip}
.ws-shell{display:grid;grid-template-rows:auto minmax(0,1fr) auto;width:100%;height:100%;min-width:0;min-height:0;background:#0f131b;color:#e8ecf4;overflow:hidden}
.ws-shell:fullscreen{width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:0}
.ws-shell:-webkit-full-screen{width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0}
.ws-header{display:grid;grid-template-columns:44px max-content minmax(12px,1fr) minmax(0,max-content) 44px 44px;gap:8px;height:auto;min-height:76px;width:100%;max-width:920px;padding:calc(8px + env(safe-area-inset-top,0px)) max(8px,env(safe-area-inset-right,0px)) 8px max(8px,env(safe-area-inset-left,0px));z-index:2;box-sizing:border-box}
.ws-header>button{min-width:44px;width:44px;height:44px;min-height:44px;padding:8px;touch-action:manipulation}
.ws-header .ws-fullscreen{display:grid;place-items:center}.ws-fullscreen svg{width:23px;height:23px}.ws-caption{min-width:0;overflow:hidden;text-overflow:ellipsis}.ws-progress{min-width:0;overflow:hidden}
.ws-scroll{height:auto;min-height:0;min-width:0;overflow:auto}.ws-main{margin-bottom:32px}
.ws-footer{position:static;min-width:0;min-height:82px;flex-wrap:wrap;padding-bottom:calc(20px + env(safe-area-inset-bottom,0px));background:#0f131b;pointer-events:auto}.ws-status{min-width:100px;overflow-wrap:anywhere;max-width:100%}.ws-footer .ws-next{margin-left:auto}
.ws-restart-row{display:flex;justify-content:flex-end;flex-basis:100%}.writing-setup .ws-restart{min-height:36px;padding:6px 0 0 12px;font-size:12px;color:#f0a4ab;text-decoration:underline;text-underline-offset:3px}.ws-restart-dialog{width:min(420px,calc(100% - 32px));max-height:calc(100% - 32px);box-sizing:border-box;border:1px solid #45516a;border-radius:16px;padding:24px;background:#181e2a;color:#e8ecf4;overflow:auto}.ws-restart-dialog::backdrop{background:#0009}.ws-restart-dialog h2{font-size:20px;margin:0 0 16px}.ws-restart-dialog p{line-height:1.5}.ws-restart-dialog [role=alert]{color:#f0a4ab;font-size:13px}.ws-restart-dialog>div{display:flex;justify-content:flex-end;gap:12px;margin-top:20px}.writing-setup .ws-restart-dialog button{min-height:44px;padding:10px 18px;border:1px solid #45516a;background:#242e40}.writing-setup .ws-restart-dialog .ws-restart-confirm{background:#a52e41;border-color:#a52e41;color:#fff}
@media(max-width:600px){.ws-header{min-height:66px;grid-template-columns:44px max-content minmax(0,1fr) 44px 44px;gap:3px;padding-inline:max(4px,env(safe-area-inset-left,0px))}.ws-header .ws-progress{display:none}.ws-brand{font-size:19px}.ws-caption{font-size:10px;max-width:none}.ws-footer{padding:12px 12px calc(12px + env(safe-area-inset-bottom,0px))}.ws-scroll{height:auto}.ws-main{margin-top:18px}.ws-status{min-width:80px}.ws-footer .ws-next{width:145px}}
