/* HANA Editor v0.6 — 네이버 스마트에디터 ONE 동기화 */
.hana-editor { display: flex; flex-direction: column; height: 100vh; background: var(--bg-card); position: relative; }
.hana-editor__header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-light); flex: 0 0 auto; }
.hana-editor__back { background: none; border: 0; padding: 4px 8px; font-size: 22px; cursor: pointer; color: var(--text-primary); }
.hana-editor__title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; }
.hana-editor__save { background: none; border: 0; padding: 8px 12px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.hana-editor__submit { background: none; border: 0; padding: 8px 14px; font-size: 15px; font-weight: 700; color: var(--text-tertiary); cursor: pointer; }
.hana-editor__submit.is-active { color: var(--accent); }
.hana-editor__submit:disabled { cursor: not-allowed; }
.hana-editor__meta { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); flex: 0 0 auto; }
.hana-editor__select { flex: 1; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 14px; background: var(--bg-card); outline: none; }
.hana-editor__title-input { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border-light); font-size: 18px; font-weight: 700; outline: none; flex: 0 0 auto; font-family: inherit; }
.hana-editor__title-input::placeholder { color: var(--text-tertiary); font-weight: 500; }
.hana-editor__insert { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--border-light); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: 0 0 auto; }
.hana-editor__insert::-webkit-scrollbar { display: none; }
.hana-editor__insert-btn { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 12px; border: 0; background: none; cursor: pointer; color: var(--text-secondary); font-size: 11px; border-radius: 8px; min-width: 60px; }
.hana-editor__insert-btn:hover { background: var(--border-light); color: var(--text-primary); }
.hana-editor__insert-icon { font-size: 22px; }
.hana-editor__body { flex: 1; padding: 16px; overflow-y: auto; outline: none; font-size: 16px; line-height: 1.6; min-height: 200px; }
.hana-editor__body[data-empty="true"]::before { content: attr(data-placeholder); color: var(--text-tertiary); pointer-events: none; }
.hana-editor__body img { max-width: 100%; height: auto; border-radius: 8px; }
.hana-editor__body .hana-image-wrap { position: relative; display: block; margin: 8px 0; cursor: move; user-select: none; }
.hana-editor__body .hana-image-wrap.is-dragging { opacity: 0.4; }
.hana-editor__body .hana-image-wrap.drop-target { box-shadow: 0 -3px 0 var(--accent); }
.hana-editor__body .hana-image-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 999px; background: rgba(0,0,0,0.6); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; font-size: 16px; opacity: 0; transition: opacity .15s; }
.hana-editor__body .hana-image-wrap:hover .hana-image-remove { opacity: 1; }
.hana-editor__body blockquote { border-left: 3px solid var(--accent); padding: 8px 12px; margin: 12px 0; color: var(--text-secondary); background: var(--bg-app); }
.hana-editor__body hr { border: 0; border-top: 1px solid var(--border-color); margin: 16px 0; }
.hana-editor__body a { color: var(--accent); text-decoration: underline; }
.hana-editor__body video { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.hana-editor__format { display: flex; gap: 2px; padding: 8px 12px; border-top: 1px solid var(--border-light); background: var(--bg-card); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: 0 0 auto; }
.hana-editor__format::-webkit-scrollbar { display: none; }
.hana-editor__format-btn { flex: 0 0 auto; min-width: 36px; height: 36px; border-radius: 6px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--text-primary); font-size: 14px; font-weight: 600; padding: 0 8px; }
.hana-editor__format-btn:hover { background: var(--border-light); }
.hana-editor__format-btn.is-active { background: var(--accent-light); color: var(--accent); }
.hana-editor__format-divider { width: 1px; background: var(--border-color); margin: 6px 4px; flex: 0 0 auto; }
.hana-editor__color-popover { position: fixed; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.16); z-index: 110; display: none; grid-template-columns: repeat(8, 24px); gap: 4px; }
.hana-editor__color-popover.is-open { display: grid; }
.hana-editor__color-swatch { width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--border-color); cursor: pointer; padding: 0; }
.hana-editor__options { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-top: 8px solid var(--bg-app); flex: 0 0 auto; }
.hana-editor__option { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hana-editor__option-label { font-size: 14px; font-weight: 500; flex: 1; }
.hana-editor__tag-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 14px; outline: none; }
.hana-editor__file-input { display: none; }
.hana-toggle { position: relative; width: 40px; height: 22px; flex: 0 0 auto; }
.hana-toggle input { display: none; }
.hana-toggle__slider { position: absolute; inset: 0; background: var(--border-color); border-radius: 999px; cursor: pointer; transition: background .2s; }
.hana-toggle__slider::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 999px; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.hana-toggle input:checked + .hana-toggle__slider { background: var(--accent); }
.hana-toggle input:checked + .hana-toggle__slider::before { transform: translateX(18px); }
.hana-editor__loading { position: absolute; inset: 0; background: rgba(255,255,255,0.7); display: none; place-items: center; z-index: 120; }
.hana-editor__loading.is-active { display: grid; }
.hana-editor__spinner { width: 40px; height: 40px; border: 3px solid var(--border-color); border-top-color: var(--accent); border-radius: 999px; animation: hana-spin 0.8s linear infinite; }
@keyframes hana-spin { to { transform: rotate(360deg); } }


/* Image resize handle (v0.8) */
.hana-image-wrap { position: relative; resize: horizontal; overflow: hidden; max-width: 100%; min-width: 100px; }
.hana-image-wrap img { width: 100%; height: auto; display: block; }
.hana-image-wrap.is-selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.hana-resize-handle { position: absolute; bottom: 4px; right: 4px; width: 20px; height: 20px; background: var(--accent); border: 2px solid #fff; border-radius: 4px; cursor: se-resize; z-index: 5; opacity: 0; transition: opacity .15s; }
.hana-image-wrap:hover .hana-resize-handle, .hana-image-wrap.is-selected .hana-resize-handle { opacity: 1; }

/* Code block in editor */
.hana-editor__body pre { background: #1e1e1e; color: #e5e5e5; padding: 12px; border-radius: 6px; margin: 12px 0; overflow-x: auto; font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.hana-editor__body code { background: var(--bg-app); padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace; font-size: 0.9em; }
.hana-editor__body pre code { background: transparent; padding: 0; }

/* Table in editor */
.hana-editor__body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.hana-editor__body table td, .hana-editor__body table th { border: 1px solid var(--border-color); padding: 8px 12px; }
.hana-editor__body table th { background: var(--bg-app); font-weight: 600; }
.hana-editor__body table tr:nth-child(even) { background: var(--bg-app); }

/* Single page rendering of pre/code/table */
.hana-card__body pre { background: #1e1e1e; color: #e5e5e5; padding: 12px; border-radius: 6px; margin: 12px 0; overflow-x: auto; font-family: monospace; font-size: 13px; }
.hana-card__body code { background: var(--bg-app); padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.hana-card__body pre code { background: transparent; padding: 0; }
.hana-card__body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.hana-card__body table td, .hana-card__body table th { border: 1px solid var(--border-color); padding: 8px 12px; }
.hana-card__body table th { background: var(--bg-app); font-weight: 600; }

