:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f4f3ef;
  background: #0c1217;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { display: flex; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: 350px; min-width: 350px; display: flex; flex-direction: column; padding: 29px 26px 18px; background: #10161b; border-right: 1px solid #2a343b; z-index: 400; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 13px; font-weight: 650; letter-spacing: .03em; color: #e8ebe8; }
.brand-mark { display: grid; place-items: center; width: 24px; height: 24px; background: #e5b46c; border-radius: 7px; color: #162022; font-size: 17px; }
.account-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; color: #9aa6aa; font-size: 11px; }
.account-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.password-controls { margin-top: 10px; color: #a9b7b8; font-size: 11px; }
.password-controls summary { cursor: pointer; }
.password-controls form { display: flex; flex-direction: column; gap: 8px; margin-top: 9px; }
.password-controls input { padding: 9px 10px; }
.password-controls button { padding: 9px 11px; border: 1px solid #46545b; border-radius: 8px; background: #1b282e; color: #e5d4ba; }
.account-bar button, .data-actions button, .registration-link-row button { border: 1px solid #46545b; border-radius: 8px; padding: 8px 11px; background: #1b282e; color: #e5d4ba; white-space: nowrap; }
.account-bar button:hover, .data-actions button:hover, .registration-link-row button:hover { border-color: #c29763; }
.admin-controls { margin-top: 18px; padding: 14px; border: 1px solid #3b4d53; border-radius: 10px; background: #172127; }
.admin-controls summary { color: #d8c3a3; font-size: 11px; cursor: pointer; }
.admin-controls[open] summary { margin-bottom: 12px; }
.admin-controls .field-label { margin-bottom: 6px; }
.admin-controls select { padding: 8px 10px; }
.registration-link-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.registration-link-row a { color: #d6b17d; font-size: 11px; }
.admin-message { margin: 8px 0 0; color: #abb9b8; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.admin-message a { color: #e8b46b; }
.review-panel { margin-top: 16px; padding-top: 14px; border-top: 1px solid #3b4d53; }
.review-heading { display: flex; align-items: center; gap: 9px; color: #d8c3a3; font-size: 11px; }
.review-heading button { margin-left: auto; padding: 0; border: 0; background: transparent; color: #d6b17d; font-size: 11px; }
.review-list { display: flex; flex-direction: column; gap: 9px; margin-top: 11px; }
.review-card { padding: 11px; border: 1px solid #3b4d53; border-radius: 8px; background: #1b2b31; }
.review-card strong, .review-card small { display: block; overflow-wrap: anywhere; }
.review-card strong { font-size: 12px; }
.review-card small { margin-top: 3px; color: #9aabaa; font-size: 10px; }
.review-card label { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0; color: #b9c6c5; font-size: 10px; line-height: 1.5; }
.review-card input { margin: 2px 0 0; }
.review-actions { display: flex; gap: 7px; }
.review-actions button { flex: 1; min-height: 36px; border: 1px solid #4c5d60; border-radius: 7px; background: #203138; color: #e5d4ba; font-size: 11px; }
.review-actions button:disabled { opacity: .45; cursor: default; }
.review-empty { margin: 0; color: #8d9c9d; font-size: 11px; }
.brand-separator { margin: 0 3px; color: #65737b; }
.intro { margin-top: 56px; }
.eyebrow { color: #cba573; font-size: 10px; font-weight: 750; letter-spacing: .2em; }
.intro h1 { margin: 15px 0 13px; font-size: clamp(42px, 4vw, 58px); line-height: 1.12; letter-spacing: -.065em; font-weight: 750; }
.intro h1 em { color: #e8b46b; font-style: normal; }
.intro p { margin: 0; color: #9aa6aa; font-size: 13px; line-height: 1.8; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 31px; padding: 19px 0 20px; border-top: 1px solid #2a343b; border-bottom: 1px solid #2a343b; }
.stats div { display: flex; flex-direction: column; gap: 5px; }
.stats strong { color: #e9b76f; font-size: 27px; font-weight: 700; line-height: 1; }
.stats span { color: #7f8d94; font-size: 11px; }
.panel-section { margin-top: 28px; }
.field-label { display: flex; justify-content: space-between; margin-bottom: 9px; color: #b6c0c2; font-size: 11px; font-weight: 600; }
.field-label span { color: #6f7e84; font-weight: 400; }
.text-field { width: 100%; border: 1px solid #354149; border-radius: 9px; outline: none; padding: 12px 13px; background: #182229; color: #f2f3ef; font-size: 13px; }
.text-field::placeholder { color: #66757c; }
.text-field:focus { border-color: #c29763; box-shadow: 0 0 0 2px #c2976322; }
textarea.text-field { resize: vertical; line-height: 1.6; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 13px; }
.section-heading h2, .section-heading h3 { margin: 0; font-size: 13px; font-weight: 700; }
.section-heading span { color: #79878d; font-size: 11px; }
.region-list, .city-list, .search-results { display: flex; flex-direction: column; gap: 7px; }
.region-row, .city-row, .search-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 13px; border: 1px solid #29353b; border-radius: 10px; background: #172127; color: #e7ebe9; text-align: left; }
.region-row:hover, .city-row:hover, .search-row:hover { border-color: #927857; background: #1d2a2e; }
.row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-main i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #dfa85f; box-shadow: 0 0 10px #dfa85f70; }
.row-main i.unvisited { background: #5c6d74; box-shadow: none; }
.row-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.row-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #829197; font-size: 10px; }
.row-chevron { margin-left: 8px; color: #b49b78; font-size: 16px; }
.empty-state { padding: 16px; border: 1px dashed #354149; border-radius: 10px; color: #8c9ba0; font-size: 12px; line-height: 1.65; }
.sidebar-footer { margin-top: auto; padding-top: 22px; color: #65737b; font-size: 10px; line-height: 1.5; }
.footer-dot { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #8caa96; }
.preview-button { margin-top: 18px; padding: 5px 0; border: 0; background: transparent; color: #7c8a8e; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.preview-button:hover { color: #d5b07d; }
.back-button { padding: 0; border: none; background: transparent; color: #b4a07f; font-size: 12px; text-align: left; }
.back-button { display: block; margin-bottom: 27px; }
.region-title { margin: 12px 0 5px; font-size: 26px; line-height: 1.2; }
.region-country { margin: 0; color: #85949a; font-size: 12px; }
.region-actions { display: flex; gap: 7px; margin-top: 20px; }
.region-actions button { flex: 1; min-height: 39px; border-radius: 8px; padding: 7px; font-size: 10px; }
.secondary-button { border: 1px solid #4c5a5d; background: #1c282c; color: #c8d0cb; }
.search-results { margin-top: 7px; max-height: 252px; overflow-y: auto; }
.search-row { padding: 9px 11px; }
.city-list { max-height: 35vh; overflow-y: auto; padding-right: 2px; }
.city-row { padding: 10px 12px; }
.load-more { width: 100%; padding: 11px; border: 1px dashed #5c6b70; border-radius: 8px; background: #1c282e; color: #d2ad7e; font-size: 11px; }
.map-shell { position: relative; flex: 1; min-width: 0; background: #07141d; }
#map { width: 100%; height: 100%; background: #07141d; }
.leaflet-container { background: #07141d; font-family: inherit; }
.leaflet-control-zoom { overflow: hidden; border: 1px solid #445158 !important; box-shadow: 0 4px 20px #0005 !important; }
.leaflet-control-zoom a { background: #17242b !important; color: #d8dcd6 !important; border-color: #35434a !important; }
.leaflet-control-zoom a:hover { background: #2d3d43 !important; }
.leaflet-tooltip { border: 1px solid #a2825c; border-radius: 7px; background: #152127; color: #f1ebe0; box-shadow: 0 8px 18px #0006; font-size: 12px; }
.leaflet-tooltip-top::before { border-top-color: #a2825c; }
.leaflet-tooltip.city-map-label { padding: 3px 6px; border-color: #516268; background: #12232be8; font-size: 10px; }
.city-dot-marker { border: 1px solid #9cabb0; border-radius: 50%; background: #10191f; box-shadow: 0 0 0 3px #102027a8; }
.city-dot-marker.visited { border: 2px solid #ffdc9d; background: #e7ae67; box-shadow: 0 0 12px #e7ae67a8; }
.city-dot-marker.selected { border: 3px solid #fff4d9; background: #f4bb72; box-shadow: 0 0 0 5px #f4bb7240, 0 0 17px #f4bb72; }
.map-label, .legend, .data-credit { position: absolute; z-index: 500; pointer-events: none; }
.map-label { top: 24px; left: 25px; display: flex; align-items: center; gap: 9px; padding: 9px 14px; border: 1px solid #32424b; border-radius: 30px; background: #102027e8; box-shadow: 0 5px 25px #0004; color: #d3dbd9; font-size: 11px; }
.map-label-dot { width: 6px; height: 6px; border-radius: 50%; background: #e7b36e; box-shadow: 0 0 10px #e7b36e; }
.legend { bottom: 28px; left: 26px; display: flex; gap: 17px; padding: 12px 15px; border: 1px solid #32424b; border-radius: 10px; background: #102027eb; color: #b8c5c5; font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend-visited { background: #e4ae69; }
.legend-unvisited { background: #11181d; border: 1px solid #647178; }
.legend-water { background: #07141d; border: 1px solid #28516a; }
.data-credit { right: 15px; bottom: 15px; color: #91a2a8; font-size: 9px; text-shadow: 0 1px 4px #000; }
.loading { position: absolute; z-index: 600; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 16px 21px; border: 1px solid #516168; border-radius: 11px; background: #152229f2; color: #e8bd84; font-size: 13px; box-shadow: 0 12px 32px #0008; }
.journal-drawer { width: 370px; min-width: 370px; z-index: 1100; padding: 28px 25px; overflow-y: auto; border-left: 1px solid #3a474d; background: #121b20; box-shadow: -15px 0 40px #0005; }
.drawer-top { display: flex; justify-content: space-between; align-items: center; }
.drawer-top button { border: none; background: none; color: #9ba9ad; font-size: 27px; line-height: 1; }
.drawer-back-button { display: block; margin-top: 19px; padding: 0; border: 0; background: transparent; color: #d6b17d; font-size: 12px; }
.journal-drawer h2 { margin: 22px 0 4px; font-size: 30px; }
.drawer-subtitle { margin: 0; color: #87969b; font-size: 12px; }
.city-switcher { margin-top: 20px; padding: 14px; border: 1px solid #384951; border-radius: 10px; background: #18252b; }
.city-switcher-heading { display: flex; justify-content: space-between; color: #b9c6c5; font-size: 11px; font-weight: 650; }
.city-switcher-heading span:last-child { color: #7d9094; font-weight: 400; }
.city-switcher-buttons { display: flex; gap: 7px; margin: 10px 0; }
.city-switcher-buttons button { flex: 1; padding: 9px 6px; border: 1px solid #4c5d60; border-radius: 7px; background: #203138; color: #d3dcd7; font-size: 11px; }
.city-switcher-buttons button:disabled { opacity: .35; cursor: default; }
.city-switcher .text-field { padding: 9px 10px; }
.journal-city-results { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; margin-top: 8px; }
.journal-city-results button { padding: 9px 10px; border: 1px solid #37494e; border-radius: 7px; background: #223239; color: #e1e8e3; text-align: left; font-size: 11px; }
.journal-city-results button:hover { border-color: #ba925d; }
.journal-entries { display: flex; flex-direction: column; gap: 12px; }
.journal-entry { padding: 14px; border: 1px solid #334148; border-radius: 10px; background: #1a262b; }
.entry-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.entry-date { color: #d1ae80; font-size: 10px; }
.entry-header button { border: none; background: transparent; color: #8c9da1; font-size: 10px; }
.journal-entry h4 { margin: 8px 0 5px; font-size: 13px; }
.journal-entry p { margin: 0; color: #b7c2c1; white-space: pre-wrap; font-size: 11px; line-height: 1.7; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 11px; }
.photo-grid img { width: 100%; height: 76px; object-fit: cover; border-radius: 5px; }
.journal-form { margin-top: 22px; padding-top: 19px; border-top: 1px solid #354148; }
.journal-form h3 { margin: 0 0 19px; font-size: 14px; }
.journal-form .text-field { margin-bottom: 16px; }
.photo-picker { display: flex; justify-content: space-between; align-items: center; margin: 3px 0 18px; padding: 14px; border: 1px dashed #55646a; border-radius: 9px; color: #d6b280; font-size: 11px; cursor: pointer; }
.photo-picker small { color: #819198; font-size: 10px; }
.save-button { display: flex; justify-content: space-between; width: 100%; padding: 13px 15px; border: none; border-radius: 9px; background: #e2af6d; color: #182126; font-size: 12px; font-weight: 750; }
.save-button:disabled { opacity: .6; cursor: wait; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 17px; padding-top: 14px; border-top: 1px solid #29353b; }
.data-actions button { flex: 1 1 auto; font-size: 11px; }
.data-actions button:disabled { opacity: .4; cursor: default; }
.auth-screen { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px; background: radial-gradient(circle at 70% 15%, #244149 0, #0c1217 55%); }
.auth-card { width: min(100%, 420px); padding: clamp(26px, 5vw, 40px); border: 1px solid #34464d; border-radius: 18px; background: #121c22; box-shadow: 0 28px 80px #0007; }
.auth-card .eyebrow { display: block; margin-top: 42px; }
.auth-card h1 { margin: 12px 0 8px; font-size: 34px; }
.auth-card p { color: #a4b0b0; font-size: 13px; line-height: 1.6; }
.auth-card form { display: flex; flex-direction: column; margin-top: 26px; }
.auth-card .field-label { margin-top: 13px; }
.auth-card .save-button { margin-top: 24px; }
.auth-card .auth-message { min-height: 20px; color: #e8b46b; overflow-wrap: anywhere; }
.auth-link { display: inline-block; padding: 9px 0; border: none; background: none; color: #d6b17d; font-size: 12px; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
#development-link { display: block; }

@media (max-width: 900px) {
  .sidebar { width: 300px; min-width: 300px; padding: 23px 20px 15px; }
  .journal-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(370px, 100vw); min-width: 0; }
}

@media (max-width: 620px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; height: min(44dvh, 390px); flex: 0 0 auto; padding: 14px 18px 18px; border-right: none; border-bottom: 1px solid #2a343b; }
  .account-bar { margin-top: 8px; }
  .intro { margin-top: 15px; }
  .intro h1 { display: none; }
  .intro p { display: none; }
  .stats { margin-top: 11px; padding: 10px 0; }
  .stats strong { font-size: 20px; }
  .panel-section { margin-top: 11px; }
  .sidebar-footer { display: none; }
  .panel-section .section-heading { margin: 15px 0 9px; }
  .city-list { max-height: none; }
  .map-shell { min-height: 0; flex: 1; }
  .map-label { top: 12px; left: 12px; }
  .legend { bottom: 12px; left: 12px; gap: 9px; padding: 8px 10px; }
  .data-credit { font-size: 8px; }
  .journal-drawer { width: 100%; top: 0; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .region-row, .city-row, .search-row, .load-more { min-height: 44px; }
  .data-actions button, .account-bar button, .registration-link-row button { min-height: 40px; }
}
