/* 82editor — quiet, Korean-friendly UI. Everything is prefixed .e82; theme through the custom properties below. */

.e82, .e82-layer {
  --e82-font: Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  --e82-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'D2Coding', monospace;
  --e82-bg: #ffffff;
  --e82-fg: #1f2328;
  --e82-muted: #6e7781;
  --e82-faint: #a0a7b0;
  --e82-border: #e4e7eb;
  --e82-border-strong: #d0d5dc;
  --e82-chrome: #ffffff;
  --e82-hover: #f2f4f6;
  --e82-pressed: #e8edf3;
  --e82-accent: #2f6fed;
  --e82-accent-soft: #eaf1fe;
  --e82-danger: #d93a3a;
  --e82-pop: #ffffff;
  --e82-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .10);
  --e82-radius: 10px;
  --e82-code-bg: #f6f8fa;
  --e82-quote: #d0d7de;
  --e82-sel-cell: rgba(47, 111, 237, .14);
  --e82-content-size: 16px;
  --e82-line: 1.75;
  color-scheme: light;
}

.e82[data-theme='dark'], .e82-layer[data-theme='dark'] {
  --e82-bg: #17191c;
  --e82-fg: #e6e8eb;
  --e82-muted: #9aa3ad;
  --e82-faint: #6b737c;
  --e82-border: #2b2f35;
  --e82-border-strong: #3a4048;
  --e82-chrome: #1c1f23;
  --e82-hover: #262a30;
  --e82-pressed: #30353c;
  --e82-accent: #6ea0ff;
  --e82-accent-soft: rgba(110, 160, 255, .14);
  --e82-pop: #22262b;
  --e82-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .45);
  --e82-code-bg: #22262b;
  --e82-quote: #3a4048;
  --e82-sel-cell: rgba(110, 160, 255, .22);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  .e82[data-theme='auto'], .e82-layer[data-theme='auto'] {
    --e82-bg: #17191c; --e82-fg: #e6e8eb; --e82-muted: #9aa3ad; --e82-faint: #6b737c; --e82-border: #2b2f35; --e82-border-strong: #3a4048;
    --e82-chrome: #1c1f23; --e82-hover: #262a30; --e82-pressed: #30353c; --e82-accent: #6ea0ff; --e82-accent-soft: rgba(110, 160, 255, .14);
    --e82-pop: #22262b; --e82-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .45); --e82-code-bg: #22262b; --e82-quote: #3a4048;
    --e82-sel-cell: rgba(110, 160, 255, .22);
    color-scheme: dark;
  }
}

.e82, .e82 *, .e82-layer, .e82-layer * { box-sizing: border-box; }
.e82 [hidden], .e82-layer [hidden] { display: none !important; }

.e82 {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--e82-border);
  border-radius: var(--e82-radius);
  background: var(--e82-bg);
  color: var(--e82-fg);
  font-family: var(--e82-font);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.e82.is-focused { border-color: var(--e82-border-strong); box-shadow: 0 0 0 3px var(--e82-accent-soft); }
.e82.is-over-limit { border-color: var(--e82-danger); }

/* ---------------------------------------------------------------- toolbar */
.e82-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--e82-border);
  background: var(--e82-chrome);
  border-radius: var(--e82-radius) var(--e82-radius) 0 0;
  flex-wrap: nowrap;
  overflow: hidden;
  min-height: 46px;
}
.e82-toolbar.is-sticky { position: sticky; top: 0; z-index: 3; }
.e82-toolbar.is-wrap { flex-wrap: wrap; overflow: visible; }
.e82-toolbar.is-mobile { padding-right: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.e82-toolbar.is-mobile::-webkit-scrollbar { display: none; }
.e82-toolbar.is-mobile .e82-tb-btn { min-width: 40px; height: 40px; flex: none; }
.e82-toolbar.is-mobile .e82-tb-btn.is-dropdown { min-width: 0 !important; }
.e82-toolbar.is-mobile .e82-more { padding-right: 8px; min-width: 48px; border-radius: 0; position: sticky; right: 0; background: var(--e82-chrome); box-shadow: -8px 0 8px var(--e82-chrome); }

.e82-tb-btn, .e82-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--e82-fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.e82-tb-btn svg, .e82-btn-icon svg { flex: none; opacity: .86; }
.e82-tb-btn:hover:not([disabled]), .e82-btn-icon:hover:not([disabled]) { background: var(--e82-hover); }
.e82-tb-btn:focus-visible, .e82-btn-icon:focus-visible, .e82-palette-none:focus-visible, .e82-tab:focus-visible, .e82-drop:focus-visible, .e82-grid-pick:focus-visible, .e82-menu-item:focus-visible, .e82-btn:focus-visible, .e82-char:focus-visible, .e82-swatch:focus-visible { outline: 2px solid var(--e82-accent); outline-offset: 1px; }
.e82-tb-btn.is-active, .e82-btn-icon.is-active { background: var(--e82-accent-soft); color: var(--e82-accent); }
.e82-tb-btn.is-active svg, .e82-btn-icon.is-active svg { opacity: 1; }
.e82-tb-btn[disabled], .e82-btn-icon[disabled] { opacity: .35; cursor: default; }
.e82-tb-btn.is-dropdown { padding: 0 4px 0 8px; justify-content: space-between; }
.e82-tb-btn.is-dropdown svg:last-child { opacity: .5; margin-left: 2px; }
.e82-tb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; font-size: 13px; }
.e82-tb-text { font-weight: 600; font-size: 13px; }
.e82-tb-btn.is-color .e82-swatch-line, .e82-btn-icon .e82-swatch-line { stroke: var(--e82-swatch, currentColor); opacity: 1; }
.e82-tb-btn[data-name='highlight'] svg, .e82-btn-icon[data-name='highlightBubble'] svg { filter: drop-shadow(0 2px 0 var(--e82-swatch, transparent)); }
.e82-sep { flex: none; width: 1px; height: 18px; margin: 0 5px; background: var(--e82-border); }
/* toolbarDensity: 'compact' — tight icons and groups; on phones the buttons stay 32px so they remain easy to tap */
.e82.is-compact .e82-toolbar { gap: 0; padding: 2px 4px; min-height: 32px; }
.e82.is-compact .e82-toolbar .e82-tb-btn { min-width: 26px; height: 26px; padding: 0 3px; border-radius: 5px; }
.e82.is-compact .e82-toolbar .e82-tb-btn.is-dropdown { min-width: 0 !important; padding: 0 1px 0 5px; gap: 0; }
.e82.is-compact .e82-toolbar .e82-tb-btn.is-dropdown svg:last-child { margin-left: 0; }
.e82.is-compact .e82-toolbar .e82-sep { height: 14px; margin: 0 2px; }
.e82.is-compact .e82-toolbar.is-mobile { padding: 2px 0 2px 2px; min-height: 36px; }
.e82.is-compact .e82-toolbar.is-mobile .e82-tb-btn { min-width: 32px; height: 32px; padding: 0 2px; }
.e82.is-compact .e82-toolbar.is-mobile .e82-more { min-width: 36px; padding-right: 4px; }
.e82-more { margin-left: auto; }
.e82-more-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: min(332px, calc(100vw - 32px)); padding: 6px; }
.e82-more-panel .e82-sep { height: 18px; }

/* ---------------------------------------------------------------- body & content */
.e82-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.e82-body.is-scroll { overflow: auto; }
.e82-content {
  flex: 1;
  min-height: 100%;
  padding: 20px 24px;
  outline: none;
  font-size: var(--e82-content-size);
  line-height: var(--e82-line);
  word-break: keep-all;
  overflow-wrap: anywhere;
  caret-color: var(--e82-accent);
  -webkit-user-modify: read-write;
}
.e82.is-readonly .e82-content { caret-color: transparent; -webkit-user-modify: read-only; }
.e82-content.e82-is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  color: var(--e82-faint);
  pointer-events: none;
}
.e82-content.e82-painting { cursor: copy; }
.e82-content.e82-col-resize, .e82-content.e82-col-resize * { cursor: col-resize !important; }

/* Shared typography for the editing area and for showing saved HTML (wrap it in .e82-view) */
.e82-content > :first-child, .e82-view > :first-child { margin-top: 0; }
.e82-content p, .e82-view p { margin: 0 0 .5em; }
.e82-content h1, .e82-view h1 { font-size: 1.75em; line-height: 1.35; margin: 1em 0 .5em; font-weight: 700; letter-spacing: -.01em; }
.e82-content h2, .e82-view h2 { font-size: 1.45em; line-height: 1.4; margin: 1em 0 .5em; font-weight: 700; letter-spacing: -.01em; }
.e82-content h3, .e82-view h3 { font-size: 1.2em; line-height: 1.45; margin: .9em 0 .4em; font-weight: 700; }
.e82-content h4, .e82-view h4 { font-size: 1.05em; margin: .8em 0 .4em; font-weight: 700; }
.e82-content blockquote, .e82-view blockquote { margin: .8em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--e82-quote, #d0d7de); color: var(--e82-muted, #57606a); }
.e82-content pre, .e82-view pre { margin: .8em 0; padding: 14px 16px; border-radius: 8px; background: var(--e82-code-bg, #f6f8fa); font-family: var(--e82-mono, ui-monospace, monospace); font-size: .875em; line-height: 1.6; white-space: pre-wrap; overflow-x: auto; tab-size: 2; }
.e82-content :not(pre) > code, .e82-view :not(pre) > code { padding: .1em .35em; border-radius: 4px; background: var(--e82-code-bg, #f6f8fa); font-family: var(--e82-mono, ui-monospace, monospace); font-size: .875em; }
.e82-content ul, .e82-content ol, .e82-view ul, .e82-view ol { margin: .4em 0 .6em; padding-left: 1.6em; }
.e82-content li > p, .e82-view li > p { margin: 0; }
.e82-content a, .e82-view a { color: var(--e82-accent, #2f6fed); text-decoration: underline; text-underline-offset: 2px; }
.e82-content img, .e82-view img { max-width: 100%; height: auto; }
.e82-content hr, .e82-view hr { border: 0; border-top: 1px solid var(--e82-border-strong, #d0d5dc); margin: 1.4em 0; }
.e82-content table, .e82-view table { border-collapse: collapse; margin: .8em 0; max-width: 100%; }
.e82-content td, .e82-content th, .e82-view td, .e82-view th { min-width: 40px; }
.e82-content td:not([style*='border']), .e82-content th:not([style*='border']), .e82-content td[style*='border: none'], .e82-content th[style*='border: none'] { outline: 1px dashed var(--e82-border-strong); outline-offset: -1px; }
.e82-content figure, .e82-view figure { margin: 0 0 1em; }
.e82-content figcaption:empty::before, .e82-content figcaption:has(> br:only-child)::before { content: attr(data-placeholder); color: var(--e82-faint); }
.e82-content ul[data-checklist], .e82-view ul[data-checklist] { list-style: none; padding-left: 4px; }
.e82-content ul[data-checklist] > li, .e82-view ul[data-checklist] > li { position: relative; padding-left: 28px; }
.e82-content ul[data-checklist] > li::before, .e82-view ul[data-checklist] > li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: .32em;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--e82-border-strong, #c4cad3);
  border-radius: 4px;
  background: var(--e82-bg, #fff);
  cursor: pointer;
}
.e82-content ul[data-checklist] > li[data-checked='true']::before, .e82-view ul[data-checklist] > li[data-checked='true']::before {
  border-color: var(--e82-accent, #2f6fed);
  background: var(--e82-accent, #2f6fed) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 8.5 2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.e82-content ul[data-checklist] > li[data-checked='true'], .e82-view ul[data-checklist] > li[data-checked='true'] { color: var(--e82-muted, #6e7781); text-decoration: line-through; }
.e82-content [data-video], .e82-view [data-video] { margin: .8em 0; border-radius: 8px; }
.e82-content [data-video]::after { content: ''; position: absolute; inset: 0; }
.e82-content [data-page-break] { position: relative; height: 1px; margin: 1.6em 0; border-top: 1px dashed var(--e82-border-strong); }
.e82-content [data-page-break]::after { content: 'PAGE BREAK'; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); padding: 0 8px; background: var(--e82-bg); color: var(--e82-faint); font-size: 10px; letter-spacing: .08em; }
.e82-content [data-mention], .e82-view [data-mention] { padding: 0 3px; border-radius: 4px; background: var(--e82-accent-soft, #eaf1fe); color: var(--e82-accent, #2f6fed); }
.e82-content nav[data-toc], .e82-view nav[data-toc] { margin: .8em 0; padding: 12px 16px; border: 1px solid var(--e82-border, #e4e7eb); border-radius: 8px; }
.e82-content nav[data-toc] ul, .e82-view nav[data-toc] ul { list-style: none; padding-left: 0; margin: 0; }
.e82-content details > summary, .e82-view details > summary { cursor: pointer; }
.e82-content details > summary { cursor: text; }
.e82-content details > :not(summary), .e82-view details > :not(summary) { margin-top: .5em; }
.e82-content details > p:last-child, .e82-view details > p:last-child, .e82-content [data-callout] > p:last-child, .e82-view [data-callout] > p:last-child { margin-bottom: 0; }
/* folded for readers, open while editing: the title marker says which */
.e82-content details[data-e82-closed] > summary::marker { content: '▸ '; color: var(--e82-muted); }
.e82-content blockquote[data-quote='mark']::before, .e82-view blockquote[data-quote='mark']::before { content: '\201C'; display: block; height: .55em; font-size: 2.6em; line-height: 1; font-family: Georgia, serif; color: var(--e82-faint, #a0a7b0); }
.e82-content blockquote[data-quote='mark']::after, .e82-view blockquote[data-quote='mark']::after { content: '\201D'; display: block; height: .45em; font-size: 2.6em; line-height: .9; font-family: Georgia, serif; color: var(--e82-faint, #a0a7b0); }
.e82-content .e82-cell-sel { background-color: var(--e82-sel-cell) !important; }
.e82-content.e82-has-cell-sel ::selection { background: transparent; }
.e82-content img.e82-img-sel { outline: 2px solid var(--e82-accent); outline-offset: 1px; }
.e82-content img.e82-uploading { opacity: .5; filter: grayscale(.4); }
.e82-content ::highlight(e82-find), ::highlight(e82-find) { background: #ffe58a; color: inherit; }
::highlight(e82-find-current) { background: #ffa94d; color: #000; }

/* dark theme: text on light inline backgrounds (highlights, header cells) stays readable unless the writer set a color */
.e82[data-theme='dark'] .e82-content [style*='background-color']:not([style^='color']):not([style*=' color:']):not([style*=';color:']) { color: #1f2328; }
@media (prefers-color-scheme: dark) {
  .e82[data-theme='auto'] .e82-content [style*='background-color']:not([style^='color']):not([style*=' color:']):not([style*=';color:']) { color: #1f2328; }
}

/* image resize overlay */
.e82-img-overlay { position: absolute; z-index: 2; pointer-events: none; }
.e82-handle { position: absolute; width: 12px; height: 12px; border: 2px solid var(--e82-bg); border-radius: 50%; background: var(--e82-accent); pointer-events: auto; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.e82-handle.is-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.e82-handle.is-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.e82-handle.is-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.e82-handle.is-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.e82-size-label { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; opacity: 0; transition: opacity .15s; }
.e82-img-overlay.is-dragging .e82-size-label { opacity: 1; }

/* ---------------------------------------------------------------- status bar, banner, find, source */
.e82-statusbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 30px; padding: 4px 6px 4px 12px; border-top: 1px solid var(--e82-border); color: var(--e82-muted); font-size: 12px; border-radius: 0 0 var(--e82-radius) var(--e82-radius); background: var(--e82-chrome); user-select: none; }
.e82-status-info { display: flex; flex-wrap: wrap; gap: 6px; font-variant-numeric: tabular-nums; }
.e82-status-info i { font-style: normal; opacity: .5; }
.e82-status-info .is-over { color: var(--e82-danger); font-weight: 600; }
.e82-grip { display: grid; place-items: center; width: 18px; height: 18px; cursor: ns-resize; color: var(--e82-faint); }
.e82-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--e82-border); background: var(--e82-accent-soft); font-size: 13px; }
.e82-banner > span { flex: 1; }
.e82-find { display: grid; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--e82-border); background: var(--e82-chrome); }
.e82-find-row { display: flex; align-items: center; gap: 6px; }
.e82-find-row .e82-input { flex: 1; min-width: 0; }
.e82-find:not(.has-replace) > .e82-find-row:nth-child(2) { display: none; }
.e82-find-count { min-width: 56px; color: var(--e82-muted); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.e82-source { position: relative; flex: 1; min-height: 240px; }
.e82-source-input, .e82-source-hl {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 16px 20px;
  border: 0;
  font-family: var(--e82-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  overflow: auto;
  tab-size: 2;
}
.e82-source-input { resize: none; background: transparent; color: transparent; caret-color: var(--e82-fg); outline: none; z-index: 1; }
.e82-source-input::selection { background: rgba(47, 111, 237, .25); color: transparent; }
.e82-source-hl { color: var(--e82-fg); background: var(--e82-code-bg); pointer-events: none; }
.e82-hl-tag { color: #cf222e; }
.e82-hl-attr { color: #8250df; }
.e82-hl-val { color: #0a3069; }
.e82[data-theme='dark'] .e82-hl-tag { color: #ff7b72; }
.e82[data-theme='dark'] .e82-hl-attr { color: #d2a8ff; }
.e82[data-theme='dark'] .e82-hl-val { color: #a5d6ff; }

/* fullscreen */
.e82.is-fullscreen { position: fixed; inset: 0; z-index: 2147483000; border-radius: 0; border: 0; }
.e82.is-fullscreen .e82-toolbar, .e82.is-fullscreen .e82-statusbar { border-radius: 0; }
.e82.is-fullscreen .e82-body { overflow: auto; height: auto !important; max-height: none !important; }
.e82.is-fullscreen .e82-content { max-width: 860px; width: 100%; margin: 0 auto; padding: 40px 32px; }
html.e82-noscroll, html.e82-noscroll body { overflow: hidden; }

/* ---------------------------------------------------------------- floating layer */
.e82-layer { position: relative; z-index: 2147483100; font-family: var(--e82-font); font-size: 14px; line-height: 1.5; color: var(--e82-fg); }
.e82-pop { position: fixed; z-index: 1; min-width: 40px; padding: 4px; border: 1px solid var(--e82-border); border-radius: 10px; background: var(--e82-pop); box-shadow: var(--e82-shadow); animation: e82-in .12s ease-out; }
.e82-pop.is-context, .e82-pop.is-bubble { padding: 3px; border-radius: 9px; }
.e82-pop.is-caret-menu { padding: 4px; }
@keyframes e82-in { from { opacity: 0; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .e82-pop, .e82-toast { animation: none !important; } }

.e82-menu { display: flex; flex-direction: column; min-width: 140px; max-height: min(360px, 60vh); overflow-y: auto; }
.e82-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--e82-fg); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.e82-menu-item:hover, .e82-menu-item:focus-visible, .e82-menu-item.is-active { background: var(--e82-hover); }
.e82-menu-item.is-checked { color: var(--e82-accent); }
.e82-menu-item.is-checked::after { content: ''; width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: currentColor; }
.e82-menu-icon { display: inline-flex; width: 20px; justify-content: center; color: var(--e82-muted); }
.e82-menu-icon svg { width: 18px; height: 18px; }
.e82-menu-label { flex: 1; white-space: nowrap; }
.e82-menu-hint { color: var(--e82-faint); font-size: 12px; }
.e82-menu-sep { height: 1px; margin: 4px 6px; background: var(--e82-border); }
.e82-menu-empty { padding: 10px 12px; color: var(--e82-muted); font-size: 13px; }
.e82-menu.is-slash { width: 248px; }
.e82-hicon { font-size: 11px; font-weight: 700; color: var(--e82-muted); }

.e82-ctx { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; max-width: calc(100vw - 24px); }
.e82-ctx .e82-btn-icon { min-width: 30px; height: 30px; }
.e82-ctx .e82-sep { height: 16px; margin: 0 3px; }
.e82-ctx-url { max-width: 240px; padding: 0 8px; color: var(--e82-accent); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e82-ctx select { height: 30px; }
.e82-callout-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid; border-radius: 6px; font-size: 12px; line-height: 1; }
.e82-btn-icon.is-active .e82-callout-dot { box-shadow: 0 0 0 2px var(--e82-accent); }

/* image editor: crop box over a preview canvas */
.e82-crop { display: grid; gap: 10px; justify-items: center; }
.e82-crop-stage { position: relative; max-width: 100%; min-width: 120px; min-height: 120px; background: repeating-conic-gradient(var(--e82-hover) 0 25%, transparent 0 50%) 0 0 / 16px 16px; touch-action: none; user-select: none; }
.e82-crop-stage[aria-busy='true']::after { content: ''; position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border: 3px solid var(--e82-border-strong); border-top-color: var(--e82-accent); border-radius: 50%; animation: e82-spin .8s linear infinite; }
@keyframes e82-spin { to { transform: rotate(360deg); } }
.e82-crop-canvas { display: block; max-width: 100%; }
.e82-crop-stage[aria-busy='true'] .e82-crop-box { display: none; }
.e82-crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); outline: 1.5px solid #fff; cursor: move; }
.e82-crop-stage { overflow: hidden; }
.e82-crop-handle { position: absolute; width: 16px; height: 16px; border: 2px solid #fff; border-radius: 3px; background: var(--e82-accent); }
.e82-crop-handle.is-nw { left: -2px; top: -2px; cursor: nwse-resize; }
.e82-crop-handle.is-ne { right: -2px; top: -2px; cursor: nesw-resize; }
.e82-crop-handle.is-sw { left: -2px; bottom: -2px; cursor: nesw-resize; }
.e82-crop-handle.is-se { right: -2px; bottom: -2px; cursor: nwse-resize; }
@media (pointer: coarse) { .e82-crop-handle { width: 26px; height: 26px; } }
.e82-crop-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; width: 100%; }
.e82-crop-tools .e82-btn.is-on { background: var(--e82-accent-soft); color: var(--e82-accent); }
.e82-crop-size { color: var(--e82-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.e82-palette { display: grid; gap: 8px; width: 236px; padding: 6px; }
.e82-palette-none { display: flex; align-items: center; gap: 8px; padding: 6px; border: 0; border-radius: 6px; background: transparent; color: var(--e82-fg); font: inherit; font-size: 13px; cursor: pointer; }
.e82-palette-none:hover { background: var(--e82-hover); }
.e82-swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.e82-swatch { width: 100%; aspect-ratio: 1; min-width: 22px; border: 1px solid rgba(0, 0, 0, .1); border-radius: 50%; cursor: pointer; padding: 0; transition: transform .1s; }
.e82-swatch:hover { transform: scale(1.12); }
.e82-swatch.is-none { width: 18px; min-width: 18px; background: linear-gradient(135deg, transparent 45%, var(--e82-danger) 45%, var(--e82-danger) 55%, transparent 55%), var(--e82-bg); }
.e82-palette-label { color: var(--e82-muted); font-size: 12px; }
.e82-palette-custom { display: flex; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid var(--e82-border); font-size: 12px; color: var(--e82-muted); }
.e82-palette-custom > span { white-space: nowrap; }
.e82-palette-custom .e82-input { flex: 1; min-width: 0; font-family: var(--e82-mono); }
.e82-palette-custom input[type='color'] { width: 28px; height: 28px; padding: 0; border: 1px solid var(--e82-border); border-radius: 6px; background: none; cursor: pointer; }

.e82-grid-wrap { padding: 6px; }
.e82-grid-pick { display: grid; grid-template-columns: repeat(10, 18px); gap: 3px; outline: none; }
.e82-grid-cell { width: 18px; height: 18px; border: 1px solid var(--e82-border-strong); border-radius: 3px; cursor: pointer; }
.e82-grid-cell.is-on { border-color: var(--e82-accent); background: var(--e82-accent-soft); }
.e82-grid-label { margin-top: 8px; color: var(--e82-muted); font-size: 12px; text-align: center; }

.e82-picker { display: grid; gap: 6px; width: 300px; padding: 4px; }
.e82-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.e82-tab { flex: none; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--e82-muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.e82-tab.is-active { background: var(--e82-accent-soft); color: var(--e82-accent); }
.e82-chars { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; max-height: 220px; overflow-y: auto; }
.e82-chars.is-emoji { grid-template-columns: repeat(8, 1fr); }
.e82-char { height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--e82-fg); font-size: 16px; cursor: pointer; }
.e82-chars.is-emoji .e82-char { height: 34px; font-size: 20px; }
.e82-char:hover { background: var(--e82-hover); }

/* dialogs */
.e82-overlay { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 16px; background: rgba(15, 20, 25, .32); animation: e82-fade .12s ease-out; }
@keyframes e82-fade { from { opacity: 0; } }
.e82-dialog { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 14px; background: var(--e82-pop); box-shadow: var(--e82-shadow); }
.e82-dialog.is-wide { width: min(760px, 100%); }
.e82-dialog-form { display: flex; flex-direction: column; }
.e82-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px 20px; }
.e82-dialog-title { margin: 0; font-size: 16px; font-weight: 700; }
.e82-dialog-body { display: grid; gap: 14px; padding: 12px 20px 8px; }
.e82-dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.e82-spacer { flex: 1; }
.e82-field { display: grid; gap: 6px; }
.e82-field > label { font-size: 13px; font-weight: 600; }
.e82-hint { color: var(--e82-muted); font-size: 12px; }
.e82-input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--e82-border-strong); border-radius: 8px; background: var(--e82-bg); color: var(--e82-fg); font: inherit; font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.e82-input { height: auto; padding: 10px 12px; resize: vertical; }
.e82-input.is-sm { height: 30px; padding: 0 8px; font-size: 13px; }
.e82-input:focus { border-color: var(--e82-accent); box-shadow: 0 0 0 3px var(--e82-accent-soft); }
.e82-input[aria-invalid='true'] { border-color: var(--e82-danger); }
.e82-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.e82-check.is-sm { font-size: 12px; color: var(--e82-muted); }
.e82-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--e82-accent); }
.e82-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--e82-border-strong); border-radius: 8px; background: var(--e82-bg); color: var(--e82-fg); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.e82-btn:hover { background: var(--e82-hover); }
.e82-btn.is-primary { border-color: var(--e82-accent); background: var(--e82-accent); color: #fff; }
.e82-btn.is-primary:hover { filter: brightness(1.06); }
.e82-btn.is-danger { color: var(--e82-danger); }
.e82-btn.is-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.e82-btn.is-ghost { border-color: transparent; background: transparent; font-weight: 500; }
.e82-btn.is-ghost:hover { background: var(--e82-hover); }
.e82-icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--e82-muted); cursor: pointer; }
.e82-icon-btn:hover { background: var(--e82-hover); color: var(--e82-fg); }
.e82-drop { display: grid; justify-items: center; gap: 8px; width: 100%; padding: 26px 16px; border: 1.5px dashed var(--e82-border-strong); border-radius: 12px; background: transparent; color: var(--e82-muted); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .12s, background .12s; }
.e82-drop:hover, .e82-drop.is-over { border-color: var(--e82-accent); background: var(--e82-accent-soft); color: var(--e82-accent); }
.e82-drop-icon svg { width: 26px; height: 26px; }
.e82-image-dialog { display: grid; gap: 12px; }
.e82-or { display: flex; align-items: center; gap: 10px; color: var(--e82-faint); font-size: 12px; }
.e82-or::before, .e82-or::after { content: ''; flex: 1; height: 1px; background: var(--e82-border); }
.e82-issues { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.e82-issues li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.e82-issues li.is-ok { color: var(--e82-muted); }
.e82-issue-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59f00; }
.e82-link-btn { flex: 1; padding: 0; border: 0; background: none; color: var(--e82-fg); font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--e82-border-strong); text-underline-offset: 3px; }
.e82-issues .e82-input { max-width: 220px; }
.e82-keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.e82-keys td { padding: 6px 4px; border-bottom: 1px solid var(--e82-border); vertical-align: top; }
.e82-keys td:last-child { text-align: right; color: var(--e82-muted); }
.e82-keys kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--e82-border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--e82-bg); font-family: var(--e82-mono); font-size: 11.5px; }
.e82-preview { max-height: 70vh; overflow: auto; padding: 4px 2px; font-size: var(--e82-content-size); line-height: var(--e82-line); }

.e82-toast { position: fixed; z-index: 3; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 10px; background: #1f2328; color: #fff; font-size: 13px; box-shadow: var(--e82-shadow); animation: e82-up .18s ease-out; transition: opacity .3s; }
.e82-toast.is-error { background: #b42318; }
.e82-toast.is-leaving { opacity: 0; }
.e82-toast-action { flex: none; padding: 4px 10px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .16); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
@keyframes e82-up { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (max-width: 640px) {
  .e82-content { padding: 16px; }
  .e82-dialog { border-radius: 14px 14px 0 0; align-self: end; width: 100%; }
  .e82-overlay { padding: 0; }
  .e82-status-info > span:nth-child(n + 3), .e82-status-info i:nth-of-type(n + 2) { display: none; }
}

/* 1.4.0: block grip and drop line, bookmarks, photo groups, Markdown box */
.e82-drag-handle { position: absolute; z-index: 2; display: grid; place-items: center; width: 20px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--e82-muted, #8b949e); cursor: grab; opacity: .7; }
.e82-drag-handle:hover { background: var(--e82-hover, rgba(0, 0, 0, .06)); opacity: 1; }
.e82-drag-handle[hidden], .e82-drop-line[hidden] { display: none; }
.e82-drop-line { position: absolute; z-index: 3; height: 3px; border-radius: 2px; background: var(--e82-accent); pointer-events: none; }
.e82-content .e82-dragging { opacity: .35; }
.e82-content :is(p, li, blockquote, figure, table, details, div)[id] { position: relative; }
.e82-content :is(p, li, blockquote, figure, details, div)[id]::before { content: '#'; position: absolute; left: -16px; top: 0; font-size: 12px; font-weight: 700; color: var(--e82-accent); opacity: .55; pointer-events: none; }
.e82-content div[data-gallery] img { cursor: pointer; }
.e82-md-input { width: 100%; min-height: 320px; margin-top: 8px; font-family: var(--e82-mono, ui-monospace, monospace); font-size: 13px; line-height: 1.6; resize: vertical; }

/* 1.4.0 (B): boxes, columns, merge tags, preview widths, versions, image tray */
.e82-content :is(div[data-embed], div[data-link-card], div[data-file], div[data-html]) { cursor: pointer; border-radius: 10px; outline: 1px dashed transparent; outline-offset: 3px; }
.e82-content :is(div[data-embed], div[data-link-card], div[data-file], div[data-html]):hover { outline-color: var(--e82-border, #d0d7de); }
.e82-content div[data-embed] iframe { pointer-events: none; }
.e82-content ::selection { background: color-mix(in srgb, var(--e82-accent) 22%, transparent); }
.e82-content div[data-columns] > div[data-column] { outline: 1px dashed var(--e82-border, #d0d7de); outline-offset: 4px; border-radius: 4px; }
.e82-content span[data-merge] { padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--e82-accent) 14%, transparent); color: var(--e82-accent); font-size: .92em; white-space: nowrap; }
.e82-seg { display: flex; gap: 4px; margin-bottom: 12px; }
.e82-seg [aria-pressed='true'] { background: var(--e82-accent); border-color: var(--e82-accent); color: #fff; }
.e82-preview-frame { max-width: 100%; margin: 0 auto; padding: 16px; border: 1px solid var(--e82-border, #d0d7de); border-radius: 10px; overflow: auto; transition: width .2s; }
.e82-rev { display: grid; grid-template-columns: 180px 1fr; gap: 16px; min-height: 280px; }
.e82-rev-list { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow: auto; }
.e82-rev-item { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.e82-rev-item span { color: var(--e82-muted); }
.e82-rev-item:hover { background: var(--e82-hover); }
.e82-rev-item.is-active { background: color-mix(in srgb, var(--e82-accent) 14%, transparent); }
.e82-rev-view { max-height: 420px; overflow: auto; padding: 12px; border: 1px solid var(--e82-border, #d0d7de); border-radius: 8px; font-size: 14px; }
.e82-rev-view del { color: #cf222e; background: #ffebe9; }
.e82-rev-view ins { color: #116329; background: #dafbe1; text-decoration: underline; }
@media (max-width: 640px) { .e82-rev { grid-template-columns: 1fr; } .e82-rev-list { flex-direction: row; overflow-x: auto; } }
.e82-tray { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid var(--e82-border, #d0d7de); }
.e82-tray[hidden] { display: none; }
.e82-tray-item { position: relative; flex: none; }
.e82-tray-item.is-over { outline: 2px solid var(--e82-accent); border-radius: 6px; }
.e82-tray-item.is-dragging { opacity: .4; }
.e82-tray-item.is-unused { opacity: .45; }
.e82-tray-thumb { display: block; width: 64px; height: 48px; padding: 0; border: 1px solid var(--e82-border, #d0d7de); border-radius: 6px; overflow: hidden; background: var(--e82-hover); cursor: pointer; }
.e82-tray-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.e82-tray-del { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: #1f2328; color: #fff; font-size: 10px; line-height: 18px; cursor: pointer; opacity: 0; }
.e82-tray-item:hover .e82-tray-del, .e82-tray-del:focus-visible { opacity: 1; }
.e82-tray-no { position: absolute; left: 4px; bottom: 2px; color: #fff; font-size: 10px; text-shadow: 0 0 2px #000; pointer-events: none; }
