.ts-doc-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.ts-doc-title {
  font-size: 22px;
  font-weight: 700;
}
.ts-doc-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ts-doc-body {
  line-height: 1.8;
  font-size: 15px;
  max-width: 860px;
}
.ts-doc-body h1,
.ts-doc-body h2,
.ts-doc-body h3,
.ts-doc-body h4 {
  margin-top: 20px;
  margin-bottom: 10px;
}
.ts-doc-body p {
  margin: 0 0 10px;
}
.ts-doc-body ul,
.ts-doc-body ol {
  padding-left: 22px;
  margin-top: 6px;
  margin-bottom: 10px;
}
.ts-doc-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(15,23,42,0.9);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 13px;
}
.ts-doc-body pre {
  background: var(--code-bg);
  border-radius: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid rgba(30,64,175,0.85);
  box-shadow: 0 14px 30px rgba(15,23,42,0.7);
}
.ts-doc-body pre code {
  background: transparent;
  padding: 0;
}

.ts-doc-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
  border-radius: 12px;
  box-shadow: 0 18px 32px rgba(15,23,42,0.6);
}

.ts-toc-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.ts-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
}
.ts-toc-list li {
  margin-bottom: 4px;
}
.ts-toc-list a {
  color: var(--muted);
  text-decoration: none;
}
.ts-toc-list a:hover {
  color: var(--text);
}


.ts-btn.ts-danger {
  border: 1px solid rgba(248,113,113,0.8);
  background: rgba(127,29,29,0.9);
  color: #fee2e2;
}
.ts-btn.ts-danger:hover {
  background: rgba(220,38,38,1);
  color: #ffffff;
}


.ts-editor-wrapper {
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.6);
  background: #020617;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ts-editor-toolbar {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(51,65,85,0.9);
  background: linear-gradient(135deg, rgba(15,23,42,1), rgba(15,23,42,0.9));
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ts-editor-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ts-editor-btn {
  border: 1px solid rgba(148,163,184,0.4);
  background: rgba(15,23,42,1);
  color: #e5e7eb;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.ts-editor-btn:hover {
  background: rgba(30,64,175,0.9);
  border-color: rgba(129,140,248,0.9);
}
.ts-editor-select {
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,0.4);
  background:#020617;
  color:#e5e7eb;
  font-size:11px;
  padding:2px 6px;
}
.ts-editor-color {
  width: 24px;
  height: 20px;
  border-radius:4px;
  border:1px solid rgba(148,163,184,0.6);
  padding:0;
}
.ts-editor-area {
  padding: 10px 12px;
  min-height: 420px;
  max-height: 900px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}
.ts-editor-area:focus {
  outline: none;
}
.ts-editor-area table.ts-editor-table {
  border-collapse: collapse;
}
.ts-editor-area table.ts-editor-table td {
  border: 1px solid rgba(148,163,184,0.6);
  padding: 4px 6px;
}

/* KOEditor (Quill-based) */
.koeditor-wrapper{
  border-radius:12px;
  border:1px solid rgba(148,163,184,0.35);
  background:rgba(15,23,42,0.9);
  box-shadow:0 18px 40px rgba(15,23,42,0.9);
}
#koeditor-toolbar{
  border-bottom:1px solid rgba(148,163,184,0.35);
  padding:6px 8px;
  display:flex;
  flex-direction:column;
  gap:4px;
}
#koeditor-toolbar .ko-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:4px;
}
#koeditor-toolbar .ql-formats{
  margin:0;
}
#koeditor-toolbar .ql-picker,
#koeditor-toolbar .ql-picker-label,
#koeditor-toolbar .ql-picker-item,
#koeditor-toolbar .ql-toolbar button{
  color:var(--text);
}
#koeditor-area{
  min-height:480px;
}
.koeditor-area-dark .ql-editor{
  background:#020617;
  color:var(--text);
  font-family:Pretendard, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size:14px;
  line-height:1.7;
}
.koeditor-area-dark .ql-editor h1{
  font-size:24px;
  margin-top:18px;
  margin-bottom:10px;
  font-weight:700;
}
.koeditor-area-dark .ql-editor h2{
  font-size:20px;
  margin-top:16px;
  margin-bottom:8px;
  font-weight:600;
}
.koeditor-area-dark .ql-editor h3{
  font-size:18px;
  margin-top:14px;
  margin-bottom:6px;
  font-weight:600;
}
.koeditor-area-dark .ql-editor blockquote{
  border-left:3px solid rgba(148,163,184,0.8);
  margin:8px 0;
  padding:6px 10px;
  color:var(--muted);
  background:rgba(15,23,42,0.9);
}
.koeditor-area-dark .ql-editor code,
.koeditor-area-dark .ql-editor pre{
  font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  background:rgba(15,23,42,0.95);
  border-radius:6px;
  padding:2px 4px;
}
.koeditor-area-dark .ql-editor pre{
  padding:8px 10px;
}
.koeditor-table{
  width:100%;
  border-collapse:collapse;
  margin:10px 0;
  font-size:13px;
}
.koeditor-table td,
.koeditor-table th{
  border:1px solid rgba(148,163,184,0.6);
  padding:6px 8px;
}
.koeditor-hr{
  border:0;
  border-top:1px solid rgba(148,163,184,0.65);
  margin:16px 0;
}


/* KOEditor v3 — HTML 모드 & 스위치 */
#koeditor-html {
  width: 100%;
  min-height: 480px;
  padding: 14px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,0.35);
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  border-radius: 8px;
  white-space: pre;
  outline: none;
  margin-top: 6px;
}
.ko-switch {
  border: 1px solid rgba(148,163,184,0.35);
  background: rgba(30,41,59,0.8);
  color: #e5e7eb;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}
.ko-switch.active {
  background: rgba(59,130,246,0.9);
  border-color: rgba(147,197,253,0.7);
  color: #ffffff;
}
.ko-custom {
  border: 1px solid rgba(148,163,184,0.35);
  background: rgba(30,41,59,0.8);
  color: #e5e7eb;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}
.ko-custom:hover {
  background: rgba(56,189,248,0.25);
}
.ql-picker.ql-expanded .ql-picker-options {
  background: #0f172a !important;
  border: 1px solid rgba(148,163,184,0.35) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}
.ql-picker-options .ql-picker-item {
  color: #e5e7eb !important;
}
.ql-picker-options .ql-picker-item:hover {
  background: rgba(255,255,255,0.08) !important;
  color: #ffffff !important;
}
.ql-picker-label {
  color: #e5e7eb !important;
}
.ql-picker-label:hover {
  color: #ffffff !important;
}
.ql-toolbar button {
  color: #cbd5e1 !important;
}
.ql-toolbar button:hover,
.ql-toolbar button.ql-active {
  background: rgba(255,255,255,0.05) !important;
  color: #ffffff !important;
}

/* KOEditor — mode bar above toolbar */
.ko-modebar{
  display:flex;
  gap:8px;
  align-items:center;
  padding:6px 8px;
  border-bottom:1px solid rgba(30,64,175,0.8);
  background:linear-gradient(135deg,rgba(15,23,42,0.98),rgba(17,24,39,0.96));
}
.ko-modebar .ko-switch{
  margin-right:4px;
}

/* Ensure HTML editor takes full height */
#koeditor-html{
  width:100%;
  min-height:480px;
  height:480px;
  padding:14px;
  background:#0f172a;
  color:#e2e8f0;
  border:1px solid rgba(148,163,184,0.35);
  font-family:SFMono-Regular,Menlo,Consolas,monospace;
  font-size:14px;
  border-radius:0 0 12px 12px;
  white-space:pre;
  outline:none;
  display:none;
  box-sizing:border-box;
}
