@font-face { font-family: "Roboto Tooltip"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/roboto-regular.ttf") format("truetype"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/inter-regular.ttf") format("truetype"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/inter-bold.ttf") format("truetype"); }
:root { --text: #323537; --muted: #6c737b; --background: #f6f6f7; --green: #3cb46e; --surface: #fff; --subdued: rgba(50,53,55,.06); --divider: #e6e6e7; --content-width: 720px; --sidebar-width: 68px; --topbar-height: 60px; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--background); font-family: Inter, Arial, sans-serif; overflow: hidden; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; border: 0; cursor: pointer; }
button:focus-visible, summary:focus-visible { outline: 2px solid #2287e3; outline-offset: 4px; }
button:hover { background-color: rgba(50,53,55,.10); }
p, h1, h2 { margin: 0; }
[hidden] { display: none !important; }
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 4; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; background: var(--background); }
.file-info { display: flex; align-items: center; padding-left: 6px; min-width: 0; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 8px; background: var(--subdued); flex-shrink: 0; }
.icon { display: inline-flex; position: relative; width: 20px; height: 20px; align-items: center; justify-content: center; flex-shrink: 0; }
.icon img { display: block; filter: brightness(0) saturate(100%) invert(18%) sepia(6%) saturate(458%) hue-rotate(156deg) brightness(96%) contrast(88%); }
.back-button { width: 32px; height: 32px; padding: 6px; background: transparent; }
.back-button img, .subdued img, .chapter:not(.active) img { filter: brightness(0) saturate(100%) invert(47%) sepia(8%) saturate(465%) hue-rotate(173deg) brightness(92%) contrast(90%); }
.file-badge { width: 36px; height: 36px; display: grid; place-items: center; flex-shrink: 0; }
.file-badge img { display: block; transform: scale(1.125); }
.file-title { margin-left: 16px; padding: 2px 0; font-size: 14px; line-height: 20px; font-weight: 700; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 16px; padding-right: 12px; }
.avatar { display: block; width: 28px; height: 28px; border-radius: 50%; outline: 1px solid white; background-image: url("assets/avatar.jpg"); background-size: 206.34% 137.73%; background-position: 82.93% 5.23%; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.toolbar-divider { width: 13px; height: 20px; background: linear-gradient(to right, transparent 6px, var(--divider) 6px, var(--divider) 7px, transparent 7px); }
.publish-button { background: var(--text); color: white; padding: 8px 12px; height: 36px; border-radius: 10px; font-size: 14px; line-height: 20px; font-weight: 700; }
.publish-button:hover { background: #45494c; }
.language-icon img { position: absolute; }
.part-1 { left: 9.76786px; top: 12.875px; } .part-2 { left: 6.53125px; top: 2px; }
.part-3 { left: 3.81234px; top: 7.43734px; } .part-4 { left: 2px; top: 4.71875px; }
.part-5 { left: 7.43735px; top: 7.43735px; } .part-6 { left: 2px; top: 3.8125px; }
.sidebar { position: fixed; top: 60px; bottom: 0; left: 0; z-index: 3; width: var(--sidebar-width); background: #f7f7f7; display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; }
.add-button { border-radius: 999px; }
.sidebar-divider { width: 36px; height: 9px; background: linear-gradient(to bottom, transparent 4px, var(--divider) 4px, var(--divider) 5px, transparent 5px); flex-shrink: 0; }
.chapter-list { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.chapter, .expand-button { width: 40px; height: 40px; padding: 10px; background: transparent; }
.chapter.active { background: var(--subdued); }
.chapter-label { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.editor { position: fixed; inset: 60px 12px 0 var(--sidebar-width); background: var(--surface); border-radius: 16px 16px 0 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; overflow-anchor: none; }
.editor::-webkit-scrollbar { display: none; }
body { --document-column-width: min(720px, calc(100vw - 440px)); --document-column-left: max(calc(var(--sidebar-width) + 16px), min(calc((100vw - var(--document-column-width)) / 2), calc(100vw - var(--document-column-width) - 360px))); --document-editor-left: var(--sidebar-width); --document-top: 114px; }
body.preview { --document-editor-left: 12px; }
.document { padding-top: calc(var(--document-top) - var(--topbar-height)); }
.editor .document .content-width { width: var(--document-column-width); margin-left: calc(var(--document-column-left) - var(--document-editor-left)); margin-right: 0; }
.document-text { padding: 16px 0; font-size: 18px; line-height: 30px; }
.document-text p + p { margin-top: 16px; }
.content-width { width: var(--content-width); margin-left: auto; margin-right: auto; }
.document-title { padding: 30px 0; display: flex; flex-direction: column; gap: 12px; }
h1 { font-size: 44px; line-height: 52px; font-weight: 700; }
.document-title p { color: var(--muted); font-size: 24px; line-height: 32px; }
h2 { padding-top: 16px; font-size: 22px; line-height: 30px; font-weight: 700; }
.interactive-section { position: relative; isolation: isolate; padding-bottom: 16px; }
.interactive-section::before { position: absolute; content: ""; z-index: -1; inset: 0; background: #ecf5ff; border-top: 2px solid #c7e3ff; border-bottom: 2px solid #c7e3ff; opacity: 0; pointer-events: none; }
.interactive-section:has(> .ai-panel:hover)::before { opacity: 1; }
.section-description { padding-top: 16px; padding-bottom: 24px; font-size: 18px; line-height: 30px; }
.flip-cards { display: flex; gap: 24px; justify-content: center; width: 100%; }
.flip-card { background: var(--green); border-radius: 20px; width: 0; min-width: 0; height: 266.67px; padding: 24px; color: white; flex: 1 1 0; display: grid; place-items: center; }
.flip-card:hover { background: #35a967; }
.card-front, .card-back { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; width: 100%; text-align: center; }
.flip-card strong { font-size: 20px; line-height: 28px; font-weight: 700; }
.card-front > span { font-size: 15px; line-height: 20px; }
.card-back > span { font-size: 15px; line-height: 22px; }
.card-back small { font-size: 11px; line-height: 16px; opacity: .85; }
.section-conclusion { padding-top: 16px; font-size: 18px; line-height: 30px; }
.accordion { border: 1px solid rgba(50,53,55,.12); border-radius: 12px; overflow: hidden; }
.accordion details { background: var(--surface); }
.accordion details + details { border-top: 1px solid rgba(50,53,55,.12); }
.accordion summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 23px; min-height: 80px; font-size: 18px; line-height: 30px; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary:hover { background: #fafafa; }
.accordion-bullet { width: 32px; height: 32px; border-radius: 50%; background: var(--green); display: grid; place-items: center; flex-shrink: 0; }
.accordion-bullet img { filter: brightness(0) invert(1); }
details[open] .accordion-bullet { transform: rotate(180deg); }
.accordion-answer { padding: 24px 24px 24px 68px; font-size: 18px; line-height: 30px; }
.accordion-answer small { font-size: 12px; color: var(--muted); }
.document-end { height: 116px; }
.ai-panel { position: absolute; top: 12px; right: 12px; z-index: 2; background: white; border-radius: 10px; padding: 12px; width: 56px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 0 8px rgba(50,53,55,.05), 0 2px 4px rgba(50,53,55,.06); }
.panel-history, .panel-actions { display: flex; flex-direction: column; gap: 4px; }
.panel-actions { gap: 8px; }
.ai-panel .icon-button { width: 32px; height: 32px; padding: 6px; background: transparent; }
.ai-panel .icon-button:hover { background: var(--subdued); }
.success img { filter: brightness(0) saturate(100%) invert(53%) sepia(27%) saturate(927%) hue-rotate(93deg) brightness(93%) contrast(87%); }
.icon img[src="assets/right.svg"], .icon img[src="assets/expand.svg"] { transform: rotate(180deg); }
.help-button { position: fixed; z-index: 3; width: 68px; height: 68px; right: 12px; bottom: 15px; padding: 0; background: transparent; }
.help-button img { display: block; width: 68px; height: 68px; }
.help-button:hover { background: transparent; opacity: .85; }
.demo-dialog { border: 1px solid var(--divider); border-radius: 16px; max-width: min(440px, calc(100vw - 32px)); padding: 28px; color: var(--text); }
.demo-dialog::backdrop { background: rgba(50,53,55,.25); }
.demo-dialog h2 { padding-top: 0; margin-bottom: 16px; }
.demo-dialog p { font-size: 16px; line-height: 25px; margin-bottom: 24px; }
body.preview .sidebar, body.preview .ai-panel { display: none; }
body.preview .editor { left: 12px; }
body.expanded { --sidebar-width: 248px; }
body.expanded .chapter-list { align-self: stretch; padding: 0 12px; }
body.expanded .chapter[data-section] { width: 100%; justify-content: flex-start; gap: 10px; }
body.expanded .chapter-label { display: block; font-size: 13px; white-space: nowrap; }
@media (max-width: 1150px) {
  :root { --content-width: min(720px, calc(100% - 144px)); }
  .file-title { overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 490px); }
  .flip-card { flex-basis: calc((100% - 48px) / 3); width: auto; height: auto; aspect-ratio: 1; padding: 16px; }
  .card-front > span { font-size: 13px; }
}
@media (max-width: 760px) {
  :root { --content-width: calc(100% - 40px); --sidebar-width: 48px; }
  .topbar { padding-right: 8px; }
  .file-title { max-width: calc(100vw - 235px); margin-left: 4px; font-size: 11px; }
  .topbar-right { padding: 0; gap: 8px; }
  .topbar-actions > :not(.publish-button) { display: none; }
  .publish-button { font-size: 12px; }
  .avatar { width: 24px; height: 24px; }
  .editor { right: 6px; }
  .sidebar-divider { width: 28px; }
  .ai-panel { display: none; }
  .document-text { font-size: 16px; line-height: 26px; }
  .document-title { padding: 24px 0; }
  h1 { font-size: 28px; line-height: 36px; }
  .document-title p { font-size: 18px; line-height: 26px; }
  h2 { font-size: 20px; line-height: 28px; }
  .section-description, .section-conclusion { font-size: 16px; line-height: 26px; }
  .flip-cards { flex-direction: column; gap: 12px; }
  .flip-card { width: 100%; min-height: 180px; aspect-ratio: auto; flex-basis: auto; padding: 24px; }
  .card-front > span { font-size: 15px; }
  .accordion summary { padding: 18px 14px; font-size: 15px; line-height: 24px; }
  .accordion-answer { padding: 20px 18px 20px; font-size: 15px; line-height: 24px; }
  body.expanded { --sidebar-width: 48px; }
  body.expanded .chapter-label { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  body.expanded .chapter-list { padding: 0; align-self: center; }
  body.expanded .chapter[data-section] { width: 40px; justify-content: center; }
}

.tabs { border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(50,53,55,.08); background: white; }
.tab-list { display: flex; height: 80px; background: #f7f7f7; }
.tab-list button { flex: 1; min-width: 0; padding: 20px 16px; border-top: 3px solid transparent; border-right: 1px solid rgba(50,53,55,.12); background: transparent; color: var(--muted); font-size: 18px; line-height: 26px; font-weight: 700; }
.tab-list button:last-child { border-right: 0; }
.tab-list button[aria-selected="true"] { border-top-color: var(--green); background: white; color: var(--text); }
.tab-list button:hover { color: var(--text); }
.tabs [role="tabpanel"] { padding: 28px 36px 40px; font-size: 18px; line-height: 30px; }
.timeline { padding: 0; margin: 0; list-style: none; }
.timeline li + li::before { content: ""; display: block; height: 48px; width: 1px; margin: 0 auto; background: rgba(0,0,0,.08); }
.timeline-card { padding: 24px; border: 1px solid rgba(0,0,0,.08); border-radius: 20px; background: white; }
.timeline-card h3 { margin: 0; padding-bottom: 16px; border-bottom: 1px solid rgba(0,0,0,.08); color: #37a465; font-size: 18px; line-height: 30px; font-weight: 700; text-align: center; }
.timeline-card p { padding-top: 16px; font-size: 16px; line-height: 26.56px; }
.original-text { font-size: 18px; line-height: 30px; }
.original-text p + p { margin-top: 24px; }
.continue-button { min-height: 60px; padding: 19px 64px; border-radius: 16px; background: var(--green); color: white; font-size: 18px; line-height: 22px; font-weight: 700; }
.continue-button:hover { background: #35a967; }
@media (max-width: 760px) {
  .tab-list { height: auto; min-height: 64px; }
  .tab-list button { padding: 14px 8px; font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
  .tabs [role="tabpanel"] { padding: 24px 20px; font-size: 16px; line-height: 26px; }
  .timeline-card { padding: 20px; }
  .timeline-card h3 { font-size: 16px; line-height: 26px; }
  .original-text { font-size: 16px; line-height: 26px; }
  .continue-button { width: 100%; padding-left: 24px; padding-right: 24px; }
  .ai-panel { display: flex; position: static; flex-direction: row; width: max-content; margin: 16px auto 0; padding: 8px; }
  .panel-history, .panel-actions { flex-direction: row; gap: 4px; }
  body.preview .ai-panel { display: none; }
}

.continue-divider { display: flex; justify-content: center; padding: 16px 0; }

.settings-control { position: relative; flex-shrink: 0; }
.settings-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 6; width: 260px; padding: 6px; border: 1px solid rgba(50,53,55,.08); border-radius: 12px; background: white; box-shadow: 0 0 8px rgba(50,53,55,.05), 0 4px 16px rgba(50,53,55,.12); }
.settings-menu button { display: block; width: 100%; padding: 10px 12px; border-radius: 6px; background: transparent; font-size: 14px; line-height: 20px; text-align: left; }
.settings-menu button[aria-checked="true"] { background: var(--subdued); font-weight: 700; }
.settings-menu button:hover { background: rgba(50,53,55,.10); }
.global-ai-panel { position: fixed; top: max(20%, 84px); right: 24px; transform: none; display: flex; flex-direction: column; gap: 8px; width: 56px; height: 256px; padding: 12px; margin: 0; z-index: 3; }
body[data-stage="result"][data-view="global"]:not(.selection-mode) .global-ai-panel { top: var(--editor-panel-center, 50vh); transform: translateY(-50%); }
.global-ai-panel .arrow-up img { transform: rotate(90deg); }
.global-ai-panel .arrow-down img { transform: rotate(-90deg); }
.global-ai-panel button:disabled { cursor: default; background: transparent; }
.global-ai-panel button:disabled img { opacity: .35; filter: brightness(0) saturate(100%) invert(47%) sepia(8%) saturate(465%) hue-rotate(173deg) brightness(92%) contrast(90%); }
body[data-view="global"] .interactive-section > .ai-panel { display: none; }
body[data-view="global"] .interactive-section::before { opacity: 0; }
body[data-view="global"]:has(.global-ai-panel:hover) .interactive-section.is-global-active::before { opacity: 1; }
body[data-view="global"] .document-end { height: 50vh; }
body.preview .global-ai-panel { display: none; }
@media (max-width: 760px) {
  .topbar-actions > .settings-control { display: block; }
  .file-title { max-width: calc(100vw - 279px); }
  .settings-menu { position: fixed; top: 56px; right: 12px; width: min(260px, calc(100vw - 24px)); }
  .global-ai-panel { right: 12px; }
  body[data-view="global"] .content-width { width: calc(100% - 92px); margin-left: 16px; margin-right: 76px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.source-document { padding-top: 54px; }
.source-block { position: relative; margin-bottom: 16px; padding: 8px 0; border-radius: 3px; transition: background-color 120ms ease; }
.source-block p { font-size: 18px; line-height: 30px; cursor: text; }
.source-block p:focus-visible { outline: none; }
.source-block.is-selected { background: rgba(41,133,224,.2); box-shadow: 5px 0 rgba(41,133,224,.2), -5px 0 rgba(41,133,224,.2); }
.source-content.is-block-selecting, .source-content.is-block-selecting * { user-select: none; }
.block-handle { position: absolute; left: -52px; top: 0; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: transparent; opacity: 0; transform: translateX(3px); transition: opacity 160ms ease, transform 160ms ease; }
.block-handle img { display: block; }
.source-block:hover .block-handle, .source-block:focus-within .block-handle, .source-block.has-menu .block-handle { opacity: 1; transform: translateX(0); }
.block-menu { position: fixed; z-index: 7; width: 200px; padding: 8px; border-radius: 16px; background: white; box-shadow: 0 0 20px rgba(50,53,55,.06), 0 12px 20px rgba(50,53,55,.11); }
.block-menu button { width: 100%; min-height: 40px; padding: 8px; display: flex; align-items: center; gap: 8px; border-radius: 10px; background: transparent; text-align: left; font-size: 14px; line-height: 20px; }
.block-menu button:hover, .block-menu button:focus-visible, .block-menu button[aria-expanded="true"] { background: var(--subdued); }
.block-menu hr, .settings-menu hr { border: 0; border-top: 1px solid var(--divider); margin: 8px; }
.menu-icon { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; }
.menu-icon img { display: block; }
.menu-arrow { margin-left: auto; }
.ai-submenu { width: 320px; }
.ai-submenu .ai-badge { width: 28px; flex-basis: 28px; height: 24px; background: #e9e0fb; border-radius: 6px; }
.source-toolbar { position: fixed; z-index: 4; bottom: 12px; left: calc(50% + 28px); transform: translateX(-50%); display: flex; gap: 8px; filter: drop-shadow(0 0 10px rgba(50,53,55,.06)) drop-shadow(0 12px 10px rgba(50,53,55,.11)); }
.source-toolbar-group { display: flex; gap: 4px; padding: 6px; border-radius: 16px; background: white; }
.source-toolbar .icon-button { width: 36px; height: 36px; padding: 8px; background: transparent; }
.source-toolbar .icon-button:hover { background: var(--subdued); }
.source-toolbar .source-add { background: #3e4247; border-radius: 50%; }
.source-toolbar .source-add:hover { background: #51565c; }
body[data-stage="result"] .source-toolbar, body.block-menu-open .source-toolbar, body.preview .source-toolbar, body.preview .block-handle, body[data-stage="source"] .global-ai-panel { display: none; }
body[data-stage="source"][data-view="global"] .source-document .content-width { width: var(--content-width); margin-left: auto; margin-right: auto; }
.generation-dialog { width: 720px; max-width: calc(100vw - 120px); height: 498px; max-height: calc(100vh - 100px); border: 0; border-radius: 16px; padding: 0; overflow: visible; color: var(--text); background: white; box-shadow: 0 0 20px rgba(50,53,55,.05), 0 12px 20px rgba(50,53,55,.06); }
.generation-dialog::backdrop { background: rgba(50,53,55,.5); }
.generation-header { height: 64px; padding: 19px 24px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--divider); }
.generation-header img { display: block; }
.generation-header h2 { font-size: 18px; line-height: 26px; font-weight: 400; padding: 0; }
.generation-content { position: relative; height: calc(100% - 64px); display: flex; align-items: center; justify-content: center; }
.generation-progress { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 0 24px; }
.generation-progress p { font-size: 16px; line-height: 22px; }
.generation-progress .generation-step { margin-top: -10px; font-size: 13px; line-height: 20px; color: var(--muted); }
.generation-spinner { display: block; animation: generation-spin 900ms linear infinite; }
@keyframes generation-spin { to { transform: rotate(360deg); } }
.generation-stop { position: absolute; right: 24px; bottom: 24px; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 14px; line-height: 20px; border-radius: 10px; background: var(--subdued); }
.generation-close { position: absolute; top: 8px; left: calc(100% + 12px); display: grid; place-items: center; width: 32px; height: 32px; padding: 6px; border-radius: 50%; background: rgba(50,53,55,.4); }
.generation-close:hover { background: rgba(50,53,55,.6); }
@media (max-width: 760px) {
  .source-document { padding-top: 16px; }
  .source-document .content-width, body[data-stage="source"][data-view="global"] .source-document .content-width { width: calc(100% - 66px); margin-left: 46px; margin-right: 20px; }
  .source-block p { font-size: 16px; line-height: 26px; }
  .block-handle { left: -40px; width: 32px; height: 36px; }
  .source-block:focus-within .block-handle { opacity: 1; }
  .source-toolbar { left: calc(50% + 21px); gap: 4px; }
  .source-toolbar .icon-button { width: 30px; padding: 5px; }
  .source-toolbar-group { gap: 1px; padding: 5px; }
  .ai-submenu { width: min(320px, calc(100vw - 16px)); }
  .generation-dialog { max-width: calc(100vw - 24px); height: 420px; max-height: calc(100vh - 48px); }
  .generation-close { left: auto; right: 12px; top: 16px; background: transparent; }
  .generation-close img { filter: brightness(.4); }
  .generation-header { padding-left: 16px; padding-right: 50px; }
  .generation-header h2 { font-size: 15px; line-height: 22px; }
}
@media (hover: none) { .block-handle { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .block-handle, .source-block { transition: none; } .generation-spinner { animation: none; } }

.block-handle img, .block-menu:not(.ai-submenu) .menu-icon img { filter: brightness(0) saturate(100%) invert(47%) sepia(8%) saturate(465%) hue-rotate(173deg) brightness(92%) contrast(90%); }
.menu-icon img[src="assets/sparkle.svg"] { filter: brightness(0) saturate(100%) invert(48%) sepia(77%) saturate(1220%) hue-rotate(218deg) brightness(94%) contrast(89%); }
.source-add img, .generation-close img { filter: brightness(0) invert(1); }
.menu-arrow img { transform: rotate(-90deg); }
@media (max-width: 760px) { .generation-close img { filter: brightness(.4); } }

.block-menu:not(.ai-submenu) .menu-icon img[src="assets/sparkle.svg"] { filter: brightness(0) saturate(100%) invert(48%) sepia(77%) saturate(1220%) hue-rotate(218deg) brightness(94%) contrast(89%); }

/* Keep prototype controls accessible above the Netlify Free badge. */
body:has(#nl-badge-frame) .help-button { bottom: 72px; }
@media (max-width: 760px) { body:has(#nl-badge-frame) .source-toolbar { bottom: 72px; } }

.ai-actions-menu, .ai-types-menu { width: min(280px, calc(100vw - 16px)); max-height: calc(100vh - 80px); overflow-y: auto; }
.ai-menu-heading { padding: 8px 10px 4px; color: var(--muted); font-size: 12px; line-height: 18px; }
.block-menu button:disabled { cursor: default; color: #a0a5aa; background: transparent; }
.block-menu button:disabled .menu-icon { opacity: .4; }
.ai-types-menu button[aria-checked="true"] { background: var(--subdued); }
.ai-menu-check { margin-left: auto; }
.ai-actions-menu .destructive { color: #cb4444; }
.ai-actions-menu .destructive .menu-icon { background: currentColor; mask: url("assets/trash.svg") center / 16px 18px no-repeat; }
.ai-actions-menu .destructive .menu-icon img { visibility: hidden; }
.ai-panel { overflow: hidden; transition: height 240ms ease-in-out, width 240ms ease-in-out; }
.ai-panel > :not(.panel-loader) { transition: opacity 160ms ease; }
.ai-panel.is-regenerating { width: 56px !important; height: 56px !important; overflow: hidden; }
.ai-panel.is-regenerating > :not(.panel-loader) { opacity: 0; visibility: hidden; pointer-events: none; }
.panel-loader { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity 160ms ease; }
.is-regenerating .panel-loader { opacity: 1; }
[data-editable]:focus { outline: 2px solid rgba(41,133,224,.3); outline-offset: 4px; border-radius: 3px; }
[data-editable][contenteditable="plaintext-only"] { cursor: text; }
@media (prefers-reduced-motion: reduce) { .ai-panel, .ai-panel > :not(.panel-loader), .panel-loader { transition: none; } }

body:has(#nl-badge-frame) .ai-actions-menu,
body:has(#nl-badge-frame) .ai-types-menu { max-height: calc(100vh - 140px); }
@media (max-width: 760px) {
  .ai-panel:not(.global-ai-panel).is-regenerating { width: 48px !important; height: 48px !important; }
}

.card-back { height: 100%; min-height: 0; }
.card-back > span { min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.ai-types-menu .ai-menu-check.success img { filter: brightness(0) saturate(100%) invert(53%) sepia(27%) saturate(927%) hue-rotate(93deg) brightness(93%) contrast(87%); }

.ai-panel.is-panel-restoring > :not(.panel-loader) { opacity: 0; visibility: hidden; pointer-events: none; }
.is-panel-restoring .panel-loader { opacity: 1; }

/* External testing controls overlay the product without changing its layout. */
.ux-test-tools { position: fixed; z-index: 1000; inset: 0 auto 0 0; width: 6px; }
.ux-test-edge { position: absolute; inset: 0; width: 6px; height: 100%; padding: 0; background: transparent; border-radius: 0; }
.ux-test-edge::after { content: ""; position: absolute; left: 0; top: calc(50% - 22px); width: 3px; height: 44px; border-radius: 0 3px 3px 0; background: var(--text); opacity: .5; }
.ux-test-edge:hover { background: transparent; }
.ux-test-edge:focus-visible { outline-offset: -2px; }
.ux-test-sidebar { position: absolute; inset: 0 auto 0 0; width: min(336px, calc(100vw - 24px)); height: 100%; height: 100dvh; padding: 24px 20px 20px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; overscroll-behavior: contain; background: var(--text); color: #fff; border-right: 1px solid rgba(255,255,255,.14); box-shadow: 8px 0 32px rgba(0,0,0,.18); transform: translateX(-100%); visibility: hidden; transition: transform 240ms ease-in-out, visibility 0s 240ms; font-size: 13px; line-height: 20px; color-scheme: dark; }
.ux-test-tools.is-open .ux-test-sidebar { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.ux-test-tools.is-open .ux-test-edge { visibility: hidden; }
.ux-test-badge { display: inline-block; padding: 3px 8px; border: 1px solid rgba(255,255,255,.24); border-radius: 5px; color: #e0e3e6; font-size: 10px; line-height: 16px; letter-spacing: .07em; text-transform: uppercase; }
.ux-test-header h2 { padding: 12px 0 4px; font-size: 18px; line-height: 26px; }
.ux-test-header p, .ux-test-note { color: #c3c8cd; }
.ux-test-sidebar fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.ux-test-sidebar legend { padding: 0; margin-bottom: 8px; color: #c3c8cd; font-size: 11px; line-height: 16px; text-transform: uppercase; letter-spacing: .06em; }
.ux-test-concepts { display: grid; gap: 6px; }
.ux-test-concepts label { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.ux-test-concepts label:hover { background: rgba(255,255,255,.06); }
.ux-test-concepts label:has(input:checked) { background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.5); }
.ux-test-number { flex: 0 0 18px; color: #b9c0c6; font-size: 11px; line-height: 20px; }
.ux-test-concepts input { width: 14px; height: 14px; margin: 3px 0 0; flex-shrink: 0; accent-color: #fff; }
.ux-test-sidebar label:has(input:focus-visible) { outline: 2px solid #b0d8ff; outline-offset: 3px; }
.ux-test-stage-options { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; }
.ux-test-stages label { position: relative; cursor: pointer; }
.ux-test-stages input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ux-test-stages span { display: block; text-align: center; padding: 8px 4px; border-radius: 5px; font-size: 12px; white-space: nowrap; }
.ux-test-stages label:hover span { background: rgba(255,255,255,.08); }
.ux-test-stages input:checked + span { background: #fff; color: var(--text); }
.ux-test-note { font-size: 12px; line-height: 19px; }
@media (prefers-reduced-motion: reduce) { .ux-test-sidebar { transition: none; } }

.selection-panel-content { display: none; }
.selection-header { position: fixed; z-index: 5; top: 12px; left: 12px; right: 12px; height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; pointer-events: none; }
.selection-heading { display: flex; align-items: center; gap: 8px; padding-left: 6px; font-size: 14px; line-height: 20px; }
.selection-hand { display: grid; place-items: center; width: 32px; height: 32px; }
.selection-hand img { display: block; padding: 4px; box-sizing: content-box; border-radius: 8px; background: linear-gradient(87deg, rgba(191,200,255,.24), rgba(217,191,255,.24)); }
.selection-save-island { display: flex; align-items: center; gap: 8px; padding: 8px; background: #fff; border-radius: 16px; box-shadow: 0 0 16px rgba(50,53,55,.05), 0 4px 8px rgba(50,53,55,.06); pointer-events: auto; }
.selection-save-island button { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; line-height: 20px; background: var(--subdued); white-space: nowrap; }
.selection-save-island [data-selection-session="apply"] { background: var(--text); color: #fff; }
.selection-save-island button:hover { filter: brightness(.94); }
.selection-save-island button:disabled { opacity: .4; cursor: default; }
body.selection-mode { --document-editor-left: 0px; --selection-panel-inset: calc(100vw - var(--document-column-left) - var(--document-column-width) - 344px); background: #fff; }
body.selection-mode > :is(.topbar, .sidebar, .help-button) { display: none; }
.selection-mode .editor { inset: 0; border-radius: 0; }
.selection-mode .document { padding-top: var(--document-top); }
.selection-mode .interactive-section::before { background: rgba(41,133,224,.045); border-color: rgba(41,133,224,.10); transition: opacity 360ms ease-in-out; }
body.selection-mode[data-view="individual"] .interactive-section:hover::before,
body.selection-mode[data-view="global"] .interactive-section.is-global-active::before { opacity: 1; }
.selection-mode .ai-panel { right: var(--selection-panel-inset); top: 16px; width: 320px; height: var(--selection-expanded-height, 176px); padding: 0; margin: 0; position: absolute; display: block; transform: none; transition: width 360ms cubic-bezier(.4,0,.2,1), height 360ms cubic-bezier(.4,0,.2,1); }
.selection-mode .ai-panel > :is(.panel-history, .panel-actions), .selection-mode .global-ai-panel > [data-global-action] { display: none; }
.selection-mode .selection-panel-content { display: block; position: absolute; inset: 0; }
.selection-mode .ai-panel:not(.is-regenerating) { min-height: 176px; }
.selection-mode .global-ai-panel { position: fixed; top: max(20%, 84px); height: var(--selection-expanded-height, 256px); }
.selection-mode .global-ai-panel:not(.is-regenerating) { min-height: 256px; }
.selection-panel-divider { position: absolute; top: 0; bottom: 0; right: 56px; border-left: 1px solid rgba(50,53,55,.12); transition: opacity 200ms ease, visibility 0s; }
.selection-variant-title { position: absolute; top: 22px; left: 52px; width: 160px; text-align: center; font-size: 18px; line-height: 20px; font-weight: 500; }
.selection-variant-count { position: absolute; top: 48px; left: 16px; width: 232px; text-align: center; font-size: 15px; line-height: 20px; color: #99a2ad; }
.selection-variant-reason { position: absolute; top: 93px; left: 24px; width: 216px; font-size: 14px; line-height: 20px; color: var(--muted); }
.selection-variant-title, .selection-variant-count, .selection-variant-reason { transition: opacity 180ms ease, transform 360ms cubic-bezier(.4,0,.2,1); }
.ai-panel .selection-control { position: absolute; margin: 0; transition: left 360ms cubic-bezier(.4,0,.2,1), top 360ms cubic-bezier(.4,0,.2,1), opacity 180ms ease, visibility 0s; }
.selection-previous { left: 16px; top: 16px; }
.selection-next { left: 216px; top: 16px; }
.selection-undo { left: 276px; top: 12px; }
.selection-regenerate { left: 276px; top: 52px; }
.selection-add { left: 276px; top: 92px; }
.selection-more { left: 276px; top: 132px; }
.selection-up { left: 276px; top: 172px; }
.selection-down { left: 276px; top: 212px; }
.selection-up img { transform: rotate(90deg); }
.selection-down img { transform: rotate(90deg); }
.ai-panel .selection-control:disabled { background: transparent; cursor: default; }
.ai-panel .selection-control:disabled img { opacity: .35; }
.selection-actions-menu { width: min(320px, calc(100vw - 16px)); padding: 8px; border-radius: 16px; }
.selection-actions-menu button { min-height: 40px; font-size: 15px; line-height: 20px; padding: 8px 12px; }
.selection-actions-menu hr { margin: 8px; }
.selection-actions-menu .selection-generate-item { min-height: 56px; }
.selection-actions-menu small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 16px; }
.selection-menu-plus { margin-left: auto; opacity: .6; }
.generation-success { position: absolute; inset: 0; }
.generation-success-message { position: absolute; width: min(360px, calc(100% - 48px)); top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.generation-success-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 16px; }
.generation-success-icon img { grid-area: 1 / 1; display: block; }
.generation-success-message > p { font-size: 16px; line-height: 22px; }
.generation-success-message .generation-success-description { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 20px; }
.generation-success-message label { display: flex; align-items: center; gap: 8px; margin-top: 24px; font-size: 15px; line-height: 20px; text-align: left; }
.generation-success-message input { width: 16px; height: 16px; margin: 0; accent-color: #3e4247; }
.generation-success-actions { position: absolute; bottom: 24px; right: 24px; display: flex; gap: 12px; }
.generation-success-actions button { height: 36px; padding: 0 12px; border-radius: 10px; font-size: 15px; line-height: 20px; background: var(--subdued); }
.generation-success-actions [data-generation-complete="view"] { background: #3e4247; color: white; }
[data-applied-editable]:focus { outline: 2px solid rgba(41,133,224,.3); outline-offset: 4px; }
@media (max-width: 900px) {
  body { --document-column-width: calc(100vw - var(--sidebar-width) - 48px); --document-column-left: calc(var(--sidebar-width) + 24px); --document-top: 112px; }
  body.selection-mode { --selection-panel-inset: 16px; }
  .selection-header { top: 8px; left: 8px; right: 8px; height: auto; align-items: flex-start; flex-direction: column; gap: 8px; background: white; padding-bottom: 8px; }
  .selection-heading { font-size: 12px; }
  .selection-save-island { align-self: flex-end; }
  .selection-mode .interactive-section > .ai-panel { position: relative; top: 0; right: auto; margin: 16px 16px 0 auto; }
  .selection-mode .global-ai-panel { top: auto; bottom: 80px; right: 16px; }
  .selection-mode .document-end { height: 360px; }
  .generation-success-actions { left: 16px; right: 16px; bottom: 16px; justify-content: flex-end; gap: 8px; }
  .generation-success-actions button { font-size: 13px; }
}
@media (max-width: 370px) { .selection-mode .ai-panel { max-width: calc(100vw - 32px); } }
@media (prefers-reduced-motion: reduce) { .selection-mode .ai-panel, .ai-panel .selection-control, .selection-panel-divider, .selection-variant-title, .selection-variant-count, .selection-variant-reason, .selection-mode .interactive-section::before { transition: none; } }

.selection-next img { transform: rotate(180deg); }
.selection-down img { transform: rotate(-90deg); }
.selection-hand { position: relative; }
.selection-hand::before { content: ""; position: absolute; width: 28px; height: 24px; border-radius: 8px; background: linear-gradient(87deg, rgba(191,200,255,.24), rgba(217,191,255,.24)); }
.selection-hand img { position: relative; padding: 0; background: none; border-radius: 0; filter: brightness(0) saturate(100%) invert(48%) sepia(77%) saturate(1220%) hue-rotate(218deg) brightness(94%) contrast(89%); }

.generation-success-icon img,
.block-menu.selection-actions-menu .ai-menu-check.success img { filter: brightness(0) saturate(100%) invert(53%) sepia(27%) saturate(927%) hue-rotate(93deg) brightness(93%) contrast(87%); }



.ai-tooltip { position: fixed; z-index: 10; width: max-content; max-width: min(360px, calc(100vw - 16px)); padding: 8px 12px; border-radius: 10px; background: #323537; color: #fff; font-family: "Roboto Tooltip", Arial, sans-serif; font-size: 13px; line-height: 16px; font-weight: 400; text-align: left; overflow-wrap: anywhere; pointer-events: none; box-shadow: 0 0 16px rgba(50,53,55,.05), 0 4px 8px rgba(50,53,55,.06); }
.ai-tooltip > img { position: absolute; display: block; top: 100%; left: var(--tooltip-pointer-left); transform: rotate(180deg); }
.ai-tooltip[data-side="bottom"] > img { top: -8px; transform: none; }


.ux-test-other { border-top: 1px solid rgba(255,255,255,.15); padding-top: 12px; }
.ux-test-other > summary { cursor: pointer; padding: 4px 0; color: #dce0e4; font-size: 13px; line-height: 20px; }
.ux-test-other[open] > summary { margin-bottom: 10px; }
body.selection-focus[data-view="global"] .interactive-section:not(.is-global-active):hover::before { opacity: 1; }
.selection-focus .interactive-section:not(.is-global-active) { cursor: pointer; }
body.selection-focus[data-view="global"] .interactive-section.is-global-active { z-index: 1; }
.interactive-section h2:focus { outline: none; }
body.selection-focus[data-view="global"] .interactive-section > .global-ai-panel { display: block; position: absolute; top: 16px; right: 12px; bottom: auto; }
.selection-completion { --completion-bottom: 24px; flex-wrap: wrap; position: fixed; z-index: 6; left: 50%; bottom: var(--completion-bottom); transform: translateX(-50%); width: min(var(--document-column-width), calc(100vw - 32px)); padding: 20px 24px; border-radius: 16px; display: flex; align-items: center; gap: 20px; background: white; box-shadow: 0 0 16px rgba(50,53,55,.06), 0 8px 32px rgba(50,53,55,.16); translate: 0 calc(100% + var(--completion-bottom) + 24px); opacity: 1; visibility: hidden; pointer-events: none; transition: translate 700ms cubic-bezier(.6,-.25,.75,.5), visibility 0s 700ms; }
.selection-completion.is-visible { translate: 0 0; opacity: 1; visibility: visible; pointer-events: auto; transition: translate 700ms cubic-bezier(.22,1.25,.4,1), visibility 0s; }
.selection-completion h2 { padding: 0; font-size: 18px; line-height: 24px; font-weight: 700; }
.selection-completion p { margin-top: 6px; font-size: 13px; line-height: 20px; color: var(--muted); }
.selection-completion-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }
.selection-completion button { flex-shrink: 0; padding: 8px 12px; border-radius: 10px; background: var(--text); color: white; font-size: 13px; line-height: 20px; }
.selection-completion button:hover { background: #45494c; }
.selection-completion [data-selection-completion="dismiss"] { background: var(--subdued); color: var(--text); }
.selection-completion [data-selection-completion="dismiss"]:hover { background: rgba(50,53,55,.12); }
.selection-completion button:disabled { opacity: .4; cursor: default; }
body:has(#nl-badge-frame) .selection-completion { --completion-bottom: 80px; }
@media (max-width: 900px) {
  body.selection-focus[data-view="global"] .interactive-section > .global-ai-panel { position: relative; top: 0; right: auto; bottom: auto; margin: 16px 16px 0 auto; }
  .selection-completion { width: calc(100vw - 32px); flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px 20px; }
  .selection-completion-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .selection-completion, .selection-completion.is-visible { transition: none; } }

body.selection-entry[data-focus-entry="scrolling"] :is(.global-ai-panel, .selection-save-island) { visibility: hidden; }

/* Default selection panel, Figma 326:21747. Other concepts keep their layout. */
.selection-block-navigation { display: none; }
.selection-focus .global-ai-panel { height: auto; border-radius: 10px; background: #fff; box-shadow: 0 0 8px rgba(50,53,55,.05), 0 2px 4px rgba(50,53,55,.06); }
.selection-focus .global-ai-panel:not(.is-regenerating) { min-height: 225px; }
.selection-focus .global-ai-panel .selection-panel-content { position: static; }
.selection-focus .global-ai-panel :is(.selection-panel-divider, .selection-undo, .selection-regenerate, .selection-add) { display: none; }
.selection-focus .global-ai-panel .selection-block-navigation { display: flex; align-items: flex-start; gap: 8px; height: 56px; padding: 12px 12px 8px; border-bottom: 1px solid rgba(50,53,55,.12); }
.selection-focus .global-ai-panel .selection-block-navigation .selection-control { position: static; width: 32px; height: 32px; padding: 6px; background: transparent; }
.selection-focus .global-ai-panel .selection-block-navigation .selection-control:hover:not(:disabled) { background: var(--subdued); }
.selection-focus .global-ai-panel :is(.selection-up, .selection-down) img { transform: none; }
.selection-block-count { flex: 1; min-width: 0; height: 32px; display: flex; align-items: center; font-family: 'Roboto Tooltip', Roboto, Arial, sans-serif; font-size: 14px; line-height: 20px; white-space: nowrap; }
.selection-focus .global-ai-panel .selection-choice-body { padding: 12px 16px 16px; }
.selection-focus .global-ai-panel .selection-choice-heading { display: flex; align-items: center; gap: 4px; padding-top: 4px; }
.selection-focus .global-ai-panel .selection-variant-title { position: static; flex: 1; min-width: 0; width: auto; font-size: 18px; line-height: 20px; font-weight: 500; }
.selection-focus .global-ai-panel .selection-choice-heading .selection-control { position: static; width: 36px; height: 36px; padding: 8px; background: #3e4247; }
.selection-focus .global-ai-panel .selection-choice-heading .selection-control:hover { background: #52565b; }
.selection-focus .global-ai-panel .selection-choice-heading img { filter: none; transform: none; }
.selection-focus .global-ai-panel .selection-variant-count { position: static; width: auto; height: 20px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.selection-variant-dot { width: 6px; height: 6px; border-radius: 50%; background: #bdbebf; }
.selection-variant-dot.is-current { background: #389f63; }
.selection-focus .global-ai-panel .selection-variant-reason { position: static; width: auto; margin-top: 21px; font-family: 'Roboto Tooltip', Roboto, Arial, sans-serif; font-size: 14px; line-height: 20px; color: #6c737b; }

/* Text selection toolbar, Figma 332:29733. Reveal from the selection's upper edge. */
.selection-text-toolbar { position: fixed; z-index: 6; translate: -50% 0; display: flex; align-items: center; gap: 4px; width: max-content; max-width: calc(100vw - 16px); height: 48px; padding: 6px 12px 6px 6px; border-radius: 12px; background: #fff; color: #6c737b; box-shadow: 0 0 20px rgba(50,53,55,.06), 0 12px 20px rgba(50,53,55,.11); overflow-x: auto; scrollbar-width: none; animation: text-selection-rise 300ms cubic-bezier(.22,1,.36,1); }
.selection-text-toolbar::-webkit-scrollbar { display: none; }
.selection-text-toolbar button { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 8px; border-radius: 8px; background: transparent; font-size: 15px; line-height: 20px; white-space: nowrap; }
.selection-text-toolbar button:has(span) { padding-left: 12px; padding-right: 12px; }
.selection-text-toolbar button:hover, .selection-text-toolbar button[aria-expanded="true"] { background: var(--subdued); }
.selection-text-toolbar img { display: block; flex-shrink: 0; }
.text-toolbar-divider { align-self: stretch; flex: 0 0 15px; background: linear-gradient(to right, transparent 7px, #e6e6e7 7px, #e6e6e7 8px, transparent 8px); }
.selection-text-toolbar .text-toolbar-color { flex-direction: column; gap: 0; width: 34px; }
.text-toolbar-color::after { content: ''; flex: 0 0 3px; width: 18px; background: #323537; }
.selection-text-toolbar .text-toolbar-highlighter { width: 32px; }
.selection-ai-menu, .selection-create-menu { width: min(320px, calc(100vw - 16px)); overflow-y: auto; overscroll-behavior: contain; }
.selection-create-menu { z-index: 8; }
.selection-ai-menu button, .selection-create-menu button { min-height: 40px; padding: 8px 12px; font-family: 'Roboto Tooltip', Roboto, Arial, sans-serif; font-size: 15px; line-height: 20px; }
body[data-stage="result"] :is(.selection-text-toolbar, .selection-ai-menu, .selection-create-menu) { display: none; }
@keyframes text-selection-rise { from { clip-path: inset(calc(100% - 1px) -24px 0); transform: translateY(8px); } to { clip-path: inset(-24px); transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .selection-text-toolbar { animation: none; } }

.selection-text-toolbar [data-text-action="ai"] { width: 67px; }
.selection-text-toolbar [aria-label="Стиль текста"] { width: 88px; }
.selection-text-toolbar [aria-label="Размер шрифта"] { width: 66px; }
