@font-face {
  font-family: Rubik; src: url("assets/rubik.ttf") format("truetype");
  font-weight: 300 900; font-display: swap;
}
:root {
  --bg:#f1f1ea; --card:#fcfbf7; --text:#354239; --muted:#58675d; --border:#cbd0c3;
  --brown:#4b6656; --brown-dark:#3e5646; --brown-light:#637f69; --accent:#bb8b73;
  --paper:#f7f5ef; --soft:#e2e8dc; --ink:#37473c; --shadow:0 3px 0 #143b3414;
}
body.dark {
  color-scheme:dark; --bg:#242d28; --card:#303a32; --text:#f1efe4; --muted:#bbc6b8;
  --border:#515f52; --paper:#2a342c; --soft:#38483b; --brown:#516d58;
  --brown-dark:#435d49; --brown-light:#b2c9af; --ink:#e2e9d9;
}
body, button, input, select, textarea { font-family:Rubik, Arial, sans-serif; }
button { cursor:pointer; }
button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline:3px solid #97654e; outline-offset:3px;
}
.icon-library { position:absolute; width:0; height:0; overflow:hidden; pointer-events:none; }
.ui-icon { width:21px; height:21px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.wordmark { display:inline-flex; align-items:center; gap:10px; font-size:30px; font-weight:740; letter-spacing:-1.3px; color:var(--ink); }
.wordmark img { object-fit:contain; }
#auth-screen { display:block; background:var(--paper); padding:0 5vw; overflow-y:auto; }
.auth-shell { max-width:1240px; margin:auto; padding-bottom:34px; }
.auth-mast, #app-screen header { display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--border); }
.auth-mast { min-height:78px; }
.auth-layout { display:grid; grid-template-columns:minmax(0,1.37fr) minmax(300px,.84fr); align-items:center; gap:clamp(40px,6vw,106px); padding:clamp(24px,4vh,48px) 0 0; }
.atlas-cover { overflow:hidden; border:1px solid #c3c6b7; border-radius:21px; background:#e7e4d5; color:#37473c; box-shadow:0 4px 0 #264c3524; }
.cover-heading { padding:clamp(22px,2.5vw,38px) 6% 24px; background-color:#e7e4d5;
  background-image:radial-gradient(#626a5b0d .8px,transparent .9px); background-size:6px 6px; }
.cover-heading h1 { font-size:clamp(46px,5.4vw,84px); line-height:.91; letter-spacing:-.053em; font-weight:720; }
.cover-heading em { color:#5d7563; font-style:normal; }
.cover-art { display:block; width:100%; height:clamp(220px,35vh,385px); object-fit:cover; object-position:center 55%; }
.cover-caption { display:flex; align-items:center; gap:11px; min-height:46px; padding:10px 6%; color:#fff9e5; background:#506957; font-size:14px; line-height:1.35; }
.cover-caption .ui-icon { color:#ead6bd; width:18px; }
.auth-box, body.dark .auth-box { width:100%; max-width:408px; background:transparent; color:var(--text); padding:0; box-shadow:none; text-align:left; }
.auth-box h2, body.dark .auth-box h2 { font-weight:740; font-size:clamp(28px,3.1vw,46px); line-height:1.05; letter-spacing:-.055em; color:var(--text); margin:0 0 30px; }
.auth-box label, .modal-content label { display:block; font-size:14px; font-weight:560; color:var(--text); margin:0 0 7px; }
.auth-box input, .modal-content input, .modal-content textarea, .modal-content select, .list-controls input, .list-controls select, .search-bar input {
  border:1px solid var(--border); background:var(--card); color:var(--text); border-radius:10px; min-height:44px; font:inherit; max-width:100%;
}
.auth-box input { min-height:50px; margin:0 0 19px; padding:0 14px; }
.auth-box input::placeholder { color:var(--muted); opacity:.86; }
.auth-box input:focus { background:var(--card); border-color:var(--brown-light); }
.auth-box .primary, .auth-box .outline-btn { display:flex; align-items:center; justify-content:center; gap:12px; min-height:48px; width:100%; margin:3px 0 10px; border-radius:10px; font-size:16px; font-weight:630; }
.auth-box .primary { color:#fff9e9; background:var(--brown); }
.auth-box .primary:hover { background:var(--brown-dark); }
.auth-box .outline-btn { color:var(--text); border:1px solid var(--border); background:var(--card); }
.auth-box .outline-btn:hover { background:var(--soft); }
.restore-help { border-top:1px solid var(--border); margin-top:23px; padding:18px 0 0; font-size:13px; color:var(--muted); line-height:1.5; }
.restore-help summary { cursor:pointer; display:flex; align-items:center; gap:8px; width:fit-content; }
.restore-help summary .ui-icon { width:16px; height:16px; }
.restore-help p { padding:9px 0 0 24px; }
#app-screen { background:var(--bg); }
#app-screen header { background:var(--paper); padding:8px max(16px,2vw); padding-top:calc(8px + env(safe-area-inset-top)); box-shadow:none; }
#app-screen .wordmark { font-size:26px; }
#app-screen .wordmark img { width:39px; height:39px; }
.icon-btn, .map-tool, .locate-fab { display:inline-flex; align-items:center; justify-content:center; color:var(--ink); background:var(--card); border:1px solid var(--border); box-shadow:var(--shadow); }
.icon-btn { border-radius:50%; width:42px; height:42px; }
.icon-btn:hover,.map-tool:hover,.locate-fab:hover { background:var(--soft); }
.header-actions { gap:9px; }
.bottom-nav { background:var(--paper); box-shadow:none; border-color:var(--border); padding:5px 5px calc(5px + env(safe-area-inset-bottom)); gap:3px; }
.bnav-btn { color:var(--muted); font-weight:540; min-height:48px; justify-content:center; border-radius:11px; }
.bnav-btn.active { background:var(--soft); color:var(--ink); }
.bnav-btn.active .ui-icon { stroke-width:2.3; }
.container { max-width:850px; padding:clamp(20px,4vw,48px); }
.container h1,.container h2,.modal-content h3 { color:var(--text); letter-spacing:-.045em; font-weight:730; }
.container h1 { margin:0 0 20px; font-size:clamp(32px,4vw,54px); line-height:1.08; }
.container h2,body.dark .container h2 { color:var(--text); margin:27px 0 13px; font-size:22px; }
.container h1 + .muted { margin:-10px 0 22px; font-size:15px; }
.profile-heading { background:var(--soft); border:1px solid var(--border); border-radius:18px; padding:18px 22px; display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.profile-heading h1 { margin:0; }
.profile-heading p { font-size:15px; margin-top:6px; color:var(--muted); overflow-wrap:anywhere; }
.profile-heading img { object-fit:contain; flex:none; }
#stats-content { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.stat-card, .feed-card, .place-card, .list-item, .user-card, .lb-row,.badge { background:var(--card); border:1px solid var(--border); box-shadow:var(--shadow); border-radius:14px; }
.stat-card { margin:0; padding:18px 15px; }
.stat-card .big-num { line-height:1.15; margin-bottom:5px; letter-spacing:-.045em; color:var(--ink); }
.stat-card .label,.feed-meta,.list-meta { line-height:1.5; }
#stats-view .link-btn { display:inline-flex; align-items:center; gap:6px; color:var(--ink); padding:8px 12px; min-height:41px; margin:0 5px 15px 0; border:1px solid var(--border); border-radius:9px; background:var(--card); text-decoration:none; }
.link-btn .ui-icon { width:17px; height:17px; }
.badge { padding:18px 12px; }
.badge.unlocked { background:var(--soft); border-color:var(--brown-light); }
body.dark .badge.unlocked .b-title { color:var(--ink); }
.search-bar input { min-width:0; }
.search-bar button,.modal-actions button,.comment-add button { font-weight:550; }
.empty { line-height:1.5; }
.illustrated { padding:26px 24px 34px; border:1px dashed var(--border); border-radius:16px; background:var(--card); }
.illustrated::before { content:""; display:block; width:86px; height:86px; margin:0 auto 12px; background:url("assets/guide.webp") center / contain no-repeat; }
.modal { background:#0c2b25a8; }
.modal-content,body.dark .modal-content { background:var(--paper); border:1px solid var(--border); padding:26px; border-radius:18px; box-shadow:0 12px 48px #0c2b2533; }
.modal-content label { margin-top:14px; }
.modal-content h3,body.dark .modal-content h3 { color:var(--text); font-size:26px; }
body.dark button.primary, body.dark .process-chips .chip.selected { color:white; background:var(--brown); }
.modal-actions button,.process-chips .chip { color:var(--text); background:var(--card); }
.location-info { color:var(--text); background:var(--soft); }
.modal-content select { padding:8px 11px; }
.modal-content .modal-actions .danger { color:#ab3325; }
body.dark .modal-content .modal-actions .danger { color:#ffbcb3; }
.map-search { width:min(calc(100% - 32px),420px); background:var(--card); border:1px solid var(--border); border-radius:15px; padding:3px; box-shadow:0 3px 14px #143b3422; }
.map-search input,.map-search button { color:var(--text); box-shadow:none; background:transparent; }
.map-search input { min-width:0; }
.map-search button { display:grid; place-items:center; border-radius:10px; background:var(--soft); }
.map-tool,.locate-fab { border-radius:14px; }
.fab { display:grid; place-items:center; background:#cfa78f; color:#414e40; border:2px solid #414e40; box-shadow:0 3px 0 #414e40; }
.fab .ui-icon { width:29px; height:29px; stroke-width:2.4; }
.map-hint { display:flex; align-items:center; gap:9px; top:75px; padding:7px 13px 7px 8px; border:1px solid var(--border); border-radius:14px; background:var(--paper); color:var(--text); text-align:left; line-height:1.45; font-size:12px; width:max-content; max-width:calc(100% - 110px); box-shadow:var(--shadow); pointer-events:none; }
.map-hint img { object-fit:contain; }
.map-hint strong { display:block; font-size:14px; }
.leaflet-control-zoom { overflow:hidden; }
@media(min-width:820px) {
  #app-screen { display:grid; grid-template-columns:180px 1fr; grid-template-rows:auto minmax(0,1fr); }
  #app-screen header { grid-column:1/-1; grid-row:1; min-height:66px; }
  #app-screen .view { grid-column:2; grid-row:2; min-width:0; }
  .bottom-nav { grid-column:1; grid-row:2; flex-direction:column; align-items:stretch; padding:22px 10px; gap:5px; border:0; border-right:1px solid var(--border); }
  .bnav-btn { flex:none; flex-direction:row; justify-content:flex-start; padding:11px 17px; gap:12px; font-size:15px; }
  .bnav-btn .badge-count { left:auto; right:5px; }
  .auth-layout { min-height:min(83vh,860px); }
}
@media(max-width:819px) {
  #auth-screen { padding:0 20px; }
  .auth-shell { max-width:570px; }
  .auth-mast { min-height:64px; }
  .wordmark { font-size:26px; }
  .auth-layout { grid-template-columns:minmax(0,1fr); gap:23px; padding-top:18px; }
  .atlas-cover { position:relative; display:grid; grid-template-columns:1fr 1fr; border-radius:14px; }
  .cover-heading { display:flex; align-items:center; padding:19px 10px 19px 17px; }
  .cover-heading h1 { font-size:clamp(30px,6.2vw,48px); }
  .cover-art { height:clamp(108px,27vw,165px); }
  .cover-caption { grid-column:1/-1; min-height:34px; padding:6px 12px; gap:6px; font-size:12px; }
  .auth-box { max-width:none; padding:0 4px; }
  .auth-box h2 { font-size:29px; margin-bottom:20px; }
  .auth-box input { margin-bottom:13px; }
  .restore-help { margin:16px 0 0; padding-top:14px; }
  .profile-heading img { width:66px; height:66px; }
}
@media(max-width:600px) {
  .modal-content { border-radius:18px 18px 0 0; padding:20px 18px calc(18px + env(safe-area-inset-bottom)); }
  #app-screen header { flex-wrap:nowrap; }
  .map-hint { max-width:calc(100% - 112px); }
  .map-hint img { width:34px; height:40px; }
  .search-results-list { top:63px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.001ms!important; transition-duration:.001ms!important; }
}

:root { --danger:#a44e42; --success:#486953; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background:#a3b39a9c; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background:#62795f; color:white; }
.toilet-pin { background:#e1e8df; border-color:#738a79; }
.me-dot { background:#647f88; }
body.dark .leaflet-tile-pane { filter:invert(1) hue-rotate(180deg) brightness(.85) contrast(.92); }
.leaflet-tile-pane { filter:saturate(.75); }

.entry-more, .view-personal {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}
.entry-more summary { padding: 4px 0; cursor: pointer; font-weight: 600; }
#entry-count:not(:empty) { padding: 2px 8px; border-radius: 12px; background: var(--soft); }
.entry-more p, .feed-personal { color: var(--muted); font-size: .85rem; }
.entry-more p { margin: 8px 0; }
.entry-more select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
}
.view-personal dl { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px 12px; margin: 10px 0 0; font-size: .9rem; }
.view-personal dt { color: var(--muted); }
.view-personal dd { margin: 0; overflow-wrap: anywhere; }

.entry-more summary small { display: block; margin-top: 4px; color: var(--muted); font-size: .82rem; font-weight: 400; }
.entry-more[open] summary small { display: none; }
.club-tabs,.club-actions {display:flex;flex-wrap:wrap;gap:7px;margin:10px 0 16px}
.club-tabs button,.club-card button,.club-card .club-link {border:1px solid var(--border);border-radius:9px;padding:8px 13px;background:var(--card);color:var(--ink);min-height:38px;font:inherit;font-size:14px;cursor:pointer}
.club-tabs button[aria-pressed=true],.club-card button.main,.club-link {background:var(--brown);color:white}
.club-card {background:var(--card);border:1px solid var(--border);border-radius:16px;padding:18px;margin-bottom:14px;overflow-wrap:anywhere}
.club-card h2 {margin:0 0 12px;font-size:21px}
.club-card p,.club-card summary,.club-card li {font-size:14px;line-height:1.55;margin:6px 0}
.club-card select,.club-card input,.club-card textarea {display:block;max-width:100%;width:100%;border:1px solid var(--border);border-radius:8px;background:var(--paper);color:var(--text);padding:9px;margin:6px 0 10px;font:inherit}
.club-card label {display:block;font-size:14px;margin-top:10px}.club-card input[type=checkbox]{width:auto;display:inline;margin-right:8px}
.club-card details {border-top:1px solid var(--border);padding:8px 0}
.club-row {padding:8px 0;border-bottom:1px solid var(--border)}
.club-stickers {display:grid;grid-template-columns:repeat(auto-fill,minmax(82px,1fr));gap:8px}
.club-sticker {text-align:center;font-size:12px}.club-sticker i,.club-pet {display:block;background-image:url(assets/stickers.webp);background-size:600% 400%;aspect-ratio:1;border-radius:12px;margin-bottom:4px}
.club-sticker.locked i {filter:grayscale(1);opacity:.45}.club-pet{background-image:url(assets/pets.webp);background-size:300% 300%;width:128px}
.club-card .club-value{font-size:28px;font-weight:650}.club-card button:disabled{opacity:.5;cursor:wait}
.club-card[data-room=night] .club-pet{background-color:#c4cbd7}
.club-card[data-room=beach] .club-pet{background-color:#e8d8b8}
.club-card[data-room=forest] .club-pet{background-color:#c8d7c0}
.club-rating{max-height:245px;overflow:auto;margin-top:8px}
.club-rating label{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:4px 0}
.comment small{color:var(--muted)}
