/* Calm, non-judgmental phrase actions for Reading and Listening. */
.phrase-save-toolbar{
 display:flex!important; align-items:center; justify-content:flex-start;
 flex-wrap:wrap;gap:7px;max-width:calc(100vw - 24px);
 background:#edf8f6!important;border:1px solid #b6dad4!important;
 box-shadow:0 10px 28px rgba(26,70,75,.18)!important;
 padding:9px!important;border-radius:12px!important;
}
.phrase-save-toolbar .phrase-selection-status{
 flex:1 1 100%;font-size:12px;color:#235c64;font-weight:650;
 overflow-wrap:anywhere;white-space:normal;max-width:100%;padding:0 1px;
}
.phrase-save-toolbar button{white-space:nowrap}
.phrase-ai-popover{
 position:fixed;z-index:99999;
 max-height:calc(100dvh - 24px);overflow-y:auto;
 overscroll-behavior:contain;max-width:calc(100vw - 24px);
 border:1px solid #d2e5e2;border-radius:13px;
}
.phrase-ai-status{
 font-size:12px;font-weight:650;color:#17665f;
 background:#e9f6f1;padding:9px 11px;border-radius:8px;
 line-height:1.7;margin:10px 0;
}
.phrase-ai-status.phrase-ai-unavailable{
 color:#7f6536;background:#f9f4e7;
}
.phrase-ai-details{margin:10px 0;display:grid;gap:8px}
.phrase-ai-detail{
 margin:0;padding:9px 11px;border:1px solid #e3ebed;border-radius:9px;
 background:#fbfdfd;
}
.phrase-ai-detail p{margin:5px 0 0;color:#364e60;font-size:13px;
 white-space:pre-wrap;line-height:1.72;overflow-wrap:anywhere}
.phrase-ai-example{border-style:dashed;background:#f6fafb}
.phrase-ai-popover .word-save-form{display:grid;gap:9px}
.phrase-ai-popover .word-context{margin:3px 0}
.phrase-ai-popover input.wordbook-field{
 box-sizing:border-box;width:100%;padding:10px;border:1px solid #d2dfe2;
 border-radius:9px;font-size:14px;background:#fff;color:#213b48;
}
.phrase-ai-popover textarea.word-note{
 box-sizing:border-box;width:100%;min-height:76px;resize:vertical;
}
.phrase-ai-popover .word-popover-actions{
 display:flex;gap:8px;align-items:center;flex-wrap:wrap;
}
.phrase-ai-popover .word-context-label{display:block}
@media(max-width:480px){
 .phrase-save-toolbar .btn{flex:1 1 auto;padding:9px 10px;font-size:12px}
 .phrase-ai-popover{font-size:13px}
 .phrase-ai-detail{padding:8px}
}

/* Related expressions, non-blocking save, quiet optional notes. */
.phrase-ai-popover{width:min(520px,calc(100vw - 24px));}
.phrase-ai-head{gap:12px;align-items:center;justify-content:space-between;}
.phrase-ai-head .word-popover-title{min-width:0;overflow-wrap:anywhere;}
.phrase-ai-head-actions{display:flex;gap:7px;align-items:center;flex-shrink:0;}
.phrase-ai-head-actions .btn{white-space:nowrap;}
.phrase-ai-field-label{margin-top:4px;}
.phrase-ai-section-title{font-size:15px;font-weight:750;color:#213d4c;margin:5px 0 3px;}
.phrase-ai-related-caption{font-size:11px;line-height:1.55;color:#667c88;margin-bottom:10px;}
.phrase-ai-related-list{display:grid;gap:9px;}
.phrase-ai-related-card{border:1px solid #dbe7e9;border-radius:10px;padding:10px 11px;background:#fff;}
.phrase-ai-related-term{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.phrase-ai-related-english{font-size:15px;font-weight:720;color:#183748;overflow-wrap:anywhere;}
.phrase-ai-related-type{font-size:11px;color:#597984;background:#eef5f5;border-radius:6px;padding:2px 6px;}
.phrase-ai-related-chinese{font-size:14px;line-height:1.6;color:#354d58;margin-top:5px;}
.phrase-ai-related-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:7px;}
.phrase-ai-related-actions .btn{font-size:12px;padding:5px 10px;}
.phrase-ai-related-actions .btn:disabled{opacity:.75;}
.phrase-ai-related-example{margin-top:6px;border-top:1px dashed #e5ecee;padding-top:7px;}
.phrase-ai-related-example summary,.phrase-ai-expand summary{cursor:pointer;color:#446674;font-size:12px;line-height:1.8;}
.phrase-ai-related-example p{margin:3px 0;font-size:12px;line-height:1.6;white-space:pre-wrap;}
.phrase-ai-related-hint{color:#5f7780;font-size:13px;margin:5px 0;}
.phrase-ai-expand{border-top:1px solid #e8eeee;padding-top:8px;margin-top:4px;}
.phrase-ai-source{margin:8px 0!important;}
.phrase-ai-notes .word-context-label{margin-top:8px;}
.phrase-ai-popover .word-popover-actions{margin:3px 0;}
@media(max-width:480px){
 .phrase-ai-popover{width:calc(100vw - 24px);}
 .phrase-ai-head .word-popover-title{font-size:16px;}
 .phrase-ai-head-actions .btn{font-size:12px;padding:7px 9px;}
 .phrase-ai-related-card{padding:9px;}
}

/* Context-first phrase preview, shared across Reading and Listening. */
.phrase-explain-toolbar{width:min(620px,calc(100vw - 24px));}
.phrase-selection-preview{flex:1 1 100%;width:100%;padding:10px 12px;
 background:#fff;border:1px solid #d4e6e2;border-radius:9px;line-height:1.6}
.phrase-selection-meaning{font-size:16px;font-weight:750;color:#18463e;
 overflow-wrap:anywhere;margin:1px 0 5px}
.phrase-selection-usage{font-size:13px;color:#355964;line-height:1.65;margin:0 0 4px;
 overflow-wrap:anywhere}
.phrase-selection-context{font-size:12px;color:#70848c;line-height:1.6;margin:3px 0 0;
 display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;
 overflow-wrap:anywhere}
.phrase-selection-source{font-size:11px;color:#8999a1;line-height:1.5;margin:5px 0 0;
 overflow-wrap:anywhere}
.phrase-explain-toolbar button:disabled{opacity:.55;cursor:progress}
.phrase-ai-loading{color:#71868f;font-size:12px;line-height:1.65}
.phrase-ai-popover .phrase-ai-expand[open] .phrase-ai-details{display:grid;gap:8px}
@media(max-width:480px){
 .phrase-explain-toolbar{width:calc(100vw - 24px);padding:9px!important}
 .phrase-selection-preview{padding:8px 10px}
 .phrase-selection-meaning{font-size:15px}
 .phrase-selection-usage{font-size:13px}
}

/* Progressive phrase flow: compact quick preview stays readable while deep AI runs. */
.phrase-ai-status{transition:background-color .12s ease;}
.phrase-explain-toolbar .phrase-selection-source{min-height:16px;}
.phrase-ai-popover .phrase-ai-related-list{min-height:22px;}

/* Shared native selection for study-only word tokens, including answer review. */
:is(.s-en,.sentence-text,.answer-selectable-en,.answer-rich-phrase,[data-language-study-surface]){ -webkit-user-select:text; user-select:text; }
:is(.s-en,.sentence-text,.answer-selectable-en,.answer-rich-phrase,[data-language-study-surface]) :is(.word-token,.fillword){ -webkit-user-select:text!important; user-select:text!important; }
