:root {
  --sm-bg: #f4f6f8;
  --sm-surface: #ffffff;
  --sm-border: #e2e8f0;
  --sm-text: #0f172a;
  --sm-muted: #64748b;
  --sm-c20: #0f766e;
  --sm-c20-soft: #ccfbf1;
  --sm-c10-new: #ea580c;
  --sm-c10-new-soft: #ffedd5;
  --sm-c10-old: #2563eb;
  --sm-c10-old-soft: #dbeafe;
  --sm-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --sm-radius: 10px;
}

* {
  box-sizing: border-box;
}

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

.sm-map-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.sm-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--sm-border);
  z-index: 500;
  flex-shrink: 0;
}

.sm-map-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sm-map-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.sm-map-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.sm-map-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--sm-muted);
}

.sm-map-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sm-map-count-pill {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--sm-text);
  white-space: nowrap;
}

.sm-map-cat-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sm-cat-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.sm-cat-20 {
  background: var(--sm-c20-soft);
  color: var(--sm-c20);
}

.sm-cat-10-new {
  background: var(--sm-c10-new-soft);
  color: #c2410c;
}

.sm-cat-10-old {
  background: var(--sm-c10-old-soft);
  color: #1d4ed8;
}

/* Mobile tabs */
.sm-mobile-tabs {
  display: none;
  background: #ffffff;
  border-bottom: 1px solid var(--sm-border);
  flex-shrink: 0;
}

.sm-mobile-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--sm-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.sm-mobile-tab.is-active {
  color: var(--sm-c20);
  border-bottom-color: var(--sm-c20);
}

/* Workspace 2-pane */
.sm-map-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

.sm-map-sidebar {
  width: 390px;
  max-width: 100%;
  background: var(--sm-surface);
  border-right: 1px solid var(--sm-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 400;
}

.sm-filter-panel {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--sm-border);
  background: #fbfcfd;
  flex-shrink: 0;
}

.sm-filter-group {
  margin-bottom: 10px;
}

.sm-filter-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sm-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--sm-muted);
  margin-bottom: 4px;
}

.sm-input,
.sm-select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
  color: var(--sm-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sm-input:focus,
.sm-select:focus {
  outline: none;
  border-color: var(--sm-c20);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.sm-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #e2e8f0;
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
}

.sm-seg-btn {
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sm-seg-btn.is-active {
  background: #ffffff;
  color: var(--sm-text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.sm-filter-row-inline {
  margin-bottom: 10px;
}

.sm-toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.sm-toggle-label small {
  font-weight: 400;
  color: var(--sm-muted);
}

.sm-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sm-toggle-switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.sm-toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sm-toggle-input:checked + .sm-toggle-switch {
  background: var(--sm-c10-new);
}

.sm-toggle-input:checked + .sm-toggle-switch::after {
  transform: translateX(16px);
}

.sm-filter-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.sm-btn-primary {
  background: var(--sm-c20);
  color: #ffffff;
}

.sm-btn-primary:hover {
  background: #115e59;
}

.sm-btn-secondary {
  background: #eef2f6;
  color: var(--sm-text);
  border-color: #cbd5e1;
}

.sm-btn-secondary:hover {
  background: #e2e8f0;
}

.sm-btn-outline {
  background: #ffffff;
  color: var(--sm-text);
  border-color: #cbd5e1;
}

.sm-btn-outline:hover {
  background: #f8fafc;
}

.sm-btn-ghost {
  background: transparent;
  color: var(--sm-muted);
  border-color: #e2e8f0;
}

.sm-btn-ghost:hover {
  background: #f1f5f9;
  color: var(--sm-text);
}

.sm-btn-full {
  width: 100%;
  height: 36px;
}

.sm-status-msg {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--sm-muted);
  min-height: 15px;
}

/* Store List */
.sm-list-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sm-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid var(--sm-border);
  background: #ffffff;
  font-size: 12px;
  flex-shrink: 0;
}

.sm-list-title {
  font-weight: 700;
}

.sm-list-showing {
  color: var(--sm-muted);
}

.sm-store-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sm-store-card {
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  padding: 10px 12px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.sm-store-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.sm-store-card.is-selected {
  border-color: var(--sm-c20);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.sm-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.sm-card-brand-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sm-mini-genre-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1.5px solid #0f766e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sm-mini-genre-icon svg {
  width: 12px;
  height: 12px;
}

.sm-card-brand {
  font-size: 11px;
  font-weight: 600;
  color: var(--sm-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-card-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sm-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.sm-badge-20 {
  background: var(--sm-c20-soft);
  color: var(--sm-c20);
}

.sm-badge-10-new {
  background: var(--sm-c10-new-soft);
  color: #c2410c;
}

.sm-badge-10-old {
  background: var(--sm-c10-old-soft);
  color: #1d4ed8;
}

.sm-badge-new-tag {
  background: #ea580c;
  color: #ffffff;
}

.sm-card-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.sm-card-addr {
  margin: 0 0 6px;
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}

.sm-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--sm-muted);
}

.sm-card-route {
  color: var(--sm-c20);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.sm-card-route:hover {
  text-decoration: underline;
}

.sm-load-more-wrap {
  padding: 8px 12px 12px;
  border-top: 1px solid var(--sm-border);
  background: #ffffff;
}

.sm-empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--sm-muted);
  font-size: 13px;
}

/* Map Pane */
.sm-map-pane {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
}

.sm-map-canvas {
  width: 100%;
  height: 100%;
}

/* Custom Brand-Mark Pin Markers */
.sm-pin-wrapper {
  background: transparent;
  border: none;
}

.sm-brand-pin {
  position: relative;
  width: 42px;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.36));
  transition: transform 0.14s ease;
}

.sm-brand-pin:hover {
  transform: scale(1.15);
  z-index: 900;
}

.sm-brand-pin-head {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--sm-pin-color, #0f766e);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  position: relative;
  padding: 2px;
}

.sm-brand-pin-svg {
  color: var(--sm-pin-color, #0f766e);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sm-brand-pin-svg svg {
  width: 14px;
  height: 14px;
}

.sm-brand-pin-text {
  font-size: 8px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.05;
  letter-spacing: -0.04em;
  max-width: 34px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-brand-pin-tip {
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--sm-pin-color, #0f766e);
}

.sm-pin-rate-pill {
  position: absolute;
  bottom: 7px;
  right: -4px;
  background: var(--sm-pin-color, #0f766e);
  color: #ffffff;
  border: 1px solid #ffffff;
  font-size: 8px;
  font-weight: 800;
  padding: 0 3px;
  border-radius: 4px;
  line-height: 1.3;
  pointer-events: none;
}

.sm-pin-new-pill {
  position: absolute;
  top: -5px;
  right: -7px;
  background: #fef08a;
  color: #9a3412;
  border: 1px solid #ea580c;
  font-size: 8px;
  font-weight: 800;
  padding: 0 3px;
  border-radius: 4px;
  line-height: 1.25;
  pointer-events: none;
}

.sm-popup-brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

/* Legend */
.sm-map-legend {
  position: absolute;
  right: 12px;
  bottom: 24px;
  z-index: 450;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid var(--sm-border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--sm-shadow);
  font-size: 11px;
  max-width: 270px;
}

.sm-legend-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 12px;
}

.sm-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.sm-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.sm-dot-20 {
  background: var(--sm-c20);
}

.sm-dot-10-new {
  background: var(--sm-c10-new);
}

.sm-dot-10-old {
  background: var(--sm-c10-old);
}

.sm-mini-new {
  display: inline-block;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--sm-c10-new);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
}

.sm-legend-note {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--sm-border);
  color: var(--sm-muted);
  font-size: 10px;
}

/* Leaflet Popup */
.sm-popup {
  min-width: 230px;
  max-width: 290px;
  font-family: "Noto Sans JP", sans-serif;
}

.sm-popup-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.sm-popup-brand {
  font-size: 11px;
  color: var(--sm-muted);
  font-weight: 600;
}

.sm-popup-name {
  margin: 2px 0 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.sm-popup-row {
  font-size: 12px;
  color: #334155;
  margin-bottom: 4px;
  line-height: 1.45;
}

.sm-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sm-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.sm-popup-btn-gmap {
  background: #0f766e;
  color: #ffffff !important;
}

.sm-popup-btn-gmap:hover {
  background: #115e59;
}

.sm-popup-btn-official {
  background: #f1f5f9;
  color: #0f172a !important;
  border: 1px solid #cbd5e1;
}

/* Modal */
.sm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.sm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.sm-modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  padding: 18px 20px;
}

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

.sm-modal-head h2 {
  margin: 0;
  font-size: 16px;
}

.sm-modal-close {
  border: none;
  background: #f1f5f9;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.sm-modal-body ul {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.65;
  color: #334155;
}

.sm-modal-body li + li {
  margin-top: 6px;
}

.sm-modal-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 900px) {
  .sm-map-cat-pills {
    display: none;
  }

  .sm-mobile-tabs {
    display: flex;
  }

  .sm-map-workspace {
    display: block;
  }

  .sm-map-sidebar,
  .sm-map-pane {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
  }

  .sm-map-sidebar.is-active-mobile,
  .sm-map-pane.is-active-mobile {
    display: flex;
  }

  .sm-map-legend {
    bottom: 14px;
    right: 8px;
    max-width: 225px;
    padding: 8px 10px;
  }
}
