/**
 * TipTap Simple Editor: 본문 높이는 내용에 맞춤. 도구줄은 한 줄 + 가로 스크롤, 상단 sticky.
 */
@import url('/asset/css/richtext-content.css');

.dt-simple-editor {
    --dt-se-radius: 0;
    --dt-se-border: rgba(148, 163, 184, 0.18);
    --dt-se-toolbar-h: 48px;
    --dt-se-text: #e2e8f0;
    --dt-se-muted: #94a3b8;
    --dt-se-accent: #f87171;
    --dt-se-body-bg: #020202;
    --dt-se-chrome: #090909;
    --dt-se-reading-max-width: min(100%, 57rem);
    --dt-se-reading-inline-gutter: clamp(1rem, 2.2vw, 2rem);
    --dt-se-reading-line-height: 1.82;
    --dt-se-reading-letter-spacing: -0.012em;
    --dt-se-reading-paragraph-gap: 1.06em;
    --dt-se-toolbar-pin-right-width: 4.5rem;
    width: 100%;
    max-width: none;
    margin: 0;
    /* 그리드·플렉스 자식에서 가로 오버플로 방지 */
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: visible;
}

.dt-simple-editor__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: var(--dt-se-radius);
    border: 1px solid var(--dt-se-border);
    background: var(--dt-se-chrome);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4) inset,
        0 24px 48px rgba(0, 0, 0, 0.45);
    /* sticky 툴바를 위해 Y는 열고, 바깥 가로 스크롤 전파는 차단 */
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: visible;
}

/* 페이지 스크롤 시 헤더 아래에 도구줄 고정 (레이아웃과 동일한 --darkthread-sticky-header-offset) */
.dt-simple-editor__toolbar-sticky {
    position: sticky;
    top: calc(var(--darkthread-sticky-header-presence-offset, var(--darkthread-sticky-header-offset, 4.25rem)) - 1px);
    z-index: 12;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: visible;
    background: var(--dt-se-chrome);
    border-bottom: 1px solid var(--dt-se-border);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

@media (max-width: 1079px) {
    body.darkthread-has-mobile-tab-bar:not(.darkthread-editor-page) .dt-simple-editor__toolbar-sticky {
        transition: top 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    }

    body.darkthread-editor-page.darkthread-board-view-v2-page .dt-simple-editor__toolbar-sticky {
        transition: none;
    }
}

.dt-simple-editor__toolbar-scroll {
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.dt-simple-editor__toolbar-scroll-hint {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 3;
    display: none;
    align-items: center;
    width: 1.85rem;
    pointer-events: none;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    color: rgba(148, 163, 184, 0.42);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dt-simple-editor__toolbar-scroll-hint i {
    font-size: 0.7rem;
}

.dt-simple-editor__toolbar-scroll-hint--left {
    left: 0;
    justify-content: flex-start;
    padding-left: 0.4rem;
    background: linear-gradient(to right, rgba(9, 9, 9, 0.96) 35%, rgba(9, 9, 9, 0));
}

.dt-simple-editor__toolbar-scroll-hint--right {
    right: 0;
    justify-content: flex-end;
    padding-right: 0.4rem;
    background: linear-gradient(to left, rgba(9, 9, 9, 0.96) 35%, rgba(9, 9, 9, 0));
}

.dt-simple-editor__toolbar-scroll.can-scroll-left .dt-simple-editor__toolbar-scroll-hint--left,
.dt-simple-editor__toolbar-scroll.can-scroll-right .dt-simple-editor__toolbar-scroll-hint--right {
    opacity: 1;
}

.dt-simple-editor__toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.2rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: var(--dt-se-toolbar-h);
    padding: 0.35rem 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    max-inline-size: 100%;
    contain: inline-size;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.dt-simple-editor__toolbar-group {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.15rem;
    padding-right: 0.45rem;
    margin-right: 0.35rem;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.dt-simple-editor__toolbar-group:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.dt-simple-editor__toolbar-pin-right {
    position: absolute;
    inset: 0 0 0 auto;
    width: var(--dt-se-toolbar-pin-right-width);
    display: none;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.5rem 0 0.7rem;
    background: linear-gradient(90deg, rgba(9, 9, 9, 0) 0%, rgba(9, 9, 9, 0.96) 34%, rgba(9, 9, 9, 1) 100%);
    pointer-events: none;
}

.dt-simple-editor--has-toolbar-overflow .dt-simple-editor__toolbar {
    padding-right: calc(var(--dt-se-toolbar-pin-right-width) + 0.35rem);
}

.dt-simple-editor--has-toolbar-overflow .dt-simple-editor__toolbar-pin-right {
    display: inline-flex;
}

.dt-simple-editor--has-toolbar-overflow .dt-simple-editor__toolbar-group--copy-inline {
    display: none;
}

.dt-simple-editor__toolbar-group--pinned {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
    pointer-events: auto;
}

.dt-simple-editor__select {
    box-sizing: border-box;
    height: 2rem;
    padding: 0 1.85rem 0 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--dt-se-border);
    background: rgba(9, 9, 9, 0.88) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.4rem center;
    color: var(--dt-se-text);
    font-size: 0.78rem;
    font-weight: 600;
    appearance: none;
    cursor: pointer;
    min-width: 6.75rem;
}

.dt-simple-editor__select:focus {
    outline: 2px solid rgba(248, 113, 113, 0.35);
    outline-offset: 1px;
}

.dt-simple-editor__btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.05rem;
    height: 2.05rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--dt-se-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition:
        background 0.12s ease,
        color 0.12s ease,
        border-color 0.12s ease;
}

.dt-simple-editor__btn:hover {
    background: rgba(51, 65, 85, 0.45);
    color: var(--dt-se-text);
    border-color: rgba(148, 163, 184, 0.25);
}

.dt-simple-editor__btn.is-active {
    background: rgba(127, 29, 29, 0.24);
    border-color: rgba(248, 113, 113, 0.46);
    color: var(--dt-se-accent);
}

.dt-simple-editor__toolbar-group--font-size {
    gap: 0.15rem;
}

.dt-simple-editor__btn--font-size {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dt-simple-editor__font-size-glyph {
    display: block;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
}

.dt-simple-editor__font-size-glyph--default {
    font-size: 0.68rem;
}

.dt-simple-editor__font-size-glyph--large {
    font-size: 1.02rem;
}

.dt-simple-editor__btn--font-size.is-active .dt-simple-editor__font-size-glyph {
    color: inherit;
}

.dt-simple-editor__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dt-simple-editor__color {
    flex-shrink: 0;
    width: 2.05rem;
    height: 2.05rem;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--dt-se-border);
    background: rgba(9, 9, 9, 0.88);
    cursor: pointer;
}

.dt-simple-editor__color::-webkit-color-swatch-wrapper {
    padding: 3px;
}

.dt-simple-editor__color::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.dt-simple-editor__color-preset {
    position: relative;
    flex-shrink: 0;
    width: 1.45rem;
    height: 2.05rem;
    padding: 0;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition:
        background 0.12s ease,
        border-color 0.12s ease;
}

.dt-simple-editor__color-preset::before {
    content: "";
    display: block;
    width: 0.95rem;
    height: 0.95rem;
    margin: 0 auto;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    background: var(--dt-se-preset-color);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.38);
}

.dt-simple-editor__color-preset:hover {
    background: rgba(51, 65, 85, 0.45);
    border-color: rgba(148, 163, 184, 0.25);
}

.dt-simple-editor__color-preset.is-active {
    background: rgba(127, 29, 29, 0.24);
    border-color: rgba(248, 113, 113, 0.46);
}

.dt-simple-editor__toolbar-field-label {
    flex-shrink: 0;
    padding-left: 0.15rem;
    padding-right: 0.1rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--dt-se-muted);
    line-height: 1;
}

.dt-simple-editor__toolbar-group--color {
    align-items: center;
}

.dt-simple-editor__host {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    background: var(--dt-se-body-bg);
}

.dt-simple-editor__status {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.45rem 0.95rem 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(5, 5, 5, 0.82);
    color: #94a3b8;
    font-size: 0.78rem;
}

.dt-simple-editor__status-label {
    font-weight: 600;
}

.dt-simple-editor__status-value {
    color: #e2e8f0;
    font-size: 0.83rem;
}

.dt-simple-editor__btn.is-copied {
    background: rgba(20, 83, 45, 0.48);
    border-color: rgba(74, 222, 128, 0.5);
    color: #dcfce7;
}

.darkthread-title-copy-field {
    position: relative;
}

.darkthread-title-copy-field .notice-admin-input {
    padding-right: 2.95rem;
}

.darkthread-title-copy-button {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.55rem;
    background: rgba(10, 10, 10, 0.92);
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.darkthread-title-copy-button:hover {
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(24, 24, 24, 0.95);
}

.darkthread-title-copy-button:focus-visible {
    outline: 2px solid rgba(248, 113, 113, 0.35);
    outline-offset: 1px;
}

.darkthread-title-copy-button.is-copied {
    border-color: rgba(74, 222, 128, 0.5);
    color: #dcfce7;
}

.dt-simple-editor__host .ProseMirror {
    box-sizing: border-box;
    width: var(--dt-se-reading-max-width);
    min-width: 0;
    max-width: 100%;
    margin: 0 auto;
    /* 빈 편집기도 입력 영역이 넉넉히 보이도록 — 내용이 늘면 그대로 확장 */
    min-height: clamp(15rem, 30vh, 24rem);
    padding: clamp(1rem, 2vw, 1.4rem) var(--dt-se-reading-inline-gutter) clamp(1.75rem, 2vw, 2.4rem);
    outline: none;
    color: var(--dt-se-text);
    line-height: var(--dt-se-reading-line-height);
    letter-spacing: var(--dt-se-reading-letter-spacing);
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Placeholder: 노드 데코레이션(is-editor-empty) — float 제거로 상단 레이아웃 간섭 방지 */
.dt-simple-editor__host .ProseMirror p.is-editor-empty:first-child {
    position: relative;
    min-height: 1.65em;
}

.dt-simple-editor__host .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    position: absolute;
    left: 0;
    top: 0;
    color: var(--dt-se-muted);
    pointer-events: none;
    font-weight: 400;
}

.dt-simple-editor__host .ProseMirror .darkthread-editor-image-box {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
}

.dt-simple-editor__host .ProseMirror .darkthread-editor-image-box > img {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

/* 리사이즈로 width/height 속성이 있으면 CSS height:auto 가 덮어쓰지 않도록 */
.dt-simple-editor__host.darkthread-tiptap-editor .ProseMirror img:not([height]) {
    height: auto;
}

/* 깨진 이미지도 리사이즈 기준 박스는 유지하고, 시각 표현만 플레이스홀더로 대체한다. */
.dt-simple-editor__host .ProseMirror img.darkthread-richtext-image-missing {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.dt-simple-editor__host .ProseMirror .darkthread-richtext-image-placeholder {
    display: flex;
    position: relative;
    z-index: 1;
    align-items: center;
    justify-content: center;
    width: min(100%, 560px);
    max-width: 100%;
    min-height: 180px;
    box-sizing: border-box;
    flex-shrink: 0;
    margin: 0;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: rgba(9, 9, 9, 0.6);
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.dt-simple-editor__host .ProseMirror .darkthread-richtext-image-placeholder[data-align='center'] {
    margin-left: auto;
    margin-right: auto;
}

.dt-simple-editor__host .ProseMirror .darkthread-richtext-image-placeholder[data-align='right'] {
    margin-left: auto;
    margin-right: 0;
}

.dt-simple-editor__host .ProseMirror .dt-youtube-node {
    display: block;
    width: min(100%, 560px);
    max-width: 100%;
    margin: calc(var(--dt-se-reading-paragraph-gap) * 0.95) auto 0;
    padding: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(3, 3, 3, 0.95);
    box-sizing: border-box;
}

.dt-simple-editor__host .ProseMirror .dt-youtube-node.ProseMirror-selectednode {
    outline: 2px solid rgba(248, 113, 113, 0.85);
    outline-offset: 3px;
}

.dt-simple-editor__host .ProseMirror .dt-youtube-node__toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.35rem;
}

.dt-simple-editor__host .ProseMirror .dt-youtube-node__drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(9, 9, 9, 0.9);
    color: #cbd5e1;
    cursor: grab;
}

.dt-simple-editor__host .ProseMirror .dt-youtube-node__drag-handle:active {
    cursor: grabbing;
}

.dt-simple-editor__host .ProseMirror .dt-youtube-node__iframe {
    width: 100%;
    max-width: 100%;
}

.dt-simple-editor__host .ProseMirror [data-resize-container] {
    display: block !important;
    position: relative;
    width: fit-content;
    max-width: 100%;
    clear: none;
    float: left;
    margin-top: calc(var(--dt-se-reading-paragraph-gap) * 0.95);
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0.75rem;
    box-sizing: border-box;
    text-align: left;
}

.dt-simple-editor__host .ProseMirror .darkthread-editor-image-box.is-dt-image-missing {
    overflow: hidden;
}

.dt-simple-editor__host .ProseMirror .darkthread-editor-image-box.is-dt-image-missing .darkthread-richtext-image-placeholder {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100%;
    min-height: 0 !important;
}

.dt-simple-editor__host .ProseMirror [data-resize-container].is-dt-image-missing {
    margin-right: 0;
}

.dt-simple-editor__host .ProseMirror [data-resize-wrapper].is-dt-image-missing {
    position: relative;
}

.dt-simple-editor__host .ProseMirror [data-resize-container]:has(img[data-align='center']) {
    float: none;
    clear: both;
    margin-left: auto;
    margin-right: auto;
}

.dt-simple-editor__host .ProseMirror [data-resize-container]:has(img[data-align='right']) {
    margin-left: auto;
    margin-right: 0;
    float: right;
}

.dt-simple-editor__host .ProseMirror [data-resize-wrapper] {
    display: block !important;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.dt-simple-editor__host .ProseMirror [data-resize-container] img {
    margin: 0;
}

/* After a floated image group, ensure the next non-image block starts below (prevent text wrapping). */
.dt-simple-editor__host .ProseMirror [data-resize-container] + :not([data-resize-container]) {
    clear: both;
}

.dt-simple-editor__host .ProseMirror [data-resize-container] + .dt-youtube-node {
    clear: both;
}

.dt-simple-editor__host .ProseMirror [data-resize-container].is-image-node-selected [data-resize-wrapper] {
    outline: 2px solid rgba(248, 113, 113, 0.85);
    outline-offset: 3px;
}

.dt-simple-editor__host.has-image-node-selection .ProseMirror {
    caret-color: transparent;
}

.dt-simple-editor__host .ProseMirror [data-resize-handle] {
    box-sizing: border-box;
    z-index: 2;
    border: none;
    border-radius: 0;
    background: transparent;
    pointer-events: auto;
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='top-left'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='top-right'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-left'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-right'] {
    width: 16px;
    height: 16px;
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='top-left'] {
    border-top: 3px solid rgba(248, 113, 113, 0.9);
    border-left: 3px solid rgba(248, 113, 113, 0.9);
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='top-right'] {
    border-top: 3px solid rgba(248, 113, 113, 0.9);
    border-right: 3px solid rgba(248, 113, 113, 0.9);
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-left'] {
    border-bottom: 3px solid rgba(248, 113, 113, 0.9);
    border-left: 3px solid rgba(248, 113, 113, 0.9);
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-right'] {
    border-bottom: 3px solid rgba(248, 113, 113, 0.9);
    border-right: 3px solid rgba(248, 113, 113, 0.9);
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='top-left'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-right'] {
    cursor: nwse-resize;
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='top-right'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-left'] {
    cursor: nesw-resize;
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='top'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='bottom'] {
    height: 10px;
    cursor: ns-resize;
}

.dt-simple-editor__host .ProseMirror [data-resize-handle='left'],
.dt-simple-editor__host .ProseMirror [data-resize-handle='right'] {
    width: 10px;
    cursor: ew-resize;
}

.content-frame:has(.dt-simple-editor) {
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: visible;
}

.darkthread-page-shell:has(.dt-simple-editor) {
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: visible;
}

.darkthread-tiptap-image-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.darkthread-tiptap-image-modal-backdrop[hidden] {
    display: none;
}

html.darkthread-tiptap-image-modal-open {
    overflow: hidden;
}

.darkthread-tiptap-image-modal {
    width: 100%;
    max-width: 22rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.85rem;
    background: rgba(9, 9, 9, 0.98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    padding: 1.1rem 1.15rem 1rem;
}

.darkthread-tiptap-image-modal-title {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.02em;
}

.darkthread-tiptap-image-modal-fields {
    display: grid;
    gap: 0.75rem;
}

.darkthread-tiptap-image-modal-ratio-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.15rem;
}

.darkthread-tiptap-image-modal-switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    user-select: none;
}

.darkthread-tiptap-image-modal-switch-text {
    flex: 1;
}

.darkthread-tiptap-image-modal-switch {
    position: relative;
    flex-shrink: 0;
    width: 2.65rem;
    height: 1.45rem;
}

.darkthread-tiptap-image-modal-switch-input {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.darkthread-tiptap-image-modal-switch::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(51, 65, 85, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.35);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.darkthread-tiptap-image-modal-switch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0.2rem;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: -0.525rem;
    border-radius: 50%;
    background: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background-color 0.18s ease;
    pointer-events: none;
    z-index: 1;
}

.darkthread-tiptap-image-modal-switch:has(.darkthread-tiptap-image-modal-switch-input:checked)::before {
    background: rgba(248, 113, 113, 0.35);
    border-color: rgba(248, 113, 113, 0.55);
}

.darkthread-tiptap-image-modal-switch:has(.darkthread-tiptap-image-modal-switch-input:checked)::after {
    transform: translateX(1.15rem);
    background: #f8fafc;
}

.darkthread-tiptap-image-modal-switch:has(.darkthread-tiptap-image-modal-switch-input:focus-visible)::before {
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.35);
}

.darkthread-tiptap-image-modal-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
}

.darkthread-tiptap-image-modal-input {
    box-sizing: border-box;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.55rem;
    background: rgba(0, 0, 0, 0.55);
    color: #e2e8f0;
    font-size: 0.9rem;
}

.darkthread-tiptap-image-modal-input:focus {
    outline: none;
    border-color: rgba(248, 113, 113, 0.55);
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
}

.darkthread-tiptap-image-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.darkthread-tiptap-image-modal-btn {
    min-height: 2.25rem;
    padding: 0 1rem;
    border-radius: 0.55rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
}

.darkthread-tiptap-image-modal-btn.is-secondary {
    border-color: rgba(148, 163, 184, 0.35);
    background: transparent;
    color: #cbd5e1;
}

.darkthread-tiptap-image-modal-btn.is-secondary:hover {
    background: rgba(51, 65, 85, 0.88);
    color: #f8fafc;
}

.darkthread-tiptap-image-modal-btn.is-primary {
    border-color: rgba(248, 113, 113, 0.65);
    background: #7f1d1d;
    color: #f8fafc;
}

.darkthread-tiptap-image-modal-btn.is-primary:hover {
    background: #1e40af;
}

/* 태블릿·좁은 창: 도구줄은 계속 한 줄 + 가로 스크롤, 버튼만 약간 확대 */
@media (max-width: 900px) {
    .dt-simple-editor {
        --dt-se-reading-max-width: 100%;
        --dt-se-reading-inline-gutter: clamp(0.9rem, 3vw, 1.25rem);
        --dt-se-reading-line-height: 1.78;
    }

    .dt-simple-editor__toolbar {
        flex-wrap: nowrap;
        padding: 0.4rem max(0.5rem, env(safe-area-inset-right)) 0.4rem
            max(0.5rem, env(safe-area-inset-left));
        overflow-x: auto;
        overflow-y: hidden;
    }

    .dt-simple-editor__btn,
    .dt-simple-editor__color {
        width: 2.4rem;
        height: 2.4rem;
        min-width: 2.4rem;
        min-height: 2.4rem;
        font-size: 0.88rem;
    }

    .dt-simple-editor__color-preset {
        width: 1.9rem;
        height: 2.4rem;
        min-width: 1.9rem;
        min-height: 2.4rem;
    }

    .dt-simple-editor__color-preset::before {
        width: 1.05rem;
        height: 1.05rem;
    }

    .dt-simple-editor__select {
        height: 2.4rem;
        min-height: 2.4rem;
    }

    .dt-simple-editor__host .ProseMirror {
        padding: 1.15rem max(1rem, 3vw) 1.45rem;
    }
}

/* 모바일·터치: iOS 줌 방지(본문 16px), 탭 타깃 확대 — 한 줄 가로 스크롤 + 스크롤 힌트 */
@media (max-width: 640px) {
    .dt-simple-editor {
        --dt-se-radius: 0;
        --dt-se-toolbar-h: 52px;
    }

    .dt-simple-editor__toolbar-scroll-hint {
        display: flex;
    }

    .dt-simple-editor__toolbar {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.2rem;
        padding: 0.45rem max(0.5rem, env(safe-area-inset-right)) 0.45rem
            max(0.5rem, env(safe-area-inset-left));
        overflow-x: auto;
        overflow-y: hidden;
        touch-action: pan-x;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .dt-simple-editor__toolbar::-webkit-scrollbar {
        display: none;
    }

    .dt-simple-editor__toolbar-pin-right,
    .dt-simple-editor--has-toolbar-overflow .dt-simple-editor__toolbar-pin-right {
        display: none;
    }

    .dt-simple-editor__toolbar-group--copy-inline,
    .dt-simple-editor--has-toolbar-overflow .dt-simple-editor__toolbar-group--copy-inline {
        display: inline-flex;
    }

    .dt-simple-editor--has-toolbar-overflow .dt-simple-editor__toolbar {
        padding-right: max(0.5rem, env(safe-area-inset-right));
    }

    .dt-simple-editor__btn,
    .dt-simple-editor__color {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 2.75rem;
        min-height: 2.75rem;
        touch-action: manipulation;
        font-size: 0.95rem;
    }

    .dt-simple-editor__font-size-glyph--default {
        font-size: 0.74rem;
    }

    .dt-simple-editor__font-size-glyph--large {
        font-size: 1.12rem;
    }

    .dt-simple-editor__color-preset {
        width: 2.15rem;
        height: 2.75rem;
        min-width: 2.15rem;
        min-height: 2.75rem;
        touch-action: manipulation;
    }

    .dt-simple-editor__color-preset::before {
        width: 1.15rem;
        height: 1.15rem;
    }

    .dt-simple-editor__select {
        height: 2.75rem;
        min-height: 2.75rem;
        min-width: 5.5rem;
        padding-right: 2rem;
        font-size: 16px;
    }

    .dt-simple-editor__toolbar-field-label {
        font-size: 0.72rem;
    }

    .dt-simple-editor__host .ProseMirror {
        min-height: clamp(13.5rem, 34dvh, 22rem);
        padding: 1rem max(0.85rem, env(safe-area-inset-right)) 1.35rem
            max(0.85rem, env(safe-area-inset-left));
    }

    .darkthread-tiptap-image-modal-backdrop {
        align-items: flex-end;
        justify-content: center;
        padding:
            max(0.75rem, env(safe-area-inset-top))
            max(0.75rem, env(safe-area-inset-right))
            max(1rem, env(safe-area-inset-bottom))
            max(0.75rem, env(safe-area-inset-left));
    }

    .darkthread-tiptap-image-modal {
        max-width: 100%;
        border-radius: 0.85rem 0.85rem 0 0;
        padding: 1rem 1rem 1.1rem;
    }
}

@media (max-width: 380px) {
    .dt-simple-editor__toolbar-group {
        padding-right: 0.35rem;
        margin-right: 0.25rem;
    }
}

@media (pointer: coarse) {
    .dt-simple-editor__host .ProseMirror [data-resize-handle='top-left'],
    .dt-simple-editor__host .ProseMirror [data-resize-handle='top-right'],
    .dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-left'],
    .dt-simple-editor__host .ProseMirror [data-resize-handle='bottom-right'] {
        width: 22px;
        height: 22px;
    }

    .dt-simple-editor__host .ProseMirror [data-resize-handle='top'],
    .dt-simple-editor__host .ProseMirror [data-resize-handle='bottom'] {
        height: 14px;
    }

    .dt-simple-editor__host .ProseMirror [data-resize-handle='left'],
    .dt-simple-editor__host .ProseMirror [data-resize-handle='right'] {
        width: 14px;
    }
}
