:root {
  --bg: #f4f2ec;
  --card: #fffdf8;
  --ink: #1e2a24;
  --muted: #66716a;
  --line: #ddd8cc;
  --accent: #2f6b4f;
  --accent-soft: #dcebe2;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 14px rgb(0 0 0 / .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714;
    --card: #1b221e;
    --ink: #e7ece8;
    --muted: #93a098;
    --line: #2c3530;
    --accent: #6fbf93;
    --accent-soft: #24382d;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2 { margin: 0; }
h2 { font-size: 15px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
button {
  font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { width: 30px; fill: var(--accent); }
.brand h1 { font-size: 22px; letter-spacing: -.01em; }
.sync { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.journey-link {
  text-decoration: none; font-weight: 600; color: var(--card); background: var(--accent);
  border-radius: 999px; padding: 6px 14px; font-size: 14px;
}
.journey-link:hover { filter: brightness(1.1); }

main { max-width: 1200px; margin: 0 auto; padding: 24px; display: grid; gap: 32px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.bar { height: 6px; background: var(--accent-soft); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

.people-head { display: flex; align-items: baseline; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--card); }
.chip .n { font-variant-numeric: tabular-nums; font-weight: 600; opacity: .75; }
.face { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); flex: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.hike {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column;
}
.hike:hover { border-color: var(--accent); }
.hike .cover { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--accent-soft); display: block; }
.hike .body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.hike .date { color: var(--muted); font-size: 13px; }
.hike .peak { font-weight: 600; font-size: 16px; }
.hike .meta { color: var(--muted); font-size: 13px; }
.who { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 13px; }
.who span { display: inline-flex; align-items: center; gap: 5px; }
.who .face { width: 22px; height: 22px; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

dialog {
  width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  border: 1px solid var(--line); border-radius: 18px; padding: 20px;
  background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgb(0 0 0 / .55); }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dlg-head h2 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 20px; margin: 0; }
.dlg-head p { margin: 4px 0 0; color: var(--muted); }
#dlg-close, .dlg-head .close { font-size: 20px; width: 36px; height: 36px; padding: 0; flex: none; }
.caption-edit {
  width: 100%; margin-bottom: 10px; font: inherit; font-weight: 600; color: var(--ink); background: var(--bg);
  border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px;
}
.caption-edit:focus { outline: none; border-color: var(--accent); border-style: solid; }
.photo .star {
  position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; padding: 0; line-height: 1;
  background: rgb(0 0 0 / .55); color: #fff; border: 0; font-size: 13px;
}
.photo.featured .star { background: #e8b53a; color: #000; }
.photo.featured img { outline: 3px solid #e8b53a; outline-offset: -3px; }
.who-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.who-edit .chip { cursor: default; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.who-edit .chip.manual { border-style: dashed; }
.who-edit .chip .rm { border: 0; background: none; padding: 0 0 0 2px; color: var(--muted); font-size: 15px; line-height: 1; }
.who-edit .chip .rm:hover { color: var(--ink); }
#dlg-add {
  font: inherit; color: var(--ink); background: var(--card); border: 1px dashed var(--line);
  border-radius: 999px; padding: 6px 12px; max-width: 200px;
}
#removed-list h3 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; color: var(--muted); }
.photo.gone { opacity: 0; transform: scale(.9); transition: opacity .2s, transform .2s; }
#dlg-preview { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #000; display: block; }
.hint { color: var(--muted); font-size: 13px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.photo { position: relative; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; cursor: pointer; background: var(--accent-soft); }
.photo.summit img { outline: 2px solid var(--accent); outline-offset: -2px; }
.photo .x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0; line-height: 1;
  background: rgb(0 0 0 / .55); color: #fff; border: 0; font-size: 14px;
}
.photo .x.restore { background: var(--accent); }
.photo .tag {
  position: absolute; left: 4px; bottom: 4px; font-size: 11px; padding: 1px 6px; border-radius: 6px;
  background: rgb(0 0 0 / .55); color: #fff;
}

@media (max-width: 600px) {
  .top, main { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: 1fr; }
}
