:root {
  --forest: #244b3b;
  --pine: #46755d;
  --moss: #6f927c;
  --sage: #dfeadf;
  --mist: #f3f7f1;
  --sand: #faf8f2;
  --ink: #20372d;
  --muted: #607269;
  --line: #d3e0d5;
  --white: #ffffff;
  --shadow: 0 12px 34px rgba(36, 75, 59, .09);
}

* { box-sizing: border-box; }
html { background: var(--sand); scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 88% 4%, rgba(196, 218, 195, .62), transparent 26rem),
    radial-gradient(circle at -5% 33%, rgba(224, 235, 218, .76), transparent 25rem),
    var(--sand);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--forest); text-underline-offset: .15em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #a8cdb1; outline-offset: 3px; }
main { width: min(840px, calc(100% - 32px)); margin: auto; padding: 42px 0 36px; }

header {
  position: relative;
  overflow: hidden;
  margin: 0 0 26px;
  padding: 30px 30px 26px;
  text-align: center;
  border: 1px solid rgba(211, 224, 213, .9);
  border-radius: 30px;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow);
}
header::before, header::after { position: absolute; z-index: 0; border-radius: 50%; content: ""; pointer-events: none; }
header::before { width: 190px; height: 190px; top: -104px; right: -46px; background: #cfe0c9; opacity: .72; }
header::after { width: 95px; height: 95px; right: 84px; bottom: -56px; background: #e7dcbf; opacity: .72; }
header > * { position: relative; z-index: 1; }

h1, h2, h3 { color: var(--forest); letter-spacing: -.035em; }
h1 { max-width: none; margin: 0 auto; font-size: clamp(2.25rem, 7.2vw, 4rem); line-height: 1.01; text-align: center; }
h2 { margin: 0; font-size: clamp(1.45rem, 4vw, 1.9rem); line-height: 1.12; }
h3 { display: flex; align-items: center; gap: 8px; margin: 30px 2px 12px; padding: 0 0 10px; border-bottom: 1px solid var(--line); font-size: 1.17rem; }
h3::before { width: 9px; height: 9px; border-radius: 50% 50% 50% 0; background: var(--moss); content: ""; transform: rotate(-45deg); }
.subtitle { margin: 10px auto 6px; color: var(--pine); font-size: 1.07rem; font-weight: 800; letter-spacing: .065em; }
header p:not(.subtitle) { max-width: 52ch; margin: 0 auto; color: var(--muted); }

nav {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 0 0 26px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid rgba(211, 224, 213, .9);
  border-radius: 21px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 24px rgba(36, 75, 59, .055);
  scrollbar-width: thin;
}
nav a { min-width: 58px; padding: 8px 7px 7px; border-radius: 14px; color: var(--muted); font-size: .78rem; font-weight: 700; text-align: center; text-decoration: none; transition: background-color .18s ease, color .18s ease, transform .18s ease; }
nav a span { display: block; margin-bottom: 1px; font-size: .7rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
nav a:hover { background: var(--mist); color: var(--forest); transform: translateY(-1px); }
nav a.active { background: var(--forest); color: var(--white); box-shadow: 0 4px 12px rgba(36, 75, 59, .2); }
.place-nav { margin-bottom: 12px; }
.place-nav a { flex: 1; min-width: 120px; padding: 10px 12px; font-size: .9rem; }
.location-kicker { margin: 0 0 4px; color: var(--pine); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.empty-state { margin: 20px 0 4px; padding: 16px; border: 1px dashed #bfd1c1; border-radius: 16px; background: var(--mist); color: var(--muted); }

.admin-nav-box,
.admin-top-nav,
.admin-bottom-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1px solid rgba(211, 224, 213, .9);
  border-radius: 20px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 6px 18px rgba(36, 75, 59, .045);
}
.admin-bottom-nav {
  margin: 24px 0 10px;
}
.admin-nav-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.admin-nav-box a,
.admin-top-nav a,
.admin-bottom-nav a,
.nav-logout-btn,
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid #bfd1c1;
  border-radius: 999px;
  background: #eff5ed;
  color: var(--forest);
  font: inherit;
  font-size: .88rem;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.admin-nav-box a:hover,
.admin-top-nav a:hover,
.admin-bottom-nav a:hover,
.nav-logout-btn:hover,
.nav-btn:hover {
  background: #e2eee0;
  border-color: var(--moss);
  color: var(--forest);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(36, 75, 59, .08);
}
.nav-logout-btn {
  color: #7a352d;
  background: #fdf5f4;
  border-color: #e5c4c0;
}
.nav-logout-btn:hover {
  background: #fae8e6;
  border-color: #d89e96;
  color: #5c2019;
}
.nav-logout-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}
.admin-nav-box svg,
.admin-top-nav svg,
.admin-bottom-nav svg,
.nav-logout-btn svg {
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .admin-nav-box,
  .admin-top-nav,
  .admin-bottom-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .admin-nav-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .admin-nav-box a,
  .admin-top-nav a,
  .admin-bottom-nav a,
  .nav-logout-btn,
  .nav-btn {
    justify-content: center;
    width: 100%;
  }
  .nav-logout-form {
    width: 100%;
  }
}

.day, aside { margin: 0 0 22px; padding: 26px; border: 1px solid rgba(211, 224, 213, .9); border-radius: 27px; background: rgba(255, 255, 255, .86); box-shadow: var(--shadow); }
.treasures { display: grid; gap: 12px; }
.treasure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 132px;
  gap: 18px;
  padding: 15px 16px 15px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: linear-gradient(135deg, #fff, #fbfdf9);
  box-shadow: 0 5px 16px rgba(36, 75, 59, .045);
  content-visibility: auto;
  contain-intrinsic-size: 132px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.treasure:hover { border-color: #b7cdbb; box-shadow: 0 9px 22px rgba(36, 75, 59, .085); transform: translateY(-1px); }
.treasure-copy { min-width: 0; flex: 1; }
.treasure-title { overflow-wrap: anywhere; font-size: clamp(1.08rem, 3vw, 1.28rem); font-weight: 850; line-height: 1.16; }
.treasure-title a:hover, .perletur-link:hover { text-decoration: underline; }
.perletur-link { display: inline-block; margin-top: 6px; color: var(--pine); font-size: .86rem; font-weight: 700; }
.found-status { display: flex; align-items: center; gap: 9px; margin-top: 11px; color: var(--muted); font-size: .92rem; font-weight: 780; }
.check { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border: 2px solid #a7bbb0; border-radius: 50%; color: var(--white); font-size: 1.05rem; font-weight: 900; }
.check.checked { border-color: var(--pine); background: var(--pine); box-shadow: 0 3px 8px rgba(70, 117, 93, .22); }
.treasure.found { border-color: #a9c8ae; background: linear-gradient(135deg, #f4faf2, #eaf4e9); }
.found .treasure-title a, .found .treasure-title strong, .found .found-status { color: var(--forest); }
.found-status form { margin-left: auto; }
.prize-recipient { margin: 10px 0 0; color: var(--pine); font-size: .84rem; font-weight: 760; }

button { padding: 9px 13px; border: 1px solid transparent; border-radius: 999px; background: var(--forest); color: var(--white); font: inherit; font-size: .88rem; font-weight: 760; cursor: pointer; transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease; }
button:hover { background: #183d2f; box-shadow: 0 4px 12px rgba(36, 75, 59, .18); transform: translateY(-1px); }
button.secondary { border-color: #bfd1c1; background: #eff5ed; color: var(--forest); }
button.secondary:hover { background: #e2eee0; }
button.danger { background: #a84f45; }
button.danger:hover { background: #883e36; }

.map-thumb { width: 156px; height: 142px; flex: 0 0 156px; overflow: hidden; border: 1px solid #aac2ae; border-radius: 18px; background: #dce9d5; color: var(--forest); text-decoration: none; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .48), 0 4px 11px rgba(36, 75, 59, .08); }
.map-thumb small { font-size: .62rem; font-weight: 850; letter-spacing: .045em; }
.notice { margin: 14px 0; padding: 12px 14px; border: 1px solid #e7d5a5; border-radius: 15px; background: #fff8e4; color: #665120; font-size: .92rem; }
aside { border-color: #cadcca; background: linear-gradient(135deg, #edf5e9, #f9fcf6); }
aside h2 { font-size: 1.28rem; }
aside p { margin-bottom: 0; color: var(--muted); }

.login { display: grid; max-width: 360px; gap: 14px; }
.login label { color: var(--forest); font-weight: 750; }
.login input, .login select { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid #b9cdbd; border-radius: 13px; background: #fff; color: var(--ink); font: inherit; }
.login select { cursor: pointer; }
.helper { margin: 0; color: var(--muted); font-size: .86rem; }
.welcome { margin: 0 0 18px; color: var(--muted); }
.admin-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.admin-actions a { display: grid; min-height: 126px; align-content: start; gap: 7px; padding: 20px; border: 1px solid #cfdfd0; border-radius: 20px; background: linear-gradient(145deg, #f5faf2, #e7f0e4); color: var(--forest); text-decoration: none; box-shadow: 0 5px 16px rgba(36, 75, 59, .05); transition: transform .18s ease, box-shadow .18s ease; }
.admin-actions a:hover { box-shadow: 0 10px 22px rgba(36, 75, 59, .1); transform: translateY(-2px); }
.admin-actions strong { font-size: 1.14rem; }
.admin-actions span { color: var(--muted); font-size: .88rem; }
.post-list, .claim-list, .user-list { display: grid; gap: 14px; margin-top: 18px; }
.post-editor, .claim-editor, .user-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 18px; border: 1px solid var(--line); border-radius: 19px; background: #fbfdf9; }
.post-editor label, .claim-editor label, .user-editor label { color: var(--forest); font-size: .86rem; font-weight: 760; }
.post-editor input, .post-editor select, .claim-editor input, .claim-editor select, .user-editor input, .user-editor select { display: block; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #b9cdbd; border-radius: 12px; background: #fff; color: var(--ink); font: inherit; }
.location-editor { display: grid; grid-template-columns: 1fr 170px auto; align-items: end; gap: 13px; }
.location-editor label { color: var(--forest); font-size: .86rem; font-weight: 760; }
.location-editor textarea, .location-editor select { display: block; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #b9cdbd; border-radius: 12px; background: #fff; color: var(--ink); font: inherit; }
.location-editor textarea { min-height: 104px; resize: vertical; }
.location-editor .checkbox { display: flex; align-items: center; gap: 8px; align-self: end; }
.location-editor .checkbox input { width: 18px; height: 18px; margin: 0; accent-color: var(--pine); }
.protected-user { display: grid; gap: 3px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: #f5f7f3; }
.protected-user strong { color: var(--forest); }
.protected-user span, .claim-treasure em { color: var(--muted); font-size: .86rem; font-style: normal; }
.readonly-field { display: grid; gap: 4px; align-content: end; margin: 0; color: var(--forest); font-size: .86rem; }
.readonly-field span { display: block; padding: 10px 11px; border: 1px solid #d2dfd2; border-radius: 12px; background: #f5f7f3; color: var(--muted); overflow-wrap: anywhere; }
.pending-invite { align-self: end; margin: 0; color: #665120; font-size: .86rem; font-weight: 700; }
.invitation-summary dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 20px; }
.invitation-summary dl div { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f7faf5; }
.invitation-summary dt { color: var(--muted); font-size: .77rem; font-weight: 750; }
.invitation-summary dd { margin: 3px 0 0; color: var(--forest); font-weight: 760; overflow-wrap: anywhere; }
.invitation-summary label { display: block; margin-bottom: 6px; color: var(--forest); font-size: .9rem; font-weight: 760; }
.invitation-summary textarea { display: block; width: 100%; min-height: 220px; padding: 12px; border: 1px solid #b9cdbd; border-radius: 14px; background: #fff; color: var(--ink); font: inherit; line-height: 1.5; resize: vertical; }
.copy-status { align-self: center; color: var(--pine); font-size: .86rem; font-weight: 720; }
.post-editor .checkbox, .claim-editor .checkbox, .user-editor .checkbox { display: flex; align-items: center; gap: 8px; align-self: end; }
.post-editor .checkbox input, .claim-editor .checkbox input, .user-editor .checkbox input { width: 18px; height: 18px; margin: 0; accent-color: var(--pine); }
.form-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.claim-row { grid-template-columns: 1.2fr 1fr 1fr; }
.claim-treasure { display: grid; align-content: center; margin: 0; }
.claim-treasure strong { color: var(--forest); }
.claim-treasure span { color: var(--muted); font-size: .8rem; }
.treasure-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.treasure-name strong { color: var(--forest); overflow-wrap: anywhere; }
.treasure-name p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.admin .treasure { align-items: center; }
.admin .treasure > form { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.inactive { opacity: .68; background: #f5f4ef; }
footer { padding: 4px 0; color: var(--muted); font-size: .86rem; text-align: center; }
footer p { margin: 0 0 6px; }
footer a { color: var(--pine); font-weight: 700; }
.admin-footer-link { display: inline-block; margin-top: 7px; padding: 9px 15px; border: 1px solid #2b5d47; border-radius: 999px; background: var(--forest); color: var(--white) !important; box-shadow: 0 4px 12px rgba(36, 75, 59, .16); text-decoration: none; transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.admin-footer-link:hover { background: #183d2f; box-shadow: 0 7px 16px rgba(36, 75, 59, .23); transform: translateY(-1px); }
.cookie-backdrop { position: fixed; z-index: 999; inset: 0; background: rgba(24, 52, 41, .43); backdrop-filter: blur(3px); }
.cookie-notice { position: fixed; z-index: 1000; top: 50%; left: 50%; display: grid; width: min(92vw, 620px); grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 25px; border: 1px solid #b7cdbb; border-radius: 25px; background: linear-gradient(135deg, #edf5e9, #f9fcf6); box-shadow: 0 24px 60px rgba(20, 47, 36, .3); transform: translate(-50%, -50%); }
.cookie-notice h2 { font-size: 1.28rem; }
.cookie-notice p { max-width: 45ch; margin: 7px 0 9px; color: var(--muted); font-size: .92rem; }
.cookie-notice a { color: var(--pine); font-size: .88rem; font-weight: 750; }
.cookie-notice form { display: grid; gap: 8px; }
.policy { display: grid; gap: 4px; }
.policy h2 { margin-top: 4px; }
.policy p { max-width: 72ch; margin: 6px 0 13px; color: var(--muted); }
.directions-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; font-size: .84rem; color: var(--pine); font-weight: 700; text-decoration: none; }
.directions-link:hover { text-decoration: underline; color: var(--forest); }

@media (max-width: 640px) {
  main { width: min(100% - 20px, 840px); padding: 18px 0 28px; }
  header { margin-bottom: 18px; padding: 24px 20px 21px; border-radius: 25px; }
  h1 { font-size: clamp(2.05rem, 10vw, 3rem); }
  nav { margin-bottom: 18px; border-radius: 18px; }
  nav a { min-width: 52px; }
  .day, aside { padding: 19px 16px; border-radius: 23px; }
  .treasure { min-height: 118px; gap: 12px; padding: 12px; border-radius: 18px; contain-intrinsic-size: 118px; }
  .treasure-title { font-size: 1.05rem; }
  .perletur-link { font-size: .78rem; }
  .map-thumb { width: 128px; height: 112px; flex-basis: 128px; border-radius: 15px; }
  .found-status { margin-top: 8px; font-size: .84rem; }
  .found-status button { padding: 7px 10px; font-size: .75rem; }
  .admin .treasure { align-items: flex-start; flex-direction: column; }
  .admin .treasure > form { justify-content: flex-start; }
  .admin-actions { grid-template-columns: 1fr; }
  .post-editor, .claim-editor, .user-editor, .claim-row, .location-editor, .cookie-notice, .invitation-summary dl { grid-template-columns: 1fr; }
  .cookie-notice { gap: 14px; padding: 21px; }
}
@media (max-width: 390px) { .map-thumb { width: 106px; height: 100px; flex-basis: 106px; } .treasure { padding: 11px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
