* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
:root {
  --ink: #1c1f24; --muted: #6b7280; --line: #e5e7eb;
  --bg: #f6f7f9; --accent: #0f62fe; --red: #e11;
}
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
#app { display: grid; grid-template-columns: 320px 1fr; height: 100vh; }

#sidebar { border-right: 1px solid var(--line); background: #fff; overflow-y: auto; }
#sidebar header { padding: 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
#sidebar h1 { font-size: 17px; }
#post-list h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 16px 6px; }
.post-link { display: flex; gap: 8px; align-items: baseline; padding: 8px 16px; text-decoration: none; color: var(--ink); font-size: 13.5px; border-left: 3px solid transparent; }
.post-link:hover { background: #f3f4f6; }
.post-link.active { background: #eef2ff; border-left-color: var(--accent); }
.post-link .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line); align-self: center; }
.post-link .dot.on { background: var(--red); }
.post-link .plat { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }

#main { overflow-y: auto; padding: 20px 28px 60px; }
#post-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
#post-meta { font-weight: 600; text-align: center; }
#empty-state { color: var(--muted); text-align: center; margin-top: 30vh; }

button { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
button:hover:not(:disabled) { border-color: #c7cbd1; }
button:disabled { opacity: .45; cursor: default; }
#toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 3; }
#toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
#toolbar .tool.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#media-container { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.media-wrap { position: relative; width: min(680px, 100%); background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.media-wrap img, .media-wrap canvas, .media-wrap video { display: block; width: 100%; height: auto; }
video { width: min(420px, 100%); }
.annotation-layer { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
body[data-tool="pen"] .annotation-layer { cursor: crosshair; }
body[data-tool="text"] .annotation-layer { cursor: text; }
body[data-tool="select"] .annotation-layer { cursor: default; }
body[data-tool="pen"] .anno, body[data-tool="text"] .anno { pointer-events: none; }
body[data-tool="select"] .anno { cursor: move; }
.anno.selected { filter: drop-shadow(0 0 3px var(--accent)) drop-shadow(0 0 1px var(--accent)); }
.text-editor { position: absolute; transform: translateY(-70%); min-width: 120px; border: 1px dashed var(--red); background: rgba(255,255,255,.9); color: var(--red); font-weight: 700; padding: 2px 6px; outline: none; }
.placeholder { color: var(--muted); padding: 40px 0; }

.pdf-nav { display: flex; gap: 10px; align-items: center; }
.pdf-nav span { font-size: 13px; color: var(--muted); min-width: 90px; text-align: center; }

#caption-section, #notes-section { max-width: 680px; margin: 22px auto 0; }
#caption-section h2, #notes-section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
#caption { white-space: pre-wrap; font: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
#notes { width: 100%; min-height: 130px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; resize: vertical; }
#notes:focus { outline: 2px solid var(--accent); border-color: transparent; }

#save-indicator { position: fixed; right: 16px; bottom: 14px; font-size: 12.5px; padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--muted); z-index: 10; }
#save-indicator[data-state="saving"] { color: var(--accent); }
#save-indicator[data-state="error"] { color: #fff; background: #d33; border-color: #d33; }
