/* full-screen item editor */
.ed { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 76px 1fr 320px; grid-template-rows: 56px 1fr;
  grid-template-areas: "top top top" "tools stage panel"; background: color-mix(in srgb, var(--bg) 92%, #000 8%); font: 13px Inter; color: var(--ui-ink); }
.ed-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--ui-bg); border-bottom: 1px solid var(--ui-line); }
.ed-title { font: 600 15px Inter; display: flex; gap: 10px; align-items: baseline; min-width: 0 }
.ed-title span { font-weight: 400; color: var(--ui-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.ed-act { display: flex; gap: 8px; } .ed-act .btn { cursor: pointer; border: 1px solid var(--ui-line); background: var(--ui-bg); }
.ed-act .btn.primary { background: #b0001e; color: #fff; border-color: #b0001e; }
.ed-tools { grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; background: var(--ui-bg); border-right: 1px solid var(--ui-line); overflow-y: auto; }
.ed-tools.off { opacity: .35; pointer-events: none; }
.ed-tool { width: 60px; padding: 6px 0 4px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--ui-ink); }
.ed-tool svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ed-tool span { font: 500 9.5px Inter; color: var(--ui-muted); white-space: nowrap; }
.ed-tool.on { background: #fde2e2; color: #b0001e; } .ed-tool.on span { color: #b0001e; }
.ed-sep { width: 36px; height: 1px; background: var(--ui-line); margin: 6px 0; flex: none; }
.ed-ink { width: 24px; height: 24px; border-radius: 50%; background: var(--c); margin: 3px; cursor: pointer; flex: none; }
.ed-ink.on { outline: 2px solid #3b82f6; outline-offset: 2px; }
.ed-stage { grid-area: stage; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.ed-holder { position: relative; }
.ed-holder[data-tool="marker"], .ed-holder[data-tool="pencil"], .ed-holder[data-tool="highlight"], .ed-holder[data-tool="circle"], .ed-holder[data-tool="arrow"], .ed-holder[data-tool="redact"] { cursor: crosshair; }
.ed-holder[data-tool="text"] { cursor: text; } .ed-holder[data-tool="eraser"] { cursor: cell; }
.ed-item { position: absolute !important; left: 0; top: 0; transform-origin: 0 0; }
.ed svg.marks { pointer-events: auto; }
.ed-pin { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; z-index: 5; cursor: move; pointer-events: auto; }
.ed-pin::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1.5px dashed rgba(59,130,246,.7); }
.ed-hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font: 12px Inter; color: var(--ui-muted); pointer-events: none; }
.ed-words { position: absolute; top: 12px; left: 12px; right: 12px; display: none; gap: 6px; flex-wrap: wrap; justify-content: center; z-index: 6; }
.ed-words div { font: 400 12px 'Black Ops One'; letter-spacing: .05em; color: #b0001e; border: 2px solid currentColor; border-radius: 3px; padding: 3px 7px 2px; background: var(--ui-bg); cursor: pointer; opacity: .75; }
.ed-words div.on { opacity: 1; background: #fde2e2; }
.ed-input { position: absolute; z-index: 7; font: 700 20px Caveat; border: 1px dashed #3b82f6; background: rgba(255,255,255,.9); padding: 0 6px; width: 200px; outline: none; }
.ed-back { transform-origin: 0 0; background: #fbf8f0; box-shadow: var(--card-shadow); padding: 14px 16px; position: absolute; left: 0; top: 0; overflow: hidden;
  background-image: repeating-linear-gradient(to bottom, transparent 0 21px, #d6e1ee 21px 22px); background-position: 0 30px; animation: flip .35s ease-out; }
@keyframes flip { from { transform: perspective(900px) rotateY(80deg) scale(var(--k, 1)); opacity: .3; } }
.bk-h { font: 700 11px Inter; letter-spacing: .12em; text-transform: uppercase; color: #8a8174; margin-bottom: 6px; }
.bk-n { font: 700 18px/22px Caveat; color: #2b2622; white-space: pre-wrap; } .bk-e { color: #a39a8c; }
.bk-l { margin-top: 10px; font: 11px/16px 'Courier Prime'; color: #1f4fbf; word-break: break-all; }
.bk-c { margin-top: 8px; font: 10px Inter; color: #8a8174; }
.ed-panel { grid-area: panel; background: var(--ui-bg); border-left: 1px solid var(--ui-line); display: flex; flex-direction: column; min-height: 0; }
.ed-tabs { display: flex; border-bottom: 1px solid var(--ui-line); flex: none; }
.ed-tabs div { flex: 1; text-align: center; padding: 12px 4px; font-weight: 500; color: var(--ui-muted); cursor: pointer; }
.ed-tabs div.on { color: #b0001e; box-shadow: inset 0 -2px #b0001e; }
.ed-body { padding: 4px 16px 20px; overflow-y: auto; }
.ed-body label { display: block; font: 500 12px Inter; color: var(--ui-muted); margin: 14px 0 5px; }
.ed-body input, .ed-body textarea { width: 100%; font: 13px Inter; padding: 8px 10px; border: 1px solid var(--ui-line); border-radius: 7px; background: #fff; color: #2b2622; resize: vertical; }
.ed-seg { display: flex; border: 1px solid var(--ui-line); border-radius: 8px; overflow: hidden; }
.ed-seg div { flex: 1; text-align: center; padding: 7px 4px; cursor: pointer; } .ed-seg div.on { background: #b0001e; color: #fff; }
.ed-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .ed-row .btn { border: 1px solid var(--ui-line); cursor: pointer; }
.ed-sw { width: 30px; height: 30px; border-radius: 6px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); } .ed-sw.round { border-radius: 50%; width: 26px; height: 26px; }
.ed-sw.on { outline: 2px solid #3b82f6; outline-offset: 2px; }
.ed-note { color: var(--ui-muted); font-size: 12px; line-height: 1.5; margin: 14px 0 0; }
.ed-link { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font: 12px 'Courier Prime'; color: #1f4fbf; border-bottom: 1px solid var(--ui-line); word-break: break-all; }
.ed-link b { font: 500 11px Inter; color: var(--ui-muted); cursor: pointer; flex: none; }
.theme-night .ed-body input, .theme-night .ed-body textarea { background: #23272e; color: #ecebe8; }
@media (max-width: 700px) {
  .ed { grid-template-columns: 1fr; grid-template-rows: 52px minmax(0, 1fr) 64px 38vh; grid-template-areas: "top" "stage" "tools" "panel"; }
  .ed-tools { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: none; border-top: 1px solid var(--ui-line); padding: 4px 6px; }
  .ed-sep { width: 1px; height: 30px; margin: 0 4px; }
  .ed-tool { width: 54px; flex: none; }
  .ed-panel { border-left: none; border-top: 1px solid var(--ui-line); }
  .ed-hint { display: none; }
}
