.epic-workspace { --epic-ink: #152038; --epic-muted: #5d6d86; --epic-blue: #0671e8; --epic-line: #dce4ef; color: var(--epic-ink); min-height: 100%; padding: 24px; background: #f7faff; font-size: 15px; }
.epic-workspace *, .epic-source-navigation * { box-sizing: border-box; }
.epic-workspace button, .epic-workspace input, .epic-workspace textarea { font: inherit; }
.epic-workspace [hidden], .epic-source-navigation [hidden] { display: none !important; }
.epic-heading, .epic-page-heading, .epic-document-heading { display: flex; align-items: baseline; gap: 16px; justify-content: space-between; margin-bottom: 18px; }
.epic-heading h1 { line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.epic-heading .epic-text-link { white-space: nowrap; }
.epic-heading .epic-text-link.epic-item-settings { color: var(--epic-muted); }
.epic-workspace .epic-heading .epic-text-link.epic-item-settings:hover { color: var(--epic-ink); }
.epic-title-field { flex: 1; min-width: 0; }
.epic-title-editor { display: block; min-height: 1.5em; overflow-wrap: anywhere; }
.epic-title-editor:focus { outline: none; }
.epic-tabs, .epic-subtabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--epic-line); }
.epic-tabs { margin: 0 -24px 20px; padding: 0 24px; background: rgba(255, 255, 255, .62); }
.epic-tab { color: var(--epic-muted); padding: 14px 18px; border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; }
.epic-tab[aria-current="page"] { color: var(--epic-blue); border-color: var(--epic-blue); }
.epic-build { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; color: var(--epic-muted); width: 44px; height: 48px; }
.epic-icon { height: 20px; width: 20px; flex-shrink: 0; }
.app-project-create .epic-icon { width: 16px; height: 16px; }
.epic-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; padding: 9px 18px; border: 1px solid #b4d1f7; border-radius: 6px; background: #fff; color: #0664cb; text-decoration: none; line-height: 1.5; cursor: pointer; }
.epic-button:hover { background: #f5faff; border-color: #7aafed; }
.epic-button:disabled { opacity: .55; cursor: wait; }
.epic-button-large { min-height: 48px; padding: 12px 32px; font-size: 17px; }
.epic-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; background: transparent; color: var(--epic-muted); border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.epic-icon-button:hover { background: #edf5ff; color: var(--epic-blue); }
.epic-text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--epic-blue); text-decoration: underline; text-underline-offset: 4px; background: transparent; border: 0; }
.epic-workspace :focus-visible, .epic-source-navigation :focus-visible { outline: none; }
.epic-item-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--epic-line); background: #fff; }
.epic-item-row { display: flex; align-items: center; gap: 20px; justify-content: space-between; padding: 22px 18px; color: inherit; border-bottom: 1px solid var(--epic-line); text-decoration: none; font-size: 17px; }
.epic-item-row:hover { background: #f7fbff; }
.epic-item-row time { flex-shrink: 0; font-size: 13px; color: var(--epic-muted); font-variant-numeric: tabular-nums; }
.epic-empty { background: #fff; padding: 42px 32px; line-height: 1.9; }
.epic-empty h2 { font-size: 22px; font-weight: 650; margin: 0 0 12px; }
.epic-empty p { color: var(--epic-muted); margin: 0 0 24px; }
.epic-form-page { max-width: 760px; margin: 0 auto; }
.epic-form-page h1 { margin: 22px 0 28px; }
.epic-form { display: flex; flex-direction: column; gap: 20px; }
.epic-field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; }
.epic-field > label, .epic-field > legend { font-weight: 550; margin-bottom: 6px; }
.epic-input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #c5d2e3; border-radius: 6px; background: #fff; color: var(--epic-ink); line-height: 1.75; }
.epic-textarea { resize: vertical; font-size: 17px !important; }
/* 成果物の本文の編集（Lexxy）。表示の .epic-prose と同じ文字の大きさで編集する。フォーカス時の枠は付けない。 */
.epic-rich-text { --lexxy-focus-ring-size: 0; --lexxy-focus-ring-color: transparent; display: block; min-width: 0; border: 1px solid #c5d2e3; border-radius: 6px; background: #fff; color: var(--epic-ink); }
.epic-rich-text :focus, .epic-rich-text :focus-visible { outline: none; }
.epic-rich-text .lexxy-editor__content { min-height: 26rem; padding: 12px 14px; font-size: 17px; line-height: 1.95; overflow-wrap: anywhere; }
.epic-rich-text .lexxy-editor__content h2 { font-size: 22px; font-weight: 650; line-height: 1.65; margin: 30px 0 14px; }
.epic-rich-text .lexxy-editor__content h3 { font-size: 19px; font-weight: 650; line-height: 1.65; margin: 26px 0 12px; }
.epic-rich-text .lexxy-editor__content h4 { font-size: 17px; font-weight: 650; line-height: 1.65; margin: 22px 0 10px; }
.epic-rich-text .lexxy-editor__content > :first-child { margin-top: 0; }
.epic-field-help { color: var(--epic-muted); font-size: 13px; margin: 6px 0 0; }
.epic-actions, .epic-document-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; justify-content: flex-end; }
.epic-danger-zone { padding-top: 24px; margin-top: 40px; border-top: 1px solid var(--epic-line); text-align: right; }
.epic-danger-link { color: #b32d37; border: 0; background: transparent; font-size: 14px; cursor: pointer; }
.epic-error { padding: 16px; border: 1px solid #ecc9cc; color: #993640; background: #fff7f8; margin-bottom: 20px; overflow-wrap: anywhere; }
.epic-notice { padding: 16px; border: 1px solid var(--epic-line); background: #fff; margin-bottom: 20px; }
.epic-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: var(--epic-muted); }
.epic-toolbar > span { font-size: 13px; }
.epic-home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 24px; align-items: start; padding-bottom: 72px; }
.epic-transcript { min-width: 0; background: #fff; }
.epic-chapter { position: sticky; top: 0; z-index: 2; margin: 0; padding: 17px 22px; border-block: 1px solid #d2dff2; background: #edf2fc; color: #293f64; font-size: 16px; font-weight: 600; }
.epic-source-line { padding: 18px 22px; border-bottom: 1px solid var(--epic-line); scroll-margin-top: 72px; position: relative; }
.epic-source-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: #6c7f9a; font-size: 12px; min-height: 16px; margin-bottom: 7px; }
.epic-time { padding: 0; border: 0; color: #567197; background: transparent; font-variant-numeric: tabular-nums; }
.epic-time:hover { color: var(--epic-blue); text-decoration: underline; }
.epic-source-text { font-size: 17px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.95em; outline: none !important; }
.epic-save-status { font-size: 12px; line-height: 1.6; color: var(--epic-muted); }
.epic-save-status.is-error { color: #a02d39; }
.epic-context { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.epic-player { position: sticky; top: 12px; background: #fff; border: 1px solid var(--epic-line); padding: 8px; }
.epic-player video, .epic-player audio { display: block; width: 100%; max-height: 360px; }
.epic-source-navigation { margin-top: 28px; border-top: 1px solid #e5e7eb; padding-top: 12px; }
.epic-sidebar-tabs { display: flex; margin-bottom: 8px; }
.epic-sidebar-tabs button { flex: 1; padding: 8px 3px; font-size: 12px; color: #64748b; border: 0; background: transparent; border-bottom: 2px solid transparent; }
.epic-sidebar-tabs button[aria-selected="true"] { color: #1262c2; border-color: #1262c2; }
.epic-revision { padding: 10px; font-size: 12px; overflow-wrap: anywhere; }
.epic-revision p { white-space: pre-wrap; color: #64748b; margin: 12px 0; }
.epic-revision-diff { white-space: pre-wrap; margin: 12px 0; line-height: 1.8; }
.epic-diff-delete { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.epic-diff-insert { background: #dcfce7; color: #166534; text-decoration: underline; }
.epic-revision-full { margin: 12px 0; }
.epic-revision-full h4 { margin: 12px 0 0; font-size: inherit; font-weight: 600; }
.epic-revision .epic-button { font-size: 12px; padding: 5px 8px; min-height: 32px; }
.epic-annotation { border-left: 2px solid #afd0fb; padding: 10px 14px; margin-top: 16px; font-size: 14px; line-height: 1.8; background: #f7faff; overflow-wrap: anywhere; scroll-margin-top: 70px; }
.epic-annotation blockquote { margin: 0; color: #5b7292; }
.epic-annotation p { margin: 6px 0; }
.epic-annotation-actions.is-material { display: flex; justify-content: flex-end; }
@media (max-width: 760px) { .epic-material-edit { width: 44px; height: 44px; } }
.epic-annotation-actions { margin-top: 6px; color: var(--epic-muted); }
.epic-annotation-actions > form, .epic-annotation-actions > .epic-upload { margin-top: 12px; }
.epic-selection { position: fixed; inset: auto; margin: 0; width: 350px; max-width: calc(100vw - 24px); padding: 12px; border: 1px solid #b5d3fb; border-radius: 8px; background: #fff; color: #152038; box-shadow: 0 12px 45px #31527e24; }
.epic-selection .epic-form { gap: 12px; }
.epic-selection-actions { display: flex; align-items: center; gap: 3px; }
.epic-selection-actions > label { position: relative; white-space: nowrap; }
.epic-selection-actions input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.epic-selection-actions label span { display: block; padding: 8px 10px; border-radius: 4px; font-size: 14px; }
.epic-selection-actions input:checked + span { background: #edf5ff; color: #0664cb; }
.epic-selection-actions > button { margin-left: auto; }
.epic-selection-fields { display: grid; gap: 8px; }
.epic-dialog { width: min(760px, calc(100vw - 40px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid #cfdaeb; border-radius: 8px; background: #fff; color: #152038; box-shadow: 0 24px 100px #152d4d30; }
.epic-dialog::backdrop { background: rgb(0 0 0 / 50%); backdrop-filter: blur(8px); }
.epic-dialog[open] { display: flex; flex-direction: column; }
.epic-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 26px; border-bottom: 1px solid #dce4ef; flex-shrink: 0; gap: 18px; }
.epic-dialog-head h2 { font-size: 20px; margin: 0; font-weight: 650; }
.epic-dialog-body { padding: 28px; min-height: 0; overflow-y: auto; }
.epic-dialog-form { display: flex; flex-direction: column; min-height: 0; }
.epic-dialog-foot { padding: 18px 28px; border-top: 1px solid #dce4ef; display: flex; justify-content: flex-end; }
.epic-resolution { width: min(960px, calc(100vw - 40px)); }
.epic-resolution-question { padding: 22px 0; border-top: 1px solid #dce4ef; }
.epic-resolution-question:first-child { border: 0; padding-top: 0; }
.epic-resolution-question label { display: block; font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.epic-ask-button { position: fixed; bottom: 22px; right: 24px; display: inline-flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #b9d6ff; border-radius: 30px; padding: 13px 20px; color: var(--epic-blue); box-shadow: 0 8px 32px #2262af1a; z-index: 12; }
.epic-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #0b82ff; }
.epic-chat { width: min(900px, calc(100vw - 32px)); height: min(760px, calc(100dvh - 32px)); }
.epic-chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; scrollbar-gutter: stable; }
.epic-chat-message { margin: 0 0 24px; font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.epic-chat-message > span { display: block; font-size: 12px; color: #73849b; margin-bottom: 6px; }
.epic-chat-user { margin-left: auto; max-width: 85%; width: fit-content; padding: 12px 16px; background: #edf4ff; border-radius: 16px 16px 4px 16px; }
.epic-chat-user p { white-space: pre-wrap; margin: 0; }
.epic-chat-assistant { padding: 0 4px; }
.epic-chat-assistant .epic-prose { font-size: inherit; }
.epic-chat-assistant .epic-generation-status { padding: 8px 0; justify-content: flex-start; font-size: 13px; }
.epic-chat-assistant .epic-generation-status svg { width: 18px; height: 18px; }
.epic-chat-compose { flex-shrink: 0; border-top: 1px solid #dce4ef; padding: 16px 24px; }
.epic-chat-compose .epic-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; }
.epic-chat-compose .epic-field { min-width: 0; margin: 0; }
.epic-chat-compose .epic-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.epic-chat-compose textarea { display: block; box-sizing: border-box; min-height: 52px; max-height: 160px; resize: none; border-radius: 12px; font-size: 15px !important; line-height: 1.5; }
.epic-chat-compose .epic-actions { margin: 0; align-self: end; }
.epic-chat-compose .epic-button { min-height: 52px; border-radius: 12px; }
.epic-chat-compose .epic-form > .epic-save-status { grid-column: 1 / -1; margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.epic-chat-compose .epic-form > .epic-save-status:empty { display: none; }
.epic-subtabs { margin-bottom: 22px; }
.epic-subtabs .epic-tab { padding: 10px 0; margin-right: 24px; }
.epic-research-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.epic-research-nav { min-width: 0; }
.epic-research-nav .epic-button { width: 100%; margin-bottom: 14px; }
.epic-research-link { display: block; background: #fff; padding: 16px; color: #536882; border-bottom: 1px solid var(--epic-line); line-height: 1.75; }
.epic-document-card { padding: 28px; background: #fff; margin-bottom: 18px; line-height: 1.9; }
.epic-document-heading h2 { margin: 0; font-size: 21px; font-weight: 650; line-height: 1.65; }
.epic-document-heading time { font-size: 12px; color: var(--epic-muted); white-space: nowrap; }
.epic-document-card p { color: var(--epic-muted); }
.epic-research-examples { display: grid; gap: 12px; }
.epic-example { text-align: left; background: #fff; border: 1px solid #d3e3fa; padding: 16px 18px; line-height: 1.8; color: #0861c8; }
.epic-product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-bottom: 76px; }
.epic-product-card { display: flex; flex-direction: column; background: #fff; border: 1px solid #d3e3fa; min-width: 0; }
/* Rounded like the dialogs; a card that already has results reads as done at a glance. */
.epic-product-card { border-radius: 8px; overflow: hidden; }
.epic-product-card.has-results { border-color: #9cc3f2; }
.epic-product-card.has-results > .epic-product-create { background: #f3f8ff; }
.epic-product-open { width: 100%; flex: 1; display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 24px; background: transparent; border: 0; }
.epic-product-open h2 { font-size: 22px; color: #0664d2; font-weight: 650; margin: 0 0 12px; line-height: 1.5; }
.epic-product-open p { margin: 0; font-size: 15px; color: var(--epic-muted); line-height: 1.8; }
.epic-card-arrow { display: flex; justify-content: flex-end; color: var(--epic-blue); margin-top: 18px; }
.epic-product-results { border-top: 1px solid var(--epic-line); padding: 14px 24px; display: grid; gap: 12px; }
.epic-product-description { margin: 0 0 24px; line-height: 1.9; font-size: 17px; }
.epic-reader { padding: 32px; max-width: 960px; margin: 0 auto; background: #fff; min-width: 0; }
.epic-reader h1 { margin-bottom: 28px; line-height: 1.6; }
.epic-prose { font-size: 17px; line-height: 1.95; overflow-wrap: anywhere; }
.epic-prose > :first-child { margin-top: 0; }
.epic-prose h1, .epic-prose h2, .epic-prose h3 { font-weight: 650; line-height: 1.65; margin: 30px 0 14px; }
.epic-prose h1, .epic-prose h2 { font-size: 22px; }
.epic-prose h3 { font-size: 19px; }
.epic-prose p, .epic-prose ul, .epic-prose ol { margin: 14px 0; }
.epic-prose ul, .epic-prose ol { padding-left: 24px; }
.epic-prose ul { list-style: disc; }
.epic-prose ol { list-style: decimal; }
.epic-prose a, .epic-sources a { color: #0664d2; text-decoration: underline; text-underline-offset: 3px; }
.epic-prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.epic-prose th, .epic-prose td { padding: 12px; border: 1px solid #dce4ef; min-width: 120px; }
.epic-prose pre { max-width: 100%; overflow-x: auto; padding: 16px; background: #f5f8fc; font-size: 14px; }
.epic-prose img { max-width: 100%; height: auto; }
.epic-prose h4 { font-size: 17px; font-weight: 650; line-height: 1.65; margin: 22px 0 10px; }
.epic-prose figure.attachment { margin: 20px 0; }
.epic-prose figure.attachment img { border-radius: 6px; }
.epic-prose .attachment__caption { margin-top: 8px; color: var(--epic-muted); font-size: 14px; line-height: 1.7; }
.epic-document-actions { border-top: 1px solid var(--epic-line); margin-top: 30px; padding-top: 22px; }
.epic-radio { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.epic-field > .epic-radio { margin-bottom: 0; padding-block: 4px; }
.epic-generation-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 18px 0; color: var(--epic-muted); font-size: 14px; }
.epic-generation-status svg { width: 22px; height: 22px; }
.epic-generation-status p { margin: 0; }
.epic-sources { border-top: 1px solid var(--epic-line); padding-top: 24px; margin-top: 30px; font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
.epic-sources h3 { font-weight: 650; margin-bottom: 12px; }
.epic-sources ol { list-style: decimal; padding-left: 24px; }
.epic-sources-checked { margin: -6px 0 10px; color: var(--epic-muted); font-size: 13px; }
.epic-image-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.epic-image { margin: 0; min-width: 0; }
.epic-image-open { display: block; }
.epic-workspace .epic-image-open:focus-visible { outline: 2px solid #1262c2; outline-offset: 3px; }
.epic-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #f6f8fc; }
.epic-image figcaption { font-size: 13px; line-height: 1.7; margin-top: 10px; overflow-wrap: anywhere; }
.epic-image-placeholder { aspect-ratio: 16 / 9; display: grid; place-items: center; background: #f0f5fc; font-size: 13px; }
.epic-upload { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.epic-upload-progress { width: 100%; accent-color: #1680ed; }
.epic-publication { padding-block: 40px; }
.epic-eyebrow { font-size: 13px; color: var(--epic-muted); margin-bottom: 20px; }
.epic-highlight { color: inherit; background: #dfeeff; box-shadow: 0 1px 0 #9fc8fa; }
@media (max-width: 1200px) { .epic-home-grid { grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); gap: 18px; } .epic-product-open { padding: 20px; } .epic-research-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 18px; } }
@media (max-width: 760px) {
  .epic-workspace { padding: 16px; }
  .epic-heading { gap: 10px; }
  .epic-heading h1 { font-size: 20px; }
  .epic-tabs { margin-inline: -16px; padding-inline: 12px; }
  .epic-tab { padding: 12px 14px; font-size: 14px; }
  .epic-home-grid, .epic-research-layout { grid-template-columns: minmax(0, 1fr); }
  .epic-context { gap: 16px; }
  .epic-player { position: static; }
  .epic-product-grid { gap: 12px; }
  .epic-product-open { padding: 18px; }
  .epic-product-open h2 { font-size: 19px; }
  .epic-product-open p { font-size: 14px; }
  .epic-source-line { padding: 16px 18px; }
  .epic-chapter { padding: 14px 18px; }
  .epic-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .epic-dialog-head { padding: 14px 18px; }
  .epic-dialog-body { padding: 22px 18px; }
  .epic-dialog-head h2 { font-size: 18px; }
  .epic-dialog-foot { padding: 16px 18px; }
  .epic-chat { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .epic-chat-body { padding: 20px; }
  .epic-chat-compose { padding: 14px; }
  .epic-chat-compose .epic-form { gap: 8px; }
  .epic-chat-compose .epic-button { padding: 10px 13px; }
  .epic-reader, .epic-document-card { padding: 24px 20px; }
  .epic-document-heading { flex-wrap: wrap; gap: 8px; }
  .epic-item-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .epic-page-heading { flex-wrap: wrap; gap: 12px; }
  .epic-empty { padding: 30px 22px; }
  .epic-image-grid { grid-template-columns: minmax(0, 1fr); }
  .epic-ask-button { bottom: 16px; right: 16px; }
}
@media (max-width: 520px) { .epic-product-grid { grid-template-columns: minmax(0, 1fr); } .epic-build { width: 38px; } .epic-tabs { gap: 0; } .epic-tab { padding-inline: 11px; } }
@media (prefers-reduced-motion: reduce) { .epic-workspace *, .epic-dialog * { scroll-behavior: auto !important; animation-duration: .01ms !important; } }

/* The source stays one continuous reading surface. */
.epic-workspace { container-type: inline-size; container-name: epic; }
.epic-home-grid { display: block; --epic-source-width: 60%; --epic-row-gap: 24px; }
.epic-transcript { background: transparent; }
.epic-transcript-chapter { position: relative; }
.epic-source-row { display: grid; grid-template-columns: minmax(0, var(--epic-source-width)) minmax(0, 1fr); gap: var(--epic-row-gap); align-items: start; }
.epic-source-row > .epic-source-line { background: white; min-width: 0; height: 100%; }
.epic-chapter { width: var(--epic-source-width); top: 0; }
.epic-source-text { font-size: 15px; }
.epic-player { position: fixed; z-index: 10; border-radius: 8px; box-shadow: 0 16px 48px #27487726; }
.epic-player-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 8px; color: var(--epic-muted); }
.epic-analysis-status, .epic-analysis-footer { padding: 8px 0 20px; }
.epic-analysis-footer { display: flex; justify-content: flex-end; padding: 8px 138px 88px 0; }
.epic-analysis-form { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#message-area:has(.epic-dialog[open]) { overflow: hidden; }
.epic-dialog-body, .epic-chat-body { overscroll-behavior: contain; }
.epic-chat-references { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
@container epic (max-width: 680px) {
  .epic-home-grid { --epic-source-width: 100%; }
  .epic-source-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .epic-chapter { width: 100%; }
}
/* The player is fixed to the viewport, so it follows the screen width, not the item column. */
@media (max-width: 680px) {
  .epic-player:not(.epic-original-window) { width: calc(100vw - 32px) !important; left: 16px !important; top: auto !important; bottom: 82px; }
  .epic-player video { max-height: 35dvh; }
}
.epic-source-line.is-playing::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--epic-blue); }
.epic-source-line.is-playing .epic-time { color: var(--epic-blue); font-weight: 600; }
.epic-highlight { cursor: pointer; }
.epic-highlight.is-note { background: #fff1bd; box-shadow: 0 1px 0 #ddc97d; }
.epic-highlight.is-material { background: #e9e1ff; box-shadow: 0 1px 0 #b5a2e4; }
.epic-selection-actions > button { margin-left: 0; font-size: 14px; background: transparent; padding: 8px; border-radius: 4px; }
.epic-selection-actions > button:last-child { margin-left: auto; }
.epic-selection-actions button[aria-pressed="true"] { color: var(--epic-blue); background: #edf5ff; }

/* One reading surface: speaker turns are separated by space, not rules. */
.epic-source-line { border-bottom: 0; padding: 18px 22px 4px; }
.epic-source-line.is-continuation { padding-top: 6px; }
.epic-source-line.is-continuation .epic-speaker { display: none; }
.epic-source-line .epic-source-meta:not(:has(.epic-speaker, .epic-time, > .epic-save-status:not(:empty))),
.epic-source-line.is-continuation .epic-source-meta:not(:has(.epic-time, > .epic-save-status:not(:empty))) { display: none; }
.epic-transcript-chapter:last-child .epic-source-row:last-child > .epic-source-line { padding-bottom: 18px; }
@media (max-width: 760px) {
  .epic-source-line { padding: 16px 18px 4px; }
  .epic-source-line.is-continuation { padding-top: 6px; }
}
.epic-toolbar { gap: 8px; }
.epic-toolbar .epic-analysis-status { margin-left: auto; padding: 0; min-width: 0; }

/* Products: a scannable index rather than a wall of large cards. */
.epic-product-grid { gap: 8px; }
.epic-product-open { padding: 18px 20px; }
.epic-product-open h2 { font-size: 17px; color: var(--epic-ink); font-weight: 600; margin: 0 0 6px; }
.epic-product-open p { font-size: 14px; line-height: 1.75; }
.epic-card-arrow { margin-top: 10px; }
@container epic (max-width: 600px) { .epic-product-grid { grid-template-columns: minmax(0, 1fr); } }
@container epic (min-width: 980px) { .epic-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .epic-product-open { padding: 16px 18px; }
  .epic-product-open h2 { font-size: 16px; }
  .epic-product-open p { font-size: 13px; }
  .epic-ask-button { padding: 10px 16px; gap: 8px; font-size: 14px; }
}

/* Selection actions: a small toolbar next to the text, widening only when a note or material is written. */
.epic-selection { width: auto; padding: 4px; border-color: #dce4ef; border-radius: 8px; box-shadow: 0 8px 28px #1520381f; }
.epic-selection:has(.epic-selection-fields:not([hidden])) { width: 360px; padding: 12px; }
.epic-selection .epic-form { gap: 8px; }
.epic-selection .epic-save-status:empty, .epic-selection .epic-actions:not(:has(> :not([hidden]))) { display: none; }
.epic-selection-actions { gap: 2px; }
.epic-selection-actions > button.epic-text-link { padding: 6px 12px; border-radius: 6px; color: var(--epic-ink); font-size: 14px; line-height: 1.6; text-decoration: none; white-space: nowrap; }
.epic-selection-actions > button.epic-text-link:hover { background: #f1f5fb; }
.epic-selection-actions > button[aria-pressed="true"] { color: var(--epic-blue); background: #edf5ff; }
.epic-selection-actions > .epic-icon-button { width: 30px; height: 30px; margin-left: 2px; }
.epic-selection-actions > .epic-icon-button .epic-icon { width: 16px; height: 16px; }

/* Chapter design 10: centred title between two fine grey rules. */
.epic-chapter { display: flex; align-items: center; gap: 16px; border-block: 0; background: #fff; color: var(--epic-ink); font-size: 16px; font-weight: 650; line-height: 1.65; text-align: center; padding: 36px 22px 8px; }
.epic-chapter::before, .epic-chapter::after { content: ""; height: 1px; background: #d6d9de; flex: 1; min-width: 14px; }
.epic-chapter > span { min-width: 0; max-width: 80%; overflow-wrap: anywhere; }
.epic-highlight[id] { scroll-margin-top: 90px; }
.epic-build-dialog .epic-form > .epic-save-status:empty { display: none; }

/* Links are told apart by colour, not underlines. */
.epic-workspace .epic-text-link, .epic-dialog .epic-text-link, .epic-selection .epic-text-link { text-decoration: none; }
.epic-workspace .epic-text-link:hover, .epic-dialog .epic-text-link:hover { color: #0451a8; }
.epic-workspace .flex.mb-4 { width: fit-content; }
/* Same-speaker lines read as one paragraph block. */
.epic-source-line { padding-bottom: 0; }
.epic-source-line.is-continuation { padding-top: 2px; }
/* On wide screens the outline is always in the sidebar, so the toolbar button is only for phones. */
@media (min-width: 1024px) { .epic-outline-button { display: none; } }
.epic-toolbar .epic-analysis-status { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.epic-toolbar .epic-analysis-status > p { margin: 0; }

/* Home is a reading surface; Resolution asks about the whole item from its toolbar. */
.epic-home-grid { --epic-source-width: 100%; max-width: 860px; }
.epic-source-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
.epic-resolution-button { margin-left: auto; }

.epic-item-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 18px;
}
.epic-item-heading .epic-title-field { grid-column: 1; min-width: 0; text-align: left; }
.epic-item-heading h1 { margin: 0; font-size: clamp(17px, 1.7vw, 21px); line-height: 1.5; }
.epic-item-heading .epic-title-editor { width: 100%; max-width: 40ch; margin-inline: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; cursor: text; }
.epic-item-heading .epic-title-editor:focus { max-width: none; overflow: visible; white-space: pre-wrap; }
.epic-item-heading .epic-item-settings { justify-self: end; align-self: center; min-height: 36px; text-decoration: none; font-size: 14px; }
.epic-item-heading .epic-save-status:empty { display: none; }
@media (max-width: 760px) {
  .epic-item-heading { gap: 8px; }
  .epic-item-heading .epic-item-settings { min-height: 44px; }
}

.epic-chat-thinking { display: flex; align-items: center; gap: 5px; min-height: 28px; padding-block: 6px; color: #73849b; }
.epic-chat-thinking > span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: epic-chat-pulse 1.2s ease-in-out infinite; }
.epic-chat-thinking > span:nth-child(2) { animation-delay: .15s; }
.epic-chat-thinking > span:nth-child(3) { animation-delay: .3s; }
@keyframes epic-chat-pulse { 0%, 70%, 100% { opacity: .35; } 35% { opacity: 1; } }
.epic-chat-delivery-error { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 12px; margin: -14px 0 24px; color: #9b3b3b; font-size: 13px; }
.epic-chat-delivery-error .epic-text-link { cursor: pointer; color: inherit; }
.epic-chat-compose .epic-chat-send { width: 44px; min-height: 44px; height: 44px; padding: 0; margin-bottom: 4px; border: 0; border-radius: 50%; background: #152038; color: #fff; }
.epic-chat-send .epic-icon { transform: rotate(-90deg); }
.epic-chat-compose .epic-chat-send:hover { background: #29394f; }
.epic-chat-compose .epic-chat-send:disabled { background: #e8ecf1; color: #8b98aa; opacity: 1; cursor: default; }
@media (prefers-reduced-motion: reduce) { .epic-chat-thinking > span { animation: none; opacity: .65; } }

.epic-document-preview { width: min(1120px, calc(100vw - 40px)); }
.epic-document-preview .epic-dialog-head { flex-wrap: wrap; row-gap: 4px; }
.epic-document-preview .epic-dialog-head h2 { min-width: 0; overflow-wrap: anywhere; flex: 1 1 240px; }
.epic-preview-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.epic-document-preview .epic-dialog-body { padding: 28px 40px; }
@media (max-width: 760px) {
  .epic-document-preview { width: calc(100vw - 24px); }
  .epic-document-preview .epic-dialog-body { padding: 22px 18px; }
}

.epic-document-preview .epic-dialog-body { flex: 1; }
.epic-document-preview .epic-preview-foot { padding: 10px 26px; }
.epic-document-preview .epic-preview-date { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; margin: 0; padding: 0; border: 0; line-height: 18px; }
/* On wide screens the preview takes over the item's content column; the item list and navigation stay in view. */
@media (min-width: 1024px) {
  .epic-document-preview[open] { inset: 0 0 0 var(--epic-preview-left, 0px); width: auto; height: 100dvh; max-height: none; margin: 0; border: 0; border-left: 1px solid #cfdaeb; border-radius: 0; box-shadow: -16px 0 40px rgb(39 72 119 / 10%); }
  .epic-document-preview::backdrop { background: transparent; backdrop-filter: none; }
}
@media (max-width: 760px) {
  .epic-document-preview .epic-preview-foot { padding: 10px 18px; }
}

.epic-research-grid .epic-product-create, .epic-research-grid .epic-product-open { display: flex; flex-direction: column; flex: 1; }
.epic-research-grid .epic-product-open { min-height: 164px; align-items: stretch; }
.epic-research-grid .epic-product-open h2 { margin: 0; }
.epic-research-grid .epic-product-open > .epic-create-action { margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; }
.epic-document-preview .epic-dialog-head { align-items: center; gap: 12px 24px; }
.epic-document-preview .epic-dialog-head h2 { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; margin: 0; }
.epic-preview-title { min-width: 0; overflow-wrap: anywhere; }
.epic-document-preview .epic-variant-label { flex: 0 0 auto; margin: 0; align-self: center; }
@media (max-width: 600px) {
  .epic-tabs { padding-inline: 8px; }
  .epic-tabs > .epic-tab { padding-inline: 8px; font-size: 14px; }
  .epic-tabs > .epic-build { width: 30px; min-width: 30px; }
  .epic-research-grid .epic-product-open { min-height: 144px; }
}

.epic-research-grid .epic-product-open > p { margin-top: 8px; }

.epic-chapter-editor { min-width: 0; }
.epic-chapter-label { display: flex; align-items: center; gap: 4px; min-width: 0; }
.epic-chapter-label[hidden] { display: none; }
.epic-chapter-title { padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; text-align: left; overflow-wrap: anywhere; }
.epic-chapter-title:focus { outline: none; box-shadow: none; }
.epic-chapter > .epic-chapter-editor { max-width: 80%; }
.epic-chapter-input { width: 100%; min-width: 0; padding: 4px; border: 0; border-radius: 0; background: white; color: inherit; font: inherit; }
.epic-chapter-input:focus { outline: none; box-shadow: none; }

/* ホームの原本は本文から独立した、移動できる小窓に置く。 */
.epic-workspace .epic-player.epic-original-window { --epic-glass: #f5f8ff; }
.epic-original-image { display: block; width: 100%; max-height: min(400px, calc(100dvh - 90px)); object-fit: contain; border-radius: 14px; }
.epic-workspace .epic-original-toggle { flex: 0 0 40px; width: 40px; min-height: 40px; padding: 0; gap: 0; }
.epic-workspace .epic-original-toggle .epic-icon { width: 19px; height: 19px; }
.epic-workspace .epic-original-window { position: fixed; top: 132px; right: 24px; bottom: auto; left: auto; width: 330px; max-width: calc(100vw - 24px); z-index: 20; padding: 0; overflow: hidden; }
.epic-workspace .epic-original-window.is-expanded { width: min(600px, calc(100vw - 28px)); }
.epic-original-handle { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 8px 12px; cursor: grab; touch-action: none; user-select: none; }
.epic-original-handle.is-dragging { cursor: grabbing; }
.epic-original-grip { width: 28px; height: 3px; margin-left: 4px; border-radius: 999px; background: #c2cddb; }
.epic-original-controls { display: flex; }
.epic-original-controls .epic-icon-button { width: 30px; height: 30px; }
.epic-original-controls .epic-icon { width: 16px; height: 16px; }
.epic-original-body { padding: 0 10px 10px; }
.epic-original-body video { display: block; width: 100%; max-height: min(300px, calc(100dvh - 90px)); border-radius: 14px; background: #101827; }
.epic-original-body audio { display: block; width: 100%; }
.epic-original-text { max-height: min(300px, calc(100dvh - 90px)); overflow: auto; padding: 12px 14px; font-size: 14px; line-height: 1.95; overflow-wrap: anywhere; white-space: pre-wrap; }
.epic-original-text p { margin: 0 0 1em; }
.epic-original-text p:last-child { margin-bottom: 0; }
.epic-original-document { display: block; width: 100%; height: min(400px, calc(100dvh - 90px)); border: 0; border-radius: 14px; }
@media (max-width: 760px) {
  .epic-workspace .epic-original-window { top: 172px; right: 14px; width: 260px; }
  .epic-original-body video { max-height: min(145px, calc(100dvh - 90px)); }
  .epic-original-text { max-height: min(240px, calc(100dvh - 90px)); }
  .epic-workspace .epic-original-window.is-expanded video { max-height: min(300px, calc(100dvh - 90px)); }
}
