/* Memo composer: one warm-cream paper. Text and ink share #memoSurface (same box); the ink layer is transparent and only takes the pointer in draw mode.
   Bottom toolbar (입력 / 그리기 / 사진) + a white rounded contextual sheet attached right above it (only the selected mode's settings). */
.memo-paper { background: #fbf6e9; border: 1px solid #eadfc2; border-radius: 20px; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.memo-title { width: 100%; background: transparent; border: 0; border-bottom: 1px solid #eadfc2; padding: 6px 2px; font-size: 24px; font-weight: 800; color: #0f172a; outline-offset: 2px; }
.memo-surface { position: relative; width: 100%; height: 22rem; min-height: 14rem; }
.memo-text { position: absolute; inset: 0; box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 10px 6px; resize: none; overflow: auto; background: transparent; border: 0; color: #1e293b; line-height: 1.7; }
.memo-ink { position: absolute; inset: 0; width: 100%; height: 100%; color: #1e293b; pointer-events: none; touch-action: auto; overflow: hidden; }
.memo-paper[data-mode="draw"] .memo-ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.memo-paper[data-mode="draw"] .memo-text { user-select: none; }
.memo-title:focus-visible, .memo-text:focus-visible, .memo-tool:focus-visible, .memo-chip:focus-visible, .memo-font-tile:focus-visible, .memo-done:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.memo-note { min-height: 1.2em; margin: 0; font-size: 12px; color: #b45309; }
.memo-photo-wrap { display: flex; align-items: center; gap: 10px; }
.memo-photo-wrap[hidden], .memo-sheet[hidden] { display: none; }
.memo-photo-preview { max-width: 160px; max-height: 120px; border-radius: 10px; border: 1px solid #eadfc2; object-fit: contain; background: #fff; }
.memo-photo-thumb { display: block; max-width: 100%; max-height: 120px; margin-top: 6px; border-radius: 8px; object-fit: contain; }

/* bottom mode toolbar */
/* dock: sticks to the bottom edge of the modal's scroll area (the footer buttons are outside that area), so modes + active sheet are always reachable */
.memo-dock { position: sticky; bottom: 0; z-index: 5; margin: 0 -14px -10px; padding: 6px 14px 8px; background: #fbf6e9; border-top: 1px solid #eadfc2; border-radius: 0 0 20px 20px; box-shadow: 0 -8px 14px -10px rgba(15, 23, 42, .25); }
.memo-toolbar { display: flex; gap: 6px; align-items: stretch; justify-content: space-around; padding-top: 4px; }
.memo-tool { flex: 1 1 0; min-height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 8px; border: 2px solid transparent; border-radius: 14px; background: transparent; color: #1f2937; cursor: pointer; }
.memo-tool-icon { font-size: 20px; font-weight: 800; line-height: 1; }
.memo-tool-label { font-size: 11px; font-weight: 700; color: #475569; }
.memo-tool.is-selected { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.memo-tool.is-selected .memo-tool-label { color: #1d4ed8; }

/* contextual bottom sheet: white, rounded, visually attached to the toolbar below it */
.memo-sheet { background: #fff; border: 1px solid #e5e7eb; border-radius: 20px 20px 8px 8px; box-shadow: 0 -6px 18px rgba(15, 23, 42, .08); padding: 8px 10px 10px; margin-bottom: 4px; max-height: min(38vh, 240px); overflow-y: auto; overscroll-behavior: contain; }
.memo-sheet-head { position: sticky; top: -8px; z-index: 1; background: #fff; display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; padding-top: 2px; font-size: 15px; color: #0f172a; }
.memo-done { width: 36px; height: 36px; border-radius: 999px; border: 0; background: #eff6ff; color: #1d4ed8; font-size: 20px; font-weight: 800; cursor: pointer; }
.memo-sheet-body { display: flex; flex-direction: column; gap: 8px; }
.memo-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.memo-font-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 6px; border: 2px solid #e5e7eb; border-radius: 14px; background: #fff; color: #0f172a; cursor: pointer; }
.memo-font-sample { font-size: 20px; line-height: 1.15; }
.memo-font-name { font-size: 11px; color: #64748b; }
.memo-font-tile[data-font="system"] .memo-font-sample { font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif; }
.memo-font-tile[data-font="serif"] .memo-font-sample { font-family: Georgia, "Noto Serif KR", "Times New Roman", serif; }
.memo-font-tile[data-font="mono"] .memo-font-sample { font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace; }
.memo-font-tile[data-font="rounded"] .memo-font-sample { font-family: "Arial Rounded MT Bold", "Nanum Gothic", system-ui, sans-serif; }
.memo-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f8fafc; border-radius: 14px; padding: 6px 10px; }
.memo-row-label { font-size: 13px; font-weight: 700; color: #475569; white-space: nowrap; }
.memo-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.memo-chip { min-width: 40px; min-height: 38px; padding: 2px 10px; border: 2px solid transparent; border-radius: 12px; background: #fff; color: #334155; font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.memo-brush-dot { display: inline-block; border-radius: 999px; background: #1e293b; }
.memo-brush-num { font-size: 12px; }
.memo-chip.is-selected, .memo-font-tile.is-selected { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
@media (max-height: 640px) { .memo-sheet { max-height: 30vh; } .memo-surface { height: 14rem; } .memo-tool { min-height: 40px; } }
@media (max-width: 420px) { .memo-surface { height: 18rem; } .memo-row { flex-direction: column; align-items: stretch; } .memo-chips { justify-content: flex-start; } }

/* photo INSIDE the writing surface: a layer under the text (never permanently hides text); movable/resizable only in photo mode */
.memo-photo-layer { position: absolute; z-index: 0; pointer-events: none; line-height: 0; }
.memo-photo-layer[hidden] { display: none; }
.memo-photo-img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid #eadfc2; background: #fff; user-select: none; -webkit-user-drag: none; }
.memo-text, .memo-ink { z-index: 1; }
.memo-paper[data-mode="photo"] .memo-photo-layer { z-index: 3; cursor: move; touch-action: none; outline: 2px solid #2563eb; outline-offset: 1px; border-radius: 10px; }
.memo-paper[data-mode="photo"] .memo-text { user-select: none; }
.memo-photo-handle { display: none; position: absolute; right: -14px; bottom: -14px; width: 44px; height: 44px; border: 0; border-radius: 999px; background: transparent; cursor: nwse-resize; touch-action: none; }
.memo-photo-handle::after { content: ""; position: absolute; right: 8px; bottom: 8px; width: 18px; height: 18px; border-radius: 999px; background: #2563eb; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .4); }
.memo-paper[data-mode="photo"] .memo-photo-handle { display: block; }
.memo-photo-handle:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.memo-size-ctl { align-items: center; }
.memo-range { width: min(180px, 100%); min-height: 44px; accent-color: #2563eb; }
.memo-help { margin: 0; font-size: 12px; color: #64748b; }
.memo-photo-thumb { cursor: zoom-in; }
.memo-photo-thumb:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
/* shield next to the memo type pills: SAME Lucide shield + button classes as the task form's shield; muted because individual encryption is not available yet */
.memo-shield { min-width: 44px; min-height: 44px; cursor: help; opacity: .6; }
.memo-shield:focus-visible, #taskEncryptionToggleBtn:focus-visible, #detailEncryptionBtn:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; opacity: 1; }
#taskEncryptionToggleBtn[aria-disabled="true"], #detailEncryptionBtn[aria-disabled="true"] { opacity: .6; cursor: help; }
/* lightbox */
.photo-viewer { position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; background: rgba(15, 23, 42, .92); color: #fff; }
.photo-viewer-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 12px; }
.photo-viewer-btn { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; }
.photo-viewer-btn[aria-disabled="true"] { opacity: .35; cursor: default; }
.photo-viewer-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.photo-viewer-zoom { min-width: 3.5em; text-align: center; font-size: 14px; }
.photo-viewer-stage { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; padding: 8px; box-sizing: border-box; -webkit-overflow-scrolling: touch; }
.photo-viewer-img { display: block; flex: none; max-width: none; max-height: none; margin: auto; image-rendering: auto; }
.photo-viewer-note { margin: 0; padding: 6px 12px 10px; font-size: 12px; text-align: center; color: #cbd5e1; }

/* memo type row: the visible pills are as tall as the 44px shield and everything is centred on one line (mobile 320/390 and desktop) */
#memoTypeRow { align-items: center; gap: 6px; max-width: 100%; flex-wrap: wrap; }
#memoTypeRow > label { display: flex; }
#memoTypeRow > label > div { min-height: 44px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
#memoTypeRow > .memo-shield { margin: 0; flex: none; }
@media (max-width: 380px) { #memoTypeRow { gap: 4px; } #memoTypeRow > label > div { padding-left: 10px; padding-right: 10px; } }
.shield-help { margin: 0; font-size: 12px; line-height: 1.5; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 6px 10px; }
.shield-help[hidden] { display: none; }
/* the preview bar (sticky, may wrap to several lines on a phone) must never sit on top of an open modal; modals are z-[100]/[110] */
#previewBar { z-index: 50 !important; }
/* the error/notice toast never blocks or hides the controls behind it */
#mockUnsupportedNotice { pointer-events: none; z-index: 3500; }

/* personal account / Drive panel (compact bar + popover) */
.drive-title { font-size: 14px; }
.drive-chip { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: #fff; border: 1px solid #b6d4f5; }
.drive-chip[data-tone="ok"] { border-color: #86efac; background: #f0fdf4; } .drive-chip[data-tone="warn"] { border-color: #fdba74; background: #fff7ed; }
.drive-account-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 60vw; padding: 2px 12px 2px 4px; border: 1px solid #94a3b8; border-radius: 999px; background: #fff; cursor: pointer; }
.drive-account-btn:focus-visible, .drive-btn:focus-visible, #driveNickname:focus-visible, #driveTestTools summary:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.drive-avatar { width: 36px; height: 36px; border-radius: 999px; background: #2563eb; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.drive-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.drive-btn { min-height: 44px; padding: 4px 14px; border: 1px solid #64748b; border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; }
.drive-btn:disabled, .drive-btn[hidden] { opacity: .5; cursor: default; } .drive-btn[hidden] { display: none; }
.drive-panel { position: absolute; top: 100%; right: 8px; width: min(440px, calc(100vw - 16px)); max-height: calc(100vh - 90px); overflow: auto; background: #fff; border: 1px solid #b6d4f5; border-radius: 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); padding: 10px 14px 14px; z-index: 60; font-size: 14px; }
.drive-panel[hidden] { display: none; }
.drive-sec h3 { margin: 10px 0 4px; font-size: 13px; color: #475569; }
.drive-acc-line { margin: 0; font-weight: 800; overflow-wrap: anywhere; } .drive-small { margin: 2px 0; font-size: 12px; color: #64748b; line-height: 1.5; }
.drive-lines { margin: 0 0 6px; padding-left: 1.1em; } .drive-lines li { margin: 2px 0; }
.drive-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; align-items: center; }
#driveNickname { flex: 1 1 140px; min-height: 44px; padding: 4px 10px; border: 1px solid #94a3b8; border-radius: 10px; }
.drive-tools { margin-top: 12px; border: 1px dashed #94a3b8; border-radius: 10px; padding: 6px 10px; } .drive-tools summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }

/* bottom control area = same place as the old card-colour row: white, outside the cream paper, sticky at the bottom of the modal scroll area */
#memoDock { position: sticky; bottom: 0; z-index: 5; margin: 12px -24px -24px; padding: 8px 24px 12px; background: #fff; border-top: 1px solid #e5e7eb; border-radius: 0; box-shadow: 0 -8px 14px -10px rgba(15, 23, 42, .25); }
@media (min-width: 640px) { #memoDock { margin: 12px -32px -32px; padding: 8px 32px 12px; } }
.memo-controlrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.memo-controlrow .memo-toolbar { flex: 1 1 210px; border-top: 0; padding-top: 0; gap: 4px; }
.memo-tool { min-width: 44px; }
.memo-tool-icon svg, svg.memo-tool-icon { width: 20px; height: 20px; }
.memo-color { position: relative; flex: none; }
.memo-color-current { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 8px; border: 2px solid #e5e7eb; border-radius: 14px; background: #fff; color: #334155; font-weight: 700; font-size: 13px; cursor: pointer; }
.memo-color-current:focus-visible, .memo-color-btn:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.memo-color-current[aria-expanded="true"] { border-color: #2563eb; background: #eff6ff; }
.memo-color-dot { width: 24px; height: 24px; border-radius: 999px; border: 2px solid #cbd5e1; background: #fff; flex: none; }
.memo-color-dot[data-color="sky"] { background: #7dd3fc; border-color: #38bdf8; } .memo-color-dot[data-color="emerald"] { background: #6ee7b7; border-color: #34d399; }
.memo-color-dot[data-color="amber"] { background: #fcd34d; border-color: #fbbf24; } .memo-color-dot[data-color="rose"] { background: #fda4af; border-color: #fb7185; }
.memo-color-palette { position: absolute; right: 0; bottom: calc(100% + 8px); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: calc(100vw - 56px); padding: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; box-shadow: 0 10px 28px rgba(15, 23, 42, .25); z-index: 7; }
.memo-color-palette[hidden] { display: none; }
#memoColorPalette .memo-color-btn { width: 44px; height: 44px; border-radius: 999px; cursor: pointer; }

.memo-color-name { white-space: nowrap; }
