:root {
  --page: #f4f2ec;
  --ink: #24262d;
  --muted: #6f756f;
  --panel: #ffffff;
  --line: #ded8cb;
  --accent: #2f7d68;
  --accent-strong: #1f5f50;
  --note: #fff7cc;
  --note-text: #24262d;
  --tab-color: #2f7d68;
  --memo-width: 720px;
  --memo-height: 780px;
  --memo-font-size: 17px;
  --editor-top-space: 18px;
  --toolbar-top: 63px;
  --native-edge-width: 120px;
  --native-mole-hit-width: 64px;
  --native-card-y-margin: 16px;
  --tag-deco-art-width: 74px;
  --tag-deco-scale: 0.58;
  --tag-deco-right-hidden-x: 42px;
  --tag-deco-left-hidden-x: -42px;
  --tag-deco-top-hidden-y: -42px;
  --tag-deco-bottom-hidden-y: 42px;
  --tag-deco-right-hand-x: -1px;
  --tag-deco-left-hand-x: 1px;
  --tag-deco-top-hand-y: 1px;
  --tag-deco-bottom-hand-y: -1px;
  --tag-deco-right-hand-y: calc(-50% - 6px);
  --tag-deco-left-hand-y: calc(-50% - 6px);
  --tag-deco-top-hand-x: calc(-50% - 6px);
  --tag-deco-bottom-hand-x: calc(-50% + 6px);
  --app-font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--app-font-family);
  background:
    linear-gradient(120deg, rgba(47, 125, 104, 0.1), transparent 32%),
    linear-gradient(300deg, rgba(169, 91, 63, 0.1), transparent 35%),
    var(--page);
}

.is-native-app body {
  min-height: 100vh;
  background: transparent;
}

button,
input,
select,
textarea,
[contenteditable="true"] {
  font: inherit;
}

.workspace {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(28px, 6vw, 76px);
}

.is-native-app .workspace {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100% !important;
  min-height: 100% !important;
  padding: 0;
  overflow: hidden !important;
}

.is-native-app .intro {
  display: none;
}

.is-native-app .memo-shell {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: flex-start !important;
  z-index: 1;
  overflow: hidden;
  transform: translate3d(0, 0, 0) !important;
}

.is-native-app .memo-shell.is-peeking-tags:not(.is-open) .edge-tab.has-mole:hover .mole-art,
.is-native-app .memo-shell.is-peeking-tags:not(.is-open) .edge-tab.has-mole:hover .tab-label {
  transition-delay: calc(var(--tab-index, 0) * 45ms);
}

/* 마우스가 오버된 바로 그 해당 탭은 딜레이 없이 즉각 반응하게 하여, 마우스를 스쳐 지나갈 때 양옆 태그들이 뒤늦게 튀어나오는 현상을 완벽 차단 */
.is-native-app .memo-shell.is-peeking-tags:not(.is-open) .edge-tab.has-mole:hover .mole-art,
.is-native-app .memo-shell.is-peeking-tags:not(.is-open) .edge-tab.has-mole:hover .tab-label {
  transition-delay: 0s !important;
}

.is-native-app .memo-shell.is-peeking-tags:not(.is-open).dock-right .edge-tab.has-mole:hover .mole-art {
  transform: translate(var(--mole-main), var(--mole-cross)) scale(var(--tag-deco-scale)) !important;
}

.is-native-app .memo-shell.is-peeking-tags:not(.is-open).dock-right .edge-tab.has-mole:hover .tab-label {
  opacity: 1;
  transform: translate(var(--tag-main), -50%) !important;
}

.is-native-app .memo-shell.is-peeking-tags:not(.is-open).dock-left .edge-tab.has-mole:hover .mole-art {
  transform: translate(var(--mole-main), var(--mole-cross)) scaleX(-1) scale(var(--tag-deco-scale)) !important;
}

.is-native-app .memo-shell.is-peeking-tags:not(.is-open).dock-left .edge-tab.has-mole:hover .tab-label {
  opacity: 1;
  transform: translate(var(--tag-main), -50%) !important;
}

/* Electron 창은 화면 끝에 붙고, CSS로 직접 위치를 애니메이션합니다. */
.is-native-app .memo-shell {
  display: block !important;
}

/* ALL DOCKS COMMON */
.is-native-app .edge-tabs {
  position: absolute !important;
  transition: none !important;
  z-index: 20 !important;
  display: flex !important;
}

.is-native-app .dock-right .edge-tab.has-mole,
.is-native-app .dock-left .edge-tab.has-mole {
  width: var(--native-mole-hit-width) !important;
  min-height: 96px !important;
}

.is-native-app .memo-card {
  position: absolute !important;
  width: var(--memo-width) !important;
  height: var(--memo-height) !important;
  box-shadow: 0 4px 24px rgba(36, 38, 45, 0.15), 0 1px 3px rgba(36, 38, 45, 0.1) !important;
  transition: right 220ms ease, left 220ms ease, top 220ms ease, bottom 220ms ease, opacity 200ms ease !important;
  opacity: 0 !important;
  pointer-events: none;
  z-index: 10 !important;
  will-change: right, left, top, bottom, opacity;
}

.is-native-app .memo-shell.is-open .memo-card {
  opacity: 1 !important;
  pointer-events: auto;
}

.is-native-app .memo-shell.is-resizing .memo-card {
  transition: none !important;
}

/* DOCK RIGHT */
.is-native-app .dock-right .edge-tabs {
  right: 0 !important;
  left: auto !important;
  top: 0 !important;
  bottom: 0 !important;
  width: var(--native-edge-width) !important;
  height: max-content !important;
  max-height: var(--memo-height) !important;
  /* 상시 메모장 카드 높이만큼만 묶어두어 여닫을 때 세로가 고무줄처럼 늘어나는 버그 제거 */
  margin: auto 0 !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: flex-end !important;
  transform: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: none !important;
}

.is-native-app .dock-right.is-open .edge-tabs {
  right: var(--memo-width) !important;
  margin-right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  max-height: var(--memo-height) !important;
  margin: auto 0 !important;
}

.is-native-app .dock-right .memo-card {
  right: calc(-1 * var(--memo-width)) !important;
  top: 0 !important;
  bottom: 0 !important;
  margin: auto 0 !important;
}

.is-native-app .dock-right.is-open .memo-card {
  right: 0 !important;
  margin-right: 0 !important;
}

/* DOCK LEFT */
.is-native-app .dock-left .edge-tabs {
  left: 0 !important;
  right: auto !important;
  top: 0 !important;
  bottom: 0 !important;
  width: var(--native-edge-width) !important;
  height: max-content !important;
  max-height: var(--memo-height) !important;
  /* 상시 메모장 카드 높이로 세로 최대 한계 고정 */
  margin: auto 0 !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  transform: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: none !important;
}

.is-native-app .dock-left.is-open .edge-tabs {
  left: var(--memo-width) !important;
  margin-left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  max-height: var(--memo-height) !important;
  margin: auto 0 !important;
}

.is-native-app .dock-left .memo-card {
  left: calc(-1 * var(--memo-width)) !important;
  top: 0 !important;
  bottom: 0 !important;
  margin: auto 0 !important;
}

.is-native-app .dock-left.is-open .memo-card {
  left: 0 !important;
  margin-left: 0 !important;
}

/* DOCK TOP */
.is-native-app .dock-top .edge-tabs {
  top: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  right: 0 !important;
  width: max-content !important;
  max-width: calc(100vw - 32px) !important;
  margin: 0 auto !important;
  height: var(--native-edge-width) !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  transform: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
}

.is-native-app .dock-top.is-open .edge-tabs {
  top: var(--memo-height) !important;
}

.is-native-app .dock-top .memo-card {
  top: calc(-1 * var(--memo-height)) !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 auto !important;
}

.is-native-app .dock-top.is-open .memo-card {
  top: 0 !important;
}

/* DOCK BOTTOM */
.is-native-app .dock-bottom .edge-tabs {
  bottom: 0 !important;
  top: auto !important;
  left: 0 !important;
  right: 0 !important;
  width: max-content !important;
  max-width: calc(100vw - 32px) !important;
  margin: 0 auto !important;
  height: var(--native-edge-width) !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: flex-end !important;
  transform: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
}

.is-native-app .dock-bottom.is-open .edge-tabs {
  bottom: var(--memo-height) !important;
}

.is-native-app .dock-bottom .memo-card {
  bottom: calc(-1 * var(--memo-height)) !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 auto !important;
}

.is-native-app .dock-bottom.is-open .memo-card {
  bottom: 0 !important;
}

.intro {
  display: none;
}

.is-native-app .memo-shell {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  z-index: 1;
  overflow: hidden;
  transform: translate3d(0, 0, 0) !important;
}

/* 중복된 peeking-tags 스타일을 깨끗하게 정리 및 삭제합니다. */

/* Electron 창은 화면 끝에 붙고, CSS는 창 내부의 태그 레일만 고정합니다. */
.is-native-app .dock-right {
  right: 0;
  left: auto;
  flex-direction: row-reverse !important;
  justify-content: flex-start !important;
}

.is-native-app .dock-left {
  left: 0;
  right: auto;
  flex-direction: row !important;
  justify-content: flex-start !important;
}

.is-native-app .memo-card {
  width: var(--memo-width) !important;
  height: var(--memo-height) !important;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(36, 38, 45, 0.15), 0 1px 3px rgba(36, 38, 45, 0.1) !important;
  transition: opacity 200ms ease !important;
  opacity: 1;
  will-change: opacity;
}

/* 닫혀 있을 때 memo-card는 보이지 않게 처리합니다 */
.is-native-app .memo-shell:not(.is-open) .memo-card {
  opacity: 0 !important;
  pointer-events: none;
}


@keyframes mole-slide-in-right {
  from {
    transform: translateX(calc(var(--memo-width) + 40px));
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes mole-slide-in-left {
  from {
    transform: translateX(calc(-1 * var(--memo-width) - 40px));
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 네이티브 앱에서 닫혀 있을 때 마우스 오버 시 두더지가 귀엽게 쏙 튀어나오도록 위치 변경 (peeking-tags의 !important를 덮어씀) */
.is-native-app .memo-shell.dock-right:not(.is-open) .has-mole:hover .mole-art {
  transform: translate(var(--mole-main), var(--mole-cross)) scale(var(--tag-deco-scale)) !important;
}

.is-native-app .memo-shell.dock-left:not(.is-open) .has-mole:hover .mole-art {
  transform: translate(var(--mole-main), var(--mole-cross)) scaleX(-1) scale(var(--tag-deco-scale)) !important;
}

.is-native-app .memo-shell.dock-top:not(.is-open) .has-mole:hover .mole-art {
  transform: translate(var(--tag-deco-top-hand-x), var(--mole-main)) rotate(-90deg) scale(var(--tag-deco-scale)) !important;
}

.is-native-app .memo-shell.dock-bottom:not(.is-open) .has-mole:hover .mole-art {
  transform: translate(var(--tag-deco-bottom-hand-x), var(--mole-main)) rotate(90deg) scale(var(--tag-deco-scale)) !important;
}


.intro {
  max-width: 560px;
  padding-top: 8vh;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 0.98;
}

.intro p:last-child {
  max-width: 430px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.memo-shell {
  position: fixed;
  z-index: 10;
  transition: transform 220ms ease;
}

.dock-right {
  top: 50%;
  right: 0;
  transform: translateY(-50%) translateX(100%);
}

.dock-right.is-open {
  transform: translateY(-50%) translateX(0);
}

.dock-left {
  top: 50%;
  left: 0;
  transform: translateY(-50%) translateX(-100%);
}

.dock-left.is-open {
  transform: translateY(-50%) translateX(0);
}

.dock-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
}

.dock-top.is-open {
  transform: translateX(-50%) translateY(0);
}

.dock-bottom {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
}

.dock-bottom.is-open {
  transform: translateX(-50%) translateY(0);
}

.edge-tabs {
  position: absolute;
  z-index: 7;
  display: flex;
  gap: 8px;
  max-height: calc(min(var(--memo-height), calc(100vh - 32px)) - 28px);
  overflow-y: auto;
  overflow-x: visible;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.edge-tabs::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.edge-tab {
  position: relative;
  width: 22px;
  min-height: 88px;
  max-height: min(72vh, 420px);
  padding: 0;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: var(--tab-color);
  color: #fff;
  cursor: pointer;
  touch-action: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.72;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  outline: none;
}

.edge-tab:focus,
.edge-tab:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.edge-tab.is-dragging {
  z-index: 20;
  opacity: 0.96;
  transform: scale(1.04);
}

.tab-label {
  position: relative;
  z-index: 2;
  display: block;
  max-height: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edge-tab.has-mole {
  --tag-main: 0px;
  --mole-offset: var(--tag-deco-right-hand-x);
  --mole-main: calc(var(--tag-main) + var(--mole-offset));
  --mole-cross: var(--tag-deco-right-hand-y);
  width: 34px;
  min-height: 34px;
  overflow: visible;
  border-radius: 999px;
  background: transparent !important;
  opacity: 0.64;
}

.edge-tabs:has(.has-mole) {
  width: 120px;
}

.edge-tab.has-mole:hover,
.edge-tab.has-mole.is-active {
  opacity: 1;
}

.edge-tab.has-mole .tab-label {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 24px;
  min-height: 96px;
  height: max-content;
  max-height: min(72vh, 420px);
  padding: 8px 0;
  border-radius: 10px 0 0 10px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    opacity 160ms ease,
    transform 180ms ease;
}

.mole-face {
  position: absolute;
  z-index: 3;
  width: 58px;
  height: 68px;
  border-radius: 54% 48% 48% 52%;
  background:
    radial-gradient(circle at 50% 47%, #f1d097 0 13%, transparent 14%),
    radial-gradient(ellipse at 62% 68%, #a97861 0 25%, transparent 26%),
    #8a5a3c;
  opacity: 0;
  box-shadow:
    inset -8px -5px 0 rgba(68, 38, 31, 0.12),
    0 8px 18px rgba(36, 38, 45, 0.2);
  transition:
    opacity 160ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.mole-face::before,
.mole-face::after {
  content: "";
  position: absolute;
  top: 18px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0 18%, transparent 19%),
    #2c1c18;
  box-shadow: 0 19px 0 -3px #5a332a;
}

.mole-face::before {
  left: 10px;
}

.mole-face::after {
  right: 10px;
}

.has-mole .mole-face {
  opacity: 1;
}

.edge-tab.has-mole::before,
.edge-tab.has-mole::after {
  content: "";
  position: absolute;
  z-index: 5;
  width: 17px;
  height: 15px;
  border-radius: 45% 45% 50% 50%;
  background:
    linear-gradient(90deg, transparent 18%, #6f452f 19% 25%, transparent 26% 36%, #6f452f 37% 43%, transparent 44% 54%, #6f452f 55% 61%, transparent 62%),
    #f1d097;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 180ms ease;
}

.edge-tab.has-mole:hover::before,
.edge-tab.has-mole:hover::after {
  opacity: 1;
}

.dock-right .has-mole .mole-face {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.dock-right .has-mole:hover .mole-face {
  transform: translate(-126%, -50%) rotate(-2deg);
}

.dock-right .has-mole .tab-label {
  right: 26px;
  top: 50%;
  transform: translate(30px, -50%);
}

.dock-right .has-mole:hover .tab-label {
  opacity: 1;
  transform: translate(0, -50%);
}

.dock-right .edge-tab.has-mole::before,
.dock-right .edge-tab.has-mole::after {
  left: -13px;
  top: calc(50% - 24px);
  transform: translate(18px, 0) rotate(90deg);
}

.dock-right .edge-tab.has-mole::after {
  top: calc(50% + 12px);
  transform: translate(18px, 0) rotate(90deg);
}

.dock-right .edge-tab.has-mole:hover::before {
  transform: translate(-28px, 0) rotate(90deg);
}

.dock-right .edge-tab.has-mole:hover::after {
  transform: translate(-28px, 0) rotate(90deg);
}

.dock-left .has-mole .mole-face {
  right: 50%;
  top: 50%;
  transform: translate(50%, -50%);
}

.dock-left .has-mole:hover .mole-face {
  transform: translate(126%, -50%) rotate(2deg);
}

.dock-left .has-mole .tab-label {
  left: 26px;
  top: 50%;
  border-radius: 0 8px 8px 0;
  transform: translate(-30px, -50%);
}

.dock-left .has-mole:hover .tab-label {
  opacity: 1;
  transform: translate(0, -50%);
}

.dock-left .edge-tab.has-mole::before,
.dock-left .edge-tab.has-mole::after {
  right: -13px;
  top: calc(50% - 24px);
  transform: translate(-18px, 0) rotate(-90deg);
}

.dock-left .edge-tab.has-mole::after {
  top: calc(50% + 12px);
  transform: translate(-18px, 0) rotate(-90deg);
}

.dock-left .edge-tab.has-mole:hover::before {
  transform: translate(28px, 0) rotate(-90deg);
}

.dock-left .edge-tab.has-mole:hover::after {
  transform: translate(28px, 0) rotate(-90deg);
}

.dock-top .has-mole .mole-face {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.dock-top .has-mole:hover .mole-face {
  transform: translate(-50%, 118%) rotate(2deg);
}

.dock-top .has-mole .tab-label,
.dock-bottom .has-mole .tab-label {
  width: 108px;
  min-height: 28px;
  padding: 0 8px;
  writing-mode: horizontal-tb;
}

.dock-top .has-mole .tab-label {
  left: 50%;
  bottom: 26px;
  border-radius: 0 0 8px 8px;
  transform: translate(-50%, 30px);
}

.dock-top .has-mole:hover .tab-label {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dock-top .edge-tab.has-mole::before,
.dock-top .edge-tab.has-mole::after {
  left: calc(50% - 24px);
  bottom: -13px;
  transform: translate(0, -18px);
}

.dock-top .edge-tab.has-mole::after {
  left: calc(50% + 12px);
  transform: translate(0, -18px);
}

.dock-top .edge-tab.has-mole:hover::before {
  transform: translate(0, 28px);
}

.dock-top .edge-tab.has-mole:hover::after {
  transform: translate(0, 28px);
}

.dock-bottom .has-mole .mole-face {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.dock-bottom .has-mole:hover .mole-face {
  transform: translate(-50%, -118%) rotate(-2deg);
}

.dock-bottom .has-mole .tab-label {
  left: 50%;
  top: 26px;
  border-radius: 8px 8px 0 0;
  transform: translate(-50%, -30px);
}

.dock-bottom .has-mole:hover .tab-label {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dock-bottom .edge-tab.has-mole::before,
.dock-bottom .edge-tab.has-mole::after {
  left: calc(50% - 24px);
  top: -13px;
  transform: translate(0, 18px) rotate(180deg);
}

.dock-bottom .edge-tab.has-mole::after {
  left: calc(50% + 12px);
  transform: translate(0, 18px) rotate(180deg);
}

.dock-bottom .edge-tab.has-mole:hover::before {
  transform: translate(0, -28px) rotate(180deg);
}

.dock-bottom .edge-tab.has-mole:hover::after {
  transform: translate(0, -28px) rotate(180deg);
}

.edge-tab.is-active {
  opacity: 1;
}

.edge-tab.has-mole::before,
.edge-tab.has-mole::after {
  display: none;
}

.tag-decoration-art,
.mole-art {
  position: absolute;
  z-index: 5;
  width: var(--tag-deco-art-width);
  height: auto;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(36, 38, 45, 0.18));
  transition: transform 180ms ease;
}

.edge-tab.has-mole .tag-decoration-art,
.edge-tab.has-mole .mole-art {
  display: block;
}

.edge-tab.has-mole .mole-face {
  display: none;
}

.edge-tab.has-mole .tab-label {
  z-index: 4;
  opacity: 0;
  box-shadow: 0 8px 18px rgba(36, 38, 45, 0.18);
}

.dock-right .has-mole .mole-art {
  right: 0;
  top: 50%;
  transform: translate(var(--tag-deco-right-hidden-x), -50%) scale(var(--tag-deco-scale));
}

.dock-right .has-mole:hover .mole-art,
.dock-right.is-open .has-mole .mole-art {
  transform: translate(var(--mole-main), var(--mole-cross)) scale(var(--tag-deco-scale));
}

.dock-right .has-mole .tab-label {
  right: 0;
  top: 50%;
  transform: translate(18px, -50%);
}

.dock-right .has-mole:hover .tab-label,
.dock-right.is-open .has-mole .tab-label {
  opacity: 1;
  transform: translate(var(--tag-main), -50%);
}

.dock-left .has-mole {
  --mole-offset: var(--tag-deco-left-hand-x);
  --mole-cross: var(--tag-deco-left-hand-y);
}

.dock-left .has-mole .mole-art {
  left: 0;
  top: 50%;
  transform: translate(var(--tag-deco-left-hidden-x), -50%) scaleX(-1) scale(var(--tag-deco-scale));
}

.dock-left .has-mole:hover .mole-art,
.dock-left.is-open .has-mole .mole-art {
  transform: translate(var(--mole-main), var(--mole-cross)) scaleX(-1) scale(var(--tag-deco-scale));
}

.dock-left .has-mole .tab-label {
  left: 0;
  top: 50%;
  border-radius: 0 10px 10px 0;
  transform: translate(-18px, -50%);
}

.dock-left .has-mole:hover .tab-label,
.dock-left.is-open .has-mole .tab-label {
  opacity: 1;
  transform: translate(var(--tag-main), -50%);
}

.dock-top .has-mole {
  --mole-offset: var(--tag-deco-top-hand-y);
}

.dock-top .has-mole .mole-art {
  left: 50%;
  bottom: 0;
  transform: translate(-50%, var(--tag-deco-top-hidden-y)) rotate(-90deg) scale(var(--tag-deco-scale));
}

.dock-top .has-mole:hover .mole-art,
.dock-top.is-open .has-mole .mole-art {
  transform: translate(var(--tag-deco-top-hand-x), var(--mole-main)) rotate(-90deg) scale(var(--tag-deco-scale));
}

.dock-top .has-mole .tab-label {
  left: 50%;
  bottom: 0;
  transform: translate(-50%, -18px);
}

.dock-top .has-mole:hover .tab-label,
.dock-top.is-open .has-mole .tab-label {
  opacity: 1;
  transform: translate(-50%, var(--tag-main));
}

.dock-bottom .has-mole {
  --mole-offset: var(--tag-deco-bottom-hand-y);
}

.dock-bottom .has-mole .mole-art {
  left: 50%;
  top: 0;
  transform: translate(-50%, var(--tag-deco-bottom-hidden-y)) rotate(90deg) scale(var(--tag-deco-scale));
}

.dock-bottom .has-mole:hover .mole-art,
.dock-bottom.is-open .has-mole .mole-art {
  transform: translate(var(--tag-deco-bottom-hand-x), var(--mole-main)) rotate(90deg) scale(var(--tag-deco-scale));
}

.dock-bottom .has-mole .tab-label {
  left: 50%;
  top: 0;
  transform: translate(-50%, 18px);
}

.dock-bottom .has-mole:hover .tab-label,
.dock-bottom.is-open .has-mole .tab-label {
  opacity: 1;
  transform: translate(-50%, var(--tag-main));
}

.dock-right .edge-tabs {
  left: 0;
  top: 0;
  bottom: 0;
  height: max-content;
  margin: auto 0;
  flex-direction: column;
  align-items: flex-end;
  padding: 14px 0;
  transform: translateX(-100%);
  overflow-y: auto;
  overflow-x: hidden;
}

.dock-left .edge-tabs {
  right: 0;
  top: 0;
  bottom: 0;
  height: max-content;
  margin: auto 0;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 0;
  transform: translateX(100%);
  overflow-y: auto;
  overflow-x: hidden;
}

.dock-left .edge-tab {
  border-radius: 0 8px 8px 0;
}

.dock-right .edge-tab,
.dock-left .edge-tab {
  text-orientation: upright;
}

.dock-right .edge-tab.has-mole .tab-label,
.dock-left .edge-tab.has-mole .tab-label {
  text-orientation: upright;
}

.dock-right .edge-tab.has-mole,
.dock-left .edge-tab.has-mole {
  min-height: 96px;
}

.dock-top .edge-tabs,
.dock-bottom .edge-tabs {
  flex-direction: row;
}

.dock-top .edge-tabs {
  left: 0;
  right: 0;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  bottom: 0;
  transform: translateY(100%);
  overflow-x: auto;
  overflow-y: hidden;
}

.dock-bottom .edge-tabs {
  left: 0;
  right: 0;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  top: 0;
  transform: translateY(-100%);
  overflow-x: auto;
  overflow-y: hidden;
}

.dock-top .edge-tab,
.dock-bottom .edge-tab {
  width: 88px;
  min-height: 22px;
  border-radius: 0 0 8px 8px;
  writing-mode: horizontal-tb;
}

.dock-bottom .edge-tab {
  border-radius: 8px 8px 0 0;
}

.dock-top .edge-tab.has-mole,
.dock-bottom .edge-tab.has-mole {
  width: 108px;
  min-height: 34px;
}

.memo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(var(--memo-width), calc(100vw - 56px));
  height: min(var(--memo-height), calc(100vh - 32px));
  min-width: 420px;
  min-height: 420px;
  overflow: hidden !important;
  border: 1px solid rgba(36, 38, 45, 0.12);
  border-radius: 8px;
  background: var(--note);
  box-shadow: 0 22px 70px rgba(36, 38, 45, 0.22);
}

.dock-top .memo-card,
.dock-bottom .memo-card {
  width: min(var(--memo-width), calc(100vw - 56px));
  height: min(var(--memo-height), calc(100vh - 32px));
}

.memo-header,
.memo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  flex-shrink: 0;
}

.memo-header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.memo-header strong {
  display: block;
  min-width: 48px;
  max-width: 220px;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  font-size: 15px;
  outline: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-header strong.is-editing {
  border-bottom-color: var(--accent);
  color: var(--accent-strong);
  cursor: text;
  text-overflow: clip;
}

.title-area {
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.title-edit {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  outline: none;
}

.title-edit.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.memo-header small {
  color: var(--muted);
  font-size: 12px;
}

.memo-header small.is-credit-egg {
  color: var(--accent-strong);
  animation: creditPeek 620ms ease-out;
}

@keyframes creditPeek {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }

  48% {
    opacity: 1;
    transform: translateY(-1px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.settings-button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  outline: none;
}

.title-edit:hover,
.icon-button:hover,
.settings-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 125, 104, 0.15);
}

.title-edit:focus-visible,
.icon-button:focus-visible,
.settings-button:focus-visible {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.25);
}

.title-edit.is-active:hover,
.icon-button.is-active:hover,
.settings-button[aria-expanded="true"]:hover {
  box-shadow: 0 0 0 2px rgba(47, 125, 104, 0.25);
}

.icon-button {
  width: 34px;
  font-size: 21px;
  line-height: 1;
}

.pin-button,
.undo-button {
  display: inline-grid;
  place-items: center;
}

.undo-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pin-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transform: rotate(-28deg);
}

.icon-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.settings-button {
  width: 34px;
  padding: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.settings-button:hover {
  transform: rotate(45deg);
}

.settings-button[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.switch input {
  accent-color: var(--accent);
  cursor: pointer;
}

.favorite-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  background: #fffdf6;
  flex-shrink: 0;
}

.favorite-bar[hidden] {
  display: none;
}

.favorite-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.favorite-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.favorite-item button,
.favorite-item input,
.favorite-item select {
  height: 21px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.favorite-item button {
  min-width: 24px;
  padding: 0 6px;
  cursor: pointer;
  font-weight: 800;
}

.favorite-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.favorite-item input[type="search"] {
  width: 90px;
  padding: 0 6px;
}

.favorite-item input[type="number"] {
  width: 48px;
  padding: 0 4px;
  text-align: center;
}

.favorite-size input[type="number"] {
  width: 54px;
}

.favorite-item input[type="color"] {
  width: 24px;
  padding: 1px;
}

.favorite-item select {
  max-width: 70px;
  padding: 0 4px;
}

.favorite-shortcut input[type="text"] {
  width: 86px;
  padding: 0 6px;
}

.favorite-underline-button {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.favorite-bold-button {
  font-weight: 800;
}

.favorite-highlight-button {
  background: linear-gradient(180deg, #fff 0 52%, var(--highlight-color, #ffe066) 52% 100%) !important;
}



.toolbar {
  position: absolute;
  top: var(--toolbar-top);
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 5px;
  overflow: visible;
  min-height: 74px;
  padding: 5px 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
  box-shadow: 0 8px 24px rgba(36, 38, 45, 0.1);
  flex-shrink: 0;
}

.toolbar[hidden] {
  display: none;
}

.ribbon-group {
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 72px;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: grab;
  transition:
    box-shadow 160ms ease,
    transform 160ms ease;
  user-select: none;
}

.favorite-toggle {
  width: 13px !important;
  min-width: 13px !important;
  height: 13px !important;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #b1a278;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.favorite-toggle.is-active {
  color: #d19b19;
}

.ribbon-group:active {
  cursor: grabbing;
}

.ribbon-group.is-dragging {
  z-index: 5;
  opacity: 0.82;
  box-shadow: 0 8px 20px rgba(36, 38, 45, 0.15);
}

.ribbon-group.is-drop-target {
  border-color: var(--accent);
}

.ribbon-group input,
.ribbon-group select,
.ribbon-group label {
  cursor: auto;
  user-select: auto;
}

.ribbon-group:first-child {
  padding-left: 6px;
}

.ribbon-group:last-child {
  padding-right: 6px;
}

.ribbon-group legend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.search-group,
.memo-group,
.mole-group,
.format-group,
.shortcut-group {
  min-width: 78px;
}

.memo-group {
  grid-template-columns: 18px 62px;
  column-gap: 5px;
  min-width: 96px;
  align-items: center;
}

.memo-group legend {
  grid-column: 1 / -1;
}

.memo-group select {
  width: 62px;
  height: 22px;
  padding: 0 2px;
  font-size: 11px;
}

.mole-group {
  grid-template-columns: 18px 62px;
  column-gap: 5px;
  min-width: 96px;
  justify-items: center;
  align-items: center;
}

.mole-group legend {
  grid-column: 1 / -1;
}

.mole-group select {
  width: 62px;
  height: 22px;
  padding: 0 2px;
  font-size: 11px;
}

.format-group {
  grid-template-columns: repeat(5, 26px);
  min-width: 155px;
}

.format-group legend {
  grid-column: 1 / -1;
}

.format-group button {
  height: 21px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.format-group button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

#boldBtn {
  font-weight: 800;
}

#underlineBtn {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

#highlightBtn {
  background: linear-gradient(180deg, #fff 0 52%, var(--highlight-color, #ffe066) 52% 100%);
}

#powerLinkBtn,
.favorite-link-button {
  color: #1769aa;
}

.format-group input[type="color"] {
  width: 24px;
  height: 21px;
  padding: 1px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.search-group {
  min-width: 88px;
}

.search-group input[type="search"] {
  width: 76px;
}

.compact-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  gap: 0;
  padding: 0;
  vertical-align: middle;
}

.compact-switch input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

.font-group {
  grid-template-columns: 78px 40px;
  min-width: 130px;
}

.family-group {
  grid-template-columns: 1fr;
  min-width: 140px;
}

.family-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  grid-column: 1 / -1;
  width: 100%;
}

#fontFamilySelect {
  flex: 1;
  height: 24px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

#openFontsFolder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#openFontsFolder:hover {
  background: #e2dfd5;
}

#openFontsFolder:active {
  transform: scale(0.95);
}

.font-group legend,
.family-group legend,
.size-group legend,
.color-group legend {
  grid-column: 1 / -1;
}

.size-group {
  grid-template-columns: repeat(2, 54px) 52px;
  min-width: 180px;
  align-items: center;
  column-gap: 8px;
}

.size-lock {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap !important;
  user-select: none;
  grid-column: span 1;
  line-height: 1;
}

.size-lock input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  position: relative;
  top: 1px;
  flex-shrink: 0;
  /* 체크박스가 찌그러지는 현상 방지 */
}

.color-group {
  grid-template-columns: repeat(3, 30px);
  min-width: 106px;
  align-items: end;
  column-gap: 5px;
}

.color-group legend {
  display: grid;
  grid-template-columns: repeat(3, 30px) 13px;
  align-items: center;
  column-gap: 5px;
  width: auto;
}



.shortcut-group {
  min-width: 98px;
}

.autostart-group {
  min-width: 60px;
}

.data-group {
  max-width: 132px;
  min-width: 118px;
}

.data-group p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.autostart-toggle {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap !important;
  user-select: none;
  line-height: 1;
}

.autostart-toggle input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  position: relative;
  top: 1px;
  flex-shrink: 0;
}

.autostart-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
}

.quit-button {
  height: 22px;
  padding: 0 8px;
  background: var(--danger-subtle, #ffe3e3);
  color: var(--danger-strong, #e03131);
  border: 1px solid var(--danger-line, #ffc9c9);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.quit-button:hover {
  background: var(--danger-strong, #e03131);
  color: #fff;
  border-color: var(--danger-strong, #e03131);
}

.toolbar label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.toolbar select,
.toolbar input[type="range"],
.toolbar input[type="number"],
.toolbar input[type="text"],
.toolbar input[type="search"] {
  min-width: 0;
  height: 22px;
}

.toolbar select,
.toolbar input[type="number"],
.toolbar input[type="text"],
.toolbar input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 0 6px;
  font-size: 11px;
}

.shortcut-group input[type="text"] {
  width: 88px;
}

.shortcut-status {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 12px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
}

.shortcut-status.is-error {
  color: #b42318;
}

.shortcut-status.is-ok {
  color: var(--accent-strong);
}

.shortcut-status.is-pending {
  color: var(--muted);
}

.toolbar input[type="number"] {
  text-align: center;
  padding: 0;
}

.toolbar select option {
  font-size: 11px;
}

.toolbar input[type="color"] {
  width: 28px;
  height: 24px;
  padding: 1px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.toolbar select,
.toolbar input[type="number"],
.toolbar input[type="text"],
.toolbar input[type="search"],
.toolbar input[type="color"],
.compact-switch input[type="checkbox"],
.size-lock input[type="checkbox"],
.autostart-toggle input[type="checkbox"] {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.toolbar select:hover,
.toolbar input[type="number"]:hover,
.toolbar input[type="text"]:hover,
.toolbar input[type="search"]:hover,
.toolbar input[type="color"]:hover,
.compact-switch input[type="checkbox"]:hover,
.size-lock input[type="checkbox"]:hover,
.autostart-toggle input[type="checkbox"]:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 125, 104, 0.15);
}

.toolbar select:focus,
.toolbar input[type="number"]:focus,
.toolbar input[type="text"]:focus,
.toolbar input[type="search"]:focus,
.toolbar input[type="color"]:focus,
.compact-switch input[type="checkbox"]:focus,
.size-lock input[type="checkbox"]:focus,
.autostart-toggle input[type="checkbox"]:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.25);
}

.memo-editor {
  position: relative;
  align-self: stretch;
  flex: 1;
  height: 100% !important;
  min-height: 0px !important;
  max-height: 100% !important;
  margin-top: var(--editor-top-space);
  overflow: hidden !important;
  background: var(--note);
}

.memo-editor .rich-editor,
.memo-editor pre {
  position: relative;
  display: block;
  width: 100%;
  height: 100% !important;
  min-height: 0px !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 18px;
  border: 0;
  font-family: inherit;
  font-size: var(--memo-font-size);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.memo-editor pre {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  overflow: auto;
  color: transparent;
  pointer-events: none;
}

.memo-editor.is-layered pre,
.memo-editor.is-preview pre {
  color: var(--note-text);
}

.memo-editor.is-preview pre {
  pointer-events: auto;
}

.memo-editor a {
  color: #1769aa;
  text-decoration: underline;
}

.memo-editor .memo-underline {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.memo-editor .memo-font-size {
  font-size: var(--inline-font-size);
  line-height: 1.35;
}

.memo-editor .memo-highlight {
  border-radius: 3px;
  background: #ffe066;
  color: inherit;
}

.memo-editor mark {
  border-radius: 4px;
  background: #ffe066;
  color: inherit;
  box-shadow: 0 0 0 2px rgba(255, 224, 102, 0.52);
}

::highlight(mole-search-hit) {
  background: #ffe066;
  color: inherit;
}

.rich-editor {
  position: relative;
  z-index: 1;
  overflow: auto;
  outline: 0;
  color: var(--note-text);
  background: var(--note);
  caret-color: var(--note-text);
}

.memo-editor strong {
  font-weight: 800;
  text-shadow: 0.3px 0 0.1px currentColor, -0.3px 0 0.1px currentColor, 0 0.3px 0.1px currentColor;
}

.memo-image-frame {
  position: absolute;
  display: inline-block;
  width: 220px;
  min-width: 80px;
  line-height: 0;
  cursor: move;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  z-index: 2;
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: outline-color 0.2s ease, outline-width 0.2s ease;
}

.memo-image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  box-shadow: 0 6px 18px rgba(36, 38, 45, 0.18);
  object-fit: fill;
  pointer-events: none;
}

.memo-image-frame:hover {
  outline: 2px solid rgba(47, 125, 104, 0.4);
}

.memo-image-frame.is-over-edge {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.memo-image-frame.is-editing-image {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.memo-image-frame.is-selected-image {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.memo-image-resize {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(36, 38, 45, 0.22);
  cursor: nwse-resize;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.memo-image-frame:hover .memo-image-resize,
.memo-image-frame.is-editing-image .memo-image-resize,
.memo-image-frame.is-selected-image .memo-image-resize {
  opacity: 1;
  pointer-events: auto;
}

.memo-image-n {
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.memo-image-s {
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.memo-image-e {
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.memo-image-w {
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.memo-image-ne {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}

.memo-image-nw {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}

.memo-image-se {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.memo-image-sw {
  left: -7px;
  bottom: -7px;
  cursor: nesw-resize;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(111, 117, 111, 0.72);
  pointer-events: none;
}

.rich-editor mark {
  border-radius: 4px;
  background: #ffe066;
  color: inherit;
}

.search-hit {
  box-shadow: inset 0 0 0 3px rgba(47, 125, 104, 0.28);
}

.memo-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid var(--line);
  background: var(--panel);
  justify-content: flex-start;
}

.memo-footer button {
  position: relative;
  min-width: 76px;
  height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 0 rgba(36, 38, 45, 0);
  transform: translateY(0);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.memo-footer button::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(111, 86, 58, 0.72);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0) scale(0.8);
  box-shadow:
    -10px 2px 0 rgba(111, 86, 58, 0.46),
    9px 1px 0 rgba(111, 86, 58, 0.36),
    -3px -2px 0 rgba(111, 86, 58, 0.28);
}

.memo-footer button.is-buried::after {
  animation: saveDust 760ms ease-out 2;
}

.save-dust-burst {
  position: absolute;
  left: 50%;
  top: 4px;
  z-index: 2;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.save-dust-burst i {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #8a6244;
  opacity: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
  transform: translate(-50%, 6px) scale(0.5);
  animation: saveDustParticle 820ms ease-out var(--dust-delay) forwards;
}

.memo-footer button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 7px 16px rgba(47, 125, 104, 0.22);
  transform: translateY(-2px);
}

.memo-footer button:active {
  box-shadow: 0 3px 8px rgba(36, 38, 45, 0.16);
  transform: translateY(0);
}

.memo-footer .ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.memo-footer .ghost:hover {
  border-color: rgba(47, 125, 104, 0.38);
  background: #f7fbf7;
  color: var(--accent-strong);
}

.memo-footer .danger {
  margin-left: auto;
  color: #a34338;
}

.memo-footer .danger:hover {
  border-color: rgba(163, 67, 56, 0.42);
  background: #fff4f2;
  color: #8f2f27;
  box-shadow: 0 7px 16px rgba(163, 67, 56, 0.16);
}

@keyframes saveDust {
  0% {
    opacity: 0;
    transform: translate(-50%, 2px) scale(0.45);
  }

  28% {
    opacity: 0.72;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -14px) scale(1.4);
  }
}

@keyframes saveDustParticle {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.45);
  }

  22% {
    opacity: 0.95;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dust-x)), var(--dust-y)) scale(1.05);
  }
}

.resize-handle {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 4;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-left: 3px solid rgba(36, 38, 45, 0.36);
  border-top: 3px solid rgba(36, 38, 45, 0.36);
  background: transparent;
  cursor: nwse-resize;
}

.dock-left .resize-handle {
  left: auto;
  right: 8px;
  top: 8px;
  border-left: 0;
  border-right: 3px solid rgba(36, 38, 45, 0.36);
  border-top: 3px solid rgba(36, 38, 45, 0.36);
  cursor: nesw-resize;
}

.dock-top .resize-handle {
  left: 8px;
  top: auto;
  bottom: 8px;
  border-top: 0;
  border-left: 3px solid rgba(36, 38, 45, 0.36);
  border-bottom: 3px solid rgba(36, 38, 45, 0.36);
  cursor: nesw-resize;
}

.resize-handle:hover {
  border-color: var(--accent);
}

@media (max-width: 720px) {
  .workspace {
    padding: 24px;
  }

  .intro {
    padding-top: 3vh;
  }

  .intro p:last-child {
    font-size: 16px;
  }

  .toolbar {
    padding: 10px 12px;
  }

  .memo-card {
    min-width: 300px;
    min-height: 380px;
  }

  .memo-editor,
  .memo-editor .rich-editor,
  .memo-editor pre {
    min-height: 240px;
  }
}

/* 커스텀 컨펌 모달 */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  opacity: 0;
  transition: opacity 180ms ease;
}

.confirm-modal[hidden] {
  display: none !important;
  pointer-events: none;
}

.confirm-modal:not([hidden]) {
  display: flex;
  opacity: 1;
}

.confirm-modal-content {
  width: 280px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(36, 38, 45, 0.18);
  text-align: center;
  transform: scale(0.92);
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-modal:not([hidden]) .confirm-modal-content {
  transform: scale(1);
}

.confirm-modal-content h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.confirm-modal-content p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.confirm-modal-actions button {
  flex: 1;
  height: 32px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 120ms ease;
}

.confirm-modal-actions .ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.confirm-modal-actions .ghost:hover {
  background: #f4f5f6;
}

.confirm-modal-actions .danger {
  border-color: #a34338;
  background: #a34338;
  color: #fff;
}

.confirm-modal-actions .danger:hover {
  background: #8e352c;
  border-color: #8e352c;
}

.link-modal-content {
  width: 320px;
  text-align: left;
}

.link-modal-field {
  display: grid;
  gap: 6px;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.link-modal-field input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.link-modal-field input:focus {
  outline: 2px solid rgba(47, 125, 104, 0.22);
  border-color: var(--accent);
}

.link-modal-status {
  display: block;
  min-height: 16px;
  margin-bottom: 10px;
  color: #b42318;
  font-size: 11px;
  font-weight: 700;
}

/* --- v0.1.4 2차 배포 추가 개선 스타일 --- */
/* 10. 행간 간격 일정 통일 */
#memoText, 
#memoText div, 
#memoText p, 
#memoText span {
  line-height: 1.62 !important;
}

/* 3. 탭 드래그 앤 드롭 정렬 중 시각 효과 */
.edge-tab {
  transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.2s ease;
  user-select: none;
}
.edge-tab.is-dragging {
  opacity: 0.35 !important;
  transform: scale(0.94);
  background-color: var(--line) !important;
  border: 1.5px dashed var(--accent) !important;
}
.edge-tab.drag-over {
  background-color: rgba(47, 125, 104, 0.2) !important;
  border: 1px solid var(--accent) !important;
}
