:root {
  --color-forest: #2b2b2b;
  --color-forest-dark: #1a1a1a;
  --color-terracotta: #e2672c;
  --color-terracotta-dark: #b8501f;
  --color-terracotta-darker: #a6481c;
  --color-cream: #f7f7f7;
  --color-cream-dark: #e0e0e0;
  --color-wood: #6b6b6b;
  --color-ink: #1f1f1f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-cream);
  color: var(--color-ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  flex-shrink: 0;
  background-color: var(--color-forest);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: white;
  padding: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.site-header::after {
  content: "";
  position: absolute;
  pointer-events: none;
  bottom: 0;
  right: 0;
  width: 140px;
  height: 110px;
  background-image: url("img/leaf.png");
  background-repeat: no-repeat;
  background-position: bottom right;
  background-size: contain;
  opacity: 0.18;
}

.site-header > * {
  position: relative;
  z-index: 1;
}

.site-name {
  font-size: 24px;
  font-weight: 700;
  opacity: 0.95;
}

.site-tagline {
  font-size: 13px;
  font-weight: 500;
}

.site-header h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
  margin: 0;
}

.site-header h1 a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.site-header a {
  color: inherit;
  text-decoration: none;
}

.site-footer {
  flex-shrink: 0;
  background: var(--color-ink);
  color: #cfcfcf;
  padding: 14px 20px;
  text-align: center;
  font-size: 12px;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 6px;
}

.footer-nav a {
  color: #fff;
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.footer-copy {
  margin: 0;
  opacity: 0.7;
}

.marker-cluster-small {
  background-color: rgba(90, 62, 120, 0.5);
}
.marker-cluster-small div {
  background-color: rgba(90, 62, 120, 0.85);
}

.marker-cluster-medium {
  background-color: rgba(74, 45, 105, 0.55);
}
.marker-cluster-medium div {
  background-color: rgba(74, 45, 105, 0.85);
}

.marker-cluster-large {
  background-color: rgba(58, 30, 87, 0.6);
}
.marker-cluster-large div {
  background-color: rgba(58, 30, 87, 0.9);
}

.marker-cluster span {
  color: white;
  font-weight: 600;
}

.mobile-tabs {
  display: none;
  flex-shrink: 0;
}

.container {
  flex: 1;
  min-height: 0;
  display: flex;
}

.map-container {
  flex: 1;
  background: var(--color-cream-dark);
}

.leaflet-tile-pane {
  opacity: 0.75;
}

.sidebar {
  width: 450px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-wood);
  background: white;
}

.section {
  padding: 1rem;
  border-bottom: 1px solid var(--color-cream-dark);
  background: white;
}

.search-box {
  margin: 0;
}

.search-box > div:not(:last-child) {
  margin-bottom: 12px;
}

input[type="text"],
select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-wood);
  border-radius: 3px;
  background: white;
  color: var(--color-ink);
  font-size: 14px;
  font-family: inherit;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.category-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid var(--color-wood);
  border-radius: 3px;
  background: white;
  color: var(--color-wood);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.category-icon {
  width: 18px;
  height: 18px;
}

.category-tab:hover:not(.active) {
  background: var(--color-cream-dark);
}

.category-tab.active {
  background: var(--color-terracotta-dark);
  border-color: var(--color-terracotta-dark);
  color: white;
  font-weight: 600;
}

.results {
  flex: 1;
  overflow-y: auto;
  margin: 0;
}

.results-count {
  background: var(--color-cream);
  padding: 0.5rem;
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--color-wood);
}

.skeleton-card {
  height: 68px;
  background: linear-gradient(90deg, #eee 25%, #e2e2e2 37%, #eee 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}

.skeleton-card:not(:last-child) {
  margin-bottom: 1rem;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.shop-card {
  padding: 12px;
  background: white;
  border-left: 4px solid var(--color-forest);
  margin: 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: background 0.2s;
  cursor: pointer;
}

.shop-card:not(:last-child) {
  margin-bottom: 1rem;
}

.shop-card:hover {
  background: var(--color-cream-dark);
}

.shop-card:focus-visible {
  outline: 2px solid var(--color-terracotta);
  outline-offset: -2px;
}

.shop-card.active {
  background: #fce3d2;
  border-left: 6px solid var(--color-terracotta);
  box-shadow: 0 2px 8px rgba(226, 103, 44, 0.35);
}

.shop-info {
  flex: 1;
  min-width: 0;
}

.shop-header {
  display: flex;
  gap: 8px;
  margin: 0 0 4px 0;
  align-items: center;
}

.shop-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-ink);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.shop-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--color-wood);
}

.shop-distance {
  white-space: nowrap;
}

.shop-rating {
  color: var(--color-terracotta-dark);
  font-weight: 600;
  white-space: nowrap;
}

.shop-address {
  font-size: 11px;
  color: var(--color-wood);
  line-height: 1.3;
  font-style: normal;
}

.shop-link {
  flex-shrink: 0;
  padding: 8px 12px;
  background: var(--color-terracotta-dark);
  border: none;
  border-radius: 3px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  transition: background 0.2s;
}

.shop-link:hover {
  background: var(--color-terracotta-darker);
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--color-wood);
}

.no-results p {
  margin: 0 0 12px;
}

.clear-search-btn {
  padding: 8px 16px;
  background: var(--color-forest);
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.clear-search-btn:hover {
  background: var(--color-forest-dark);
}

.shop-card mark {
  background: #f0d9a0;
  color: inherit;
  padding: 0 1px;
}

.scroll-top-btn {
  margin: 0 auto 8px;
  background: none;
  border: 1px solid var(--color-wood);
  color: #fff;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}

.scroll-top-btn:not([hidden]) {
  display: block;
}

.scroll-top-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.info {
  margin: 0;
}

.info-message {
  margin: 0;
  padding: 1rem;
  background: var(--color-cream-dark);
  border-left: 4px solid var(--color-forest);
  font-size: 12px;
  color: var(--color-forest-dark);
}

.info-message:not(:last-child) {
  margin-bottom: 8px;
}

.info-message.location-tip {
  background: #fce3d2;
  border-left-color: var(--color-terracotta);
  color: var(--color-terracotta-darker);
}

.ad-slot {
  display: none;
}

.ad-placeholder {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #ccc;
  background: #fafafa;
  color: #aaa;
  font-size: 12px;
}

.leaflet-popup-content {
  font-family: inherit;
  font-size: 12px;
}

@media (max-width: 768px) {
  .mobile-tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--color-cream-dark);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .tab-button {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    color: var(--color-wood);
    font-size: 14px;
    cursor: pointer;
  }

  .tab-button.active {
    color: var(--color-terracotta-dark);
    font-weight: 600;
    border-bottom: 3px solid var(--color-terracotta);
  }

  body {
    height: auto;
    min-height: 100%;
    padding-bottom: 56px;
  }

  .container {
    flex-direction: column;
    flex: none;
  }

  .map-container.mobile-hidden,
  .sidebar.mobile-hidden {
    display: none;
  }

  .map-container {
    flex: none;
    height: 60vh;
  }

  .sidebar {
    width: 100%;
    flex: none;
    border-right: none;
  }

  .results {
    flex: none;
    overflow-y: visible;
  }

  .site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }

  body.showing-map {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }

  body.showing-map .mobile-tabs {
    position: static;
  }

  body.showing-map .container {
    flex: 1;
    min-height: 0;
  }

  body.showing-map .map-container {
    height: auto;
    flex: 1;
  }

  body.showing-map .site-footer {
    position: static;
  }
}
