:root {
  color-scheme: light;
  --paper: #f6f2e9;
  --surface: #fffdf7;
  --ink: #233a33;
  --muted: #556259;
  --line: #ded9cb;
  --green: #24564a;
  --earth: #854b35;
  --serif: "Noto Serif SC", "Songti SC", SimSun, Georgia, serif;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
h1, h2, .brand, .record strong { font-family: var(--serif); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 9px 14px; }
button:disabled { cursor: default; opacity: .6; }
button:not(:disabled):hover { border-color: var(--green); }
:focus-visible { outline: 3px solid #ad6c36; outline-offset: 3px; }
.shell { width: min(1230px, calc(100% - 96px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  height: 71px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px clamp(22px, 3vw, 46px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; justify-self: start; white-space: nowrap; font-size: 20px; font-weight: 700; letter-spacing: .06em; }
.brandmark { display: block; width: 32px; height: 32px; border-radius: 7px; background: var(--green); }
.site-nav { display: flex; align-items: center; justify-self: start; gap: clamp(16px, 2.5vw, 35px); font-size: 15px; font-weight: 550; white-space: nowrap; }
.site-nav a, footer a { text-underline-offset: 5px; }
.site-nav a:hover, footer a:hover { text-decoration: underline; }
.quiet { justify-self: end; min-height: 38px; background: transparent; font-size: 14px; white-space: nowrap; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  min-height: clamp(390px, 35vw, 480px);
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.hero:has(.hero-media[hidden]) { grid-template-columns: minmax(0, 1fr); min-height: 0; }
.hero-media { position: relative; background: #e2eadf; }
.hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 46%; }
.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 3.4vw, 50px);
}
.hero h1 { margin-bottom: 19px; color: var(--green); font-size: clamp(40px, 5vw, 72px); letter-spacing: .085em; line-height: 1.15; }
.hero-description { color: var(--muted); font-size: 16px; line-height: 1.8; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.hero-link, .primary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid transparent; border-radius: 8px; padding: 8px 17px; background: var(--green); color: var(--surface); font-weight: 600; }
.hero-link:hover, .primary:not(:disabled):hover { background: #20483f; }
.hero .primary { background: transparent; border-color: #a9b5a5; color: var(--green); }
.hero .primary:not(:disabled):hover { background: #e9efe7; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 420px; gap: 12px; border-top: 1px solid var(--line); margin-top: clamp(25px, 4vw, 43px); padding-top: 20px; }
.stats div { display: flex; flex-direction: column; gap: 5px; }
.stats dd { order: -1; color: var(--green); font: 400 clamp(30px, 3vw, 40px)/1 Georgia, serif; font-variant-numeric: lining-nums; }
.stats dt { color: var(--muted); font-size: 13px; }
.dashboard { display: grid; gap: clamp(44px, 6vw, 76px); margin: clamp(34px, 5vw, 66px) 0 60px; }
.dashboard > section { min-width: 0; scroll-margin-top: 20px; }
.section-title { display: flex; align-items: baseline; gap: 13px; margin-bottom: 18px; }
.section-title h2 { font-size: clamp(26px, 2.7vw, 36px); line-height: 1.28; letter-spacing: .045em; }
.map-section > .section-title { align-items: center; gap: 20px; }
.map-section > .section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.atlas-layout { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr); gap: clamp(16px, 2.3vw, 30px); align-items: start; }
.atlas { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.mapbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 49px; padding: 10px 16px; }
#crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 15px; font-weight: 650; }
#crumb button, .textbtn { border: 0; padding: 2px 0; background: transparent; color: var(--green); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.legend-photo { background: linear-gradient(140deg,#d9af70 48%,#6f946b 50%,#477c94); }
.legend-visited { background: #4f7a56; }
.legend-empty { background: #e9e8d9; border: 1px solid #9ba79a; }
.mapfield { position: relative; height: clamp(450px, 49vw, 580px); background: #e7eeea; background-image: linear-gradient(#cfdcd580 1px, transparent 1px), linear-gradient(90deg, #cfdcd580 1px, transparent 1px); background-size: 36px 36px; }
#map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
.mapfield.is-picking #map, .mapfield.is-picking .region { cursor: crosshair; }
#map.is-dragging, #map.is-dragging * { cursor: grabbing; }
#map:focus-visible { outline-offset: -4px; }
#map:focus:not(:focus-visible), .region:focus { outline: none; }
.region:focus-visible, .region.visited:focus-visible { stroke: #ad6c36; stroke-width: 2.5; }
.north { position: absolute; z-index: 1; top: 16px; left: 19px; display: grid; gap: 5px; justify-items: center; color: #526a58; font-size: 12px; pointer-events: none; }
.north i { width: 13px; height: 21px; background: #526a58; clip-path: polygon(50% 0,100% 100%,50% 75%,0 100%); }
.region { stroke: #8c9e8d; fill: #e9e8d9; stroke-width: .85; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .15s, stroke .2s, stroke-width .2s; }
.region.visited { fill: #4f7a56; stroke: #3c6245; }
.region:hover, .region:focus-visible { fill: #9bb49a; }
.city-region { stroke: #8b9e8b; stroke-width: .58; }
.region.photo-covered { fill: var(--region-cover); }
.region.photo-covered:hover:not(:focus-visible) { stroke: #f4f2df; }
.region[aria-pressed="true"]:not(:focus-visible) { stroke: #3f6652; stroke-width: 1.8; }
@media (prefers-reduced-motion: reduce) {
  .region { transition: none; }
}
.label { fill: #2d4235; stroke: #eff2e7; stroke-width: 2.2; stroke-linejoin: round; paint-order: stroke; font-weight: 600; pointer-events: none; }
.label.photo-label { stroke: #fffdf4; stroke-width: 3.2; }
.map-labels, .map-offshore { pointer-events: none; }
.label.city-label { pointer-events: auto; cursor: pointer; }
.mapfield.is-picking .city-label { pointer-events: none; }
.territory-label { font-weight: 600; fill: #315746; stroke: #f5f8ee; stroke-width: 2.4; paint-order: stroke; }
.map-controls { position: absolute; left: 11px; bottom: 12px; display: grid; border: 1px solid #aebead; border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: 0 2px 7px #213b3020; }
.map-controls button { width: 38px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 0; padding: 0; font-size: 23px; line-height: 1; }
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover { background: #e6ede2; }
.map-controls button:focus-visible { outline-offset: -4px; }
.maphelp { min-height: 44px; padding: 11px 15px; font-size: 14px; color: var(--muted); }
.maphelp .textbtn { margin-left: 6px; }
.area-panel { position: sticky; top: 16px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: clamp(16px, 1.7vw, 22px); }
.area-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 14px; }
.area-heading h3 { margin: 0; font: 700 22px/1.4 var(--serif); }
.area-heading .textbtn { flex-shrink: 0; padding-block: 9px; }
.area-list { display: grid; max-height: 390px; overflow-y: auto; }
.area-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 3px; min-height: 47px; text-align: left; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.area-row:hover { background: #eef2e8; }
.area-row:focus-visible { outline-offset: -3px; }
.area-row img { width: 54px; height: 42px; flex-shrink: 0; object-fit: cover; border-radius: 4px; }
.area-overview img { width: 68px; height: 52px; border-radius: 6px; }
.area-overview .meta { font-size: 13px; }
.area-entry { display: grid; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.area-note { margin-top: 2px; color: var(--muted); white-space: pre-wrap; }
.area-arrow { padding-inline: 4px; color: var(--green); font-size: 22px; }
.area-empty { padding-top: 8px; color: var(--muted); font-size: 14px; }
.meta { font-size: 14px; color: var(--muted); }
.journal-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.journal-heading .section-title { margin: 0; }
.journal-tools { width: min(100%, 330px); }
input, select, textarea { min-width: 0; background: var(--surface); border: 1px solid #cbd0c4; border-radius: 7px; padding: 9px 11px; }
.search { width: 100%; min-height: 44px; padding-inline: 14px; }
#feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: clamp(14px, 2vw, 24px); align-items: stretch; }
#feed .empty { grid-column: 1 / -1; }
.record { display: flex; flex-direction: column; width: 100%; text-align: left; padding: 0; overflow: hidden; background: var(--surface); border-radius: 14px; transition: border-color .16s, box-shadow .16s; }
.record:hover { box-shadow: 0 4px 16px #293e3010; }
.record-body { display: grid; gap: 7px; padding: 18px 20px 20px; overflow-wrap: anywhere; }
.record strong { color: var(--ink); font-size: 25px; line-height: 1.3; }
.record-meta, .record-photos { color: var(--muted); font-size: 13px; }
.record-meta:empty { display: none; }
.record-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 15px; }
.member-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: -3px 0 16px; }
.member-filter button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 5px 12px; font-size: 14px; }
.member-filter button[aria-pressed="true"] { border-color: #83a08c; background: #e7eee4; color: var(--green); font-weight: 700; }
.member-avatar { display: inline-grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; background: #efe1ce; font: 16px/1 "Segoe UI Emoji", sans-serif; }
.member-avatar[data-member="2"] { background: #f5e6b9; }
.member-avatar[data-member="3"] { background: #e7e0ed; }
.participant-badges { display: flex; flex-wrap: wrap; gap: 5px 9px; }
.participant-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.participant-badge .member-avatar { flex-basis: 20px; width: 20px; height: 20px; font-size: 12px; }
.participants { min-width: 0; margin: 0; padding: 8px 0 0; border: 0; }
.participants legend { font-size: 14px; font-weight: 600; }
.participant-options { display: flex; flex-wrap: wrap; gap: 7px; }
.participant-options label { display: inline-flex; align-items: center; min-height: 43px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.participant-options label:has(:checked) { border-color: #83a08c; background: #e7eee4; }
.participant-options input { width: auto; accent-color: var(--green); }
.member-roster { display: grid; }
.member-row { display: flex; align-items: center; gap: 10px; min-height: 59px; padding: 9px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.member-row .member-avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 19px; }
.member-edit { flex: 0 0 auto; margin-inline-start: auto; min-height: 37px; padding: 5px 11px; font-size: 14px; color: var(--green); }
.family-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 3px; }
#family-logout { margin-inline-start: auto; min-height: 44px; border-color: #c4cec5; color: var(--muted); font-size: 14px; }
#family-logout:hover { background: #eef1e9; color: var(--ink); }
.family-contribution { padding: 11px 12px; border-radius: 8px; background: #eef1e9; }
.access-card { width: min(100%, 430px); margin: clamp(35px, 10vh, 110px) auto; padding: clamp(20px, 5vw, 36px); background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.access-card h1 { margin-bottom: 20px; }
.record .thumb { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e5ebdf; }
.empty { color: var(--muted); padding: 25px 16px; text-align: center; border: 1px dashed #cbd3c7; border-radius: 9px; }
footer { padding: 20px 0 28px; border-top: 1px solid var(--line); text-align: right; font-size: 14px; color: var(--muted); }
dialog { width: min(540px, calc(100% - 28px)); max-height: 88dvh; overflow: auto; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 23px; box-shadow: 0 24px 90px #142c3355; }
dialog::backdrop { background: #1d363a77; }
.section-title h2:focus, .area-heading h3:focus, .dialoghead h2:focus { outline: none; }
.dialoghead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.dialoghead h2 { font-size: 25px; overflow-wrap: anywhere; }
.dialoghead button { border: 0; background: transparent; font-size: 26px; padding: 0 7px; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.stack input, .stack textarea, .stack select { width: 100%; }
.stack textarea { resize: vertical; }
.stack .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack .row label { flex: 1; }
.helper, .position { color: var(--muted); font-size: 14px; }
.position { display: flex; align-items: center; gap: 14px; }
.filelist { display: grid; gap: 6px; }
.filelist:empty, .error:empty { display: none; }
.filelist > div { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.filelist img { width: 46px; height: 38px; object-fit: cover; border-radius: 4px; }
.filelist span { flex: 1; overflow-wrap: anywhere; font-size: 14px; }
.filelist button { padding: 3px 8px; font-size: 14px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gallery button { padding: 0; overflow: hidden; aspect-ratio: 4 / 3; }
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
.memo { white-space: pre-wrap; overflow-wrap: anywhere; }
.largephoto { max-width: 100%; max-height: 65vh; margin: auto; border-radius: 7px; }
.photo-note { display: grid; gap: 8px; min-width: 0; padding: 10px 0; border-block: 1px solid var(--line); }
.photo-note .memo { margin-bottom: 6px; }
.photo-note form { gap: 8px; }
.photo-back { justify-self: start; }
.photo-settings summary { color: var(--muted); cursor: pointer; font-size: 14px; }
.photo-cover-controls { display: grid; gap: 8px; margin-top: 9px; }
.visit-actions { padding-top: 12px; border-top: 1px solid var(--line); }
.danger, .error { color: #943b2b; }
.error { font-size: 14px; }
#qr { justify-self: center; background: white; padding: 5px; border: 1px solid var(--line); border-radius: 8px; }
#qr svg { display: block; width: min(218px, 100%); height: auto; }
#notice { position: fixed; z-index: 3; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: 90vw; width: max-content; background: var(--ink); color: white; padding: 10px 15px; border-radius: 8px; font-size: 14px; }
#notice:empty { display: none; }
@media (max-width: 850px) {
  .shell { width: calc(100% - 40px); }
  .hero { min-height: 350px; margin-top: 19px; }
  .dashboard { margin-bottom: 40px; }
  .atlas-layout { grid-template-columns: 1fr; gap: 12px; }
  .area-panel { position: static; }
  .mapfield { height: clamp(345px, 80vw, 520px); }
}
@media (max-width: 650px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-media { grid-row: 1; aspect-ratio: 16 / 9; }
  .hero-copy { padding: 24px; }
  .hero h1 { font-size: clamp(39px, 11vw, 56px); margin-bottom: 9px; }
  .hero-actions { margin-top: 17px; }
  .stats { max-width: none; margin-top: 20px; padding-top: 14px; }
  .journal-heading { align-items: stretch; flex-direction: column; margin-bottom: 14px; }
  .journal-heading .section-title { justify-content: space-between; }
  .journal-tools { width: 100%; }
  .record .thumb { aspect-ratio: 3 / 2; }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 28px); }
  .header-inner { height: 59px; gap: 8px 14px; }
  .brand { gap: 6px; font-size: 17px; }
  .brandmark { width: 26px; height: 26px; border-radius: 6px; }
  .site-nav { gap: 10px; font-size: 13px; }
  .quiet { padding: 6px 7px; font-size: 12px; }
  .hero { margin-top: 12px; border-radius: 14px; }
  .hero-copy { padding: 21px 20px 20px; }
  .hero-description { font-size: 15px; }
  .stats dt { font-size: 12px; }
  .dashboard { margin-top: 29px; }
  .mapbar { padding-inline: 11px; }
  .maphelp { padding-inline: 11px; }
  dialog { padding: 16px; }
}
@media (max-width: 350px) {
  .header-inner { grid-template-columns: 1fr auto; height: auto; padding-block: 9px; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; }
}
