:root{color-scheme:light;--bg:#f8f6f1;--paper:#fffdf8;--sidebar:#eee9f7;--ink:#363044;--muted:#8b8498;--line:#e4deeb;--purple:#7655ce;--purple-dark:#5335a2;--peach:#ffdcad}
*{box-sizing:border-box}[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.45 ui-rounded,"SF Pro Rounded",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
button,input,select{font:inherit}button,a,select{-webkit-tap-highlight-color:transparent;touch-action:manipulation}button{cursor:pointer}button:disabled,select:disabled{cursor:wait;opacity:.55}a{color:inherit;text-decoration:none}button,input,select,a{outline-offset:3px}:focus-visible{outline:2px solid var(--purple)}
.app{min-height:100dvh}
.login-page{min-height:100dvh;display:grid;place-items:center;padding:24px}.login-card{width:min(100%,360px);padding:28px;background:var(--paper);border:1.5px solid #d4c5ea;border-radius:18px;box-shadow:0 5px 0 #e5ddef}.login-card .brand{margin-bottom:24px}.login-card h1{font-size:21px;margin-bottom:20px}.login-mark{display:grid;place-items:center;width:43px;height:43px;border:1.5px solid #e0bc8f;border-radius:13px;background:var(--peach);color:#83542c;font-size:22px;font-weight:600}.login-card label{display:block;margin:14px 0 6px;color:var(--muted);font-size:12px}.login-card input{display:block;width:100%;padding:11px 12px;border:1.5px solid #ddcfe8;border-radius:9px;background:#fcf9ff;color:var(--ink);font-size:16px}.login-card .submit-button{justify-content:center;margin-top:12px}.login-error{min-height:20px;margin:12px 0 0;color:#ad6572;font-size:12px}
.sidebar{position:sticky;top:0;height:100dvh;padding:21px 15px;background:var(--sidebar);border-right:1.5px solid #ddd4ec;display:flex;flex-direction:column;overflow:hidden}
.brand{display:flex;align-items:center;gap:9px;font-size:20px;font-weight:800;letter-spacing:-.5px;margin-bottom:22px}.mascot{width:43px;height:43px;flex:none;transform:rotate(-7deg)}.brand-dot{color:var(--purple)}
.primary-button{background:var(--purple);color:white;border:1.5px solid var(--purple-dark);border-radius:11px;min-height:40px;padding:9px 14px;font-size:13px;font-weight:650;box-shadow:0 3px 0 var(--purple-dark);transition:transform .1s,box-shadow .1s}.primary-button:hover{background:#8262d9}.primary-button:active{transform:translateY(2px);box-shadow:0 1px 0 var(--purple-dark)}
.add-button{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;margin-bottom:26px}.add-button>span{font-size:21px;line-height:16px;font-weight:400}
.library-heading{display:flex;align-items:center;justify-content:space-between;padding:0 4px;margin-bottom:12px}.library-heading h2{margin:0;font-size:11px;font-weight:650;letter-spacing:.3px;color:#81758f}.count{font-size:10px;color:#8f7ba7;font-weight:650}
.library{min-height:0;overflow-y:auto;padding:1px 2px 10px;scrollbar-width:thin}.library-item{display:block;width:100%;padding:8px;margin-bottom:12px;border:1.5px solid transparent;border-radius:12px;background:transparent;text-align:left;color:var(--ink)}.library-item:hover{background:#f7f3ff}.library-item.selected{border-color:#a490ca;background:var(--paper);box-shadow:0 3px 0 #d8cce9}
.library-cover{position:relative;display:block;aspect-ratio:16/9;border-radius:7px;overflow:hidden;background:#e6dcf6;margin-bottom:9px}.library-cover img{width:100%;height:100%;object-fit:cover;display:block}.library-cover::before{content:"▶";position:absolute;left:9px;bottom:7px;z-index:1;color:#fff;font-size:13px;text-shadow:0 1px 6px #29203b}.library-duration{position:absolute;right:6px;bottom:5px;color:#fff;background:#302939c9;border-radius:4px;padding:1px 4px;font-size:9px}
.library-title{font-size:11.5px;font-weight:650;line-height:1.45;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.library-status{display:block;color:#9a8bab;font-size:10px;margin-top:5px}.empty-library{text-align:center;font-size:12px;color:#a291b3;padding-top:20px}
.workspace{padding:23px 26px;min-width:0}#video-panel{width:100%;max-width:min(1040px,max(280px,calc((100dvh - 240px) * 1.77778)))}.video-heading{display:flex;align-items:flex-start;gap:18px;justify-content:space-between;margin-bottom:15px}.title-block{min-width:0}h1{font-size:clamp(17px,1.7vw,23px);letter-spacing:-.45px;line-height:1.3;font-weight:720;margin:0 0 6px;text-wrap:pretty}.video-details{display:flex;gap:7px;align-items:center;font-size:11px;color:#9a8b9f}.video-details .channel-name{color:#796d88;font-weight:600}.icon-button{flex-shrink:0;border:1.5px solid #d9d0e2;border-radius:9px;padding:7px 10px;font-size:10px;color:#8c7b9b;margin-top:1px;background:var(--paper)}.icon-button:hover{border-color:#ad99c7;color:var(--purple-dark)}
.player-frame{border:2px solid var(--ink);border-radius:15px;overflow:hidden;background:#19151f;box-shadow:0 5px 0 #dfd4eb}.video-js{width:100%;height:auto;background:#19151f}.video-js.vjs-fluid{padding-top:56.25%}
.video-js .vjs-big-play-button{width:68px;height:68px;border:2px solid white;border-radius:20px;line-height:64px;margin-top:-34px;margin-left:-34px;background:#7958cce8;box-shadow:0 3px 0 #352342}.video-js:hover .vjs-big-play-button{background:#8b6add}.video-js .vjs-control-bar{background:#26202fe8;height:38px;align-items:center}.video-js .vjs-control{height:38px;line-height:38px}.video-js .vjs-button>.vjs-icon-placeholder:before{line-height:38px}.video-js .vjs-progress-control{min-width:5em}.video-js .vjs-play-progress{background:#c3a6ff}.video-js .vjs-slider{background:#655872}.video-js .vjs-volume-level{background:#e2ceff}.video-js .vjs-time-control{padding:0 5px;line-height:38px;min-width:0;font-size:10px}.video-js .vjs-playback-rate{width:35px}.video-js .vjs-playback-rate .vjs-playback-rate-value{line-height:38px;font-size:10px}.video-js .vjs-quality-control{width:69px;display:flex;align-items:center;justify-content:center;padding:0 3px}.vjs-quality-select{appearance:auto;border:1px solid #8d7c9d;background:#3c3049;color:#f5eaff;border-radius:6px;height:25px;font:10px -apple-system,sans-serif;padding:0 3px;width:64px;cursor:pointer}
.video-js .vjs-text-track-display{display:none!important}.video-js video::cue{color:transparent;background:transparent}
.player-tools{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;margin-top:16px}.caption-control,.file-tools{display:flex;align-items:center;gap:9px}.caption-mark{background:var(--peach);color:#83542c;border:1px solid #e0bc8f;border-radius:7px;padding:3px 6px;font-size:12px;font-weight:750}.caption-label{color:#786687;font-size:11px}.state-tag{font-size:10px;color:#9e88b0;white-space:nowrap}.state-tag.ready::before{content:"●";font-size:6px;color:#a280d7;vertical-align:1px;margin-right:4px}.file-tools{font-size:10px;color:#9b8aa6}.text-button{color:#8a709c;border-bottom:1px solid #d9cae2;font-size:10px}.small-button{border:1px solid #cbbbdc;border-radius:7px;padding:5px 8px;color:#765b8a;background:#f2eaf9;font-size:10px}
.progress-tray{max-width:1040px;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:10px;margin-bottom:14px}.progress-item{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--paper);border:1px solid #d4c5ea;border-radius:13px;box-shadow:0 3px 0 #e5ddef}.progress-icon{display:grid;place-items:center;flex:none;width:38px;height:38px;border:1px solid #e0bc8f;border-radius:12px;background:var(--peach);color:#83542c;font-size:22px}.progress-icon svg{width:22px;height:22px}.progress-body{flex:1;min-width:0}.progress-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.progress-label{font-size:13px;font-weight:650;color:var(--purple-dark)}.progress-value{flex:none;color:var(--purple);font-size:13px;font-weight:700;font-variant-numeric:tabular-nums}.progress-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--muted);margin:2px 0 8px}.progress-detail{font-size:11px;color:#8b789d;margin-top:5px}.download-progress{display:block;appearance:none;-webkit-appearance:none;width:100%;height:9px;overflow:hidden;border:0;border-radius:6px;background:#ece5f4;accent-color:var(--purple)}.download-progress::-webkit-progress-bar{background:#ece5f4;border-radius:6px}.download-progress::-webkit-progress-value{background:var(--purple);border-radius:6px;transition:width .4s ease}.download-progress::-moz-progress-bar{background:var(--purple);border-radius:6px}.download-progress:indeterminate{background:#ece5f4}.download-progress:indeterminate::-webkit-progress-bar{background:repeating-linear-gradient(110deg,#ece5f4 0 12px,#d7c8ec 12px 24px)}
.spinner{display:inline-block;width:12px;height:12px;border:2px solid #cdbde1;border-top-color:#8862b5;border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}@keyframes spin{to{transform:rotate(360deg)}}.waiting-video{min-height:340px;background:#ede6f4;border:2px dashed #d3c5e1;border-radius:14px;display:flex;align-items:center;justify-content:center;gap:10px;font-size:12px;color:#9d86af}.empty-player{min-height:65vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px}.empty-character{font-size:50px;width:100px;height:100px;border:2px solid #cbb6de;border-radius:30px;color:#a88dbd;background:#eee4f5;display:grid;place-items:center;transform:rotate(-8deg);box-shadow:0 5px 0 #e0d0eb}
.error-box,.inline-error{color:#ad6572;font-size:11px;overflow-wrap:anywhere;white-space:pre-wrap}.error-box{border:1px solid #e7c1c7;border-radius:9px;padding:11px 13px;background:#fff0ef;margin-bottom:12px}.inline-error{margin-top:10px}#resume-video{margin-bottom:10px}
dialog{color:var(--ink);background:var(--paper);border:2px solid #665077;border-radius:18px;padding:22px;width:min(420px,calc(100vw - 32px));box-shadow:0 7px 0 #b8a2c8,0 20px 80px #3a254340}dialog::backdrop{background:#35284270;backdrop-filter:blur(3px)}.dialog-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.dialog-heading h2{font-size:17px;margin:0;letter-spacing:-.3px}.close-button{color:#9c88ad;background:#f3ebf7;border:1px solid #e3d7ec;width:27px;height:27px;line-height:22px;font-size:19px;border-radius:8px}#url-form label,.settings-form label{display:block;font-size:11px;color:#9984aa;margin:14px 0 6px}#url-form input,.settings-form input,.settings-form select{width:100%;padding:10px 11px;background:#fcf9ff;border:1.5px solid #ddcfe8;border-radius:9px;color:#706079;font-size:12px}#url-form input::placeholder,.settings-form input::placeholder{color:#baa9c6}.submit-button{width:100%;margin-top:23px;display:flex;align-items:center;justify-content:space-between}
.toast{position:fixed;z-index:1000;bottom:20px;right:24px;max-width:480px;display:flex;gap:15px;align-items:flex-start;border:1px solid #d4a2ad;background:#fff3f3;padding:12px 14px;border-radius:11px;color:#a16071;font-size:12px;box-shadow:0 4px 14px #49314612}.toast>span{overflow-wrap:anywhere}.toast button{border:0;background:transparent;color:inherit;font-size:18px;line-height:18px}.muted{color:var(--muted)}
@media(max-width:760px){.app{grid-template-columns:165px minmax(0,1fr)}.sidebar{padding:15px 10px}.brand{font-size:16px;gap:4px}.mascot{width:33px}.workspace{padding:18px 14px}.add-button{padding:8px 5px;font-size:11px}.caption-control{gap:5px;flex-wrap:wrap}.icon-button{font-size:0;padding:6px}.icon-button::after{content:"↓";font-size:14px}}

.settings-button{margin-top:auto;align-self:flex-start;flex-shrink:0;font-size:11px;padding:6px 10px}.library{margin-bottom:12px}.title-status{display:flex;align-items:center;flex-wrap:wrap;gap:7px;color:var(--muted);font-size:11px}.title-status:not(:has(:not([hidden]):not(:empty))){display:none}.title-status:has(#title-state:not(:empty)){margin-top:6px}.title-block h1{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.title-block .inline-error{margin-top:5px}.dialog-note{font-size:12px;color:#8b789d;margin:10px 0;line-height:1.5}.settings-form>.small-button{margin-top:10px}.settings-form+.settings-form{margin-top:16px;padding-top:4px;border-top:1px solid var(--line)}.settings-form input,.settings-form select{display:block;width:100%}dialog{max-height:calc(100dvh - 32px);overflow-y:auto}.video-js.vjs-fullscreen,.vjs-full-window .video-js{width:100%!important;height:100%!important;padding-top:0!important}.caption-control{flex-wrap:wrap}

/* Video on the left, a self-scrolling phrase rail on the right. */
#video-panel{max-width:none}
.workspace{padding:18px 20px}
.workspace-actions{float:right;display:flex;align-items:center;gap:8px;margin:0 0 12px 20px}
.workspace-actions .primary-button{min-height:34px;padding:6px 11px;font-size:12px}
.workspace-actions .small-button{min-height:34px;font-size:12px;padding:6px 11px}
.workspace-actions .icon-button{margin:0;width:34px;height:34px;padding:0;font-size:20px;display:grid;place-items:center;color:var(--purple-dark)}
.workspace-actions .icon-button::after{content:none}
.video-heading{min-height:48px;margin-bottom:12px}
.progress-tray{clear:both;max-width:none;margin-bottom:10px}
.waiting-video{min-height:180px;max-height:50dvh;aspect-ratio:16/9;flex-direction:column;gap:8px;border:1.5px solid #d8cbe8;background:#f0eaf7;color:#8d77a8;font-size:13px;box-shadow:0 4px 0 #e5ddef}.waiting-icon{width:48px;height:48px;color:var(--purple)}
.speech-feedback:has(#speech-state:empty):has(#speech-cancel[hidden]){display:none}
.learning-layout{clear:both;display:grid;grid-template-columns:minmax(0,1fr) clamp(300px,27vw,360px);max-width:calc((100dvh - 220px) * 1.77778 + clamp(300px,27vw,360px) + 16px);gap:16px;align-items:stretch}
.player-column{min-width:0}
.learning-layout .player-frame{min-width:0}
.caption-sizes{display:block;padding:14px;color:var(--muted);font-size:12px;min-width:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:thin}
.size-control{margin-bottom:16px}
.caption-sizes label{display:flex;justify-content:space-between;gap:4px;margin:0 0 4px}
.caption-sizes output{font-variant-numeric:tabular-nums;color:var(--purple)}
.caption-sizes input{display:block;width:100%;margin:0;accent-color:var(--purple);cursor:pointer}
.caption-backdrop-settings{position:relative;padding:12px 0 0;margin:0;border-top:1px solid var(--line)}
.caption-backdrop-settings[open]>summary{margin-bottom:8px}
#backdrop-controls:not([hidden]){display:block}
.caption-backdrop-settings .backdrop-switch{max-width:130px}
.caption-backdrop-settings summary{color:var(--purple-dark);cursor:pointer;font-size:11px;font-weight:600}
.caption-backdrop-settings label{margin-top:7px;align-items:center;gap:4px}
.caption-backdrop-settings input[type=range]{margin-bottom:7px}
.caption-backdrop-settings select{display:block;width:100%;min-width:0;border:1px solid #cbbbdc;border-radius:6px;background:var(--paper);color:var(--ink);padding:4px 2px;font-size:11px}
.caption-backdrop-settings .backdrop-switch{justify-content:space-between}
.caption-backdrop-settings input[type=checkbox]{width:15px;height:15px;margin:0;flex:none}
.caption-backdrop-settings input[type=color]{width:30px;height:22px;margin:0;padding:1px;border:1px solid var(--line);border-radius:5px;background:var(--paper)}
.caption-backdrop-settings output{flex:none;font-size:10px}
.learning-status{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:11px;color:var(--muted);margin-top:10px;min-height:16px}
.learning-status:has(#learning-state:empty):has(#retry-learning[hidden]){display:none}
.video-js .learning-captions{position:absolute;inset:0;z-index:5;pointer-events:none;font-family:ui-rounded,"SF Pro Rounded",-apple-system,sans-serif;line-height:1.35;text-shadow:none}
.learning-backdrop{position:absolute;z-index:0;pointer-events:none;overflow:hidden}
.video-js .vjs-control-bar{z-index:6}
.learning-position{position:absolute;z-index:1;left:3%;top:8px;width:max-content;max-width:calc(100% - 16px);padding-right:28px;pointer-events:none}
.learning-lines{min-width:0;overflow-y:auto;overscroll-behavior:contain;text-align:center;scrollbar-width:thin;pointer-events:auto}
.video-js .learning-drag-handle{position:absolute;right:0;top:5px;width:24px;height:30px;padding:0;border:1px solid #c9b2e780;border-radius:7px;background:#30233fe8;color:#e3cfff;font:20px/28px sans-serif;pointer-events:auto;cursor:grab;touch-action:none;user-select:none}
.video-js .learning-drag-handle:hover{background:#49355ff2}.video-js .learning-drag-handle.dragging{cursor:grabbing}
.learning-sentence{width:fit-content;max-width:100%;margin:5px auto 6px;padding:3px 8px;border-radius:7px;background:#231c30ed;color:#fff8ed;font-size:var(--sentence-size,18px);line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.learning-lines:empty{pointer-events:none}
.learning-line{white-space:pre-wrap;text-wrap:balance;font-size:var(--pinyin-size,24px);color:#fff8ed}
.video-js .learning-cell{display:inline-flex;flex-direction:column;align-items:center;vertical-align:bottom;max-width:100%;min-width:0;margin:3px 2px;padding:3px 6px;border:1px solid #c9b2e757;border-radius:7px;background:#231c30ed;color:#fff8ed;cursor:pointer;font:inherit;line-height:1.35;pointer-events:auto;text-align:center}
.video-js .learning-cell:hover,.video-js .learning-cell:focus-visible{background:#49355ff2;border-color:#d6bafc}
.learning-meaning{display:block;max-width:14ch;font-size:var(--meaning-size,13px);font-weight:500;color:#ffdcad;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-height:1.35em}
.learning-pinyin{display:block;max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--pinyin-size,24px)}
.learning-punctuation{white-space:pre-wrap;text-shadow:0 1px 3px #000,0 0 5px #000;vertical-align:bottom}
.video-js .learning-popup{position:absolute;z-index:2;pointer-events:auto;width:max-content;max-width:min(360px,calc(100% - 16px));max-height:calc(100% - 64px);overflow:auto;overscroll-behavior:contain;padding:12px 32px 12px 12px;border:1px solid #c8b4df;border-radius:10px;background:var(--paper);color:var(--ink);box-shadow:0 4px 16px #17101f66;font-size:14px;line-height:1.45;text-align:left;white-space:pre-wrap;overflow-wrap:anywhere}
.video-js .learning-popup-close{position:absolute;right:5px;top:5px;background:#eee5f8;border:1px solid var(--line);border-radius:6px;width:24px;height:24px;padding:0;color:var(--purple-dark);font:20px/20px sans-serif;cursor:pointer}
.learning-popup-pinyin{font-size:17px;font-weight:650;margin-bottom:5px;color:var(--purple-dark)}
.learning-popup-meaning{font-weight:600}

.empty-character{font-size:22px}
.player-tools{margin-top:8px;gap:6px}
.caption-status{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;border:1px solid var(--line);border-radius:8px;background:var(--sidebar);color:var(--purple-dark);font-size:11px;line-height:1.4}
.caption-status::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;flex:none;opacity:.6}
.caption-status.unavailable{background:#fff0ef;border-color:#e7c1c7;color:#ad6572}
.caption-status.loading::before{width:10px;height:10px;border:2px solid #cdbde1;border-top-color:var(--purple);background:transparent;animation:spin .8s linear infinite}
.transcript-panel{position:relative;min-width:0;min-height:0;border:1px solid #dcd2e9;border-radius:14px;background:var(--sidebar);overflow:hidden}
.transcript-heading{height:48px;padding:0 10px;display:flex;align-items:center;justify-content:space-between;gap:6px;border-bottom:1px solid #ded4eb}
.study-tabs{display:flex;gap:3px;min-width:0}
.study-tabs button{border:1px solid transparent;border-radius:8px;padding:6px 9px;font-size:12px;font-weight:600;color:#887497;background:transparent;white-space:nowrap}
.study-tabs button[aria-selected=true]{color:var(--purple-dark);background:var(--paper);border-color:#d3c3e5;box-shadow:0 2px 0 #ddd2ea}
.study-pane{position:absolute;inset:48px 0 0;min-height:0}
#follow-transcript{flex:none;white-space:nowrap}
#follow-transcript[hidden]{display:block!important;visibility:hidden;pointer-events:none}
.transcript-panel[data-view=display] #follow-transcript{visibility:hidden;pointer-events:none}
.transcript-heading h2{font-size:13px;font-weight:650;margin:0;color:var(--purple-dark)}
.transcript-list{position:absolute;inset:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-gutter:stable;scroll-padding:20px;padding:0 10px}
.transcript-list::after{content:"";display:block;height:70%;pointer-events:none}
.transcript-row{display:grid;grid-template-columns:minmax(0,1fr) 40px;align-items:center;margin:6px 0;border:1px solid transparent;border-radius:11px;transition:background .15s,border-color .15s}
.transcript-row:hover{background:#f7f3ff}
.transcript-row.current{background:var(--paper);border-color:#b29bd7;box-shadow:0 3px 0 #d8cce9}
.transcript-phrase{display:block;border:0;border-radius:10px;background:none;text-align:left;width:100%;padding:11px 12px;color:var(--ink)}
.transcript-pinyin{display:block;font-size:16px;line-height:1.5;overflow-wrap:anywhere;color:#776784}
.current .transcript-pinyin{font-weight:650;color:var(--purple-dark)}
.transcript-translation{display:block;font-size:12px;line-height:1.5;color:#96879f;margin-top:4px;overflow-wrap:anywhere}
.current .transcript-translation{color:#6e5d7d}
.transcript-empty{font-size:12px;color:var(--muted);padding:12px;text-align:center}
#library-dialog{width:min(920px,calc(100vw - 40px));background:var(--sidebar)}
#library-dialog .brand{display:none}
#library-dialog .library-heading h2{display:none}
#library-dialog .library-heading{justify-content:flex-end;margin-top:-10px}
#library-dialog .library{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px;max-height:calc(100dvh - 180px);margin:0;align-items:start}
#library-dialog .library-item{margin:0;padding:9px}
.library-open{display:block;width:100%;padding:0;border:0;background:transparent;text-align:left;color:inherit;border-radius:7px}
.library-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.library-actions .small-button{min-height:36px;padding:7px 9px;font-size:11px}
.delete-button{color:#ad6572;border-color:#e7c1c7;background:#fff0ef}
@media(pointer:coarse){.library-actions .small-button{min-height:44px}}
#library-dialog .library-title{font-size:13px}
#library-dialog .library-status{font-size:11px}
#phrase-dialog{width:min(600px,calc(100vw - 32px))}
.phrase-summary{display:flex;align-items:flex-start;gap:12px;margin-bottom:16px}
.phrase-summary-text{min-width:0;flex:1}
.phrase-pinyin{font-size:20px;line-height:1.5;color:var(--purple-dark);overflow-wrap:anywhere}
.phrase-translation{margin:5px 0 0;font-size:14px;white-space:pre-wrap;overflow-wrap:anywhere;color:#776784}
.phrase-segments{display:flex;flex-wrap:wrap;align-items:center;gap:7px;border-top:1px solid var(--line);padding-top:14px}
.phrase-cell-meaning{grid-column:1;grid-row:1;font-size:11px;line-height:1.35;color:#8a623f;white-space:normal;max-width:24ch}
.phrase-cell-meaning:empty{display:none}
.phrase-cell-pinyin{grid-column:1;grid-row:2;font-size:16px;line-height:1.4}
.phrase-punctuation{font-size:18px;color:var(--muted);align-self:center;padding:0 1px}
.speech-button,.video-js .speech-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:32px;min-height:32px;padding:6px 10px;border:1px solid #d9cde7;border-radius:9px;color:var(--purple-dark);background:#f6f1fb;cursor:pointer;font:12px/1.3 ui-rounded,"SF Pro Rounded",-apple-system,sans-serif;touch-action:manipulation;vertical-align:middle;flex:none}
.speech-icon{display:block;width:18px;height:18px;flex:none;pointer-events:none}
.speech-button[data-speech-compact=true]:not(.phrase-cell){width:32px;padding:6px;border-color:transparent;border-radius:50%;background:transparent}
.speech-button.phrase-cell{display:grid;grid-template-columns:minmax(0,1fr) 16px;gap:3px 10px;max-width:100%;min-height:58px;padding:8px 10px;border-color:#e4daee;background:#f8f5fb;text-align:left;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere}
.speech-button.phrase-cell>.speech-icon{grid-column:2;grid-row:1/3;align-self:center;width:16px;height:16px;color:#9b84b7}
.speech-button.phrase-cell:hover{border-color:#bda7d9;background:#f0e8f9}
.speech-button.phrase-cell.is-speaking{background:#eee4fa;border-color:var(--purple);color:var(--purple-dark)}
.speech-button.phrase-cell.is-speaking>.speech-icon{color:var(--purple-dark)}
.speech-button.phrase-cell:disabled{opacity:1;color:var(--ink);cursor:default}
.speech-button.phrase-cell:disabled>.speech-icon{opacity:.3}
.speech-button:hover,.video-js .speech-button:hover{background:#e6daf6}
.speech-button.is-speaking,.video-js .speech-button.is-speaking{color:white;background:var(--purple);border-color:var(--purple-dark)}
.speech-button[data-speech-compact=true]:not(.phrase-cell):hover{background:#e6daf6}
.speech-button[data-speech-compact=true]:not(.phrase-cell).is-speaking{color:white;background:var(--purple);border-color:var(--purple-dark)}
.speech-button:disabled,.video-js .speech-button:disabled{cursor:not-allowed;opacity:.45}
.transcript-row>.speech-button{justify-self:center;width:34px;padding:5px}
.video-js .learning-sentence>.speech-button{margin-left:8px;min-height:30px;min-width:30px;padding:4px 6px}
.video-js .learning-popup>.speech-button{margin-top:10px}

.speech-feedback{display:flex;align-items:center;gap:8px;min-height:20px;margin-top:4px;font-size:11px;color:var(--muted);overflow-wrap:anywhere}
.speech-settings{border-top:1px solid var(--line);padding:12px 0;margin:0}
.speech-settings summary{color:var(--purple-dark);cursor:pointer;font-size:12px;font-weight:600}
.speech-settings label{margin-top:10px;align-items:center}
.speech-settings select{width:100%;min-width:0;border:1px solid #cbbbdc;border-radius:7px;background:var(--paper);color:var(--ink);padding:7px;font-size:12px}
.speech-note{font-size:11px;color:var(--muted);line-height:1.5;margin:7px 0}
.speech-settings-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:12px}
.speech-settings progress{display:block;width:100%;height:7px;margin:8px 0;accent-color:var(--purple)}
.speech-settings-actions .small-button{min-height:36px;font-size:12px;padding:7px 10px}
.speech-settings-actions #speech-preview{display:inline-flex;align-items:center;gap:6px}
@media(pointer:coarse){.speech-button,.video-js .speech-button{min-width:44px;min-height:44px}.transcript-row{grid-template-columns:minmax(0,1fr) 48px}.transcript-row>.speech-button{width:44px}.video-js .learning-sentence>.speech-button{min-width:44px;min-height:44px}.speech-settings select{font-size:16px;min-height:44px}.speech-settings-actions .small-button{min-height:44px}}
@media(max-width:1000px){.learning-layout{gap:12px}.workspace{padding:14px}.workspace-actions{margin-left:12px}}
@media(max-width:680px){.workspace-actions{float:none;justify-content:flex-end;margin:0 0 14px}.video-heading{min-height:0}.learning-layout{grid-template-columns:minmax(0,1fr)}.transcript-panel{height:340px}.video-js .learning-cell{padding:2px 4px;margin:2px 1px}.learning-meaning{max-width:10ch}}
