:root {
  --header-h: 52px;
  --sidebar-w: 340px;
  --accent: #1e6b52;
  --accent-dark: #144a39;
  --border: #d9d9d9;
  --text: #222;
  --muted: #666;
  --bg: #fafafa;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
}

.app-header h1 {
  font-size: 16px;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clock {
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
}

.contact-open-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.6);
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.contact-open-btn:hover {
  background: rgba(255,255,255,0.28);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.app-body {
  position: absolute;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 12px;
}

.sidebar-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.category-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 12px;
  background: #eef3f0;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  color: var(--text);
  list-style: none;
  user-select: none;
}

.category-summary:hover {
  background: #e2ebe5;
}

.category-summary::-webkit-details-marker {
  display: none;
}

.category-summary .chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-top: -3px;
}

.category-details[open] .category-summary .chevron {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.category-details .category-filters {
  margin-top: 10px;
}

#search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.switch-row input {
  width: 18px;
  height: 18px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  min-height: 1em;
}

.hint.error { color: #c62828; }
.hint.ok { color: var(--accent-dark); }

.primary-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:disabled { background: #aaa; cursor: default; }

.category-filters {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.category-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 4px 2px;
  border-radius: 4px;
  cursor: pointer;
}

.category-label-wrap:hover { background: #f0f0f0; }

.category-checkbox,
.subcat-row input {
  cursor: pointer;
}

.category-filters .swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-filters .count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.subcat-toggle {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.subcat-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-top: -2px;
}

.category-group.expanded .subcat-toggle::after {
  transform: rotate(45deg);
  margin-top: 2px;
}

.subcat-list {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px 30px;
  padding-left: 8px;
  border-left: 2px solid #eee;
}

.category-group.expanded .subcat-list {
  display: flex;
}

.subcat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #444;
  padding: 3px 2px;
  border-radius: 4px;
  cursor: pointer;
}

.subcat-row:hover { background: #f0f0f0; }

.subcat-row .count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.category-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.result-count {
  font-size: 13px;
  color: var(--muted);
  border-bottom: none;
}

.spot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spot-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
}

.spot-card:hover {
  border-color: var(--accent);
  background: #f4f9f7;
}

.spot-card .title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.spot-card .name {
  font-weight: bold;
  font-size: 14px;
}

.spot-card .category-tag {
  font-size: 11px;
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.spot-card .meta-row {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.spot-card .distance {
  font-weight: bold;
  color: var(--accent-dark);
}

.spot-card .status.open { color: #2e7d32; font-weight: bold; }
.spot-card .status.closed { color: #999; }
.spot-card .status.unknown { color: #999; }

#map {
  flex: 1;
  height: 100%;
}

.loading {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 2000;
}

.loading.hidden { display: none; }

/* Leaflet marker / popup customization */
.spot-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  border: 3px solid #999;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  overflow: hidden;
}

.spot-marker span {
  transform: rotate(-45deg);
  font-size: 15px;
}

.spot-marker img {
  width: 22px;
  height: 22px;
  transform: rotate(-45deg);
  object-fit: contain;
}

.user-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #1a73e8, 0 1px 4px rgba(0,0,0,0.5);
}

.popup-content { font-size: 13px; min-width: 200px; }
.popup-content h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.popup-content .popup-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.popup-content .reading { color: var(--muted); font-weight: normal; font-size: 12px; }
.popup-content .tags { margin: 4px 0; }
.popup-content .tags span {
  display: inline-block;
  font-size: 11px;
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 4px;
}
.popup-content .description { margin: 6px 0; color: #333; }
.popup-content .distance-line { font-weight: bold; color: var(--accent-dark); margin: 4px 0; }
.popup-content table.hours { border-collapse: collapse; margin-top: 6px; width: 100%; }
.popup-content table.hours td { padding: 1px 4px; font-size: 12px; }
.popup-content table.hours td.day { color: var(--muted); width: 2.5em; }
.popup-content table.hours tr.today td { font-weight: bold; color: var(--accent-dark); }
.popup-content .extra-row { font-size: 12px; color: #444; }
.popup-content .popup-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
}
.popup-content .directions-link {
  display: inline-block;
  margin-top: 0;
  color: #1a73e8;
  font-size: 12px;
  text-decoration: none;
}
.popup-content .directions-link:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .sidebar-toggle { display: inline-block; }

  .sidebar {
    position: absolute;
    z-index: 1500;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(85vw, 340px);
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
  }

  .app-body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  .app-header h1 { font-size: 14px; }
  .contact-open-btn { font-size: 11px; padding: 5px 9px; }
}

/* お問い合わせモーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 16px;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 20px 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h2 {
  font-size: 17px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
}

#contact-form .field {
  margin-bottom: 14px;
}

#contact-form .field-row {
  display: flex;
  gap: 12px;
}

#contact-form .field-row .field {
  flex: 1;
  min-width: 0;
}

#contact-form label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: var(--muted);
  margin-bottom: 4px;
}

.section-label-static {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: var(--muted);
  margin-bottom: 4px;
}

#contact-form input[type=text],
#contact-form input[type=email],
#contact-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

#contact-form textarea {
  min-height: 100px;
  resize: vertical;
}

.radio-row {
  display: flex;
  gap: 16px;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: normal;
  color: var(--text);
}

/* ボット対策の隠しフィールド(人には見えないが送信内容に紛れ込ませる) */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.form-actions .primary-btn {
  width: auto;
  flex: 1;
}

.form-actions .btn {
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  flex: 0 0 auto;
}

#contact-status.hint.ok { color: var(--accent-dark); font-weight: bold; }
#contact-status.hint.error { color: #c62828; font-weight: bold; }

/* 言語切替ボタン */
.lang-switcher {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.4;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.28);
}

.lang-btn.active {
  background: rgba(255,255,255,0.85);
  color: var(--accent);
  font-weight: bold;
}

@media (max-width: 480px) {
  .lang-btn { padding: 2px 5px; font-size: 11px; }
}
