.kdl-theory-editor-toolbar {
  margin: 0 0 18px;
  border: 2px solid #111;
  border-radius: 14px;
  background: #fff9dd;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .08);
  overflow: hidden;
}

.kdl-editor-collapsed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 14px;
}

.kdl-editor-collapsed-head > strong {
  color: #111;
  font-size: 16px;
}

.kdl-editor-collapsed-head > button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.kdl-editor-collapsed-head > button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.kdl-editor-panel {
  padding: 14px;
  border-top: 1px solid #d9cf9a;
  background: #fffdf3;
}

.kdl-editor-panel[hidden] {
  display: none !important;
}

.kdl-editor-toolbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kdl-editor-toolbar-head > div:first-child {
  display: grid;
  gap: 4px;
}

.kdl-editor-toolbar-head strong {
  font-size: 17px;
  color: #111;
}

.kdl-editor-toolbar-head span[data-editor-status] {
  font-size: 13px;
  color: #555;
}

.kdl-editor-toolbar-head span[data-editor-status][data-state="dirty"],
.kdl-editor-toolbar-head span[data-editor-status][data-state="error"] {
  color: #b00020;
  font-weight: 700;
}

.kdl-editor-toolbar-head span[data-editor-status][data-state="saved"] {
  color: #0b6b2a;
  font-weight: 700;
}

.kdl-editor-selection-help {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff3bd;
  color: #4a3b00;
  font-size: 13px;
  line-height: 1.55;
}

.kdl-editor-main-actions,
.kdl-editor-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.kdl-editor-main-actions button,
.kdl-editor-tool,
.kdl-editor-color-control,
.kdl-editor-size-control {
  min-height: 38px;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font: inherit;
}

.kdl-editor-main-actions button,
.kdl-editor-tool {
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 700;
}

.kdl-editor-tool[data-editor-command="bold"] {
  border-color: #111;
  font-weight: 900;
}

.kdl-editor-main-actions button[data-editor-action="save"] {
  border-color: #111;
  background: #111;
  color: #fff;
}

.kdl-editor-main-actions button[data-editor-action="reset"] {
  border-color: #ba1a1a;
  color: #ba1a1a;
}

.kdl-editor-main-actions button:disabled,
.kdl-editor-tool:disabled,
.kdl-editor-color-control:has(input:disabled),
.kdl-editor-size-control:has(select:disabled) {
  opacity: .45;
  cursor: not-allowed;
}

.kdl-editor-tools {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d9cf9a;
}

.kdl-editor-color-control,
.kdl-editor-size-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
}

.kdl-editor-color-control input {
  width: 32px;
  height: 30px;
  padding: 0;
  border: 1px solid #aaa;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.kdl-editor-color-apply {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #777;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.kdl-editor-color-apply:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.kdl-editor-size-control select {
  min-height: 28px;
  border: 0;
  background: #fff;
  font: inherit;
}

.kdl-theory-editor-active #theoryCardTitle,
.kdl-theory-editor-active #theoryCardContent {
  outline: 3px solid #ffb300;
  outline-offset: 5px;
  cursor: text;
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  -webkit-touch-callout: default !important;
  touch-action: manipulation;
  caret-color: #111;
}

.kdl-theory-editor-active #theoryCardTitle *,
.kdl-theory-editor-active #theoryCardContent * {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  -webkit-user-drag: none !important;
}

.kdl-theory-editor-active #theoryCardTitle img,
.kdl-theory-editor-active #theoryCardContent img {
  pointer-events: none;
}

.kdl-theory-editor-active #theoryCardTitle {
  min-height: 1.5em;
}

.kdl-theory-editor-active #theoryCardContent {
  min-height: 120px;
}

.kdl-theory-editor-active #theoryCardTitle:focus,
.kdl-theory-editor-active #theoryCardContent:focus {
  outline-color: #d71920;
  background: #fffef5;
}

.kdl-theory-editor-active #theoryCardContent::selection,
.kdl-theory-editor-active #theoryCardContent *::selection,
.kdl-theory-editor-active #theoryCardTitle::selection,
.kdl-theory-editor-active #theoryCardTitle *::selection {
  background: #a8d4ff;
  color: #111;
}

.kdl-theory-editor-active .kdl-theory-card::before {
  content: "관리자 편집 중 · 글자를 드래그해 선택 · Ctrl+S 저장 · Esc 취소";
  display: block;
  margin: -4px 0 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 760px) {
  .kdl-editor-collapsed-head,
  .kdl-editor-toolbar-head {
    align-items: stretch;
    flex-direction: column;
  }

  .kdl-editor-collapsed-head > button,
  .kdl-editor-main-actions button {
    width: 100%;
    flex: 1 1 auto;
  }
}
