/* Keep every selector scoped: this dialog may sit above the montage editor. */
#speechEditor{position:fixed;inset:0;z-index:2000;display:flex;align-items:center;justify-content:center;padding:24px;background:#080c12bc;color:var(--fg,#ecf1f3);font:14px/1.5 var(--font-body,system-ui,sans-serif);box-sizing:border-box;overscroll-behavior:contain}
#speechEditor *{box-sizing:border-box}
#speechEditor [hidden]{display:none!important}
#speechEditor .se-panel{display:flex;flex-direction:column;width:min(860px,100%);max-height:calc(100dvh - 48px);background:var(--bg,#14191e);border:1px solid var(--line,#3a4249);border-radius:20px;box-shadow:0 18px 80px #0009;overflow:hidden}
#speechEditor .se-header{display:flex;gap:16px;justify-content:space-between;align-items:center;padding:18px 24px;border-bottom:1px solid var(--line,#3a4249);flex:none}
#speechEditor h2{font-size:20px;margin:0;color:inherit;text-transform:none;letter-spacing:normal}
#speechEditor h3{font-size:16px;margin:0}
#speechEditor .se-header p{margin:2px 0 0;color:var(--muted,#a1aeb8);font-size:12px}
#speechEditor .se-body{padding:20px 24px;overflow-y:auto;overscroll-behavior:contain;min-height:0;display:grid;gap:16px}
#speechEditor p{margin:0;overflow-wrap:anywhere}
#speechEditor .se-fields{padding:0;margin:0;border:0;min-width:0;display:grid;gap:16px}
#speechEditor .se-section{min-width:0;display:grid;gap:12px;padding:16px;border:1px solid var(--line,#3a4249);border-radius:12px;background:var(--panel,#1b2229)}
#speechEditor .se-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#speechEditor .se-grid-three{grid-template-columns:repeat(3,minmax(0,1fr))}
#speechEditor .se-field{display:grid;gap:6px;min-width:0;font-weight:500}
#speechEditor .se-field>span{font-size:12px;color:var(--muted,#a1aeb8)}
#speechEditor input:not([type=checkbox]),#speechEditor select,#speechEditor textarea{width:100%;min-width:0;min-height:44px;padding:10px 12px;border:1px solid var(--line,#3a4249);border-radius:8px;background:var(--bg,#14191e);color:inherit;font:inherit}
#speechEditor textarea{resize:vertical;line-height:1.5}
#speechEditor input[type=color]{padding:5px}
#speechEditor .se-check{display:flex;gap:10px;align-items:flex-start;cursor:pointer;font-size:14px}
#speechEditor input[type=checkbox]{width:20px;height:20px;flex:none;margin:1px 0}
#speechEditor .se-note{font-size:12px;color:var(--muted,#a1aeb8)}
#speechEditor .se-warning{font-size:13px;color:var(--accent,#edcc88);border-left:3px solid currentColor;padding-left:12px}
#speechEditor .se-status{font-size:13px;color:var(--mint,#a1d8bd)}
#speechEditor .se-error{font-size:14px;color:var(--rose,#ffb1bd);padding:12px;background:#a62f4120;border:1px solid currentColor;border-radius:8px}
#speechEditor .se-actions,#speechEditor .se-topup{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
#speechEditor button,#speechEditor .se-topup a{min-height:44px;padding:10px 14px;background:var(--raise,#29353e);color:inherit;border:1px solid var(--line,#586771);border-radius:9px;font:inherit;cursor:pointer;text-align:center;white-space:normal}
#speechEditor .se-primary{background:#285442;border-color:#79c5a3;color:#f1fff8}
#speechEditor button:disabled,#speechEditor input:disabled,#speechEditor select:disabled,#speechEditor textarea:disabled{opacity:.5;cursor:default}
#speechEditor :focus-visible{outline:2px solid var(--accent,#8acfb1);outline-offset:3px}
#speechEditor .se-close{flex:none}
#speechEditor .se-quote{display:grid;gap:12px;padding:16px;border:1px solid var(--accent,#8acfb1);border-radius:10px}
#speechEditor .se-price{font-weight:700;font-size:16px}
#speechEditor .se-connection summary{cursor:pointer;min-height:32px;font-weight:600}
#speechEditor .se-connection:not([open]){display:block}
#speechEditor .se-connection form{display:grid;gap:12px;margin-top:12px}
#speechEditor audio{width:100%;max-width:100%;margin-top:4px}
@media(max-width:600px){
  #speechEditor{padding:0;align-items:stretch}
  #speechEditor .se-panel{width:100%;max-height:100dvh;border-radius:0;border:0}
  #speechEditor .se-header{padding:calc(14px + env(safe-area-inset-top,0px)) 16px 14px}
  #speechEditor .se-body{padding:16px 12px calc(20px + env(safe-area-inset-bottom,0px))}
  #speechEditor .se-section{padding:12px}
  #speechEditor .se-grid,#speechEditor .se-grid-three{grid-template-columns:1fr 1fr}
  #speechEditor .se-actions>*{width:100%}
}
@media(max-width:360px){#speechEditor .se-grid,#speechEditor .se-grid-three{grid-template-columns:1fr}#speechEditor h2{font-size:18px}}
