/* Scoped to the optional new-story creator; no home or existing chat layout. */
.story-dialog.custom-story-dialog { width:min(100%,480px); background:#2b2119; padding:24px; box-sizing:border-box; word-break:keep-all; overflow-wrap:break-word; }
.custom-story-dialog * { box-sizing:border-box; }
.custom-story-dialog [hidden] { display:none!important; }
.custom-story-dialog .cs-eyebrow { display:block; color:#c6a263; font-size:11px; letter-spacing:.08em; margin-bottom:7px; }
.custom-story-dialog header button { flex:none; padding:6px 11px; }
.custom-story-dialog .cs-lead { margin:15px 0 20px; }
.custom-story-dialog .cs-choices { display:grid; gap:12px; }
.custom-story-dialog .cs-choice { width:100%; display:block; text-align:left; border-color:#6b543b; padding:18px; background:#34281e; }
.custom-story-dialog .cs-choice strong { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; font-size:16px; }
.custom-story-dialog .cs-choice small { display:block; color:#c2b19e; line-height:1.65; margin-top:9px; font-size:12px; }
.custom-story-dialog .cs-price { color:#dbb879; white-space:nowrap; font-size:12px; font-weight:500; }
.custom-story-dialog .cs-choice-personal { background:linear-gradient(135deg,#493025,#33251d); border-color:#b58e52; }
.custom-story-dialog .cs-link { border:0; padding:10px 0; color:#d4b77d; font-size:13px; text-decoration:underline; text-underline-offset:4px; }
.custom-story-dialog label { display:block; margin:18px 0 8px; font-size:14px; font-weight:600; }
.custom-story-dialog textarea { display:block; resize:vertical; width:100%; max-width:100%; min-height:150px; background:#201a15; color:#f1e4d3; border:1px solid #71593e; border-radius:12px; padding:14px; font:inherit; font-size:16px; line-height:1.65; }
.custom-story-dialog textarea:focus { outline:2px solid #c4a061; outline-offset:2px; }
.custom-story-dialog textarea::placeholder { color:#9e8d7a; }
.custom-story-dialog .cs-short-input { min-height:100px; }
.custom-story-dialog .cs-count { color:#ad9c88; font-size:11px; text-align:right; margin:6px 0 12px; }
.custom-story-dialog details { margin:16px 0; border-top:1px solid #58432f; padding-top:14px; }
.custom-story-dialog summary { color:#d5b984; font-size:13px; cursor:pointer; }
.custom-story-dialog .cs-note { font-size:12px; color:#bba78e; line-height:1.7; }
.custom-story-dialog .cs-content { white-space:pre-wrap; overflow-wrap:anywhere; font-size:14px; line-height:1.8; color:#ded0bf; }
.custom-story-dialog .cs-summary { background:#34291f; border:1px solid #5a452f; border-radius:13px; padding:16px; margin:18px 0; }
.custom-story-dialog .cs-summary h3 { font-size:17px; line-height:1.5; color:#f2e4cc; margin:0 0 9px; overflow-wrap:anywhere; }
.custom-story-dialog .cs-summary p:last-child { margin-bottom:0; }
.custom-story-dialog .cs-opening { border-left:2px solid #9c7b49; padding:4px 0 4px 14px; margin:18px 0; }
.custom-story-dialog .cs-section-title { color:#caa469; font-size:12px; margin:18px 0 8px; }
.custom-story-dialog ul { padding-left:18px; color:#cbbba5; font-size:13px; line-height:1.7; }
.custom-story-dialog .cs-check { display:flex; align-items:flex-start; gap:9px; font-weight:400; font-size:12px; line-height:1.7; color:#dbccb6; }
.custom-story-dialog .cs-check input { width:18px; height:18px; flex:none; margin-top:2px; accent-color:#b89357; }
.custom-story-dialog .cs-primary { background:#862e3d; border-color:#a04453; color:#fff1df; font-weight:700; }
.custom-story-dialog footer { flex-wrap:wrap; }
.custom-story-dialog footer button { min-height:44px; }
.custom-story-dialog .cs-status { min-height:1.6em; margin:14px 0; color:#d6b986; font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.custom-story-dialog .cs-library-toolbar { display:flex; justify-content:space-between; align-items:center; gap:10px; margin:4px 0 12px; }
.custom-story-dialog .cs-library-label { color:#bba78e; font-size:12px; }
.custom-story-dialog .cs-library-switch { color:#d4b77d; font-size:12px; min-height:44px; padding:8px 0 8px 8px; border:0; }
.custom-story-dialog .cs-library { display:grid; gap:10px; }
.custom-story-dialog .cs-library-row { display:flex; align-items:stretch; min-width:0; border:1px solid #675039; background:#34291f; border-radius:13px; }
.custom-story-dialog .cs-library-open { flex:1; min-width:0; padding:17px 0 17px 16px; border:0; text-align:left; }
.custom-story-dialog .cs-library-open:last-child { padding-right:16px; }
.custom-story-dialog .cs-library strong { display:block; overflow-wrap:anywhere; font-family:var(--font-serif,Georgia,"Batang",serif); font-size:16px; line-height:1.6; }
.custom-story-dialog .cs-library small { display:block; color:#baa78f; font-size:11px; line-height:1.6; margin-top:8px; }
.custom-story-dialog .cs-library-menu { flex:none; align-self:flex-start; min-height:44px; min-width:44px; padding:0 7px; margin:6px 3px 0 1px; border:0; color:#cab590; font-size:25px; line-height:1; }
.custom-story-dialog .cs-library-restore { flex:none; align-self:center; min-height:44px; margin:8px 10px; padding:8px 10px; border-color:#917145; color:#d4b77d; font-size:12px; white-space:nowrap; }
.custom-story-dialog .cs-library-notice { display:flex; align-items:center; justify-content:space-between; gap:12px; border-radius:10px; background:#e5d6b9; color:#302312; padding:6px 10px 6px 14px; font-size:12px; margin-top:16px; }
.custom-story-dialog .cs-library-undo { flex:none; min-height:44px; border:0; padding:8px; font-size:12px; font-weight:700; color:#644312; }
.custom-story-dialog .cs-library-preserve { margin:4px 0 16px; }
.cs-library-sheet-backdrop { position:absolute; inset:0; z-index:1; display:flex; align-items:flex-end; justify-content:center; padding:20px; background:rgba(8,6,4,.65); }
.cs-library-sheet { width:min(100%,480px); max-height:85dvh; overflow:auto; box-sizing:border-box; padding:14px 22px 22px; border:1px solid #6b5232; border-radius:22px; background:#30251c; color:#f0e6d6; box-shadow:0 -12px 35px #0003; word-break:keep-all; overflow-wrap:anywhere; }
.cs-library-sheet * { box-sizing:border-box; }
.cs-library-sheet-handle { width:34px; height:4px; border-radius:4px; background:#6b5842; margin:0 auto 22px; }
.cs-library-sheet h3 { margin:0 0 22px; font-size:19px; line-height:1.6; font-family:var(--font-serif,Georgia,"Batang",serif); }
.cs-library-sheet button { display:block; width:100%; min-height:46px; padding:14px 16px; border:1px solid #745936; border-radius:11px; background:#3c2e21; color:#f0e6d6; font:inherit; cursor:pointer; }
.cs-library-sheet button:focus-visible { outline:2px solid #edc890; outline-offset:3px; }
.cs-library-sheet button:disabled { opacity:.6; cursor:default; }
.cs-library-sheet .cs-library-hide { text-align:left; }
.cs-library-sheet .cs-library-sheet-close { background:transparent; border-color:#675039; }
.cs-library-sheet .cs-note,.cs-library-sheet .cs-status { color:#bba78e; font-size:12px; line-height:1.8; margin:14px 0; }
.cs-library-sheet .cs-status:empty { display:none; }
.custom-story-dialog .cs-order-state { display:inline-flex; border:1px solid #866840; border-radius:6px; padding:3px 8px; color:#e2c389; font-size:11px; margin:18px 0 0; }
@media(max-width:380px) {
  .story-dialog-backdrop:has(.custom-story-dialog) { padding:12px; }
  .story-dialog.custom-story-dialog { padding:20px 17px; }
  .custom-story-dialog h2 { font-size:19px; }
  .custom-story-dialog footer button { flex:1; padding:10px; }
  .cs-library-sheet-backdrop { padding:12px; }
  .cs-library-sheet { padding-left:18px; padding-right:18px; }
  .custom-story-dialog .cs-library-restore { padding:8px; margin-right:8px; }
}
@media(prefers-reduced-motion:reduce) { .custom-story-dialog * { scroll-behavior:auto!important; } }
