:root {
  color-scheme: light;
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #f5f1e7;
  --panel: #fffcf4;
  --ink: #23382d;
  --muted: #536557;
  --edge: #dcded2;
  --pine: #18493e;
  --sun: #fbd784;
  --shadow: 0 14px 38px -30px rgb(36 57 43 / 45%), 0 2px 10px rgb(65 62 36 / 5%);
  background: var(--paper);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
:focus-visible { outline: 3px solid #854c20; outline-offset: 3px; }
.wrap { width: min(100% - 72px, 1256px); margin-inline: auto; }
.skip-link { position: absolute; top: 6px; left: 6px; padding: 10px 14px; background: white; transform: translateY(-150%); z-index: 20; }
.skip-link:focus { transform: translateY(0); }

.site-header, .head-nav, .site-footer {
  display: flex;
  align-items: center;
  gap: 14px 24px;
}
.site-header { min-height: 80px; justify-content: space-between; }
.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { display: block; width: clamp(110px, 17vw, 175px); height: auto; }
.head-nav a { display: grid; align-items: center; min-height: 44px; font-size: .91rem; }

.intro {
  min-height: 195px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  background: radial-gradient(ellipse at 82% 0, #f4dea9, transparent 68%), linear-gradient(110deg, #e9ead6, #f7eacb);
  border: 1px solid #d8dac2;
  border-radius: 28px;
  padding: clamp(22px, 4.2vw, 52px);
  box-shadow: var(--shadow);
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { font-size: clamp(2.35rem, 5.4vw, 4.65rem); line-height: 1.02; letter-spacing: -.055em; }
h2 { font-size: clamp(1.57rem, 2.5vw, 2.1rem); line-height: 1.07; letter-spacing: -.032em; }
.intro p { max-width: 47ch; margin-top: 13px; color: var(--muted); }
.rules-link { margin-top: 12px; }
.profile {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 238px;
  max-width: 100%;
  padding: 11px 15px;
  border: 1px solid #e4d1a2;
  border-radius: 17px;
  background: #fffbf1;
  box-shadow: var(--shadow);
}
.profile-emblem {
  display: grid;
  flex: 0 0 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: #f9e6b8;
  color: #795126;
}
.profile-emblem img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-main { min-width: 0; overflow-wrap: anywhere; }
.profile-identity { display:flex; align-items:center; flex-wrap:wrap; gap:2px 8px; }
.profile-trainer-code, .result-author-number {
  color: var(--muted);
  font-size: .79rem;
  font-variant-numeric: tabular-nums;
}
.profile-role { border-radius:99px; padding:2px 7px; background:#efe4c8; color:#66461b; font-size:.68rem; font-weight:740; }
.profile-role.is-helper { background:#deeae9; color:#254d55; }
.profile-exchange.button { min-height:36px; padding:5px 0; text-decoration:underline; text-underline-offset:3px; font-size:.78rem; }
.profile-character { color: var(--muted); font-size: .84rem; }
.profile-coins { color: #684c19; font-size: .81rem; font-weight: 650; margin-top: 2px; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 0 12px; color: var(--muted); font-size: .81rem; }
.notice {
  padding: 12px 15px;
  margin-top: 16px;
  border-radius: 12px;
  background: #f4e5c7;
  color: #593d21;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.53fr) minmax(310px, 1fr);
  align-items: start;
  gap: 18px;
  margin-top: 24px;
}
.panel {
  min-width: 0;
  border: 1px solid var(--edge);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.map-panel { padding: clamp(13px, 2vw, 24px); }
.editor-panel { padding: clamp(19px, 3vw, 33px); }
.panel-heading, .review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
}
.panel-heading p, .editor-heading p, .review-heading p { margin-top: 7px; color: var(--muted); font-size: .93rem; }

.map-frame {
  position: relative;
  height: clamp(285px, 36vw, 480px);
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid #d1d9cd;
  border-radius: 17px;
  background: linear-gradient(150deg, #dfe5d8, #eceddc);
  isolation: isolate;
}
#map { position: absolute; inset: 0; }
#map .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.map-status {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: max-content;
  max-width: calc(100% - 38px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #fffdf2;
  color: var(--ink);
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.map-marker {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.map-marker::before {
  content: "";
  width: 21px;
  height: 21px;
  border: 2px solid #fffdf3;
  border-radius: 50%;
  background: #197e77;
  box-shadow: 0 2px 8px rgb(25 58 49 / 45%);
}
.map-marker:hover::before, .map-marker:focus-visible::before { background: #a06521; }
.map-marker--ancient::before {
  width: 19px;
  height: 19px;
  border-radius: 4px;
  background: #a86518;
  transform: rotate(45deg);
}
.map-marker.is-selected { z-index: 1; }
.map-marker.is-selected::before {
  background: #2259a4;
  box-shadow: 0 0 0 3px #2259a4, 0 3px 9px rgb(27 52 80 / 50%);
}
.map-marker--ancient.is-selected::before {
  background: #873786;
  box-shadow: 0 0 0 3px #873786, 0 3px 9px rgb(47 24 59 / 48%);
}
.map-point {
  width: 20px;
  height: 20px;
  border: 3px solid #fffdf3;
  border-radius: 50%;
  background: #82450e;
  box-shadow: 0 0 0 2px #82450e, 0 2px 8px rgb(45 25 7 / 40%);
  pointer-events: none;
  z-index: 2;
}
.map-point--review {
  background: #126e9b;
  box-shadow: 0 0 0 2px #126e9b, 0 2px 8px rgb(17 62 91 / 46%);
}
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 9px; color: var(--muted); font-size: .79rem; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-zoom-hint { margin-top:8px; color:var(--muted); font-size:.84rem; }
.legend-dot, .legend-cell, .legend-review { display: inline-block; width: 11px; height: 11px; flex: none; }
.legend-dot { border-radius: 50%; background: #197e77; }
.legend-dot-ancient { border-radius: 2px; background: #a86518; transform: rotate(45deg); }
.legend-cell { border: 2px dashed #557c8e; border-radius: 2px; }
.legend-review { border: 2px solid #126e9b; border-radius: 50%; background: #edf7ff; }
.review-map-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 10px;
  margin-top: 8px;
  padding: 2px 12px;
  border-radius: 10px;
  background: #e4edf4;
  color: #244560;
  font-size: .85rem;
  overflow-wrap: anywhere;
}
.map-next-step { margin-top: 8px; }
.cell-card { margin-top: 12px; padding: 12px 13px; border: 1px solid #c7dbda; border-radius: 14px; background: #edf6f4; }
.cell-heading { display: flex; flex-wrap: wrap; gap: 3px 12px; justify-content: space-between; align-items: baseline; }
.cell-heading span, .cell-capacity span { color: #425d62; font-size: .79rem; }
.cell-capacity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block: 8px; }
.cell-capacity > div { min-width: 0; padding: 6px 8px; border-radius: 8px; background: #fbfdfa; }
.cell-capacity > div:nth-child(2) { background: #fff6df; }
.cell-capacity strong, .cell-capacity span { display: block; }
.cell-capacity strong { font-size: 1.04rem; font-variant-numeric: tabular-nums; }
.cell-result { color: #234950; font-size: .85rem; }

.coordinates {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 9px;
  margin-top: 12px;
}
.coordinates label, form label { display: block; color: var(--ink); font-size: .88rem; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8cbbf;
  border-radius: 11px;
  background: #fffefa;
  color: var(--ink);
  padding: 8px 11px;
}
input::placeholder, textarea::placeholder { color: #586659; opacity: 1; }
textarea { display: block; min-height: 100px; resize: vertical; }
.coordinates input, .dialog-card input, .dialog-card textarea { display: block; margin-top: 4px; }
.inline-message {
  margin-top: 8px;
  color: var(--pine);
  font-size: .89rem;
}
.inline-message:empty { display: none; }
.inline-message.is-error { color: #8c3825; }

.button, .filter {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 730;
  line-height: 1.2;
  text-align: center;
}
.button-quiet { border-color: #d0d8c9; background: #f3f4eb; }
.button-quiet:hover:not(:disabled) { background: #e5ecdf; }
.button-primary { border-color: #e4ba5b; background: var(--sun); color: #3d311c; box-shadow: inset 0 1px rgb(255 255 255 / 66%); }
.button-primary:hover:not(:disabled) { background: #f5c765; }
.button-ink { background: var(--pine); color: #fffdf6; }
.button-ink:hover:not(:disabled) { background: #245d4b; }
.button-text { color: var(--pine); }
.button-text:hover:not(:disabled) { background: #ecefe4; }
.button:active:not(:disabled), .filter:active { transform: translateY(1px); }

.nearby-tools { margin-top: 10px; border-top: 1px solid #e6e8df; padding-top: 8px; }
.nearby-tools > .button { justify-content: flex-start; padding-left: 0; }
.nearby-results { list-style: none; margin: 0; padding: 0; max-height: 185px; overflow-y: auto; }
.nearby-results li + li { border-top: 1px solid #e8e9e0; }
.nearby-results button { justify-content: flex-start; width: 100%; text-align: left; overflow-wrap: anywhere; }
.map-place-card { overflow-wrap: anywhere; }
.map-place-card h2 { margin: 5px 0 8px; }
.map-place-card .place-kind { color:var(--pine); font-size:.8rem; font-weight:750; }
.map-place-card .place-kind.is-ancient { color:#74501d; }
.map-place-actions { display:flex; flex-wrap:wrap; align-items:center; gap:4px 9px; margin-top:10px; }
.map-place-card p, .map-place-card small { color: var(--muted); font-size: .85rem; }
.review-map-card > h2 { margin-bottom: 12px; }
.review-map-card .result { margin-bottom: 12px; padding: 12px; box-shadow: none; }
#begin-proposal { margin-top: 14px; }

.guest-note { margin-top: 21px; padding: 15px; border-radius: 14px; background: #ecf1e6; color: var(--muted); }
.guest-note .button { margin-top: 10px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.proposal-form { margin-top: 18px; }
.proposal-form label { margin-bottom: 4px; }
.proposal-form input, .proposal-form select { margin-bottom: 12px; }
.field-help { margin: 2px 0 10px; color: var(--muted); font-size: .81rem; }
.proposal-form .category-note { margin-top:-7px; }
.photo-picker { position:relative; width:max-content; max-width:100%; margin-bottom:4px; }
.photo-picker input[type="file"] { position:absolute; z-index:1; inset:0; height:100%; cursor:pointer; opacity:0; margin:0; }
.photo-picker:focus-within { outline:3px solid #854c20; outline-offset:3px; border-radius:11px; }
.photo-picker:hover .button { background:#e5ecdf; }
.draft-photo { margin: 8px 0; }
.draft-photo img, .result-photo { display: block; width: min(100%, 340px); max-height: 230px; object-fit: contain; border-radius: 12px; background: #eaece2; }
.change-reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 9px; margin: 8px 0 14px; }
.change-reasons legend { margin-bottom: 6px; font-size: .91rem; font-weight: 700; }
.change-reasons label { display: flex; align-items: center; min-height: 44px; gap: 7px; margin: 0; }
.change-reasons input { width: 17px; height: 17px; min-height: 17px; margin: 0; flex: none; accent-color: var(--pine); }
.change-reasons .wide { display: block; grid-column: 1 / -1; }
.change-reasons textarea { min-height: 70px; margin-top: 4px; }
.chosen-point { margin-top: 11px; color: var(--muted); font-size: .86rem; }
.target-place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 6px 8px 6px 13px;
  margin-bottom: 11px;
  border: 1px solid #dbd8bd;
  border-radius: 12px;
  background: #f5ecce;
  overflow-wrap: anywhere;
}
.target-place small, .target-place strong { display: block; }
.target-place small { color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 13px; }

.review { margin-top: clamp(36px, 6vw, 72px); }
.review-heading { margin-bottom: 17px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.admin-filters { display:grid; grid-template-columns:minmax(150px, 2fr) minmax(135px,1fr) minmax(135px,1fr) auto; align-items:end; gap:9px; margin-bottom:14px; }
.admin-filters input, .admin-filters select { display:block; margin-top:4px; }
.admin-more { margin-top:12px; }
.filter { border-color: #dce0d4; border-radius: 999px; background: #fdfaf3; white-space: nowrap; }
.filter[aria-pressed="true"] { border-color: #22554a; background: #22554a; color: white; }
.result-list { display: grid; gap: 10px; }
.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 15px 17px;
  border: 1px solid var(--edge);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.result h3 { font: 700 1.12rem/1.35 system-ui, sans-serif; overflow-wrap: anywhere; }
.result-description { margin-top: 5px; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; white-space: pre-line; }
.result-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; color: var(--muted); font-size: .83rem; }
.result-actions { display: flex; flex-wrap: wrap; align-content: start; gap: 6px; }
.badge { align-self: start; justify-self: end; padding: 4px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge-review { background: #f8e7be; color: #64481d; }
.badge-approved { background: #d7eee7; color: #22554a; }
.badge-rejected { background: #f5dfd3; color: #723a2b; }
.result-detail { grid-column: 1 / -1; }
.result-author { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.result-author-photo {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #e5ece2;
  color: var(--pine);
  font-weight: 700;
}
.result-author-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.result-author-details { min-width: 0; display: grid; overflow-wrap: anywhere; font-size: .89rem; }
.result-photo { margin: 12px 0 7px; }
.credited-photo { margin: 0; }
.credited-photo figcaption { max-width: 340px; overflow-wrap: anywhere; }
.result-note { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: #f3ead6; color: #584222; font-size: .85rem; overflow-wrap: anywhere; }
.change-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; overflow-wrap: anywhere; }
.change-comparison > div { padding: 8px 10px; border-radius: 9px; background: #eef3ee; }
.change-comparison > div:first-child { background: #f1eee8; }
.change-comparison ul { margin: 5px 0 0; padding-left: 16px; color: var(--muted); font-size: .85rem; }
.change-comparison img { width: 100%; max-height: 130px; object-fit: contain; border-radius: 8px; margin-top: 4px; }
.moderation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding: 8px; border: 1px solid #ddc79f; border-radius: 9px; background: #fff6e1; }
.moderation .moderation-label { flex-basis: 100%; font-size: .84rem; color: #664511; }
.review-learn { display: grid; justify-items: start; gap: 8px; padding: 14px 16px; margin-bottom: 12px; border-radius: 13px; background: #edf3e8; font-size: .89rem; }
.empty-state { padding: 24px 18px; border: 1px dashed #d2d5c9; border-radius: 16px; text-align: center; color: var(--muted); }
.site-footer { padding: 29px 0 max(29px, env(safe-area-inset-bottom)); flex-wrap: wrap; color: var(--muted); font-size: .83rem; }

dialog {
  width: min(100% - 30px, 460px);
  max-height: min(745px, 100% - 32px);
  padding: 0;
  border: 1px solid #e0d9c8;
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 70px rgb(24 43 33 / 28%);
}
dialog::backdrop { background: rgb(19 35 28 / 55%); }
.dialog-card { position: relative; padding: 24px; }
.dialog-card h2 { padding-right: 35px; }
.dialog-card p:not(.inline-message) { margin-top: 8px; color: var(--muted); }
.dialog-card label { margin-top: 15px; }
.dialog-card .button-primary { margin-top: 14px; }
.dialog-card .icon-close { position: absolute; right: 9px; top: 9px; width: 44px; padding: 0; font-size: 1.5rem; }
.icon-close:hover { background: #eeeade; }
.rules-card ol { padding-left: 24px; margin: 14px 0; }
.rules-card li + li { margin-top: 10px; }
.leaderboard { padding:0; margin:16px 0 0; list-style:none; }
.leaderboard li { display:grid; grid-template-columns:30px minmax(0,1fr) auto; gap:9px; align-items:center; padding:8px 10px; border-radius:8px; overflow-wrap:anywhere; }
.leaderboard li:nth-child(odd) { background:#f2f1e8; }
.leaderboard li.is-you { background:#e1efe8; }
.leaderboard .leader-rank, .leaderboard .leader-score { font-variant-numeric:tabular-nums; }
.leaderboard .leader-rank { color:var(--muted); }
.exchange-rates { margin:15px 0 8px; }
.exchange-rates div { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:5px 0; border-bottom:1px solid var(--edge); }
.exchange-rates dd { margin:0; font-weight:650; }
@media (max-width: 850px) {
  .wrap { width: min(100% - 36px, 680px); }
  .site-header { min-height: 69px; }
  .workbench { grid-template-columns: 1fr; }
  .map-frame { height: clamp(270px, 47vw, 420px); }
  .review-heading { flex-wrap: wrap; }
  .admin-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .admin-filters label:first-child, .admin-filters > .button { grid-column:1 / -1; }
}
@media (max-width: 530px) {
  .wrap { width: calc(100% - 24px); }
  .head-nav, .site-header { gap: 6px 10px; }
  .head-nav a { font-size: .8rem; }
  .head-nav .button { padding-inline: 10px; }
  .intro { min-height: 0; align-items: start; flex-direction: column; padding: 18px; gap: 13px; border-radius: 20px; }
  .intro p { margin-top: 9px; font-size: .94rem; line-height: 1.45; }
  .profile-stats { gap: 0 8px; }
  .filters .filter { padding-inline: 11px; font-size: .81rem; }
  .profile { min-width: 0; width: 100%; }
  .workbench { margin-top: 14px; gap: 12px; }
  .panel { border-radius: 18px; }
  .panel-heading { align-items: start; }
  .map-locate { padding-inline: 9px; white-space: nowrap; }
  .coordinates { grid-template-columns: 1fr 1fr; }
  .coordinates .button { grid-column: 1 / -1; }
  .result { gap: 8px; padding: 13px; }
  .result .badge { max-width: 115px; text-align: center; }
  .result-actions .button { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}

.evidence { margin: 9px 0; color: var(--pine); font-size: .88rem; }
.evidence summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 700; }
.evidence input { margin-bottom: 0; }
.proposal-form .checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 9px 0 0;
  padding: 8px 10px;
  border: 1px solid #d8ded2;
  border-radius: 11px;
  background: #f2f4e8;
  letter-spacing: 0;
  cursor: pointer;
}
.proposal-form .checkbox input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 3px 0 0;
  accent-color: var(--pine);
}
