/* Controls belong to this preview only. Existing content stays untouched. */
.chat-home-slot { position: relative; z-index: 2; width: min(82%, 600px); min-width: 480px; margin: 120px 0 64px; scroll-margin-top: 16px; }
.chat-workspace { color: var(--ink); width: 100%; border-radius: 25px; background: var(--paper); box-shadow: 0 24px 64px #00000030; }
.chat-workspace .chat-shell { width: 100%; min-width: 0; max-width: none; margin: 0; border-radius: 0 0 25px 25px; box-shadow: none; scroll-margin-top: 64px; }
.chat-placement-bar { display: flex; align-items: center; gap: .5rem; min-height: 46px; padding: 3px 8px 3px 18px; border-bottom: 1px solid #e4e3dc; }
.chat-placement-name { margin-right: auto; font-size: .87rem; font-weight: 600; white-space: nowrap; }
.chat-placement-bar button { min-height: 40px; background: transparent; color: #4a5869; padding: .35rem .5rem; border: 0; border-radius: 7px; font: inherit; font-size: .85rem; cursor: pointer; }
.chat-placement-bar button:hover { background: #ebece8; color: var(--navy); }
.chat-placement-bar .chat-minimize { width: 40px; font-size: 1.5rem; line-height: 1; }
.chat-workspace button:focus-visible, .chat-minimized-launcher:focus-visible, .chat-home-placeholder button:focus-visible { outline: 2px solid #9b722f; outline-offset: 2px; }
.chat-workspace[data-chat-placement="dock"] { position: fixed; z-index: 80; right: 16px; bottom: calc(16px + var(--chat-keyboard-bottom, 0px)); width: min(440px, calc(100% - 32px)); max-height: calc(var(--chat-visible-height, 100dvh) - 32px); display: flex; flex-direction: column; border: 1px solid #bdb8ad; box-shadow: 0 12px 50px #0c193d45; }
.chat-workspace[data-chat-placement="dock"] .chat-placement-bar { flex-shrink: 0; }
.chat-workspace[data-chat-placement="dock"] .chat-shell { min-height: 0; height: auto; max-height: calc(var(--chat-visible-height, 100dvh) - 82px); overflow-y: auto; overscroll-behavior: contain; }
.chat-workspace[data-chat-placement="dock"] .chat-shell[data-reading="true"] { height: min(680px, calc(var(--chat-visible-height, 100dvh) - 82px)); overflow: hidden; }
.chat-workspace[data-chat-placement="dock"] .chat-shell:not([data-reading="true"]) .chat-conversation { max-height: min(38dvh, 300px); }
.chat-minimized-launcher { position: fixed; z-index: 81; right: 18px; bottom: max(14px, env(safe-area-inset-bottom)); min-height: 52px; padding: 8px 16px 8px 9px; display: flex; align-items: center; gap: 10px; border: 1px solid #d3c5aa; border-radius: 17px 17px 5px 17px; background: #fffefa; color: var(--navy); font: inherit; font-weight: 600; box-shadow: 0 6px 24px #0c193d30; cursor: pointer; }
.chat-minimized-launcher img { border-radius: 50%; }
.chat-home-placeholder { border: 1px solid #ffffff50; border-radius: 18px; padding: 1.4rem; color: #fffefa; background: #13203cd9; }
.chat-home-placeholder p { margin: 0 0 .5rem; }
.chat-home-placeholder button { color: #f0e5cd; background: none; border: 0; padding: .4rem 0; min-height: 44px; font: inherit; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.chat-workspace[hidden], .chat-minimized-launcher[hidden], .chat-home-placeholder[hidden] { display: none !important; }
.reader-stack-page.chat-reader { left: var(--sheet-left, calc(32px + var(--layer, 0)*32px)); }
.reader-width-handle { position: absolute; z-index: 45; left: 0; top: 58px; bottom: 12px; width: 14px; cursor: ew-resize; touch-action: none; }
.reader-width-handle::after { content: ''; position: absolute; left: 3px; top: 43%; height: 48px; width: 4px; border-radius: 4px; background: #b7a480; opacity: .65; transition: opacity .2s, background .2s; }
.reader-width-handle:hover::after, .reader-width-handle:focus-visible::after { background: #9b722f; opacity: 1; }
.reader-width-handle:focus-visible { outline: 2px solid #9b722f; outline-offset: -2px; border-radius: 6px; }
.reader-stack-page.is-resizing { user-select: none; }
.reader-media { flex: 0 0 auto; background: #f3f0e8; border-top: 1px solid #e3ddd0; }
.reader-video-tab { position: relative; display: flex; align-items: center; justify-content: center; gap: .55rem; width: 100%; min-height: 54px; padding: 13px 12px 8px; background: transparent; border: 0; color: var(--navy); font: inherit; font-size: .91rem; cursor: pointer; touch-action: none; }
.reader-video-tab img { width: 28px; height: 28px; object-fit: cover; border-radius: 50%; }
.reader-video-grip { position: absolute; top: 5px; left: calc(50% - 16px); width: 32px; height: 3px; border-radius: 3px; background: #c4b99e; }
.reader-video-arrow { font-size: 1.2rem; line-height: 1; }
.reader-video-tab:hover { background: #ebe6d9; }
.reader-video-tab.has-gentle-hint { animation: video-tab-hint 1.3s 1.2s ease-in-out 1; }
@keyframes video-tab-hint { 0%, 100% { transform: translateY(0); } 38% { transform: translateY(-5px); } 65% { transform: translateY(0); } 80% { transform: translateY(-2px); } }
.reader-media.is-open { position: absolute; z-index: 42; inset: auto 0 0; height: min(83%, 420px); display: flex; flex-direction: column; border-radius: 18px 18px 0 0; box-shadow: 0 -14px 36px #10213c25; }
.reader-media.is-open .reader-video-tab { flex-shrink: 0; min-height: 38px; padding: 14px 12px 5px; }
.reader-media.is-open .reader-video-tab > :not(.reader-video-grip) { display: none; }
.reader-video-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 18px 18px; }
.reader-video-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 10px; font-size: .88rem; }
.reader-video-heading > span { color: #5b635f; }
.reader-video-close { min-height: 40px; padding: .4rem .2rem; background: none; color: var(--navy); border: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.reader-video-placeholder { min-height: 245px; padding: 22px 16px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; text-align: center; background: radial-gradient(ellipse at 50% 0, #e4e9e1, #e9e5db 80%); border: 1px solid #d4d6ca; border-radius: 12px; }
.reader-video-placeholder img { width: 84px; height: 84px; border-radius: 50%; }
.reader-video-placeholder strong { color: var(--navy); font-size: 1.2rem; }
.reader-video-placeholder .reader-video-topic { margin: 0; font-size: 1rem; line-height: 1.4; }
.reader-video-placeholder small { max-width: 28ch; margin-top: 9px; color: #576057; font-size: .87rem; line-height: 1.4; }
@media (max-width: 980px) {
  .chat-home-slot { width: 100%; max-width: 680px; min-width: 0; margin: 0 auto; order: 2; }
}
@media (max-width: 540px) {
  .chat-placement-bar { padding-left: 12px; gap: 3px; }
  .chat-placement-bar button { font-size: .84rem; }
  .chat-workspace[data-chat-placement="dock"] { right: 8px; bottom: calc(8px + var(--chat-keyboard-bottom, 0px)); width: calc(100% - 16px); max-height: calc(var(--chat-visible-height, 100dvh) - 16px); }
  .chat-workspace[data-chat-placement="dock"] .chat-shell { max-height: calc(var(--chat-visible-height, 100dvh) - 66px); }
  .chat-workspace[data-chat-placement="dock"] .chat-shell[data-reading="true"] { height: calc(var(--chat-visible-height, 100dvh) - 66px); }
  .chat-workspace .chat-shell[data-reading="true"] { height: calc(100svh - 74px); min-height: 360px; }
  .reader-stack-page.chat-reader { left: 26px; }
  .reader-video-tab { font-size: .88rem; gap: .4rem; }
  .reader-video-content { padding: 0 12px 12px; }
  .reader-video-placeholder { min-height: 225px; padding: 16px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-video-tab.has-gentle-hint { animation: none; }
  .reader-width-handle::after { transition: none; }
}
