* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 1rem 2rem;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

header .subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
}

.controls {
  background: white;
  padding: 1rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  color: #666;
  white-space: nowrap;
}

.filter-group select {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  min-width: 150px;
}

.stats {
  font-size: 0.9rem;
  color: #666;
}

.stats span {
  font-weight: bold;
  color: #e74c3c;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

#map {
  flex: 1;
  min-height: 500px;
}

footer {
  background: #333;
  color: #999;
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
}

/* ボタン共通 */
.adventure-btn, .help-btn {
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.adventure-btn {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}

.adventure-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.help-btn {
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.help-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

/* サイドパネル共通 */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s;
}

.side-panel.hidden {
  transform: translateX(100%);
}

.panel-header {
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.panel-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.adventure-header-bg {
  background: linear-gradient(135deg, #2c3e50, #34495e);
}

.help-header-bg {
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.panel-content {
  padding: 1rem;
}

/* InfoWindow スタイル */
.info-window {
  max-width: 280px;
  padding: 0.5rem;
}

.info-window h3 {
  font-size: 1rem;
  color: #333;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid #e74c3c;
  padding-bottom: 0.25rem;
}

.info-window .representative {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.info-window .industry {
  display: inline-block;
  background: #e74c3c;
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.info-window .pattern {
  display: inline-block;
  background: #3498db;
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.25rem;
}

.info-window .address {
  font-size: 0.8rem;
  color: #666;
  margin: 0.5rem 0;
  line-height: 1.4;
}

.info-window .links {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.info-window .links a {
  font-size: 0.8rem;
  color: #3498db;
  text-decoration: none;
}

.info-window .links a:hover {
  text-decoration: underline;
}

/* 店舗カード共通 */
.shop-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid #e74c3c;
}

.shop-number {
  font-size: 0.85rem;
  color: #e74c3c;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.shop-card h3 {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.shop-meta {
  margin-bottom: 0.5rem;
}

.industry-tag {
  display: inline-block;
  background: #e74c3c;
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}

.industry-tag.small {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
}

.shop-rep {
  font-size: 0.85rem;
  color: #666;
  margin: 0.25rem 0;
}

.shop-address {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.shop-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-small {
  display: inline-block;
  background: #3498db;
  color: white;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
}

.btn-small:hover {
  background: #2980b9;
}

/* ストーリーカード */
.story-card {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 12px;
  padding: 1.2rem;
  margin: 1rem 0;
}

.story-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.story-text {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* 再生成ボタン */
.adventure-actions {
  text-align: center;
  padding: 1rem 0;
}

.regenerate-btn {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  transition: transform 0.2s;
}

.regenerate-btn:hover {
  transform: scale(1.05);
}

/* ローディング */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  color: white;
}

.loading.hidden {
  display: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #f39c12;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  font-size: 1.1rem;
}

/* ===== 困ったときは パネル ===== */

.help-input-section {
  margin-bottom: 1rem;
}

#helpInput {
  width: 100%;
  min-height: 80px;
  padding: 0.8rem;
  font-size: 0.95rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 0.75rem;
}

#helpInput:focus {
  outline: none;
  border-color: #9b59b6;
}

.help-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: white;
  border: none;
  padding: 0.8rem;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.help-submit-btn:hover {
  transform: scale(1.02);
}

.help-result.hidden {
  display: none;
}

.result-section {
  margin-bottom: 1.5rem;
}

.result-section h3 {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #9b59b6;
}

.solution-box {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
}

.solution-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #333;
}

.industries-tags {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ddd;
}

.industry-badge {
  display: inline-block;
  background: #9b59b6;
  color: white;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 15px;
  margin: 0.2rem;
}

/* 店舗グリッド（並列表示） */
.help-shops-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.help-shop-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 0.9rem;
  border-left: 4px solid #9b59b6;
  cursor: pointer;
  transition: all 0.2s;
}

.help-shop-card:hover {
  background: #f0e6f6;
  transform: translateX(4px);
}

.help-shop-card.active {
  background: #e8d5f0;
  border-left-color: #e74c3c;
  box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
}

.help-shop-card h4 {
  font-size: 0.95rem;
  color: #333;
  margin: 0 0 0.4rem 0;
}

.help-shop-card .industry-tag {
  background: #9b59b6;
  margin-bottom: 0.4rem;
}

.help-shop-card .shop-rep {
  font-size: 0.8rem;
  margin: 0.3rem 0;
}

.help-shop-card .shop-address {
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.help-shop-card .shop-actions {
  margin-top: 0.5rem;
}

.help-reset-btn {
  width: 100%;
  background: #95a5a6;
  color: white;
  border: none;
  padding: 0.7rem;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.help-reset-btn:hover {
  background: #7f8c8d;
}

/* エラー・結果なし */
.error-message {
  background: #fee;
  color: #c00;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.no-results {
  text-align: center;
  color: #666;
  padding: 1.5rem;
}

/* レスポンシブ */
@media (max-width: 768px) {
  header {
    padding: 0.75rem 1rem;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .controls {
    padding: 0.75rem 1rem;
    gap: 1rem;
  }

  .filter-group {
    flex: 1 1 100%;
  }

  .filter-group select {
    flex: 1;
  }

  .stats {
    flex: 1 1 100%;
    text-align: center;
  }

  .action-buttons {
    flex: 1 1 100%;
    flex-direction: column;
    margin-left: 0;
  }

  .adventure-btn,
  .help-btn {
    width: 100%;
  }

  .side-panel {
    width: 100%;
  }
}

/* スマホ用: パネル再表示ボタン */
.reopen-help-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
  z-index: 1500;
  transition: transform 0.2s;
}

.reopen-help-btn:hover {
  transform: translateX(-50%) scale(1.05);
}

.reopen-help-btn.hidden {
  display: none;
}
