/* Shared compact dictionary on learning pages; access is gated by dictionary policy. */
/* Keep the mode toggle compact on every host, including the unscoped wordbook. */
.study-dictionary-tools{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
.study-dictionary-tools [data-lookup][aria-pressed],.article-page .learning-lookup[aria-pressed]{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:6px;box-sizing:border-box;width:auto;min-height:36px;margin:0;padding:6px 10px;border:0;border-radius:6px;background:transparent;color:#365f4c;box-shadow:none;font:500 14px/20px system-ui;white-space:nowrap;text-decoration:none;cursor:pointer}
.study-dictionary-tools [data-lookup][aria-pressed]:hover,.article-page .learning-lookup[aria-pressed]:hover{background:#f5f7f2}
.study-dictionary-tools [data-lookup][aria-pressed="true"],.article-page .learning-lookup[aria-pressed="true"]{background:#e7efe2;color:#254c38}
.study-dictionary-tools [data-lookup][aria-pressed]:focus-visible,.article-page .learning-lookup[aria-pressed]:focus-visible{outline:2px solid #60876c;outline-offset:3px}
.study-dictionary-tools .dictionary-toggle-emoji,.article-page .learning-lookup .dictionary-toggle-emoji{display:inline-block;flex:none;font-style:normal;font-size:18px;line-height:1}
@media(max-width:760px),(pointer:coarse){.study-dictionary-tools [data-lookup][aria-pressed],.article-page .learning-lookup[aria-pressed]{min-height:44px}}
@media(forced-colors:active){.study-dictionary-tools [data-lookup][aria-pressed="true"],.article-page .learning-lookup[aria-pressed="true"]{outline:1px solid Highlight}}
.article-page.cloze-dictionary-on .sentence-side.english p{cursor:help}
.reading-word-popover{position:fixed;z-index:16020;box-sizing:border-box;width:292px;max-width:calc(100vw - 16px);padding:13px 15px 12px;overflow:auto;overscroll-behavior:contain;border:1px solid #d3ddcd;border-radius:10px;background:#fff;color:#293c33;box-shadow:0 5px 22px #233a2926;font:14px/1.55 system-ui;overflow-wrap:anywhere;text-align:left}
.reading-word-popover[hidden]{display:none!important}
.reading-word-popover header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.reading-word-popover header strong{font:600 19px/1.4 system-ui;min-width:0}
.reading-word-popover button{border:1px solid #dce4d7;border-radius:5px;background:#fff;color:#365f4c;font:12px/1.4 system-ui;min-height:32px;padding:5px 8px;cursor:pointer}
.reading-word-popover [data-popover-close]{border:0;background:transparent;font-size:22px;line-height:1;min-height:26px;padding:0 2px;flex:none}
.reading-word-popover button:disabled{opacity:.6;cursor:default}
.reading-word-popover p{margin:8px 0}
.reading-word-popover .reading-word-form{font-size:11px;color:#6d796f;margin:3px 0 6px}
.reading-word-popover .reading-word-meaning{margin:9px 0 12px}
.reading-word-popover .reading-word-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.reading-word-popover [data-popover-save]{margin-left:auto;background:#365f4c;border-color:#365f4c;color:#fff}
.reading-word-popover [data-popover-status]{font-size:12px;color:#6d796f;margin:8px 0 0}
.reading-word-popover [data-popover-status]:empty{display:none}
.reading-word-popover label{display:block;margin:8px 0;font-size:12px;color:#6d796f}
.reading-word-popover select,.reading-word-popover input{box-sizing:border-box;max-width:100%;border:1px solid #dce4d7;border-radius:4px;background:#fff;color:#293c33;padding:5px;font:14px system-ui}
.reading-word-popover input{width:100%;margin:0 0 10px}
@media(max-width:480px){.reading-word-popover{width:276px;padding:12px}.reading-word-popover button{min-height:38px}.reading-word-popover select,.reading-word-popover input{font-size:16px}}
.reading-word-popover [data-popover-speak]{display:inline-flex;align-items:center;gap:3px;border:0;padding:4px;color:#647a6b}
.reading-word-popover [data-popover-speak] svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.reading-word-popover [data-popover-speak] span{font-size:10px}
.reading-word-popover .reading-word-editor{margin:8px 0 0;padding:0}
.reading-word-popover .reading-word-editor label{margin:0;color:#536958}
.reading-word-popover .reading-word-editor input{display:block;margin:5px 0 7px}
.reading-word-popover .reading-word-guidance{font:12px/1.6 system-ui;color:#536958;background:#f1f5ed;padding:8px;border-radius:5px}
.reading-word-popover .reading-word-editor-actions{display:flex;gap:7px}
.reading-word-popover [data-popover-confirm]{background:#365f4c;color:#fff;border-color:#365f4c}

/* Visual reference: CodePen “input box glowing border” by Vivi Tseng. */
.reading-word-popover .reading-word-editor input{border:1px solid transparent;border-radius:9px;padding:10px 11px;background:linear-gradient(#fff,#fff) padding-box,linear-gradient(115deg,#f3a5ae,#f6dfa6,#b6d8c8,#a1c6dc,#c8b2e4) border-box;box-shadow:-2px -2px 7px #f2b2b438,3px 2px 8px #b8a7de42;transition:box-shadow .15s ease}
.reading-word-popover .reading-word-editor input:focus{outline:2px solid transparent;outline-offset:2px;box-shadow:-2px -2px 9px #f2b2b470,3px 2px 10px #b8a7de70}
@media(prefers-reduced-motion:reduce){.reading-word-popover .reading-word-editor input{transition:none}}
@media(forced-colors:active){.reading-word-popover .reading-word-editor input{border-color:CanvasText;background:Canvas;box-shadow:none}.reading-word-popover .reading-word-editor input:focus{outline-color:Highlight}}

/* TOEFL-style references stay behind a lazy second tab. */
.reading-word-popover [role="tabpanel"][hidden]{display:none!important}
.reading-word-tabs{display:flex;gap:14px;margin:8px 0 10px;border-bottom:1px solid #dce4d7}
.reading-word-tabs [role="tab"]{border:0;border-radius:0;border-bottom:2px solid transparent;background:transparent;color:#647a6b;padding:5px 0 7px;font-size:12px}
.reading-word-tabs [aria-selected="true"]{border-bottom-color:#365f4c;color:#294f3d;font-weight:600}
.reading-word-popover button:focus-visible,.reading-word-popover summary:focus-visible,.reading-word-popover [role="tabpanel"]:focus-visible{outline:2px solid #365f4c;outline-offset:2px}
.reading-word-reference{margin:0;border-bottom:1px solid #e7ece3;padding:6px 0}
.reading-word-reference summary{cursor:pointer;color:#365f4c;font-size:12px;padding:4px 0;min-height:24px}
.reading-word-reference>div{font-size:13px;line-height:1.7;margin:6px 0 9px}
.reading-word-reference p{font-size:12px}
.reading-word-reference p button{margin:3px 3px 0 0}

.reading-word-popover .reading-word-source{font-size:10px;color:#728174;margin:3px 0}
.reading-word-popover .reading-word-choices{display:grid;gap:5px;margin:7px 0}
.reading-word-popover .reading-word-choices button{text-align:left;font-size:12px}
.reading-word-popover .reading-word-choices button[aria-pressed="true"]{background:#edf4e8;border-color:#365f4c;color:#254c38}
.reading-word-popover .reading-word-collect-title{font-size:12px}
.study-dictionary-on :is(.passage,.question,.question-item,.structured-review-article,.vr-word,.word-manager){cursor:help}

.wordbook-dictionary-tools{flex-direction:column;align-items:flex-start;max-width:min(272px,calc(100vw - 32px))}
.wordbook-dictionary-guide{box-sizing:border-box;max-width:100%;padding:9px 10px;border-radius:7px;background:#f1f5ed;color:#536958;font:12px/1.6 system-ui}
.wordbook-dictionary-guide[hidden]{display:none!important}
.wordbook-dictionary-guide p{margin:0 0 6px}
.wordbook-dictionary-guide button{font:12px system-ui;min-height:30px}

.reading-word-popover .reading-word-editor{position:fixed;z-index:16021;box-sizing:border-box;width:292px;max-width:calc(100vw - 16px);overflow:auto;overscroll-behavior:contain;margin:0;padding:14px;border:1px solid #c8d7c1;border-radius:10px;background:#fff;color:#293c33;box-shadow:0 5px 22px #233a2926;font:13px/1.5 system-ui}
.reading-word-popover .reading-word-editor[hidden]{display:none!important}
.reading-word-popover .reading-word-pos-choices{display:flex;gap:4px;flex-wrap:wrap;margin:8px 0}
.reading-word-popover .reading-word-pos-choices button{font-size:11px}
.reading-word-popover .reading-word-copy-hint{font-size:11px;color:#718170}
.reading-word-popover .reading-word-full{margin:6px 0 10px;font-size:12px;user-select:text}
.reading-word-popover .reading-word-full summary{cursor:pointer;color:#365f4c;padding:4px 0}
.reading-word-popover .reading-word-full>div{font-size:13px;line-height:1.65;user-select:text}
.reading-word-popover .reading-word-full ol{padding-left:21px}

/* Both expressions stay discoverable; the active selection owns collection. */
.reading-word-expression-choices{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.reading-word-expression-choices button{flex:1 1 110px;text-align:left;overflow-wrap:anywhere}
.reading-word-expression-choices button[aria-pressed="true"]{background:#edf4e8;border-color:#365f4c;color:#254c38;font-weight:600}
.reading-word-contextual{padding:8px 10px;margin:8px 0;border-left:3px solid #60876c;background:#f3f7ef;border-radius:4px}
.reading-word-contextual small{font-size:11px;color:#536958}
.reading-word-contextual p{margin:4px 0;font-size:14px;font-weight:600}
@media(forced-colors:active){.reading-word-expression-choices button[aria-pressed="true"]{outline:2px solid Highlight}.reading-word-contextual{border-color:CanvasText}}

/* B19: keep the floating wordbook lookup readable over the word list. */
.study-dictionary-tools.wordbook-dictionary-tools [data-lookup][aria-pressed]{min-height:44px;padding:10px 16px;gap:8px;border:1px solid #b9cbb5;border-radius:14px;background:#fffdf7;color:#365f4c;box-shadow:0 3px 12px #233a291a;font-weight:600}
.study-dictionary-tools.wordbook-dictionary-tools [data-lookup][aria-pressed]:hover{background:#f0f5eb;border-color:#8da884}
.study-dictionary-tools.wordbook-dictionary-tools [data-lookup][aria-pressed="true"]{background:#e7efe2;border-color:#77966e;color:#254c38}
.study-dictionary-tools.wordbook-dictionary-tools [data-lookup][aria-pressed]:focus-visible{outline:2px solid #60876c;outline-offset:3px}
@media(forced-colors:active){.study-dictionary-tools.wordbook-dictionary-tools [data-lookup][aria-pressed]{background:ButtonFace;color:ButtonText;border-color:ButtonText;box-shadow:none}.study-dictionary-tools.wordbook-dictionary-tools [data-lookup][aria-pressed="true"]{outline:2px solid Highlight;outline-offset:2px}}
