/* ==========================================================================
   宮城県遺跡地図 Web版 - クイック操作チュートリアル スタイル
   ========================================================================== */

/* オーバーレイ（暗幕・すりガラス） */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.tutorial-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* モーダルカード */
.tutorial-card {
  background: #ffffff;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
  color: #333333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  min-height: 0;
  animation: tutorial-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tutorial-pop {
  0% {
    transform: scale(0.94) translateY(10px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ヘッダー */
.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px 24px;
  border-bottom: 1px solid #eeeeee;
}

.tutorial-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a3a5f;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 大きな✕ボタン */
.tutorial-close-btn {
  background: #f0f3f6;
  border: 1px solid #d0d7de;
  color: #555555;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  outline: none;
  flex: 0 0 auto;
}

.tutorial-close-btn:hover {
  background: #e1e7ed;
  color: #d32f2f;
  transform: scale(1.08);
}

.tutorial-close-btn:active {
  transform: scale(0.96);
}

/* 本文グリッド */
.tutorial-body {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* 各操作ステップのカード */
.tutorial-step {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.tutorial-step-header {
  font-size: 14px;
  font-weight: 700;
  color: #0f4c81;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tutorial-step-badge {
  background: #0f4c81;
  color: #ffffff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* ミニUI図解プレビュー枠 */
.tutorial-preview-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px;
  min-height: 125px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 12px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

/* 図解用パーツ：セクション見出し */
.preview-section-title {
  font-size: 11px;
  font-weight: bold;
  color: #1e293b;
  border-bottom: 2px solid #0f4c81;
  padding-bottom: 2px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 図解用パーツ：レイヤー項目（実画像目のアイコン） */
.preview-layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  color: #333333;
}
.preview-eye-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
  user-select: none;
}

/* 図解用パーツ：ボタン＆スライダー */
.preview-mini-group {
  display: flex;
  flex-direction: column;
}
.preview-btn-group {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.preview-mini-btn {
  background: #f1f5f9;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: bold;
  color: #1e293b;
  display: inline-flex;
  align-items: center;
}
.preview-mini-btn.active {
  background: #0f4c81;
  color: #ffffff;
  border-color: #0f4c81;
}
.preview-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #475569;
}
.preview-slider-track {
  flex: 1;
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
  position: relative;
}
.preview-slider-thumb {
  width: 8px;
  height: 8px;
  background: #0f4c81;
  border-radius: 50%;
  position: absolute;
  top: -2.5px;
  left: 50%;
  transform: translateX(-50%);
}

/* 図解用パーツ：地図ポリゴン＋吹出しポップアップ */
.preview-map-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-popup-bubble {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 8px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  font-size: 10px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  margin-bottom: 8px;
}

/* 吹出しのしっぽ（三角形） */
.preview-popup-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
  display: block;
  width: 0;
}
.preview-popup-bubble::before {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 7px 7px 0 7px;
  border-style: solid;
  border-color: #cbd5e1 transparent transparent transparent;
  display: block;
  width: 0;
}

.preview-popup-title {
  font-weight: 700;
  color: #111111;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 2px;
  margin-bottom: 3px;
  font-size: 11px;
}
.preview-popup-row {
  color: #334155;
  font-size: 9.5px;
  line-height: 1.35;
  display: flex;
  gap: 4px;
}
.preview-popup-label {
  color: #64748b;
  min-width: 42px;
}

/* 地図上の遺跡ポリゴン模式図 */
.preview-polygon-target {
  background: rgba(220, 38, 38, 0.25);
  border: 1.5px solid #dc2626;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 9px;
  color: #b91c1c;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.tutorial-step-desc {
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
  margin: 0;
}

/* フッター */
.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #f8fafc;
  border-top: 1px solid #eeeeee;
  border-radius: 0 0 14px 14px;
}

.tutorial-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

.tutorial-start-btn {
  background: #0f4c81;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 8px 24px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tutorial-start-btn:hover {
  background: #1a5c9b;
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.3);
}

.tutorial-start-btn:active {
  transform: scale(0.97);
}

/* 画面右上の目立たない「？」ヘルプボタン */
.tutorial-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f3f5;
  border: 1px solid #ced4da;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.tutorial-help-btn:hover {
  background: #e9ecef;
  color: #0f4c81;
  border-color: #adb5bd;
}

/* モバイル対応（画面幅768px以下） */
@media (max-width: 768px) {
  .tutorial-overlay {
    padding: 8px;
  }
  .tutorial-card {
    max-height: calc(100vh - 16px);
  }
  .tutorial-body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 16px;
  }
  .tutorial-header {
    padding: 12px 16px;
  }
  .tutorial-title {
    font-size: 16px;
    line-height: 1.3;
  }
  .tutorial-footer {
    flex-direction: column-reverse;
    gap: 12px;
    padding: 12px 16px;
    align-items: stretch;
    text-align: center;
  }
  .tutorial-checkbox-label {
    justify-content: center;
  }
  .tutorial-start-btn {
    width: 100%;
  }
  .mobile-page .tutorial-help-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    margin-left: 2px;
  }
}
