/* Visitor comments (js/comments.js) */
#cmBar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; gap: 8px; }
#cmBar button, .cmAddHere, #cmSubmit, #cmCancelPin {
  font: 600 14px/1 system-ui, "Segoe UI", sans-serif; border: 1px solid rgba(0,0,0,.25); border-radius: 999px;
  background: #f6f1e4; color: #2a2a20; padding: 9px 14px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#cmBar button:hover, .cmAddHere:hover, #cmSubmit:hover { background: #fff; }
#cmBar button.on { background: #5d6b3a; color: #fff; }
#cmHint { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); z-index: 40; background: #2a2a20; color: #fff;
  padding: 8px 12px; border-radius: 8px; font: 14px system-ui, sans-serif; display: flex; gap: 10px; align-items: center; }
#cmHint[hidden] { display: none; }
#cmCancelPin { padding: 5px 10px; box-shadow: none; }
canvas.cmCrosshair { cursor: crosshair !important; }

#cmPins { position: fixed; inset: 0; pointer-events: none; z-index: 28; }   /* under the Today's-town labels (29) */
.cmPin { position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; cursor: pointer; background: #fff8e6;
  border-radius: 14px 14px 14px 2px; padding: 3px 7px 3px 5px; font: 600 12px system-ui, sans-serif; color: #5a3b12;
  box-shadow: 0 1px 5px rgba(0,0,0,.4); white-space: nowrap; }
.cmPin span { margin-left: 3px; }
.cmPin:hover { background: #fff; transform-origin: bottom left; }

#cmDrawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 45; background: #f6f1e4;
  color: #2a2a20; box-shadow: -4px 0 20px rgba(0,0,0,.3); overflow-y: auto; padding: 14px 16px; font: 14px/1.45 Georgia, serif; }
#cmDrawer[hidden] { display: none; }
#cmDrawer header, #cmForm header { display: flex; justify-content: space-between; align-items: center; }
#cmDrawer h2, #cmForm h2 { margin: 0; font: 600 20px Georgia, serif; }
.cmX { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: inherit; padding: 2px 6px; }
.cmMuted { color: #6d6757; font-size: 13px; }
#cmDrawer .cmItem { cursor: pointer; }

.cmItem { border-top: 1px solid rgba(0,0,0,.12); padding: 10px 0; }
.cmWhere { font: 600 12px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; color: #5d6b3a; }
.cmMeta { font: 13px system-ui, sans-serif; color: #6d6757; margin: 2px 0 4px; }
.cmMeta b { color: #2a2a20; }
.cmText { white-space: normal; overflow-wrap: anywhere; }
.cmAtt { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cmImg img { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); display: block; }
.cmFile { font: 13px system-ui, sans-serif; background: rgba(0,0,0,.06); border-radius: 4px; padding: 4px 8px; color: #2a2a20; text-decoration: none; }
.cmFile span { color: #6d6757; }

.cmCard { margin-top: 12px; border-top: 2px solid rgba(0,0,0,.15); padding-top: 8px; }
.cmCard h3 { margin: 0 0 4px; font: 600 15px Georgia, serif; }
.cmAddHere { margin-top: 8px; border-radius: 6px; box-shadow: none; font-size: 13px; width: 100%; }

#cmModal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 12px; }
#cmModal[hidden] { display: none; }
#cmForm { background: #f6f1e4; color: #2a2a20; width: min(520px, 100%); max-height: 100%; overflow-y: auto; border-radius: 10px;
  padding: 16px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.5); font: 14px/1.4 system-ui, sans-serif; }
#cmForm label { display: block; margin: 10px 0 0; font-weight: 600; }
#cmForm input:not([type=file]), #cmForm textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 8px;
  font: 15px system-ui, sans-serif; border: 1px solid rgba(0,0,0,.3); border-radius: 6px; background: #fff; color: #222; }
#cmForm input[type=file] { display: block; margin-top: 6px; font-weight: 400; }
#cmForm small { display: block; font-weight: 400; color: #6d6757; margin-top: 3px; }
.cmTarget { margin: 6px 0 0; color: #5d6b3a; }
.cmHp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.cmActions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
#cmStatus { color: #8a3a1a; font-size: 13px; }
#cmSubmit { background: #5d6b3a; color: #fff; border-radius: 6px; }
#cmSubmit:disabled { opacity: .6; cursor: wait; }
.cmToast { position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%); z-index: 70; background: #2a2a20; color: #fff;
  padding: 10px 16px; border-radius: 8px; font: 14px system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0,0,0,.4); }

@media (max-width: 700px) {
  #cmBar { top: auto; bottom: 56px; }
  #cmBar button { padding: 8px 11px; font-size: 13px; }
  #cmHint { top: auto; bottom: 104px; width: calc(100vw - 24px); }
}

/* corrections (edit requests), roles, replies */
.cmType { display: flex; gap: 14px; margin: 6px 0 2px; flex-wrap: wrap; }
#cmForm .cmType label { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-weight: 500; cursor: pointer; }
.cmBadge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 9px; background: #efe6cf; color: #5b4a1c; margin-left: 4px; white-space: nowrap; }
.cmBadge.cmSt-applied { background: #dcebd2; color: #2f5320; }
.cmBadge.cmSt-rejected, .cmBadge.cmSt-reverted { background: #eee; color: #666; }
.cmBadge.cmSt-needs_info { background: #f6dccf; color: #7a3416; }
.cmRole { font-size: 11px; padding: 0 5px; border-radius: 8px; background: #5d6b3a; color: #fff; }
.cmSrc { font-size: 12px; color: #5b5545; margin-top: 4px; overflow-wrap: anywhere; }
.cmReply { margin: 8px 0 0 12px; padding: 6px 0 0 10px; border-left: 3px solid #c9bd96; }
.cmEdit > .cmText { border-left: 3px solid #d8b75a; padding-left: 8px; }
.cmSuggest { background: #fbf4e0; }
.cmType input { width: auto !important; margin: 0 !important; flex: none; }
#cmForm .cmType label { white-space: nowrap; }

/* owner-only delete (signed in as tedbarnett@gmail.com) */
.cmDel { display: block; margin-top: 6px; padding: 4px 10px; border: 1px solid #a31515; border-radius: 6px; background: #c62828; color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.cmDel:hover { background: #a31515; }
.cmSignOut { margin-left: 6px; padding: 1px 8px; font-size: 12px; border-radius: 5px; border: 1px solid #999; background: #fff; cursor: pointer; }


/* year ranges: a pin whose comments are all outside the year the map shows fades but stays clickable */
.cmPin { transition: opacity .25s; }
.cmPin.cmPinOut { opacity: .15; }
.cmPin.cmPinOut:hover, .cmPin.cmPinOut:focus-visible { opacity: .6; }
.cmYearsTag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 8px; background: #e6ecd8; color: #3c4a20; white-space: nowrap; }
.cmYearsTag.cmAllYears { background: #eee9dc; color: #6d6757; }
.cmItem.cmOutOfYears > :not(.cmTools):not(.cmYearsEdit) { opacity: .55; }
#cmForm fieldset.cmYears { border: 1px solid rgba(0,0,0,.2); border-radius: 6px; margin: 10px 0 0; padding: 4px 10px 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-end; }
#cmForm fieldset.cmYears legend { font-weight: 600; padding: 0 4px; }
#cmForm fieldset.cmYears label { margin: 0; font-weight: 500; }
#cmForm fieldset.cmYears input { width: 6.5em; }
#cmForm fieldset.cmYears small { flex-basis: 100%; }
.cmTools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cmTools .cmDel { margin-top: 0; }
.cmYearsBtn { padding: 4px 10px; border: 1px solid #5d6b3a; border-radius: 6px; background: #fff; color: #3c4a20; font: inherit; font-size: 12px; cursor: pointer; }
.cmYearsBtn:hover { background: #eef2e4; }
.cmYearsEdit { margin-top: 6px; padding: 6px 8px; background: #fff; border: 1px solid rgba(0,0,0,.15); border-radius: 6px; font: 13px system-ui, sans-serif; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cmYearsEdit input { width: 5.5em; padding: 3px 5px; font: inherit; }
.cmYearsEdit button { padding: 3px 9px; font: inherit; font-size: 12px; border-radius: 5px; border: 1px solid #999; background: #f6f1e4; cursor: pointer; }
.cmYearsEdit .cmYSave { background: #5d6b3a; color: #fff; border-color: #5d6b3a; }
.cmYMsg { color: #8a3a1a; }

/* attachments: drop target, thumbnails, remove, scale-down prompt (no `accept` filter on the picker) */
#cmForm .cmFilesRow { margin: 10px 0 0; }
#cmForm .cmFilesLabel { display: block; font-weight: 600; }
.cmDrop { margin-top: 4px; border: 2px dashed rgba(0,0,0,.25); border-radius: 8px; padding: 10px 12px; background: rgba(255,255,255,.55); transition: background .15s, border-color .15s; }
.cmDropText { color: #5b5545; font-size: 13px; }
#cmForm label.cmPick { display: inline; margin: 0; font-weight: 600; color: #3c4a20; text-decoration: underline; cursor: pointer; }
#cmForm label.cmPick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; margin: 0; }
#cmForm.cmDragOver .cmDrop { border-color: #5d6b3a; background: #e6ecd8; box-shadow: inset 0 0 0 2px rgba(93,107,58,.25); }
#cmForm.cmDragOver .cmDropText::after { content: '  Drop to attach'; font-weight: 700; color: #3c4a20; }
.cmFileList { list-style: none; margin: 0; padding: 0; }
.cmDrop.cmHasFiles .cmFileList { margin-top: 8px; }
.cmFileItem { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-top: 1px solid rgba(0,0,0,.08); }
.cmFileItem img, .cmFileIcon { width: 48px; height: 48px; flex: none; object-fit: cover; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cmFileInfo { flex: 1; min-width: 0; font-size: 13px; }
.cmFileName { font-weight: 600; overflow-wrap: anywhere; }
.cmFileSize { color: #6d6757; }
.cmFileBad .cmFileSize { color: #a31515; font-weight: 600; }
.cmFileWarn { color: #8a3a1a; margin-top: 3px; }
.cmFileNote { color: #3c6a20; margin-top: 3px; }
.cmScaleAsk { background: #fff4d6; border: 1px solid #e0c46c; border-radius: 6px; padding: 5px 7px; color: #5b4a1c; }
.cmScaleAsk button { padding: 2px 9px; font: inherit; font-size: 12px; border-radius: 5px; border: 1px solid #999; background: #fff; cursor: pointer; margin-left: 2px; }
.cmScaleAsk .cmScaleYes, .cmScaleAsk .cmScaleAll { background: #5d6b3a; color: #fff; border-color: #5d6b3a; }
.cmFileTotal { margin-top: 6px; font-size: 13px; }
.cmFileRm { flex: none; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: #6d6757; padding: 0 4px; }
.cmFileRm:hover { color: #a31515; }
