:root {
  --primary: #f0c014;
  --primary-dark: #c9a227;
  --ink: #1a2b45;
  --muted: #6b7c8f;
  --line: #e4e8ee;
  --paper: #ffffff;
  --canvas: #f4f1ea;
  --danger: #b42318;
  --ok: #0f7a45;
  --shadow: 0 10px 30px rgba(26, 43, 69, 0.14);
  --nav-h: 58px;
  --filter-h: 0px;
  --bottom-nav: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Nunito", system-ui, sans-serif;
}

@media (max-width: 800px) {
  :root { --bottom-nav: calc(62px + var(--safe-bottom)); }
}

body.map-page {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
}

#app {
  font-family: var(--font);
  color: var(--ink);
}

#map {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: #e6e4df;
}

#app .leaflet-container { font-family: var(--font); }

#app .leaflet-top.leaflet-left {
  top: calc(var(--nav-h) + var(--filter-h) + var(--safe-top) + 8px);
  left: 28px;
}

#app .leaflet-bottom.leaflet-right {
  bottom: calc(var(--bottom-nav) + 8px);
}

.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(228, 232, 238, 0.9);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.05; }
.brand-kicker { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.brand-name { font-size: 1rem; font-weight: 800; white-space: nowrap; }

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.82rem;
}

.top-actions { margin-left: auto; display: flex; gap: 8px; }

.list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.filter-pill .material-icons { font-size: 16px; }
.filter-pill.active { background: var(--primary); border-color: var(--primary-dark); color: var(--ink); }
.filter-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: rgba(26, 43, 69, 0.08);
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.filter-pill.active .filter-count { background: rgba(255, 255, 255, 0.45); }
.filter-count.is-zero { opacity: 0.45; }

.icon-btn, .primary-btn, .ghost-btn, .photo-btn {
  font-family: inherit;
  cursor: pointer;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.82rem;
}

.icon-btn .material-icons, .primary-btn .material-icons, .ghost-btn .material-icons { font-size: 18px; }
.icon-only { width: 40px; height: 40px; padding: 0; }
body.is-adding .add-toggle { background: var(--primary); border-color: var(--primary-dark); }

.map-hint {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: calc(var(--bottom-nav) + 14px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  font-weight: 800;
}

.map-hint .material-icons { color: var(--primary-dark); font-size: 18px; }
#mapHintText { min-width: 0; }
#useLocation { display: none; flex: none; }
body.is-adding #useLocation { display: inline-flex; }
body.sheet-open .map-hint { display: none; }

.map-error, .noscript {
  position: fixed;
  z-index: 40;
  top: calc(var(--nav-h) + var(--filter-h) + var(--safe-top) + 12px);
  left: 12px;
  right: 12px;
  background: #fff4f2;
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font);
  font-weight: 700;
}

.sheet {
  position: fixed;
  z-index: 45;
  top: calc(var(--nav-h) + var(--filter-h) + var(--safe-top));
  right: 0;
  bottom: var(--bottom-nav);
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.22s ease;
}

.sheet.open { transform: none; visibility: visible; pointer-events: auto; }

.sheet-head, .sheet-body { font-family: var(--font); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-body { overflow: auto; padding: 14px 14px 28px; -webkit-overflow-scrolling: touch; }

.search-wrap { position: relative; margin-bottom: 8px; }
.search-wrap .material-icons {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
}
.search-wrap input, .input, .admin-wrap input, .admin-wrap select, .admin-wrap textarea {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.search-wrap input { padding-left: 38px; }
.input:focus, .search-wrap input:focus, .admin-wrap input:focus, .admin-wrap select:focus, .admin-wrap textarea:focus {
  outline: none;
  border-color: var(--primary-dark);
}

.list-meta, .hint { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.place-list { list-style: none; margin: 0; padding: 0; }
.place-list .empty { padding: 18px 4px; color: var(--muted); font-weight: 700; }
.place-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 2px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.place-row .material-icons {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff7d6;
  color: #8a6d00;
  flex: none;
}
.place-row-text { display: flex; flex-direction: column; min-width: 0; }
.place-row-text strong, .place-row-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.place-row-text small { color: var(--muted); font-weight: 700; }

.sheet-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
  font-size: 0.82rem;
  font-weight: 800;
}
.sheet-legal a, .legal-wrap a { color: #8a6d00; }

.form-section {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 8px;
  font-size: 0.95rem;
}
.form-section .material-icons { color: var(--primary-dark); font-size: 20px; }
.field { display: block; margin: 12px 0 6px; font-size: 0.82rem; font-weight: 800; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fafbfc;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card .material-icons { font-size: 24px; color: var(--muted); }
.option-card.is-on, .option-card:has(input:checked) {
  border-color: var(--primary-dark);
  background: #fff7d6;
}
.option-card.is-on .material-icons, .option-card:has(input:checked) .material-icons { color: #8a6d00; }

.photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: #fafbfc;
  color: var(--muted);
  font-weight: 800;
}
.photo-preview { margin-top: 8px; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); }
.photo-preview[hidden] { display: none; }
.photo-preview img { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.picked-spot { margin: 0 0 8px; font-weight: 800; color: #8a6d00; }

.notice {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border-radius: 14px;
  background: #fff7d6;
  border: 2px solid #f0e2a2;
}
.notice .material-icons { color: #8a6d00; }
.notice p { margin: 4px 0 0; font-size: 0.86rem; }
.checkline { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 14px; font-size: 0.86rem; font-weight: 700; }
.checkline input, .admin-wrap .checkline input { margin-top: 3px; flex: none; width: 18px; height: 18px; padding: 0; }

.primary-btn, a.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--primary);
  color: var(--ink);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  box-sizing: border-box;
}
.primary-btn:disabled { opacity: 0.6; cursor: wait; }
.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  border: 2px solid #f0c7c3;
  background: #fff;
  color: var(--danger);
  border-radius: 14px;
  padding: 12px;
  font-weight: 800;
}
.hp { position: absolute; left: -10000px; height: 0; overflow: hidden; }

.form-alert { border-radius: 12px; padding: 12px; margin: 0 0 12px; font-weight: 800; }
.form-alert.bad { background: #fff4f2; color: var(--danger); }
.form-alert.ok { background: #eefaf3; color: var(--ok); }
.form-alert[hidden] { display: none !important; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: #fff7d6; border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; font-weight: 800; }
.detail-photo { width: 100%; max-height: 200px; object-fit: cover; border-radius: 14px; margin-bottom: 10px; }
.detail-line { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; word-break: break-word; }
.detail-line .material-icons { font-size: 18px; color: var(--primary-dark); flex: none; }
.detail-line a { color: #8a6d00; font-weight: 800; }
.tip-card {
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #efe6c4;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf6 0%, #fff 100%);
  box-shadow: 0 8px 24px rgba(26, 43, 69, 0.06);
}
.tip-card * { box-sizing: border-box; }
.tip-qr {
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.tip-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tip-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.address-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 10px;
  border-radius: 12px;
  background: #f7f5f0;
}
.address-line code {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  word-break: break-all;
}
.copy-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(26, 43, 69, 0.08);
  cursor: pointer;
}
.copy-btn .material-icons { font-size: 18px; }
.copy-btn.is-copied { color: var(--ok); }
.tip-send {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}
.tip-send .material-icons { font-size: 18px; }

.dialog-back {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(26, 43, 69, 0.45);
}
.dialog-back.open { display: flex; }
.dialog {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: var(--bottom-nav);
  font-family: var(--font);
}
.dialog h3 { margin: 0 0 8px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 12px; }
.dialog-actions .primary-btn { width: auto; flex: 1; }
@media (min-width: 801px) {
  .dialog-back { align-items: center; }
  .dialog { margin-bottom: 0; }
}

.bottom-nav {
  display: none;
  position: fixed;
  z-index: 35;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bottom-nav);
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  justify-content: space-around;
  align-items: center;
}
.bottom-nav-item {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
}
.bottom-nav-item .material-icons { font-size: 22px; }
body.is-adding .bottom-nav-item.add-toggle { color: #8a6d00; }

.toast {
  position: fixed;
  z-index: 260;
  left: 50%;
  bottom: calc(var(--bottom-nav) + 18px);
  transform: translateX(-50%) translateY(12px);
  max-width: calc(100% - 24px);
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }
.toast.bad { background: var(--danger); }
.toast.ok { background: var(--ok); }

.pin-wrap { background: transparent; border: 0; }
.pin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary-dark);
  box-shadow: 0 2px 8px rgba(26, 43, 69, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a6d00;
}
.pin .material-icons { font-size: 18px; }
.pin-online { border-color: #1e88e5; color: #1565c0; }
.pin-person { border-color: #2e7d32; color: #2e7d32; }
.pin-tips { border-color: #ef6c00; color: #ef6c00; }
.pin-atm { border-color: #6a1b9a; color: #6a1b9a; }
.pin-other, .pin-foundation { border-color: #607d8b; color: #455a64; }

.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(240, 192, 20, 0.35); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background-color: #f0c014;
  color: #1a2b45;
  font-family: var(--font);
  font-weight: 800;
}

#menuShibe { z-index: 99; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 400;
  overflow: hidden;
  pointer-events: auto;
  background: transparent;
}
#introSmoke {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#introDoge {
  position: absolute;
  z-index: 3;
  left: -60vw;
  top: 40%;
  width: min(52vh, 68vw, 420px);
  height: auto;
  opacity: 0;
  transform: translate(0, -50%);
  filter: drop-shadow(0 14px 18px rgba(40, 30, 10, 0.28));
  pointer-events: none;
  user-select: none;
}
.intro-title {
  position: absolute;
  left: 50%;
  top: 68%;
  z-index: 2;
  width: min(86vw, 680px);
  text-align: center;
  pointer-events: none;
  animation: title-life 6.4s ease forwards;
}
.intro-words { margin: 0; }
.intro-words span {
  display: block;
  color: #1c2433;
  font-family: var(--font);
  font-weight: 800;
  line-height: 1.02;
  text-shadow: 0 0 18px rgba(255, 250, 240, 0.95);
  animation: word-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.intro-words span:first-child {
  margin-bottom: 6px;
  color: #8a6a08;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  animation-delay: 1.7s;
}
.intro-words span:last-child {
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: -0.035em;
  animation-delay: 1.95s;
}
@keyframes title-life {
  0%, 28% { opacity: 0; transform: translate(-50%, -40%); }
  42%, 74% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-30%, -58%); }
}
@keyframes word-rise {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-title, .intro-words span { animation: none !important; }
  .intro-title { opacity: 1; transform: translate(-50%, -50%); }
}

.login-card .primary-btn { width: 100%; }

@media (max-width: 800px) {
  .top-actions { display: none; }
  .bottom-nav { display: flex; }
  .brand-name { font-size: 0.92rem; }
  .sheet { top: calc(var(--nav-h) + var(--safe-top)); width: 100%; }
  #formSheet { top: 30vh; border-radius: 18px 18px 0 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .tip-qr { width: 76px; height: 76px; }
  .option-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 380px) {
  .option-cards { grid-template-columns: repeat(2, 1fr); }
}

body.legal-page, body.admin-body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}
.legal-wrap, .admin-wrap { font-family: var(--font); }
.legal-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 72px;
}
.legal-wrap.narrow { max-width: 560px; }
.legal-wrap h1 { margin: 0 0 8px; font-size: 2rem; }
.legal-wrap h2 { margin: 1.4rem 0 0.4rem; font-size: 1.15rem; }
.legal-lead { font-size: 1.05rem; }
.legal-back a { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; text-decoration: none; }
.legal-wrap code { font-size: 0.9em; }

.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 64px; }
.admin-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.admin-top h1 { margin: 0; font-size: 1.7rem; }
.admin-top p { margin: 4px 0 0; color: var(--muted); }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 800;
  color: var(--muted);
  text-decoration: none;
}
.admin-tab.active { background: var(--primary); border-color: var(--primary-dark); color: var(--ink); }
.admin-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.admin-card h2 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 1.05rem; }
.login-card { max-width: 460px; margin: 8vh auto; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.admin-actions .primary-btn, .admin-actions .ghost-btn, .admin-actions .icon-btn { width: auto; }
.place-admin { border: 2px solid var(--line); border-radius: 16px; background: #fff; padding: 12px; margin-bottom: 10px; }
.place-admin header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.place-admin header small { color: var(--muted); font-weight: 700; }
.place-admin details { margin-top: 8px; }
.place-admin summary { cursor: pointer; font-weight: 800; }
.hidden-flag { color: var(--danger); font-weight: 800; }
.schema-error { background: #fff4f2; color: var(--danger); border-radius: 12px; padding: 12px; font-weight: 800; }
#app :focus-visible, .legal-wrap :focus-visible, .admin-wrap :focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
