.highlighterTools{display:flex;align-items:center;gap:8px}
/* The five accumulation tools share the original eraser's text-line height.
   Icons stay within that line instead of increasing the button's height. */
:is(#accumStudyActions,#subbookStudyTools) .accumPenTools,:is(#accumStudyActions,#subbookStudyTools) .accumPenTools .highlighterTools,:is(#accumStudyActions,#subbookStudyTools) .accumPenTools .redPenTools{display:flex;align-items:center;gap:4px}
:is(#accumStudyActions,#subbookStudyTools) .accumPenTools button:not(.highlighterColor){display:inline-flex;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;padding:8px;line-height:16px;border:1px solid #bec9cb;border-radius:4px;background:#fff;color:#3c5055;-webkit-text-fill-color:currentColor;box-shadow:0 1px 2px #243d4510;white-space:nowrap}
:is(#accumStudyActions,#subbookStudyTools) .accumPenTools button:not(.highlighterColor):disabled{color:#a8b2b5;border-color:#dbe1e3;background:#fafbfc;box-shadow:none;cursor:default}
:is(#accumStudyActions,#subbookStudyTools) .accumPenTools button:not(.highlighterColor):enabled:hover{border-color:#99afb4}
:is(#accumStudyActions,#subbookStudyTools) .accumPenTools button:not(.highlighterColor):focus-visible{outline:2px solid #7698a2;outline-offset:2px}
:is(#accumStudyActions,#subbookStudyTools) .accumPenTools svg{width:15px;height:15px;flex:none}
:is(#accumStudyActions #accumEraser,#subbookStudyTools [data-tool="eraser"])[aria-pressed="true"]{background:#eaf0f2;border-color:#99afb4;box-shadow:inset 0 1px 2px #243d4515}
:is(#accumStudyActions #accumHighlighter,#subbookStudyTools [data-tool="pen"])[aria-pressed="true"]{background:var(--highlighter-color,#E5FF59);background:color-mix(in srgb,var(--highlighter-color,#E5FF59) 35%,white);border-color:#a8b873;box-shadow:inset 0 1px 2px #243d4515}
:is(#accumStudyActions :is(#accumRedCircle,#accumRedCross),#subbookStudyTools :is([data-tool="red-circle"],[data-tool="red-cross"]))[aria-pressed="true"]{background:#fff0f2;border-color:#d7a2ac;box-shadow:inset 0 1px 2px #8d304515}
#accumEraser{white-space:nowrap}
#accumEraser[aria-pressed="true"]{background:#e8edf5;box-shadow:inset 0 0 0 1px #555}
:is(#accumListTable,.subbookTable).is-erasing tbody,:is(#accumListTable,.subbookTable).is-erasing tbody *{cursor:crosshair;user-select:none;-webkit-user-select:none;touch-action:pinch-zoom;-webkit-touch-callout:none}
:is(#accumEraseBox,.accumEraseBox){position:absolute;pointer-events:none;border:1px dashed #486581;background:#8bb9ee33;box-sizing:border-box;z-index:180}
:is(#accumEraseBox,.accumEraseBox)[hidden]{display:none}
:is(#accumEraseDialog,.accumEraseDialog){width:min(400px,calc(100vw - 48px));box-sizing:border-box;max-height:calc(100dvh - 32px);overflow:auto;padding:22px;border:1px solid #bbb;border-radius:14px;color:#111;background:#fff}
:is(#accumEraseDialog,.accumEraseDialog)::backdrop{background:#0005}
:is(#accumEraseTitle,.accumEraseTitle){font-size:18px;line-height:1.5;margin:0 0 18px;word-break:keep-all}
.accumEraseChoice{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:12px 0;cursor:pointer}
.accumEraseChoice input{width:20px;height:20px;accent-color:var(--lm-study-accent-color,#007aff)}
.accumEraseChoice:has(input:disabled){color:#888;cursor:default}
.accumEraseActions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
@media print{:is(#accumEraseBox,.accumEraseBox),:is(#accumEraseDialog,.accumEraseDialog),#accumEraserStatus{display:none!important}}
#accumHighlighter{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.highlighterButtonIcon{width:18px;height:18px;fill:var(--highlighter-color,#E5FF59);stroke:#555;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.redPenTools{display:flex;align-items:center;gap:8px}
#accumStudyActions .redPenButton{display:inline-flex;align-items:center;gap:5px;white-space:nowrap;color:#111;-webkit-text-fill-color:currentColor}
.redPenButton svg{width:17px;height:17px;fill:none;stroke:#df2038;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#accumStudyActions .redPenButton[aria-pressed="true"]{background:#ffe5e9;box-shadow:inset 0 0 0 1px #df2038}
:is(#accumListTable,.subbookTable).is-red-pen tbody td,:is(#accumListTable,.subbookTable).is-red-pen tbody td *{cursor:crosshair;user-select:none;-webkit-user-select:none}
:is(#accumListTable,.subbookTable) td.has-red-pen{position:relative}
.accumRedMark{position:absolute;box-sizing:border-box;transform:translate(-50%,-50%);pointer-events:none;z-index:2}
.accumRedMark.red-circle{border:2px solid #e02030;border-radius:50%}
.accumRedMark.red-cross::before,.accumRedMark.red-cross::after{content:"";position:absolute;top:50%;left:0;width:100%;height:2px;background:#e02030;transform:translateY(-50%) rotate(45deg);border-radius:1px}
.accumRedMark.red-cross::after{transform:translateY(-50%) rotate(-45deg)}
.highlighterAnchor{position:relative}
.highlighterPalette{position:absolute;right:0;top:calc(100% + 8px);z-index:150;display:flex;flex-wrap:wrap;gap:8px;width:max-content;max-width:min(290px,calc(100vw - 40px));padding:10px;border:1px solid #bbb;border-radius:12px;background:white;box-shadow:0 5px 20px #0002}
.highlighterPalette[hidden]{display:none}
#accumStudyActions .highlighterColor{width:38px;height:38px;padding:0;border:2px solid #777;border-radius:9px}
#accumStudyActions .highlighterColor[aria-pressed="true"]{border-color:#111;box-shadow:inset 0 0 0 3px #fff}
#accumHighlighter[aria-pressed="true"]{background:var(--highlighter-color,#E5FF59);box-shadow:inset 0 0 0 1px #111}
#accumListTable.is-highlighting .cellText{user-select:text;-webkit-user-select:text;cursor:text}
#accumListTable.is-highlighting ::selection{background:var(--highlighter-color,#E5FF59);color:inherit}
.highlighterNotice{position:fixed;bottom:16px;left:16px;max-width:calc(100vw - 64px);z-index:160;padding:10px 14px;border:1px solid #ddd;border-radius:9px;background:#fff;box-shadow:0 2px 12px #0002;pointer-events:none}
.highlighterNotice[hidden]{display:none}
#accumListTable mark[data-highlighter]{color:inherit;padding:0;border-radius:2px}
.highlighterCursor{position:fixed;z-index:1000;pointer-events:none;width:22px;height:12px;background:var(--highlighter-color,#E5FF59);border:1px solid #333;border-radius:3px;transform:rotate(-35deg);box-shadow:0 0 0 2px #fff9}
.highlighterCursor[hidden]{display:none}
.highlighterChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}
.highlighterChoice{display:flex;align-items:center;gap:8px;border:1px solid #ccc;border-radius:9px;padding:10px;cursor:pointer;font-size:14px}
.highlighterChoice:has(input:checked){border-color:#222;background:#f7f7f7}
.highlighterSwatch{display:inline-block;width:25px;height:20px;border:1px solid #0003;border-radius:4px;flex-shrink:0}
#highlighterCount{font:inherit;margin-left:10px;padding:6px 10px}
@media(max-width:400px){.highlighterChoice{padding:8px;gap:5px}.highlighterSwatch{width:18px}}
.subbookStudyToolsRow{position:sticky;top:0;display:flex;justify-content:flex-end;margin-top:10px;padding:8px 0;min-height:48px;background:#fff;z-index:210}
.subbookStudyTools{position:relative;display:flex;align-items:center;gap:6px;z-index:12;background:#fff;padding:4px;border:1px solid #ddd;border-radius:12px;max-width:100%;box-sizing:border-box}
.subbookStudyTools[hidden]{display:none}
.subbookStudyTools button{white-space:nowrap}
#grid>.card{position:relative}
.subbookStudyTools .highlighterColor{width:38px;height:38px;padding:0;border:2px solid #777;border-radius:9px}
.subbookStudyTools .highlighterColor[aria-pressed="true"]{border-color:#111;box-shadow:inset 0 0 0 3px #fff}
.subbookStudyTools [data-tool="pen"][aria-pressed="true"]{background:var(--highlighter-color,#E5FF59);box-shadow:inset 0 0 0 1px #111}
.subbookStudyTools [data-tool="progress"][aria-pressed="true"]{background:#fff1a8;border-color:#9b7900}
.subbookTable.is-highlighting .cellText{user-select:text;-webkit-user-select:text;cursor:text}
.subbookTable.is-highlighting ::selection{background:var(--highlighter-color,#E5FF59);color:inherit}
.subbookTable mark[data-highlighter]{color:inherit;padding:0;border-radius:2px}
.subbookTable.is-choosing-progress tbody tr[data-id],.subbookTable.is-choosing-progress tbody tr[data-id] *{cursor:crosshair}
.subbookTable tr.is-study-bookmark>td{background:#fff6bf!important}
.subbookProgressLabel{display:block;color:#846800;font-size:11px;font-weight:700;line-height:1.4}
.subbookToolsNotice{font-size:12px;color:#555;margin:8px 0 0;overflow-wrap:anywhere}
/* Table cells (not inline spans) own the touch gesture before pointerdown.
   Keep pinch zoom available; normal scrolling returns when the pen is off. */
#accumListTable.is-highlighting tbody td,.subbookTable.is-highlighting tbody td{touch-action:pinch-zoom;-webkit-touch-callout:none}
@media(pointer:coarse){
  #accumStudyActions .highlighterColor,.subbookStudyTools .highlighterColor{width:44px;height:44px}
}

/* Keep the same pen group on narrow subbook screens; progress may wrap. */
#subbookStudyTools{flex-wrap:wrap;justify-content:flex-end;gap:4px}
#subbookStudyTools .accumPenTools button:not(.highlighterColor){font-size:13.3333px}
.annotationLimitDialog{box-sizing:border-box;width:min(360px,calc(100vw - 32px));padding:22px;border:1px solid #bbb;border-radius:12px;background:#fff;color:#111;font-family:inherit}
.annotationLimitDialog::backdrop{background:#0006}
.annotationLimitDialog h2{font-size:18px;margin:0 0 14px}
.annotationLimitDialog p{font-size:15px;line-height:1.6;margin:0 0 20px;overflow-wrap:anywhere}
.annotationLimitDialog button{display:block;margin-left:auto;min-width:64px;min-height:44px;padding:8px 16px;border:1px solid #b6c7cf;border-radius:4px;background:#fff;color:#37474f;font:inherit;cursor:pointer}
