:root {
  color-scheme: dark;
  font-family: Arial, "Segoe UI", sans-serif;
  color: #f1f0e9;
  background: #131618;
  --surface: #191d1f;
  --border: #333a3c;
  --muted: #a6b0ae;
  --accent: #f3c66a;
  --mono: "Courier New", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .map:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .52; cursor: default; }
[hidden] { display: none !important; }
.topbar { direction: ltr; height: 76px; padding: 0 32px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .top-actions { display: flex; align-items: center; gap: 12px; }
.brand { gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; color: #181814; background: var(--accent); border-radius: 9px; font-size: 25px; }
.brand strong { display: block; font-family: var(--mono); font-size: 17px; letter-spacing: .035em; }
.brand strong span { color: var(--accent); }
.brand small { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; letter-spacing: .15em; color: var(--muted); }
.storage-label { direction: rtl; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.storage-label i { width: 7px; height: 7px; border-radius: 50%; background: #92cfae; }
.button { min-height: 41px; padding: 9px 16px; border-radius: 7px; border: 1px solid transparent; font-weight: 700; white-space: nowrap; }
.button.primary { background: var(--accent); color: #1d1b14; }
.button.primary:hover { background: #ffda89; }
.button.secondary { color: #f1f0e9; border-color: #4d5659; background: #222729; }
.button.secondary:hover { background: #30383a; }
.workspace { direction: ltr; display: grid; grid-template-columns: minmax(280px, 346px) minmax(0, 1fr); height: calc(100dvh - 76px); min-height: 520px; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar-head { padding: 27px 24px 22px; }
.eyebrow { color: var(--accent); font-size: 14px; font-weight: 700; }
h1 { font-size: 35px; letter-spacing: -.035em; margin: 7px 0 7px; line-height: 1.1; }
.sidebar-head p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.sidebar-head .button { width: 100%; display: flex; gap: 9px; justify-content: center; align-items: center; min-height: 47px; }
.sidebar-head .button span { font-size: 23px; line-height: 0; }
.filters { padding: 0 24px 19px; border-bottom: 1px solid var(--border); }
.search-wrap { position: relative; }
.search-wrap span { position: absolute; inset-inline-start: 12px; top: 7px; font-size: 24px; color: var(--muted); pointer-events: none; }
input:not([type=file]), textarea, select { min-width: 0; width: 100%; background: #111516; color: #f1f0e9; border: 1px solid #454e50; border-radius: 7px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: #9da7a6; }
.search-wrap input { padding-inline-start: 37px; }
.categories { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 14px; color: #d2d8d5; background: #212628; border: 1px solid #434d50; border-radius: 20px; padding: 6px 10px; }
.chip:hover { border-color: #899197; }
.chip[aria-pressed=true] { color: var(--accent); background: #393125; border-color: #806c4a; }
.results { min-height: 0; overflow: auto; flex: 1; padding: 17px 24px; }
.results-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.results-heading h2 { font-size: 15px; margin: 0; }
.results-heading span { color: var(--muted); font-size: 13px; }
.points { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.point-row { width: 100%; display: flex; align-items: center; gap: 12px; color: inherit; text-align: start; background: #222729; border: 1px solid #3b4446; border-radius: 8px; padding: 10px; }
.point-row:hover { border-color: var(--accent); }
.point-symbol { flex: none; color: var(--point-color); font-size: 18px; }
.point-row strong, .point-row small { display: block; overflow-wrap: anywhere; }
.point-row small { color: var(--muted); margin-top: 4px; font-size: 13px; }
.empty { text-align: center; padding: 33px 0 15px; color: var(--muted); }
.empty strong { color: #e8e6dc; }
.empty p { margin: 7px 0 0; font-size: 14px; }
.empty-mark { display: grid; place-items: center; width: 47px; height: 47px; margin: 0 auto 13px; background: #282d2d; border: 1px solid #485050; border-radius: 14px; color: var(--accent); font-size: 23px; }
.sidebar-foot { direction: ltr; display: flex; justify-content: space-between; gap: 8px; padding: 15px 24px; border-top: 1px solid var(--border); font: 12px var(--mono); letter-spacing: .04em; color: var(--muted); }
.map-shell { position: relative; min-width: 0; min-height: 0; background: #13272a; isolation: isolate; }
.map { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.map:focus-visible { outline-offset: -3px; }
.map.dragging { cursor: grabbing; }
.map.placing { cursor: crosshair; }
#terrain, .markers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.marker { position: absolute; pointer-events: auto; transform: translate(-50%, -100%); display: grid; place-items: center; width: 37px; height: 37px; padding: 0; border: 2px solid #f9f0d9; border-radius: 50%; translate: 0 -5px; color: #171b1c; background: var(--point-color); box-shadow: 0 2px 7px #000b; }
.marker::after { content: ""; position: absolute; top: calc(100% - 2px); border-inline: 6px solid transparent; border-top: 8px solid #f9f0d9; }
.marker span { font-size: 17px; }
.marker:hover, .marker:focus-visible { z-index: 1; border-color: white; }
.placing .marker { pointer-events: none; }
.point-row-text { flex: 1; min-width: 0; }
.point-row.selected { border-color: #a78952; }
.point-row.completed { background: #1d2524; }
.point-row.completed .point-symbol { color: #9bdcbd; font-weight: 700; }
.point-status { flex: none; padding: 3px 7px; color: #a6e5c7; background: #233a30; border: 1px solid #3f6352; border-radius: 5px; font-size: 13px; }
.marker.completed { background: #273e39e6; color: #b6f2d2; border-color: #b6f2d2; opacity: .73; }
.marker.completed::after { border-top-color: #b6f2d2; }
.marker.selected { z-index: 1; outline: 2px solid #f5d38c; outline-offset: 2px; }
.marker.completed.selected, .marker.completed:hover, .marker.completed:focus-visible { opacity: 1; }
.point-popup { position: absolute; z-index: 2; width: min(218px, calc(100% - 20px)); overflow: hidden; border: 1px solid #6a7975; border-radius: 9px; background: #151c1ef5; box-shadow: 0 5px 18px #0008; padding: 9px 11px; pointer-events: none; cursor: default; }
.point-popup.show-actions { width: min(254px, calc(100% - 20px)); overflow: auto; overscroll-behavior: contain; padding: 10px 12px; pointer-events: auto; touch-action: pan-y; }
.popup-head { display: flex; justify-content: space-between; align-items: start; gap: 6px; }
.popup-head h2 { font-size: 16px; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.point-popup:not(.show-actions) .popup-head h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-close { margin: -4px 0 0; flex: none; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #d6ded8; font-size: 21px; line-height: 1; }
.popup-close:hover { background: #2c3738; }
.popup-meta { margin: 3px 0 0; color: #b1c6bb; font-size: 13px; }
.popup-notes { margin: 6px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; color: #e6e8e1; line-height: 1.45; font-size: 14px; }
.point-popup:not(.show-actions) .popup-notes { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.point-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 8px 0 0; }
.point-actions button { min-height: 37px; padding: 5px 4px; color: #ecece5; background: #242d2f; border: 1px solid #455453; border-radius: 5px; font-size: 14px; }
.point-actions button:hover { background: #354142; }
.point-actions #complete { color: #b8eed1; }
.point-actions #delete { color: #ffada3; }
#popup-attachments { margin-top: 8px; }
#popup-image { display: block; width: 100%; max-height: 120px; object-fit: contain; border-radius: 5px; background: #111719; }
#popup-link { display: inline-block; margin-top: 5px; color: var(--accent); font-size: 14px; }
.map-controls, .placement { z-index: 3; }
.crosshair { display: none; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); color: white; font-size: 26px; text-shadow: 0 1px 3px black; pointer-events: none; }
.placing:focus-visible .crosshair { display: block; }
.map-label { position: absolute; top: 20px; left: 20px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid #687570; border-radius: 7px; color: #f0ede2; background: #151b1bed; font: 700 13px var(--mono); pointer-events: none; }
.map-label span:first-child, .map-label small { color: var(--accent); }
.map-label small { margin-left: 4px; padding-left: 8px; border-left: 1px solid #575e59; font-size: 12px; }
.map-controls { position: absolute; right: 20px; bottom: 45px; display: grid; border: 1px solid #687570; border-radius: 8px; overflow: hidden; background: #151b1bf5; }
.map-controls button { width: 43px; height: 43px; background: transparent; color: #fff3dc; border: 0; font-size: 24px; }
.map-controls button + button { border-top: 1px solid #4d5856; }
.map-controls button:hover { background: #364143; }
.map-controls button:focus-visible { outline-offset: -4px; }
.map-footer { direction: ltr; position: absolute; right: 8px; bottom: 6px; display: flex; flex-wrap: wrap; column-gap: 9px; background: #151b1bed; color: #eee9e0; padding: 4px 8px; border-radius: 4px; font-size: 12px; }
.map-footer a { color: inherit; }
.placement { direction: rtl; position: absolute; top: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--accent); color: #1d1b14; border-radius: 7px; padding: 7px 10px; font-weight: 700; white-space: nowrap; }
.placement button { background: transparent; border: 1px solid #765a2a; color: inherit; border-radius: 4px; padding: 4px 8px; }
dialog { width: min(470px, calc(100% - 28px)); max-height: calc(100dvh - 24px); padding: 22px; margin: auto; background: var(--surface); color: inherit; border: 1px solid #596266; border-radius: 12px; box-shadow: 0 20px 75px #0009; }
dialog::backdrop { background: #091113b9; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-head h2 { margin: 3px 0; font-size: 24px; overflow-wrap: anywhere; }
.icon-button { margin: 0; width: 36px; height: 36px; flex: none; font-size: 26px; line-height: 1; background: #272d2f; border: 1px solid #485257; border-radius: 6px; color: inherit; }
#point-form label { display: grid; gap: 6px; margin-bottom: 12px; font-weight: 700; }
#point-form label > * { font-weight: 400; }
textarea { resize: vertical; }
[type=file] { max-width: 100%; }
.image-field img { display: block; width: 100%; max-height: 230px; object-fit: contain; background: #101314; border-radius: 7px; margin-bottom: 10px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.backup-note { color: var(--muted); }
.error { color: #ffafa3; margin: 8px 0 0; }
.error:empty { display: none; }
.toast { position: fixed; z-index: 5; inset: auto 50% 22px auto; transform: translateX(50%); max-width: calc(100% - 24px); padding: 10px 18px; border: 1px solid #77705e; border-radius: 7px; background: #252a2b; box-shadow: 0 3px 16px #0008; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 850px) { .map-label { top: 13px; left: 13px; } .placement { top: 61px; } }
@media (max-width: 660px) {
  .topbar { height: 64px; padding-inline: 13px; }
  .storage-label { display: none; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand strong { font-size: 13px; }
  .brand small { font-size: 10px; }
  .topbar .button { min-height: 35px; padding-inline: 9px; font-size: 14px; }
  .workspace { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - 64px); }
  .map-shell { order: -1; height: 52dvh; min-height: 310px; }
  .sidebar { flex: 1; border-right: 0; border-top: 1px solid var(--border); }
  .sidebar-head { padding-top: 20px; padding-bottom: 14px; }
  h1 { font-size: 28px; }
  .sidebar-head p { margin-bottom: 13px; }
  .map-controls { right: 10px; bottom: 37px; }
}
