@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  color: #25342e;
  background: #e8e9e1;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --forest: #193b32;
  --muted: #838b81;
  --line: #e9ebe4;
  --paper: #fffefa;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; min-height: 100%; }
body { min-width: 0; min-height: 100vh; min-height: 100dvh; margin: 0; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; width: 100%; height: 100vh; height: 100dvh; min-height: 0; grid-template-columns: minmax(360px, min(440px, 36vw)) minmax(0, 1fr); padding: 18px; gap: 18px; }
.sidebar { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow-y: auto; padding: 22px 22px 18px; background: var(--paper); border: 1px solid rgba(34, 56, 42, .06); border-radius: 8px; box-shadow: 0 8px 30px rgba(36, 52, 41, .06); z-index: 2; }
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 13px; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: #f0e8cc; background: var(--forest); font-size: 20px; font-weight: 600; }
.eyebrow, .section-kicker { display: block; margin: 0; color: #92968a; font-size: 9px; font-weight: 700; letter-spacing: 1.55px; }
.brand h1 { margin: 4px 0 0; color: #213a30; font-size: 18px; font-weight: 600; letter-spacing: .3px; }
.brand h1 span { margin-left: 6px; color: #7b8479; font-size: 14px; font-weight: 400; }
.brand-home-link { display: inline-block; margin-top: 4px; color: #718071; font-size: 10px; text-decoration: none; }
.brand-home-link:hover { color: var(--forest); text-decoration: underline; }
.account-panel { margin-top: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #f8f9f5; }
.account-actions { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.account-actions > span { min-width: 0; color: #58685a; font-size: 10px; overflow-wrap: anywhere; }
.account-identity { display: grid; flex: 1; gap: 4px; min-width: 0; }
.account-identity > div, .profile-identities > div { display: flex; gap: 6px; min-width: 0; font-size: 10px; overflow-wrap: anywhere; }
.account-identity span, .profile-identities span { flex: 0 0 42px; color: #858d80; }
.account-identity strong, .profile-identities strong { min-width: 0; color: #415b49; font-weight: 600; }
.profile-identities { display: grid; gap: 7px; margin-top: 13px; padding: 10px; border-radius: 3px; background: #f5f6f1; }
.profile-identities span { flex-basis: 54px; }
.account-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.account-button { padding: 6px 9px; border: 1px solid var(--forest); border-radius: 3px; background: var(--forest); color: white; font-size: 9px; white-space: nowrap; }
.account-button.secondary { border-color: #dfe3d9; background: #fff; color: #617062; }
.account-button:hover { filter: brightness(.97); }
.friend-button { position: relative; }
.friend-request-indicator { position: absolute; top: -4px; left: -4px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #e54747; box-shadow: 0 0 0 1px rgba(229, 71, 71, .15); }
.friend-message-badge { position: absolute; top: -9px; right: -9px; display: grid; min-width: 18px; height: 18px; place-items: center; padding: 0 5px; border: 2px solid #fff; border-radius: 12px; background: #e54747; color: #fff; font-size: 9px; line-height: 1; box-shadow: 0 1px 3px rgba(100, 20, 20, .2); }
.friend-message-badge[hidden] { display: none; }
.intro-card { margin-top: 25px; padding: 15px 16px; background: #f3f4ee; border-left: 2px solid #a2ad82; }
.intro-card p { margin: 7px 0 0; color: #727b71; font-size: 11px; line-height: 1.85; }
.coordinate-card { flex: 0 0 auto; margin-top: 22px; padding: 17px; border: 1px solid var(--line); border-radius: 5px; }
.card-heading, .section-title-row { display: flex; align-items: center; justify-content: space-between; }
.card-heading h2, .section-title-row h2 { margin: 4px 0 0; color: #26382f; font-size: 15px; font-weight: 600; }
.status-dot { color: #a0a59a; font-size: 10px; }
.status-dot.ready { color: #668364; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 17px; }
.info-cell { min-width: 0; padding: 10px 11px; background: #f7f8f4; }
.info-cell span, .elevation-line > span { display: block; color: #92988d; font-family: var(--mono); font-size: 9px; letter-spacing: .3px; }
.info-cell strong { display: block; overflow: hidden; margin-top: 5px; color: #334c3d; font-family: var(--mono); font-size: 12px; font-weight: 500; text-overflow: ellipsis; }
.place-name-line { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; margin-top: 12px; padding: 10px 11px; background: #f7f8f4; }
.place-name-line > span { color: #92988d; font-size: 10px; }
.place-name-line strong { min-width: 0; color: #334c3d; font-size: 11px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.elevation-line { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; }
.elevation-line strong { color: #314c3b; font-family: var(--mono); font-size: 19px; font-weight: 500; }
.elevation-line small { color: #969b90; font-family: "DM Sans", sans-serif; font-size: 10px; }
.data-note { margin: 7px 0 0; color: #a0a397; font-size: 9px; }
.markers-section { display: flex; min-width: 0; min-height: auto; flex: 0 0 auto; flex-direction: column; margin-top: 25px; }
.tracks-section { display: flex; min-width: 0; flex: 0 0 auto; flex-direction: column; margin-top: 20px; }
.count-pill { display: inline-grid; min-width: 20px; height: 20px; margin-left: 4px; place-items: center; padding: 0 5px; border-radius: 12px; background: #eef1e9; color: #65765f; font-family: var(--mono); font-size: 10px; vertical-align: 1px; }
.icon-button { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: #728075; font-size: 17px; }
.icon-button:hover { background: #f4f5ef; }
.legend { display: flex; gap: 15px; margin: 14px 0 11px; color: #81877d; font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #8b7754; }
.legend-dot.approximate { background: #81917c; }
.marker-list { min-width: 0; flex: 0 0 auto; overflow: visible; }
.empty-state { padding: 19px 10px; border: 1px dashed #e3e6dc; border-radius: 4px; color: #a0a397; font-size: 11px; line-height: 1.9; text-align: center; }
.marker-item { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 7px 10px; padding: 12px 2px; border-bottom: 1px solid #eff0eb; }
.marker-item-main { min-width: 0; cursor: pointer; }
.marker-item h3 { margin: 0; color: #34483b; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.marker-item p { margin: 5px 0 0; color: #858c81; font-family: var(--mono); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.marker-item p.marker-note { margin-top: 6px; color: #727b71; font-family: inherit; font-size: 11px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.marker-photo-thumb { display: block; width: min(100%, 220px); max-height: 140px; margin-top: 8px; border-radius: 4px; object-fit: cover; }
.marker-photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-top: 8px; }
.marker-photo-gallery .marker-photo-thumb { width: 100%; height: 86px; margin: 0; }
.marker-popup { min-width: 140px; max-width: 240px; padding: 3px; color: #34483b; font-family: "DM Sans", "Noto Sans SC", sans-serif; }
.marker-popup strong { font-size: 12px; }
.marker-popup-note { margin-top: 6px; color: #727b71; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.marker-popup-image { display: block; width: min(100%, 260px); max-height: 190px; margin-top: 8px; border-radius: 4px; object-fit: cover; }
.marker-note { margin: 6px 0 0; color: #727b71; font-size: 10px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.marker-kind { flex: 0 0 auto; margin-top: 1px; padding: 3px 6px; border-radius: 3px; background: #f3efe7; color: #8b7754; font-size: 9px; }
.marker-kind.approximate { background: #edf1e9; color: #74876e; }
.marker-actions { display: flex; max-width: 190px; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.marker-action { padding: 3px 5px; border: 1px solid #e9ebe4; border-radius: 3px; background: #fff; color: #687568; font-size: 9px; white-space: nowrap; }
.marker-action:hover { background: #f3f5ef; }
.delete-marker { padding: 2px 5px; border: 0; background: transparent; color: #afb2a7; font-size: 15px; }
.delete-marker:hover { color: #aa5945; }
.track-list { overflow: visible; }
.pagination { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; margin-top: 8px; color: #858d80; font-size: 9px; }
.pagination[hidden] { display: none; }
.pagination-summary { margin-right: auto; }
.pagination-size, .pagination-button { min-height: 27px; padding: 4px 7px; border: 1px solid #e4e6df; border-radius: 3px; background: #fff; color: #657265; font-size: 9px; }
.pagination-button:disabled { opacity: .45; cursor: default; }
.pagination-page { min-width: 36px; text-align: center; }
.chat-pagination { flex: 0 0 auto; margin: 10px 0 -7px; }
.marker-history-dialog .pagination { margin-bottom: 4px; }
.shared-section { margin-top: 18px; }
.shared-list, .friends-list { display: grid; gap: 7px; margin-top: 10px; }
.shared-item, .friend-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.shared-item > div, .friend-row > div:first-child { display: grid; min-width: 0; gap: 4px; }
.friend-row > div:first-child { flex: 1; }
.friend-identity { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.friend-unread-badge { display: inline-grid; min-width: 18px; height: 18px; place-items: center; padding: 0 5px; border-radius: 10px; background: #e54747; color: #fff !important; font-size: 9px !important; line-height: 1; }
.friend-row.has-unread { border-color: #f0d7d5; background: #fffdfd; }
.shared-item strong, .friend-row strong { color: #415749; font-size: 10px; overflow-wrap: anywhere; }
.shared-item span, .friend-row span { color: #90978b; font-size: 9px; }
.friend-actions { display: flex; flex: 0 0 auto; gap: 4px; }
.shared-attribution { margin-top: 5px; color: #8b6596; font-size: 10px; }
.shared-marker { background: #925ea0; }
.live-share-marker { display: grid; width: 30px; height: 30px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: #9851b3; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 2px 8px rgba(44, 21, 52, .38); }
.track-item { display: flex; align-items: center; gap: 8px; padding: 10px 2px; border-bottom: 1px solid #eff0eb; }
.track-item-main { min-width: 0; flex: 1; }
.track-item h3 { margin: 0; color: #34483b; font-size: 11px; font-weight: 600; }
.track-item p { margin: 4px 0 0; color: #9a9d92; font-size: 9px; line-height: 1.55; }
.track-actions { display: flex; flex: 0 0 auto; gap: 3px; }
.track-action { padding: 4px 6px; border: 1px solid #e9ebe4; border-radius: 3px; background: #fff; color: #687568; font-size: 9px; }
.track-action:hover { background: #f3f5ef; }
.track-action.delete { color: #a45143; }
.clear-track-button { width: auto; padding: 0 7px; color: #a45143; font-size: 12px; }
.sidebar-footer { display: flex; align-items: center; gap: 7px; margin-top: 17px; padding-top: 14px; border-top: 1px solid #eff0eb; color: #969b90; font-size: 9px; }
.footer-pin { color: #82916e; font-size: 15px; }
.map-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; border-radius: 7px; background: #e4e7dd; box-shadow: 0 8px 30px rgba(36, 52, 41, .07); }
#map { position: absolute; inset: 0; }
.map-panel.map-rotated #map { transform: scale(var(--map-scale)) rotate(var(--map-bearing)); transform-origin: center; }
.compass-control { position: absolute; z-index: 1001; right: 18px; bottom: 56px; display: grid; justify-items: center; gap: 5px; width: 92px; padding: 4px; border-radius: 50px; background: rgba(27, 47, 43, .18); }
.compass-dial { position: relative; display: grid; width: 84px; height: 84px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #f4f5ed; cursor: grab; touch-action: none; user-select: none; }
.compass-dial:active { cursor: grabbing; }
.compass-dial svg { width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.compass-north { position: absolute; z-index: 1; top: 4px; color: #f4f5ed; font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 1; pointer-events: none; }
.compass-bearing { min-width: 36px; padding: 2px 5px; border-radius: 8px; background: rgba(24, 47, 43, .82); color: #fff; font-family: var(--mono); font-size: 10px; line-height: 1.2; text-align: center; }
.compass-reset { min-width: 54px; min-height: 27px; padding: 4px 9px; border: 1px solid rgba(255, 255, 255, .7); border-radius: 14px; background: rgba(255, 254, 250, .96); color: #405a49; font-size: 10px; line-height: 1; box-shadow: 0 2px 8px rgba(35, 49, 40, .14); }
.compass-reset:hover { background: #edf1e9; }
.compass-dial:focus-visible, .compass-reset:focus-visible { outline: 2px solid #718b6d; outline-offset: 2px; }
.map-topbar { position: absolute; z-index: 1000; top: 18px; right: 20px; left: 20px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.map-location, .map-controls { display: flex; align-items: center; min-height: 45px; border: 1px solid rgba(225, 227, 216, .8); border-radius: 5px; background: rgba(255, 254, 250, .94); box-shadow: 0 3px 12px rgba(35, 49, 40, .09); backdrop-filter: blur(8px); pointer-events: auto; }
.map-location { gap: 9px; padding: 7px 13px; }
.location-icon { color: #708668; font-size: 20px; }
.map-location strong, .map-location small { display: block; }
.map-location strong { color: #37463b; font-size: 11px; font-weight: 600; }
.map-location small { margin-top: 2px; color: #979b90; font-size: 9px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.place-search { position: absolute; z-index: 1001; top: 77px; right: 20px; display: flex; width: min(360px, calc(100% - 40px)); min-height: 42px; gap: 5px; padding: 4px; border: 1px solid rgba(225, 227, 216, .85); border-radius: 5px; background: rgba(255, 254, 250, .96); box-shadow: 0 3px 12px rgba(35, 49, 40, .09); }
.place-search input { min-width: 0; flex: 1; padding: 6px 9px; border: 0; outline: 0; background: transparent; color: #334339; font-size: 11px; }
.place-search input::placeholder { color: #a0a397; }
.place-search button { flex: 0 0 auto; padding: 0 12px; border: 0; border-radius: 3px; background: var(--forest); color: #fff; font-size: 10px; }
.place-search button:disabled { opacity: .65; cursor: wait; }
.place-search-results { position: absolute; top: calc(100% + 5px); right: 0; left: 0; max-height: min(300px, 42vh); overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); box-shadow: 0 8px 24px rgba(35, 49, 40, .16); }
.place-search-results[hidden] { display: none; }
.place-search-result { display: block; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid #eff0eb; background: transparent; color: #34483b; text-align: left; }
.place-search-result:last-child { border-bottom: 0; }
.place-search-result:hover, .place-search-result:focus { outline: 0; background: #f3f5ef; }
.place-search-result strong, .place-search-result span { display: block; }
.place-search-result strong { font-size: 11px; font-weight: 600; }
.place-search-result span { margin-top: 3px; color: #858c81; font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }
.place-search-message { margin: 0; padding: 12px; color: #858c81; font-size: 10px; }
.route-panel-toggle { position: absolute; z-index: 1001; top: 127px; right: 20px; padding: 9px 13px; border: 1px solid rgba(225, 227, 216, .85); border-radius: 4px; background: rgba(255, 254, 250, .96); box-shadow: 0 3px 12px rgba(35, 49, 40, .09); color: #34483b; font-size: 10px; }
.route-panel-toggle:hover, .route-panel-toggle[aria-expanded="true"] { background: var(--forest); color: #fff; }
.route-planner { position: absolute; z-index: 1002; top: 168px; right: 20px; display: flex; width: min(360px, calc(100% - 40px)); max-height: min(62dvh, 490px); flex-direction: column; overflow: hidden; border: 1px solid rgba(225, 227, 216, .9); border-radius: 5px; background: var(--paper); box-shadow: 0 8px 26px rgba(35, 49, 40, .18); }
.route-planner[hidden] { display: none; }
.route-planner-heading { display: flex; min-height: 38px; align-items: center; justify-content: space-between; padding: 0 11px; border-bottom: 1px solid var(--line); color: #34483b; font-size: 11px; }
.route-planner-heading button { width: 26px; height: 26px; border: 0; background: transparent; color: #838b81; font-size: 19px; }
.route-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 9px 10px 0; }
.route-mode { min-height: 31px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: #687568; font-size: 10px; }
.route-mode.active { border-color: var(--forest); background: var(--forest); color: #fff; }
#route-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 9px 10px; }
.route-endpoints { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) 25px; gap: 6px; }
.route-endpoints input { min-width: 0; height: 33px; padding: 6px 8px; border: 1px solid #e4e6df; border-radius: 3px; color: #334339; font-size: 10px; }
.route-endpoints input:first-of-type { grid-column: 1; grid-row: 1; }
.route-endpoints input:last-of-type { grid-column: 1; grid-row: 2; }
.route-swap { grid-column: 2; grid-row: 1 / span 2; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: #687568; font-size: 15px; }
.route-policy { grid-column: 1; min-width: 0; height: 32px; padding: 4px 7px; border: 1px solid #e4e6df; border-radius: 3px; background: #fff; color: #687568; font-size: 9px; }
.route-submit { grid-column: 2; grid-row: 2; min-width: 70px; border: 0; border-radius: 3px; background: var(--forest); color: #fff; font-size: 10px; }
.route-submit:disabled { opacity: .65; cursor: wait; }
.route-status { margin: 0; padding: 0 11px; color: #858c81; font-size: 9px; line-height: 1.5; }
.route-results { min-height: 0; flex: 1 1 auto; overflow: auto; padding: 0 10px 10px; }
.route-choice { display: block; width: 100%; margin-top: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: #34483b; text-align: left; }
.route-choice:hover, .route-choice.active { border-color: #718b6d; background: #f4f6f0; }
.route-choice strong, .route-choice span { display: block; }
.route-choice strong { font-size: 10px; font-weight: 600; line-height: 1.55; }
.route-choice span { margin-top: 4px; color: #858c81; font-size: 9px; line-height: 1.5; }
.route-endpoint-marker { display: grid; width: 30px; height: 30px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 2px 7px rgba(29, 39, 30, .35); }
.route-endpoint-start { background: #25825a; }
.route-endpoint-end { background: #c65343; }
.map-controls { gap: 3px; padding: 4px; }
.layer-button { min-width: 52px; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 3px; background: transparent; color: #777e73; font-size: 10px; touch-action: manipulation; }
.layer-button.active { background: #25473a; color: #fff; }
.tracking-controls { position: absolute; z-index: 1000; top: 77px; left: 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-width: calc(100% - 40px); padding: 7px 9px; border: 1px solid rgba(225, 227, 216, .8); border-radius: 5px; background: rgba(255, 254, 250, .95); box-shadow: 0 3px 12px rgba(35, 49, 40, .09); }
.track-button { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 4px; background: var(--forest); color: #fff; font-size: 10px; touch-action: manipulation; }
.track-button[hidden] { display: none; }
.track-button > span { font-size: 14px; }
.track-button.stop { background: #9b493d; }
.track-button:disabled { opacity: .65; cursor: wait; }
.tracking-status { color: #737d71; font-family: var(--mono); font-size: 9px; }
.tracking-status.recording { color: #a34b3b; }
.tracking-status.recording::before { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #b55241; content: ""; animation: recording-pulse 1.2s infinite; }
.live-share-toggle { background: #86529a; }
.live-share-picker { display: grid; flex-basis: 100%; gap: 6px; max-height: 250px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #fffefa; color: #657265; font-size: 9px; }
.live-share-picker strong { color: #465a49; font-size: 10px; }
.live-share-picker #live-share-options { display: grid; gap: 6px; }
.live-share-picker label { display: flex; align-items: center; gap: 7px; }
@keyframes recording-pulse { 50% { opacity: .35; } }
.location-marker { width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: #2582df; box-shadow: 0 1px 9px rgba(17, 78, 143, .65); }
.map-hint { position: absolute; bottom: 37px; left: 50%; display: flex; align-items: center; gap: 8px; padding: 9px 14px; transform: translateX(-50%); border: 1px solid rgba(229, 230, 219, .8); border-radius: 20px; background: rgba(255, 254, 250, .94); box-shadow: 0 3px 12px rgba(35, 49, 40, .09); color: #646e62; font-size: 10px; white-space: nowrap; pointer-events: none; }
.hint-crosshair { color: #708668; font-size: 15px; }
.map-attribution { position: absolute; right: 7px; bottom: 5px; padding: 3px 5px; background: rgba(255, 255, 255, .8); color: #73796e; font-size: 9px; pointer-events: none; }
.marker-dialog, .marker-history-dialog { width: min(440px, calc(100% - 32px)); max-height: min(88dvh, 760px); overflow: auto; padding: 25px; border: 1px solid #e8e9e1; border-radius: 7px; background: var(--paper); box-shadow: 0 18px 60px rgba(27, 42, 32, .2); color: #28392f; }
.social-dialog { width: min(460px, calc(100% - 28px)); max-height: min(88dvh, 700px); overflow: auto; padding: 22px; border: 1px solid #e8e9e1; border-radius: 7px; background: var(--paper); box-shadow: 0 18px 60px rgba(27, 42, 32, .2); color: #28392f; }
dialog.chat-dialog:not([open]) { display: none; }
dialog.chat-dialog[open] { display: flex; width: min(560px, calc(100% - 24px)); height: min(720px, 88dvh); max-height: 88dvh; flex-direction: column; }
.admin-dialog { width: min(920px, calc(100% - 24px)); max-height: min(92dvh, 900px); }
.marker-history-dialog { width: min(520px, calc(100% - 32px)); }
.marker-dialog::backdrop, .social-dialog::backdrop { background: rgba(24, 36, 29, .35); backdrop-filter: blur(2px); }
.marker-history-dialog::backdrop { background: rgba(24, 36, 29, .35); backdrop-filter: blur(2px); }
.dialog-top { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-top h2 { margin: 5px 0 0; font-size: 18px; font-weight: 600; }
.close-button { border: 0; font-size: 23px; }
.dialog-coordinates { margin: 15px 0 20px; padding: 9px 11px; background: #f5f6f1; color: #858d80; font-size: 10px; }
.dialog-coordinates span { margin-left: 5px; color: #415b49; font-family: var(--mono); font-size: 10px; }
.field-label { display: block; margin: 13px 0 6px; color: #647064; font-size: 10px; }
.field-label em { color: #a85943; font-style: normal; }
.field-label span { color: #a0a397; }
.marker-dialog input, .marker-dialog select, .marker-dialog textarea { width: 100%; padding: 10px 11px; border: 1px solid #e4e6df; border-radius: 3px; outline: none; background: #fff; color: #334339; font-size: 11px; }
.social-dialog input:not([type="checkbox"]) { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid #e4e6df; border-radius: 3px; outline: none; background: #fff; color: #334339; font-size: 11px; }
.social-hint { color: #848c80; font-size: 10px; line-height: 1.65; }
.social-hint strong { color: var(--forest); }
.forgot-password { margin-top: 10px; padding: 0; border: 0; background: transparent; color: #607b65; font-size: 10px; text-decoration: underline; }
.social-divider { height: 1px; margin: 17px 0; background: var(--line); }
.add-friend-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; }
.admin-toolbar p { margin: 0; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 13px 0 17px; }
.admin-stats > div { display: grid; gap: 5px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 4px; background: #f8f9f5; }
.admin-stats span, .admin-empty { color: #858d80; font-size: 10px; }
.admin-stats strong { color: #415b49; font-size: 15px; overflow-wrap: anywhere; }
.admin-section { margin-top: 16px; }
.admin-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.admin-section h3 { margin: 0; color: #4b604e; font-size: 12px; }
.admin-result-count { color: #858d80; font-size: 9px; white-space: nowrap; }
.admin-filters { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(110px, .34fr) minmax(110px, .34fr); gap: 7px; margin-bottom: 8px; }
.admin-session-filters { grid-template-columns: minmax(180px, 1fr); }
.admin-filters input, .admin-filters select { width: 100%; min-width: 0; min-height: 32px; padding: 6px 8px; border: 1px solid #e4e6df; border-radius: 3px; outline: none; background: #fff; color: #657265; font-size: 10px; }
.admin-list { display: grid; gap: 7px; }
.admin-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.admin-card-details { display: grid; gap: 5px; min-width: 0; }
.admin-card-details strong { color: #415b49; font-size: 10px; overflow-wrap: anywhere; }
.admin-card-details span, .admin-audit-row { color: #7a8377; font-size: 9px; line-height: 1.6; overflow-wrap: anywhere; }
.admin-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; flex: 0 0 auto; }
.admin-card-actions button, .admin-card-actions select, .admin-ip-form input { min-height: 31px; padding: 5px 8px; border: 1px solid #e4e6df; border-radius: 3px; background: #fff; color: #657265; font-size: 9px; }
.admin-card-actions select { max-width: 130px; }
.admin-ip-form { display: grid; grid-template-columns: minmax(120px, .9fr) minmax(140px, 1.5fr) auto; gap: 7px; }
.admin-ip-form input { width: 100%; }
.admin-empty { margin: 0; padding: 10px; }
.chat-messages { display: flex; min-height: 180px; flex: 1; flex-direction: column; gap: 9px; overflow: auto; margin: 15px 0 8px; padding: 11px; border: 1px solid var(--line); border-radius: 4px; background: #f8f9f5; }
.chat-search-form { display: flex; flex: 0 0 auto; gap: 6px; margin-top: 12px; }
.chat-search-form input { min-width: 0; min-height: 34px; flex: 1; padding: 7px 9px; border: 1px solid #e4e6df; border-radius: 3px; outline: none; background: #fff; color: #334339; font-size: 10px; }
.chat-search-form button { min-height: 34px; padding: 6px 9px; white-space: nowrap; }
.chat-search-panel { flex: 0 0 auto; margin-top: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.chat-search-status { margin: 0 0 6px; color: #858d80; font-size: 9px; }
.chat-search-results { display: grid; max-height: 150px; gap: 5px; overflow: auto; }
.chat-search-result { display: grid; gap: 4px; padding: 7px; border: 1px solid #eff0eb; border-radius: 3px; background: #fff; color: #34483b; text-align: left; }
.chat-search-result:hover { border-color: #b7c5ad; background: #f8f9f5; }
.chat-search-result-meta { color: #858d80; font-size: 9px; }
.chat-search-result-text, .chat-search-empty { margin: 0; color: #34483b; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-search-panel .pagination { margin-top: 6px; }
.chat-message-found { outline: 2px solid #8da77e; background: #f3f8e9; }
.chat-empty { margin: auto; color: #858d80; font-size: 11px; text-align: center; }
.chat-message { display: grid; max-width: 88%; gap: 5px; align-self: flex-start; padding: 8px 10px; border: 1px solid #e6e9e0; border-radius: 8px 8px 8px 2px; background: #fff; overflow-wrap: anywhere; }
.chat-message.own { align-self: flex-end; border-color: #dce8dc; border-radius: 8px 8px 2px 8px; background: #eef5ed; }
.chat-message.recalled { color: #858d80; font-style: italic; }
.chat-message-text { margin: 0; color: #34483b; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.chat-message img { display: block; max-width: min(280px, 100%); max-height: 300px; border-radius: 4px; object-fit: contain; }
.chat-message audio { width: min(280px, 100%); }
.chat-message-meta { display: flex; align-items: center; justify-content: flex-end; gap: 7px; color: #8b9288; font-size: 9px; }
.chat-message-meta button { padding: 1px 4px; border: 0; background: transparent; color: #94645b; font-size: 9px; }
.chat-form { display: grid; flex: 0 0 auto; gap: 7px; }
.chat-form textarea { width: 100%; min-height: 58px; resize: vertical; padding: 9px; border: 1px solid #e4e6df; border-radius: 4px; outline: none; background: #fff; color: #334339; font: inherit; font-size: 12px; }
.chat-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chat-toolbar button, .chat-upload { min-height: 34px; padding: 8px 10px; font-size: 10px; }
.chat-upload { display: inline-flex; align-items: center; cursor: pointer; }
.chat-record-status { flex: 1; color: #a34b3b; font-size: 10px; }
.friend-row { align-items: flex-start; }
.friend-presence { display: inline-flex; align-items: center; gap: 6px; }
.friend-presence::before { width: 7px; height: 7px; border-radius: 50%; content: ""; animation: presence-breathe 1.7s ease-in-out infinite; }
.friend-presence.online { color: #44845a !important; }
.friend-presence.online::before { background: #37ae5b; box-shadow: 0 0 0 0 rgba(55, 174, 91, .45); }
.friend-presence.offline { color: #b45151 !important; }
.friend-presence.offline::before { background: #df5555; box-shadow: 0 0 0 0 rgba(223, 85, 85, .4); }
@keyframes presence-breathe { 50% { opacity: .55; box-shadow: 0 0 0 4px transparent; } }
.chat-audio-bubble { display: flex; width: min(var(--audio-width, 150px), 100%); min-width: 105px; align-items: center; gap: 9px; padding: 7px 9px; border: 0; border-radius: 4px; background: transparent; color: #405c46; text-align: left; }
.chat-message.own .chat-audio-bubble { color: #365a3e; }
.chat-audio-play { width: 13px; font-size: 14px; }
.chat-audio-wave { flex: 1; color: #63806a; font-size: 14px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; }
.chat-audio-bubble.playing .chat-audio-wave { animation: audio-wave 700ms ease-in-out infinite alternate; }
.chat-audio-length { color: #77877a; font-size: 10px; white-space: nowrap; }
.chat-message audio { display: none; }
@keyframes audio-wave { to { opacity: .45; } }
.chat-record-button { touch-action: none; user-select: none; -webkit-user-select: none; }
.chat-record-button.recording { border-color: #b45a4f; background: #b45a4f; color: #fff; }
.chat-record-button.cancel-recording { border-color: #6f7370; background: #6f7370; }
.share-friend-option { display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 3px; color: #526453; font-size: 10px; }
.share-friend-option input, .live-share-picker input { accent-color: var(--forest); }
.marker-dialog input:focus, .marker-dialog select:focus, .marker-dialog textarea:focus { border-color: #84977d; box-shadow: 0 0 0 2px rgba(132, 151, 125, .12); }
.marker-dialog textarea { resize: vertical; }
.marker-dialog input[type="file"] { padding: 8px; }
.edit-coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.edit-coordinate-fields[hidden] { display: none; }
.marker-image-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 9px; }
.marker-image-preview[hidden] { display: none; }
.marker-image-item { display: grid; min-width: 0; justify-items: center; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 4px; }
.marker-image-item img { width: 100%; height: 76px; border-radius: 3px; object-fit: cover; }
.marker-image-item .button-secondary { padding: 5px 9px; }
.marker-popup-image { max-width: 100%; }
.marker-history-list { display: grid; gap: 9px; margin-top: 17px; }
.marker-history-entry { padding: 11px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.marker-history-entry h3 { margin: 0 0 8px; color: #52674f; font-size: 11px; }
.marker-history-entry ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.marker-history-entry li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; color: #727b71; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.marker-history-entry li strong { color: #455a49; }
.form-error { min-height: 14px; margin: 8px 0 0; color: #a84e3d; font-size: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 7px; }
.button-secondary, .button-primary { padding: 9px 15px; border: 1px solid #e4e6df; border-radius: 3px; font-size: 10px; }
.button-secondary { background: #fff; color: #727b70; }
.button-primary { border-color: var(--forest); background: var(--forest); color: #fff; }
.button-primary:disabled { opacity: .65; cursor: wait; }
.toast { position: fixed; z-index: 10; bottom: 23px; left: 50%; padding: 10px 16px; transform: translate(-50%, 12px); border-radius: 4px; background: #263f34; box-shadow: 0 5px 16px rgba(22, 36, 27, .18); color: #fff; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.tdt-marker { display: grid; width: 29px; height: 29px; place-items: center; border: 2px solid #fffefa; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: #8b7754; box-shadow: 0 2px 7px rgba(29, 39, 30, .35); }
.tdt-marker.approximate { background: #81917c; }
.tdt-marker span { transform: rotate(45deg); color: white; font-size: 12px; }
.search-result-marker { display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid #fffefa; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: #b54f42; box-shadow: 0 2px 7px rgba(29, 39, 30, .35); }
.search-result-marker span { transform: rotate(45deg); color: #fff; font-size: 12px; }
.track-point-marker { display: grid; width: 28px; height: 28px; place-items: center; border: 2px solid #fffefa; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 2px 7px rgba(29, 39, 30, .35); }
.track-point-start { background: #25825a; }
.track-point-end { background: #c65343; }
.track-point-single { background: #a45fcb; }
.track-point-popup { min-width: 150px; color: #34483b; font-family: "DM Sans", "Noto Sans SC", sans-serif; font-size: 11px; line-height: 1.8; }
.track-point-popup strong { font-size: 12px; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { display: flex; height: auto; min-height: 100vh; min-height: 100dvh; flex-direction: column; padding: 10px; gap: 10px; }
  .map-panel { order: -1; height: clamp(240px, 56dvh, 560px); min-height: 0; flex: 0 0 auto; }
  .map-panel.route-planner-open { height: clamp(420px, 72dvh, 620px); }
  .sidebar { min-height: 0; padding: 16px; }
  .coordinate-card { margin-top: 14px; }
  .markers-section { min-height: auto; flex: 0 0 auto; margin-top: 16px; }
  .marker-list { max-height: none; }
  .track-list { max-height: 130px; }
  .tracks-section { margin-top: 16px; }
  .shared-section { margin-top: 16px; }
  .sidebar-footer { margin-top: 12px; }
  .map-topbar { top: 11px; right: 10px; left: 10px; }
  .map-location { min-height: 40px; padding: 5px 9px; }
  .map-controls { min-height: 40px; }
  .layer-button { min-width: 43px; min-height: 40px; padding: 7px 6px; }
  .tracking-controls { z-index: 1003; top: 61px; left: 10px; gap: 5px; padding: 5px 6px; }
  .place-search { top: 109px; right: 10px; left: 10px; width: auto; }
  .route-panel-toggle { top: 158px; right: 10px; }
  .route-planner { top: 158px; right: 10px; bottom: 8px; left: 10px; width: auto; max-height: none; }
  .track-button { min-height: 32px; padding: 6px 8px; }
  .map-hint { bottom: 29px; }
  .compass-control { right: 10px; bottom: 52px; }
}

@media (max-width: 600px) {
  .chat-dialog { padding: 15px; }
  .chat-message { max-width: 94%; }
  .chat-toolbar { gap: 5px; }
  .chat-toolbar button, .chat-upload { padding: 7px; font-size: 9px; }
  .admin-dialog { padding: 16px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-filters { grid-template-columns: 1fr 1fr; }
  .admin-filters input { grid-column: 1 / -1; }
  .admin-card { align-items: flex-start; flex-direction: column; }
  .admin-card-actions { justify-content: flex-start; width: 100%; }
  .admin-ip-form { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .app-shell { padding: 7px; gap: 7px; }
  .map-topbar { right: 7px; left: 7px; }
  .map-location { gap: 5px; padding-right: 6px; padding-left: 6px; }
  .layer-button { min-width: 39px; padding-right: 4px; padding-left: 4px; }
  .tracking-controls { left: 7px; max-width: calc(100% - 14px); }
  .place-search { right: 7px; left: 7px; }
  .route-panel-toggle { right: 7px; }
  .route-planner { right: 7px; left: 7px; }
  .compass-control { right: 7px; }
  .sidebar { padding: 14px; }
  .brand { gap: 9px; }
  .brand h1 { font-size: 16px; }
}

@media (max-width: 280px) {
  .map-location > span:last-child { display: none; }
}

@media (max-height: 420px) and (max-width: 900px) {
  .map-panel { height: 68dvh; min-height: 210px; }
  .sidebar { padding-top: 14px; padding-bottom: 14px; }
  .intro-card { margin-top: 12px; padding-top: 10px; padding-bottom: 10px; }
}
