/* ==========================================================================
   Markup mode (preview pages only): circle things, leave notes.
   Self-contained: its own tokens so it reads the same over any section.
   ========================================================================== */
:root {
  --mk-mark: #FF5A36;        /* editor's pen: deliberately outside the brand palette */
  --mk-mark-done: #8FA3A8;
  --mk-bg: #0B171C;
  --mk-fg: #F2EFE8;
  --mk-muted: rgba(242, 239, 232, .66);
  --mk-line: rgba(242, 239, 232, .16);
  --mk-field: #15262D;
  --mk-font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.mk-ui [hidden], .mk-pop [hidden], .mk-pop[hidden], .mk-surface[hidden], .mk-panel[hidden] { display: none !important; }
.mk-ui { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: grid; justify-items: end; gap: 10px; font-family: var(--mk-font); max-width: calc(100vw - 32px); }
.mk-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding: 8px; border-radius: 999px; background: var(--mk-bg); color: var(--mk-fg); box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 1px var(--mk-line); }
.mk-on .mk-bar { border-radius: 22px; }
.mk-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: 600 13px/1 var(--mk-font); letter-spacing: .01em; cursor: pointer; }
.mk-btn:hover { background: rgba(242, 239, 232, .08); }
.mk-btn:focus-visible { outline: 2px solid var(--mk-mark); outline-offset: 2px; }
.mk-btn[aria-pressed="true"] { background: var(--mk-mark); color: #1B0B06; }
.mk-btn svg { width: 16px; height: 16px; flex: none; }
.mk-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--mk-mark); color: #1B0B06; font-size: 11px; display: inline-grid; place-items: center; }
.mk-btn[aria-pressed="true"] .mk-count { background: #1B0B06; color: var(--mk-mark); }
.mk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mk-hint { padding: 0 8px; font-size: 12px; color: var(--mk-muted); }
.mk-status { max-width: 340px; padding: 8px 12px; border-radius: 12px; background: var(--mk-bg); color: var(--mk-fg); font-size: 12px; line-height: 1.4; box-shadow: 0 0 0 1px var(--mk-line); }
.mk-status:empty { display: none; }

/* drawing surface: covers the viewport only while drawing */
.mk-surface { position: fixed; inset: 0; z-index: 80; cursor: crosshair; touch-action: none; }
.mk-surface svg { width: 100%; height: 100%; }
.mk-surface path { fill: none; stroke: var(--mk-mark); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* saved marks live in document coordinates */
.mk-layer { position: absolute; left: 0; top: 0; width: 100%; height: 0; z-index: 70; pointer-events: none; overflow: visible; }
.mk-mark { position: absolute; }
.mk-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mk-mark path { fill: none; stroke: var(--mk-mark); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .45)); }
.mk-mark.is-done path { stroke: var(--mk-mark-done); stroke-dasharray: 6 8; }
.mk-pin { position: absolute; left: -14px; top: -14px; pointer-events: auto; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #1B0B06; background: var(--mk-mark); color: #1B0B06; font: 700 13px/1 var(--mk-font); cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.mk-mark.is-done .mk-pin { background: var(--mk-mark-done); }
.mk-pin:focus-visible { outline: 2px solid var(--mk-fg); outline-offset: 2px; }
html:not(.mk-on) .mk-layer { display: none; }

/* note box */
.mk-pop { position: fixed; z-index: 95; width: min(340px, calc(100vw - 32px)); display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: var(--mk-bg); color: var(--mk-fg); font-family: var(--mk-font); box-shadow: 0 18px 48px rgba(0, 0, 0, .45), 0 0 0 1px var(--mk-line); }
.mk-pop label { font: 600 13px/1.3 var(--mk-font); }
.mk-pop .mk-where { font-size: 12px; line-height: 1.4; color: var(--mk-muted); overflow-wrap: anywhere; }
.mk-pop textarea { width: 100%; min-height: 96px; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--mk-line); background: var(--mk-field); color: var(--mk-fg); font: 400 14px/1.5 var(--mk-font); }
.mk-pop textarea:focus { outline: 2px solid var(--mk-mark); outline-offset: 1px; }
.mk-pop .mk-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.mk-pop .mk-save { background: var(--mk-mark); color: #1B0B06; }
.mk-pop .mk-save:hover { background: #FF7A5C; }
.mk-pop .mk-del { margin-right: auto; color: #FF9B85; }
@media (max-width: 600px) {
  .mk-pop { left: 16px !important; right: 16px; top: auto !important; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: auto; }
  .mk-hint { display: none; }
}

/* notes list */
.mk-panel { width: min(380px, calc(100vw - 32px)); max-height: min(60vh, 520px); overflow: auto; padding: 8px; border-radius: 16px; background: var(--mk-bg); color: var(--mk-fg); box-shadow: 0 18px 48px rgba(0, 0, 0, .45), 0 0 0 1px var(--mk-line); }
.mk-panel h2 { margin: 8px 10px 6px; font: 600 13px/1.3 var(--mk-font); color: var(--mk-muted); text-transform: uppercase; letter-spacing: .12em; }
.mk-panel ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mk-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; cursor: pointer; font-family: var(--mk-font); }
.mk-item:hover, .mk-item:focus-visible { background: rgba(242, 239, 232, .07); outline: none; }
.mk-item .mk-n { width: 24px; height: 24px; border-radius: 50%; background: var(--mk-mark); color: #1B0B06; font: 700 12px/24px var(--mk-font); text-align: center; }
.mk-item.is-done .mk-n { background: var(--mk-mark-done); }
.mk-item .mk-sec { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--mk-muted); }
.mk-item .mk-note { display: block; margin-top: 2px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.mk-item.is-done .mk-note { text-decoration: line-through; color: var(--mk-muted); }
.mk-empty { margin: 4px 10px 12px; font-size: 13px; line-height: 1.5; color: var(--mk-muted); }

@media (prefers-reduced-motion: reduce) { .mk-ui *, .mk-pop { transition: none !important; } }
