/* Air — 地図と写真でエア旅行（Instagram風） */

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #262626;
  --text-muted: #8e8e8e;
  --border: #dbdbdb;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', 'Hiragino Sans', -apple-system, sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --gradient-hover: linear-gradient(45deg, #f5a623 0%, #ed7a4a 25%, #e63950 50%, #d62d70 75%, #c61d98 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1000;
  transition: transform 0.3s ease;
}
.header.hidden {
  display: none;
}
.header.header-auto-hidden {
  transform: translateY(-100%);
}

.header-logo {
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
}

.header-right {
  flex: 1;
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: flex-end;
}

.header-info {
  min-width: 0;
  text-align: right;
}

.header-mobile-content {
  display: none;
  flex: 0 0 auto;
  min-width: 0;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
}

.header-trip-name-mobile {
  flex: 0 1 auto;
  min-width: 60px;
  max-width: 40%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.header-tabs-mobile {
  flex-shrink: 0;
  display: flex;
  gap: 0.25rem;
  background: var(--bg);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.header-mobile-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-mobile-map-controls,
.header-mobile-travelogue-controls {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.header-tab {
  padding: 0.4rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.header-tab:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

.header-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.header-tab-label {
  display: inline;
}

.header-mobile-content {
  flex: 1;
  display: none;
  align-items: center;
  min-width: 0;
}

.header-mobile-trip-name {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.header-logo.hidden {
  display: none;
}

/* モバイルビューでのヘッダー調整 */
@media (max-width: 768px) {
  .header {
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
  }

  .main {
    height: 100vh;
  }

  .map-container {
    padding-top: 60px;
    transition: padding-top 0.3s ease;
  }

  body.header-hidden .map-container {
    padding-top: 0;
  }

  /* プルダウンバー */
  .mobile-header-pulldown-bar {
    display: none;
  }

  @media (max-width: 768px) {
    .mobile-header-pulldown-bar {
      display: block;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 32px;
      z-index: 999;
      opacity: 0;
      transition: opacity 0.3s;
      pointer-events: none;
      cursor: pointer;
      background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, transparent 100%);
    }

    .mobile-header-pulldown-bar::before {
      content: '';
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      width: 80px;
      height: 5px;
      background: rgba(255, 255, 255, 0.6);
      border-radius: 3px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
      transition: all 0.2s;
    }

    .mobile-header-pulldown-bar::after {
      content: '↓';
      position: absolute;
      top: 16px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 0.7rem;
      color: rgba(255, 255, 255, 0.7);
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
      transition: opacity 0.2s;
    }

    body.header-hidden .mobile-header-pulldown-bar {
      opacity: 1;
      pointer-events: auto;
    }

    /* プルダウン中のアニメーション */
    body.header-pulling .mobile-header-pulldown-bar::before {
      background: rgba(255, 255, 255, 0.85);
      box-shadow: 0 3px 16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
    }

    body.header-pulling .mobile-header-pulldown-bar::after {
      opacity: 1;
      animation: pulldown-bounce 0.5s ease-in-out infinite;
    }

    @keyframes pulldown-bounce {
      0%, 100% { transform: translateX(-50%) translateY(0); }
      50% { transform: translateX(-50%) translateY(2px); }
    }
  }

  .header-logo {
    font-size: 1.25rem;
    display: block !important;
  }

  .header-logo.hidden {
    display: block !important;
  }

  .header-mobile-content {
    display: flex !important;
  }

  .header-mobile-trip-name {
    display: block !important;
  }

  .header-mobile-content {
    flex: 1 1 auto;
    max-width: 50%;
  }

  .header-right {
    flex: 0 1 auto;
    gap: 0.5rem;
  }
}

.header-mobile-controls {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 0.35rem;
}

.header-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


.header-controls select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-card);
  cursor: pointer;
}

.header-line1 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-trip-link {
  color: inherit;
  text-decoration: none;
}
.header-trip-link:hover {
  text-decoration: underline;
}
.header-blog-icon {
  font-size: 0.85rem;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.header-blog-icon:hover {
  opacity: 1;
}

.header-gpx {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.header-photo-count-toggle {
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: normal;
  cursor: pointer;
  transition: opacity 0.2s;
}

.header-photo-count-toggle:hover {
  opacity: 0.7;
}

.header-line2 {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: left;
  margin-top: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.header-travelogue-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  background: linear-gradient(135deg, #f5a623 0%, #f76b1c 100%);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  vertical-align: middle;
  margin-left: 0.4rem;
}

.header-travelogue-btn:hover {
  background: linear-gradient(135deg, #f7b733 0%, #fc8621 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.header-travelogue-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.hamburger-btn:hover { background: rgba(0,0,0,0.05); }

.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  margin: 0 auto;
  border-radius: 1px;
}

.main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.map-container {
  flex: 1;
  position: relative;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* will-change: transform を削除 → 常時レイヤー昇格によるVRAM増大を解消 */
}

.mobile-travelogue-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.mobile-travelogue-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.mobile-travelogue-title {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.mobile-travelogue-nav-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 50%;
}

.mobile-travelogue-nav-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: scale(1.1);
}

.mobile-travelogue-nav-btn:active {
  transform: scale(0.95);
}

.mobile-travelogue-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.mobile-travelogue-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

/* 旅行記表示時はトリップシートとサムネイルを非表示 */
body:has(.mobile-travelogue-view[style*="display: block"]) .trip-sheet-trigger-container,
body:has(.mobile-travelogue-view[style*="display: block"]) .thumbnail-strip-container {
  display: none !important;
}

.map-nav-controls {
  display: none !important;
}

/* 地図のattribution（Leaflet | © Esri等）を常に非表示 */
.map-container .leaflet-control-attribution,
.map-container .maplibregl-ctrl-attrib,
.map-container .maplibregl-ctrl-attrib-button,
.map-container .maplibregl-ctrl-bottom-right,
.map-container .maplibregl-ctrl-bottom-left,
.map-container .maplibregl-ctrl-logo,
.map-container .mapboxgl-ctrl-attrib,
.map-container .mapboxgl-ctrl-attrib-button,
.map-container .mapboxgl-ctrl-bottom-right,
.map-container .mapboxgl-ctrl-bottom-left,
.map-container .mapboxgl-ctrl-logo {
  display: none !important;
}
.map-container.map-playback-cinematic {
  transform: perspective(1400px) rotateX(10deg);
  transform-origin: center 40%;
  transition: transform 0.5s ease-out;
}
#map {
  width: 100%;
  height: 100%;
  min-height: 300px;
}

/* 地図タイルを高解像度でクリスプに表示 */
.map-tiles-crisp,
.leaflet-tile-container img,
.leaflet-tile {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

/* ラベルレイヤーを鮮明に表示 */
.leaflet-overlay-pane .leaflet-tile {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mapbox/MapLibre（3D地図）のキャンバスも高品質レンダリング */
.maplibregl-canvas,
.mapboxgl-canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
}

/* 3D地図のテキストラベルを鮮明に */
.maplibregl-ctrl,
.maplibregl-ctrl-group button,
.mapboxgl-ctrl,
.mapboxgl-ctrl-group button {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 3D地図のテキストレンダリング最適化 */
.maplibregl-canvas-container,
.mapboxgl-canvas-container {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* 3D地図のラベル位置精度向上 */
.maplibregl-map,
.mapboxgl-map {
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

/* ラベルテキストの鮮明化 */
.maplibregl-canvas-container canvas,
.mapboxgl-canvas-container canvas {
  font-smooth: always;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* 3D地図のズーム時の滑らかさ向上 */
.map-3d-layer,
#map3d {
  transition: opacity 0.3s ease-in-out;
}

/* 3D地図（自動再生時のみ表示） */
.map-3d-layer {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s ease-in;
}
.map-container.map-playback-cinematic .map-3d-layer {
  display: block;
  z-index: 10;
  opacity: 1;
}
.map-container.map-playback-cinematic #map {
  opacity: 0;
}
.map-container.map-playback-cinematic .leaflet-tile-pane,
.map-container.map-playback-cinematic .leaflet-marker-pane,
.map-container.map-playback-cinematic .leaflet-overlay-pane {
  opacity: 0;
  pointer-events: none;
}
.map-container.map-playback-cinematic .leaflet-popup-pane {
  opacity: 0;
  pointer-events: none;
}
/* 3D地図コントロール */
.maplibregl-ctrl-group,
.mapboxgl-ctrl-group {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}
.maplibregl-canvas,
.mapboxgl-canvas {
  outline: none;
}

/* 自動再生中の現在ポイント: パルスマーカー */
@keyframes playback-pulse-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes playback-pulse-core {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.playback-pulse-marker {
  position: relative;
  width: 40px;
  height: 40px;
}
.playback-pulse-marker::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pulse-color, #e1306c);
  animation: playback-pulse-ring 1.6s ease-out infinite;
}
.playback-pulse-marker::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--pulse-color, #e1306c);
  border: 3px solid #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  animation: playback-pulse-core 1.6s ease-in-out infinite;
}

/* 自動再生時の写真オーバーレイ */
.playback-photo-overlay {
  position: absolute;
  bottom: 100px;
  right: 20px;
  z-index: 1100;
  pointer-events: none;
}
.playback-photo-overlay.hidden {
  display: none;
}
/* 動画表示モード（デスクトップ：横長動画は16:9比率で中央下部に配置） */
.playback-photo-overlay.playback-video-fullscreen {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  width: 70vw;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
  pointer-events: auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
/* デスクトップ縦長動画：9:16比率で中央に配置（より大きく表示） */
.playback-photo-overlay.playback-video-fullscreen.playback-video-portrait {
  width: auto;
  height: 85vh;
  max-height: calc(100vh - 100px);
  max-width: 720px;
  aspect-ratio: 9 / 16;
  bottom: 50px;
}
.playback-photo-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  width: 594px;
  max-width: 594px;
  animation: fadeInSlide 0.4s ease-out;
}
/* 動画カード（アスペクト比に合わせて自動調整） */
.playback-photo-card.playback-video-card {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: #000;
  border-radius: 8px;
  position: relative;
  pointer-events: auto;
  overflow: hidden;
}
/* 自動再生中の動画コントロールバー（下部中央） */
.playback-video-bottombar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
  pointer-events: auto;
}
.playback-video-bar-btn {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.playback-video-bar-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}
.playback-video-bar-btn--back {
  background: rgba(40, 40, 40, 0.7);
}
.playback-video-bar-btn--back:hover {
  background: rgba(70, 70, 70, 0.9);
}
/* 動画コントロールバー（中央下） */
.video-controls-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.video-controls-bar .video-ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: background 0.2s, transform 0.15s;
  pointer-events: auto;
}
.video-controls-bar .video-ctrl-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}
.video-controls-bar .video-ctrl-btn:active {
  transform: scale(0.95);
}
.video-ctrl-btn[data-action="close"] {
  background: rgba(180, 40, 40, 0.7);
}
.video-ctrl-btn[data-action="close"]:hover {
  background: rgba(200, 30, 30, 0.9);
}

/* 自動再生停止ボタン */

.playback-photo-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}
.playback-photo-card img {
  width: 594px;
  height: auto;
  display: block;
  max-height: 396px;
  object-fit: cover;
}
/* 動画カード内の動画ラッパー */
.playback-video-card .playback-photo-wrap {
  width: 100%;
  height: 100%;
}
.playback-photo-info {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(0,0,0,0.08);
}
.playback-photo-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}
.playback-photo-desc-small {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
  opacity: 0.85;
}
@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@media (max-width: 768px) {
  .playback-photo-overlay {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: auto;
  }
  /* モバイルの自動再生時は写真表示を下から1/10上の位置に（動画フルスクリーン時は除く） */
  body.app-playing .playback-photo-overlay:not(.playback-video-fullscreen) {
    bottom: 10%;
  }
  /* モバイルの自動再生時は写真を10%大きく表示 */
  body.app-playing .playback-photo-overlay:not(.playback-video-fullscreen) .playback-photo-card {
    width: 73vw;
    max-width: 73vw;
  }
  body.app-playing .playback-photo-overlay:not(.playback-video-fullscreen) .playback-photo-card img {
    max-height: 42.5vh;
  }
  /* モバイル動画：横長動画は中央下部に */
  .playback-photo-overlay.playback-video-fullscreen {
    left: 50%;
    bottom: 60px;
    top: auto;
    right: auto;
    transform: translateX(-50%);
    width: 100vw;
    height: 67.5vw; /* 56.25vw(16:9) × 1.2 */
    aspect-ratio: unset;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
  /* モバイル縦長動画：9:16 */
  .playback-photo-overlay.playback-video-fullscreen.playback-video-portrait {
    width: auto;
    height: 207.4vh; /* 172.8vh × 1.2 */
    max-height: 207.4vh;
    aspect-ratio: 9 / 16;
    top: auto;
    bottom: 20px;
  }
  .playback-photo-card {
    width: 60vw;
    max-width: 60vw;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
  .playback-photo-card.playback-video-card {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 8px;
  }
}

/* モバイル縦向き：縦長動画を画面の下から2/3の大きさで表示 */
@media (max-width: 768px) and (orientation: portrait) {
  .playback-photo-overlay.playback-video-fullscreen.playback-video-portrait {
    width: 100vw;
    height: calc(100vh * 0.96); /* 0.8 × 1.2 = 0.96 */
    max-height: calc(100vh * 0.96);
    aspect-ratio: 9 / 16;
    bottom: 10px;
  }
  .video-overlay {
    top: 30%;
    height: 70%;
  }
  .video-controls-bar {
    bottom: 10px;
    gap: 6px;
  }
  .video-controls-bar .video-ctrl-btn {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }
  .video-overlay-point-name {
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    font-size: 14px;
    max-width: 70%;
  }
  .playback-photo-card img {
    width: 100%;
    height: auto;
    max-height: 35vh;
    object-fit: cover;
    display: block;
  }
  .playback-photo-wrap {
    position: relative;
  }
  .playback-photo-info {
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }
  .playback-photo-desc {
    font-size: 10px;
    line-height: 1.4;
    color: var(--text);
    margin: 0;
  }
}

.map-search {
  position: absolute;
  top: 12px;
  left: 55px;
  z-index: 1000;
}

/* マーカードラッグ後の保存バー */
.map-marker-save-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: rgba(20, 20, 30, 0.92);
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  white-space: nowrap;
  animation: slideUpFadeIn 0.2s ease;
}
.map-marker-save-label {
  font-size: 0.88rem;
  opacity: 0.9;
}
@keyframes slideUpFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.map-search-input {
  padding: 0.35rem 0.75rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  width: 180px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.95);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.map-search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(225, 48, 108, 0.2);
}

/* レイヤーコントロールのスタイル */
/* Google Map風レイヤーコントロール */
.gmap-layer-control {
  position: relative;
  font-family: var(--font);
}

.gmap-layer-toggle {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: background-color 0.2s;
}

.gmap-layer-toggle:hover {
  background: #f5f5f5;
}

.gmap-layer-panel {
  position: absolute;
  top: 45px;
  right: 0;
  background: white;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 1000;
}

.gmap-layer-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  background: white;
  border-bottom: 1px solid #e8e8e8;
  transition: background-color 0.2s;
  min-width: 140px;
}

.gmap-layer-btn:last-child {
  border-bottom: none;
}

.gmap-layer-btn:hover {
  background: #f5f5f5;
}

.gmap-layer-btn.active {
  background: #e8f0fe;
  color: #1967d2;
}

.gmap-layer-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.gmap-layer-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: #5f6368;
  line-height: 1.2;
}

.gmap-layer-btn.active .gmap-layer-label {
  color: #1967d2;
  font-weight: 600;
}

.video-overlay {
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
}
.video-overlay.hidden {
  display: none;
}

.video-overlay-point-name {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  z-index: 10;
  max-width: 80%;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-container.map-showing-video .map-search,
.map-container.map-showing-video .leaflet-control-zoom,
.map-container.map-showing-video .gmap-layer-control,
.map-container.map-showing-video .leaflet-control-attribution,
.map-container.map-showing-video .leaflet-control,
.map-container.map-showing-video .leaflet-top,
.map-container.map-showing-video .leaflet-bottom,
.map-container.map-showing-video .map-nav-controls,
.map-container.map-showing-video .map-playback-controls {
  display: none !important;
}

/* メニューが開いているときは再生ボタンを非表示 */
body:has(.menu-panel.open) #playBtn,
body:has(.menu-panel.open) .map-nav-controls,
body:has(.menu-panel.open) .map-playback-controls {
  display: none !important;
}

/* 自動再生時は地図コントロールとトリップメニューを非表示 */
body.app-playing .map-search,
body.app-playing .leaflet-control-zoom,
body.app-playing .gmap-layer-control,
body.app-playing .trip-sheet-trigger-container {
  display: none !important;
}

/* 自動再生時のattribution表示を非表示に */
body.app-playing .leaflet-control-attribution,
body.app-playing .maplibregl-ctrl-attrib,
body.app-playing .maplibregl-ctrl-attrib-button,
body.app-playing .maplibregl-ctrl-bottom-right,
body.app-playing .maplibregl-ctrl-bottom-left,
body.app-playing .maplibregl-ctrl-logo,
body.app-playing .mapboxgl-ctrl-attrib,
body.app-playing .mapboxgl-ctrl-attrib-button,
body.app-playing .mapboxgl-ctrl-bottom-right,
body.app-playing .mapboxgl-ctrl-bottom-left,
body.app-playing .mapboxgl-ctrl-logo {
  display: none !important;
}
.video-back-btn {
  display: none !important;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  color: #333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}
.video-back-btn:hover {
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}
.video-player-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.video-player-wrap iframe,
.video-player-wrap video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: none;
  object-fit: contain;
}

.header-video-btn {
  background: var(--gradient) !important;
  color: #fff !important;
  border: none !important;
  -webkit-text-fill-color: #fff;
}
.header-video-btn:hover {
  background: var(--gradient-hover) !important;
  opacity: 0.95;
}

.trip-panel {
  width: 345px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}

.trip-panel h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.trip-list-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.trip-list-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.trip-list-header h3 {
  margin: 0;
}

.trip-region-filter {
  flex-shrink: 0;
}

.trip-region-select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}
.trip-list-title {
  cursor: pointer;
  user-select: none;
}
.trip-list-title:empty {
  min-height: 1.5em;
}
.trip-list-title:hover {
  opacity: 0.85;
}

.trip-order-reset {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.trip-order-reset:hover {
  color: var(--text);
  background: var(--bg);
}

.trip-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.trip-detail-inline {
  padding: 0.5rem 0.75rem 0.75rem 1rem;
  margin: -0.2rem 0 0.4rem 0;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--trip-selected-color, #e1306c);
  font-size: 0.85rem;
  line-height: 1.5;
}

.trip-detail-inline .trip-detail-desc {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 0.8em;
}

.trip-detail-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.trip-detail-link:hover {
  color: var(--trip-selected-color, var(--accent));
}

.trip-detail-inline .trip-detail-btns {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.trip-detail-inline .trip-detail-btn {
  text-decoration: none;
  flex-shrink: 0;
}

.trip-detail-inline .trip-detail-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

.trip-photo-count-toggle {
  color: var(--text-muted);
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.trip-photo-count-toggle:hover {
  opacity: 0.7;
}

.trip-detail-inline .trip-detail-children {
  font-size: 0.8rem;
  margin: 0.25rem 0 0 0;
  color: var(--text-muted);
}

.trip-item-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

body.editor .trip-item-row[draggable="true"] {
  cursor: grab;
}

body.editor .trip-item-row[draggable="true"]:active {
  cursor: grabbing;
}

.trip-item-row:hover {
  background: rgba(0,0,0,0.04);
}

.trip-item-row .trip-item-label {
  flex: 1;
  min-width: 0;
}

.trip-item-row .trip-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.trip-item-row .trip-item-actions button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1;
  transition: background 0.2s;
}

.trip-item-row .trip-item-actions button:hover {
  background: rgba(0,0,0,0.06);
}

.trip-item-row .trip-item-actions button.delete-btn {
  color: #ed4956;
}

.trip-item-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0 4px;
  user-select: none;
}

.trip-item-drag-handle:active {
  cursor: grabbing;
}

.trip-item-row.trip-item-dragging {
  opacity: 0.5;
}

.trip-item-row.trip-item-drag-over {
  background: rgba(225, 48, 108, 0.08);
  border-radius: var(--radius-sm);
}

.trip-item-row.trip-item-selected {
  background: color-mix(in srgb, var(--trip-selected-color, #e1306c) 12%, transparent);
  border-left: 3px solid var(--trip-selected-color, #e1306c);
}

.trip-item-parent {
  font-weight: 600;
}

.trip-item-row.trip-item-child {
  padding-left: 0.5rem;
  font-size: 0.9rem;
}

.trip-item-row.trip-item-child .trip-item-label::before {
  content: '└ ';
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.trip-list-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.75rem 0;
}

.trip-item-expand {
  display: inline-block;
  width: 1em;
  margin-right: 0.25rem;
  cursor: pointer;
}

.trip-color-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.trip-color-picker input[type="color"] {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.trip-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.trip-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s;
}

.trip-color-swatch:hover {
  transform: scale(1.1);
}

.trip-color-swatch:hover,
.trip-color-swatch.active {
  border-color: var(--text);
}

.trip-children-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.trip-children-list .trip-child-item {
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.trip-children-list .trip-child-item:hover {
  background: rgba(0,0,0,0.04);
}

.trip-children-container {
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
}

.thumbnail-strip-container {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  position: relative;
}

.add-gps-point-btn {
  flex-shrink: 0;
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 24px;
  font-weight: bold;
}

.add-gps-point-btn:hover {
  background: #d91a60;
  transform: scale(1.05);
}

.add-gps-point-btn.active {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

.add-gps-point-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.thumbnail-strip {
  display: flex;
  flex: 1;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  min-height: 88px;
  position: relative;
}
body.app-playing .thumbnail-strip {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
}

.thumbnail-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
  padding: 0;
}

.thumbnail-close-btn:hover {
  background: rgba(0,0,0,0.8);
}

body.app-playing .thumbnail-close-btn {
  display: none;
}

.thumbnail-item {
  position: relative;
  flex-shrink: 0;
}

.thumbnail-gps-placeholder {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.thumbnail-gps-placeholder:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

.thumbnail-video-placeholder {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.thumbnail-video-placeholder:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

.thumbnail-video-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  opacity: 0.9;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.thumbnail-strip img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.2s;
  display: block;
}

.thumbnail-strip img:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

.thumbnail-draggable {
  cursor: grab;
}
.thumbnail-draggable:active {
  cursor: grabbing;
}
.thumbnail-dragging {
  opacity: 0.5;
}
.thumbnail-drag-over {
  outline: 2px solid #e1306c;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.thumbnail-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.thumbnail-delete-btn:hover {
  background: var(--danger, #dc3545);
}

.thumbnail-strip-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.thumbnail-strip-upload-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  min-width: 68px;
  min-height: 68px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.thumbnail-strip-upload-compact:hover {
  background: rgba(0,0,0,0.03);
  border-color: #e1306c;
  color: #e1306c;
}

.thumbnail-strip-upload:hover {
  background: var(--bg);
  border-color: var(--text-muted);
  color: var(--text);
}

.thumbnail-strip-upload .upload-icon {
  font-size: 1.5rem;
}

/* ドラッグ可能な写真マーカー（編集モード） */
.photo-marker-draggable {
  background: none !important;
  border: none !important;
  cursor: grab;
}
.photo-marker-draggable:active {
  cursor: grabbing;
}

/* 地図上の写真マーカー（サムネイル表示） */
.map-photo-marker {
  background: none !important;
  border: none !important;
}

/* 親トリップ表示時の地図上の各トリップの旅行記・動画ボタン */
.map-trip-action-marker {
  background: none !important;
  border: none !important;
}
.map-trip-action-card {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.92) 100%);
  border-radius: 8px;
  padding: 5px 7px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6),
              0 1px 4px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  border: 2px solid var(--trip-color, #e1306c);
  min-width: 75px;
  max-width: 140px;
  text-align: center;
  font-size: 0.75rem;
}
.map-trip-action-name {
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  width: 100%;
  font-size: 0.75rem;
  line-height: 1.2;
  display: block;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9),
               0 1px 3px rgba(0, 0, 0, 0.8),
               0 0 1px rgba(0, 0, 0, 1);
}
.map-trip-action-name-clickable:hover {
  color: var(--trip-color, #e1306c);
  text-decoration: underline;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9),
               0 2px 6px rgba(0, 0, 0, 0.9),
               0 1px 3px rgba(0, 0, 0, 0.8);
}
.map-trip-action-btns {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.map-trip-action-btns-right {
  display: none;
}

/* 通常のトリップ名カード */
.map-trip-name-card {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.90) 0%, rgba(0, 0, 0, 0.94) 100%);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7),
              0 2px 8px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  border: 2.5px solid var(--trip-color, #e1306c);
  max-width: 280px;
}

.map-trip-name-text {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 1),
               0 1px 4px rgba(0, 0, 0, 0.9),
               0 0 2px rgba(0, 0, 0, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  line-height: 1.2;
  display: block;
  max-width: 100%;
}

@media (max-width: 768px) {
  .map-trip-action-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.88);
    max-width: 120px;
  }
  .map-trip-action-name {
    margin-bottom: 0;
    font-size: 0.7rem;
    max-width: 80px;
    line-height: 1.1;
  }

  .map-trip-name-card {
    padding: 7px 10px;
    max-width: calc(100vw - 120px);
  }

  .map-trip-name-text {
    font-size: 0.83rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.1;
  }
  .map-trip-action-btns {
    gap: 4px;
    order: -1;
  }
  .map-trip-action-btns-right {
    display: flex;
    gap: 4px;
  }
  .map-trip-action-btn {
    min-width: 24px;
    height: 24px;
    font-size: 0.9rem;
  }
  .map-trip-action-label {
    display: none;
  }
}
.map-trip-action-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: var(--trip-color, #e1306c);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: opacity 0.2s;
}
.map-trip-action-label {
  font-size: 0.65rem;
  font-weight: 500;
}
.map-trip-action-btn:hover {
  opacity: 0.9;
}

.map-photo-marker-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* ランドマーク番号ラベル（地図上・写真の左上角に表示） */
.landmark-label-marker {
  background: none !important;
  border: none !important;
}

.landmark-label {
  display: inline-block;
  padding: 1px 4px;
  font-size: 0.6rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.75);
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  cursor: pointer;
}

/* 地図上の写真ポップアップ（Leaflet標準スタイルを上書き） */
.photo-popup-container .leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  width: fit-content;
  max-width: min(95vw, 792px);
}
.photo-popup-edit-container .leaflet-popup-close-button {
  display: none !important;
}

.photo-popup-container .leaflet-popup-content {
  margin: 0;
  min-width: 0;
  width: fit-content;
}

.photo-popup {
  max-width: min(95vw, 660px);
  position: relative;
  display: inline-block;
}
.photo-popup img {
  width: 100%;
  height: auto;
  max-width: 660px;
  max-height: 480px;
  object-fit: contain;
  display: block;
}

.photo-popup-header {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  padding: 0.25rem;
}

.photo-popup-edit {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.photo-popup-edit:hover {
  background: #fff;
}

.photo-popup-edit-inline {
  position: absolute;
  top: 0.25rem;
  right: 2.5rem;
}

.photo-popup-video-btn {
  position: absolute;
  top: 0.25rem;
  right: 5rem;
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.photo-popup-video-btn:hover {
  background: rgba(241, 90, 34, 0.9);
  transform: scale(1.1);
}

.photo-popup-photo-wrap {
  position: relative;
  line-height: 0;
  display: inline-block;
  max-width: 100%;
}

.photo-popup img {
  width: auto;
  height: auto;
  max-width: 660px;
  max-height: min(70vh, 480px);
  object-fit: contain;
  display: block;
  cursor: pointer;
}

.photo-popup-overlay-top {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24), 0 1px 3px rgba(0, 0, 0, 0.16);
  z-index: 2;
  pointer-events: none;
}

.photo-popup-overlay-top .photo-popup-landmark {
  background: var(--accent);
  color: white;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
  margin-right: 0;
}

.photo-popup-overlay-top .photo-popup-name {
  color: white;
  font-size: 13.5px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.32), 0 1px 2px rgba(0, 0, 0, 0.24), 0 0 8px rgba(0, 0, 0, 0.16);
  letter-spacing: 0.4px;
}

.photo-popup-overlay-bottom-right {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 0.25rem 0.5rem;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.95);
  font-size: 0.7rem;
  border-radius: 4px 0 0 0;
  z-index: 2;
  pointer-events: none;
  max-width: 70%;
  text-align: right;
}

.photo-popup-save-delete-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: nowrap;
}

.photo-popup-info {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}

.photo-popup-info-structured {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.photo-popup-info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.photo-popup-info-row .photo-popup-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.photo-popup-info-row strong {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.25rem;
}

.photo-popup-description {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}

.photo-popup-edit-container .leaflet-popup-content {
  min-width: 461px;
}

.photo-popup-edit-mode {
  max-width: 553px;
}

.photo-popup-edit-form {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.photo-popup-edit-form label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.photo-popup-landmark-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.photo-popup-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.photo-popup-checkbox input {
  width: 1rem;
  height: 1rem;
}

.photo-popup-landmark-no-inline {
  display: none;
  flex: 0 0 auto;
  align-items: center;
}

.photo-popup-landmark-name-inline {
  display: none;
  flex: 1;
  min-width: 120px;
  align-items: center;
}

.photo-popup-input-inline {
  width: 100%;
  min-width: 50px;
  max-width: 70px;
}

.photo-popup-landmark-name-inline .photo-popup-input-inline {
  max-width: 200px;
}

.photo-popup-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.photo-popup-change-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 3;
}

.photo-popup-photo-wrap:hover .photo-popup-change-overlay {
  opacity: 1;
}

.photo-popup-change-overlay .upload-icon {
  font-size: 1.2rem;
}

.photo-popup-photo-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.photo-popup-photo-btns {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.photo-popup-upload-small {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  min-width: auto;
}

.photo-popup-upload-small .upload-icon {
  font-size: 0.9rem;
}

.photo-popup-save-delete-row .btn-primary,
.photo-popup-save-delete-row .btn-secondary {
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.photo-popup-delete-photo-only {
  padding: 0.35rem 0.6rem;
  font-size: 0.7rem;
  background: transparent;
  color: #fd7e14;
  border: 1px solid #fd7e14;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.photo-popup-delete-photo-only:hover {
  background: #fd7e14;
  color: white;
  border-color: #fd7e14;
}

.photo-popup-delete-photo-only:active {
  background: #e8590c;
  border-color: #dc5000;
}

.photo-popup-save-delete-row .photo-popup-delete-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.7rem;
  background: transparent;
  color: #dc3545;
  border: 1px solid #dc3545;
  margin-left: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.photo-popup-delete-small:hover {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.photo-popup-delete-small:active {
  background: #c82333;
  border-color: #bd2130;
}

.photo-popup-textarea {
  resize: vertical;
  min-height: 2.5em;
}

.photo-popup-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  box-sizing: border-box;
}

.photo-popup-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.2s;
}

.photo-popup-upload:hover {
  background: var(--bg);
}

.photo-popup-upload .upload-icon {
  font-size: 1.2rem;
}

.photo-popup-edit-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}


.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1500;
  backdrop-filter: blur(2px);
}

.menu-overlay.open { display: block; }

.menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100%;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  z-index: 1600;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.menu-panel.open {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.menu-header-auth {
  flex-shrink: 0;
  white-space: nowrap;
}

.menu-close {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.menu-close:hover {
  background: rgba(0,0,0,0.05);
}

.menu-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 70px);
}

.menu-section-bottom {
  padding-top: 1.5rem;
}
body.editor .menu-section-bottom {
  margin-top: auto;
}

.menu-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.menu-section {
  margin-bottom: 1.5rem;
}

.menu-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.menu-field {
  margin-bottom: 0.75rem;
}

.menu-select-load-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.menu-select-load-row .menu-select {
  flex: 1;
  min-width: 0;
}

.menu-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.menu-input, .menu-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.menu-input:focus, .menu-select:focus {
  outline: none;
  border-color: #c13584;
}

.menu-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.menu-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.menu-row-label-btn {
  align-items: center;
  flex-wrap: wrap;
}

.menu-row-label-btn .menu-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  min-width: 4.5em;
}

.menu-row-label-btn .btn-travelogue {
  flex: 1;
  min-width: 0;
}

.menu-row-label-btn .menu-select-inline {
  flex: 1;
  min-width: 0;
}

.menu-full { width: 100%; }

.btn {
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.05s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
}

.btn-primary:hover {
  background: var(--gradient-hover);
  opacity: 0.95;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(0,0,0,0.04);
}

.btn-travelogue {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
  color: #fff;
  border: none;
}

.btn-travelogue:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f87171 50%, #f472b6 100%);
  opacity: 0.95;
}

.btn-stamp {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  color: #fff;
  border: none;
}

.btn-stamp:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
  opacity: 0.95;
}

.menu-row-select-btn {
  align-items: center;
  gap: 0.5rem;
}

.menu-row-select-btn .menu-select-inline {
  flex: 1;
  min-width: 0;
}

.btn-danger {
  background: #ed4956;
  color: #fff;
}

.btn-danger:hover {
  background: #e13040;
  opacity: 0.95;
}

.btn-delete-muted {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-delete-muted:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text);
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* サムネイル表示（右側メニュー） */
.trip-menu-thumbnails-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.trip-menu-thumbnails {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
  min-height: 60px;
}

.trip-menu-thumbnail-item {
  flex-shrink: 0;
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  cursor: move;
  transition: opacity 0.2s, transform 0.2s;
}

.trip-menu-thumbnail-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.trip-menu-thumbnail-item.drag-over {
  transform: scale(1.05);
}

.trip-menu-thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  display: block;
}

.trip-menu-thumbnail-item:hover img {
  border-color: var(--accent);
}

.trip-menu-thumbnail-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 0.75rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.trip-menu-thumbnail-item:hover .trip-menu-thumbnail-delete {
  display: flex;
}

.trip-menu-thumbnail-delete:hover {
  background: #d32f2f;
}

.trip-menu-gps-add-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.trip-menu-gps-add-btn:hover {
  background: rgba(225, 48, 108, 0.1);
}

.trip-menu-gps-add-btn.active {
  background: var(--accent);
  color: #fff;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: #e1306c;
  background: rgba(225, 48, 108, 0.03);
}

.upload-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

#uploadSection .upload-icon {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.editor-only { display: none; }
body.editor .editor-only { display: block; }

/* 閲覧者向け（ログアウト時）のスタイル */
.viewer-only { display: none; }
body:not(.editor) .viewer-only { display: block; }

.viewer-trip-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.viewer-trip-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.viewer-trip-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.viewer-trip-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.viewer-trip-desc-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  display: inline;
  border-bottom: 1px dashed var(--accent);
  transition: all 0.2s;
}

.viewer-trip-desc-link:hover {
  color: var(--accent);
  border-bottom-style: solid;
}

.viewer-parent-trip {
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.viewer-parent-trip:hover {
  background: var(--bg-hover);
}

.viewer-child-trips {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.viewer-child-trip-item {
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s;
}

.viewer-child-trip-item:hover {
  background: var(--bg-hover);
}

.viewer-child-trip-item.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.viewer-child-list,
.trip-parent-detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.viewer-child-list-item,
.trip-parent-detail-list-item {
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s;
}

.viewer-child-list-item:hover,
.trip-parent-detail-list-item:hover {
  background: var(--bg-hover);
}

.viewer-child-travelogue-btn,
.viewer-child-video-btn,
.trip-parent-detail-travelogue-btn,
.trip-parent-detail-video-btn {
  flex-shrink: 0;
}

.viewer-child-animes,
.trip-parent-detail-animes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.viewer-child-anime-row,
.trip-parent-detail-anime-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}


.viewer-child-anime-label,
.trip-parent-detail-anime-label {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.viewer-child-anime-label:hover,
.trip-parent-detail-anime-label:hover {
  text-decoration: underline;
}

.viewer-child-anime-thumbs,
.trip-parent-detail-anime-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.viewer-child-anime-thumbs img,
.trip-parent-detail-anime-thumbs img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}

.viewer-child-anime-thumbs img:hover,
.trip-parent-detail-anime-thumbs img:hover {
  border-color: var(--accent);
}

.trip-parent-detail-lists {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.trip-parent-detail-item {
  margin-bottom: 0.75rem;
}

.trip-parent-detail-item:last-child {
  margin-bottom: 0;
}

.trip-detail-inline-link {
  cursor: pointer;
  color: var(--accent);
  text-decoration: none;
}

.trip-detail-inline-link:hover {
  text-decoration: underline;
}

.trip-detail-parent .trip-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.trip-detail-parent .trip-detail-meta strong {
  flex-shrink: 0;
}

.trip-detail-parent-btn {
  flex-shrink: 0;
}

.trip-detail-parent-travelogue-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.45rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
  border: 1.5px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  white-space: nowrap;
  margin-right: 0.3rem;
  margin-bottom: 0.2rem;
}

.trip-detail-parent-travelogue-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 1);
}

.trip-detail-parent-travelogue-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.trip-detail-parent-travelogue-btn .trip-detail-name {
  max-width: 55px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.65rem;
  color: inherit;
}

.trip-detail-parent-travelogue-btn .trip-detail-icon {
  font-size: 0.75rem;
  line-height: 1;
}

.trip-detail-parent-anime-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}

.trip-detail-parent-anime-row:first-of-type {
  margin-top: 0.35rem;
}

.trip-detail-parent-anime-label {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
}

.trip-detail-parent-anime-label:hover {
  text-decoration: underline;
}

.trip-detail-parent-anime-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.trip-detail-parent-anime-thumbs img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.trip-detail-parent-anime-thumbs img:hover {
  border-color: var(--accent);
}

.trip-detail-anime-thumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.trip-detail-anime-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.trip-detail-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.trip-detail-thumb:hover {
  border-color: var(--accent);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 440px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 1.25rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.modal-body h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.25rem;
}

.modal-body p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.modal-body p strong {
  color: var(--text);
}

.modal-body ul,
.modal-body ol {
  margin: 0.5rem 0 1rem 1.5rem;
  line-height: 1.6;
}

.modal-body li {
  margin-bottom: 0.35rem;
}

.modal-body ol {
  list-style-type: decimal;
}

.modal-body a {
  color: var(--accent);
  text-decoration: none;
}

.modal-body a:hover {
  text-decoration: underline;
}

.menu-desc-small {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.modal-actions {
  margin-top: 1rem;
}

.anime-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 1rem;
}

.anime-loading.visible {
  display: flex;
}

.anime-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gradient);
  border-radius: 50%;
  animation: anime-spin 0.8s linear infinite;
}

@keyframes anime-spin {
  to { transform: rotate(360deg); }
}

.modal-anime .anime-loading.visible + .anime-viewer {
  display: none;
}

/* 旅行アニメ（地球の歩き方風） */
.modal-anime {
  max-width: 560px;
  width: 95%;
  overflow: hidden;
}

/* アニメ画像ビューア（サムネイルクリック時の前へ/次へ付き表示） */
#animeImageViewerModal {
  z-index: 3100;
}

.modal-anime-viewer {
  max-width: 60vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .modal-anime-viewer {
    max-width: 90vw;
  }
}

.modal-anime-viewer .modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.anime-viewer-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.anime-viewer-body {
  flex: 1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  overflow-y: auto;
  gap: 1.5rem;
}

.anime-viewer-display-img {
  max-width: 100%;
  width: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  margin-bottom: 1rem;
}

.anime-viewer-display-img:last-child {
  margin-bottom: 0;
}

.anime-viewer {
  aspect-ratio: 3/4;
  max-height: 70vh;
  background: #1a1a1a;
  position: relative;
}

.anime-frame {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.anime-cover {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.anime-cover-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.6s ease;
}

.anime-cover-photo.anime-cover-failed {
  background-color: #374151;
  background-image: none;
}

.anime-cover-photo.anime-cover-failed::after {
  content: '画像生成に失敗';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

.anime-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 40%, transparent 70%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}

.anime-cover-brand {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.anime-brand-chikyu {
  color: #c41e3a;
}

.anime-brand-jump {
  color: #ffd700;
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(255,215,0,0.5);
}

.anime-brand-magazine {
  color: #2c5282;
  letter-spacing: 0.1em;
}

.anime-brand-event {
  color: #ff9a9e;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.anime-cover-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.anime-cover-subtitle {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.anime-cover-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
}

/* ブログポップアップ */
.modal-blog {
  max-width: 90vw;
  width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-blog .modal-header {
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-blog-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.travelogue-nav-btn {
  flex-shrink: 0;
  min-width: 44px;
  padding: 0.5rem 0.75rem;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-blog-external {
  font-size: 0.85rem;
  color: #e1306c;
  text-decoration: none;
}

.modal-blog-external:hover {
  text-decoration: underline;
}

.modal-blog-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-travelogue-body {
  overflow-y: auto;
  padding: 1rem;
}

.travelogue-map-wrap {
  width: 100%;
  height: 300px;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: #f3f4f6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.travelogue-map-wrap[style*="display: none"] {
  margin-bottom: 0;
}

.travelogue-map-wrap .leaflet-container {
  height: 100%;
  width: 100%;
}

.travelogue-map-marker {
  background: transparent;
  border: none;
}

.travelogue-content {
  line-height: 1.7;
}

.travelogue-summary {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.travelogue-content h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
}

.travelogue-content p {
  margin-bottom: 1rem;
}

.travelogue-content {
  max-width: 1200px;
  margin: 0 auto;
}

.travelogue-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}
.travelogue-content img:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* 旅行記タイトル（モーダルヘッダーに表示するため非表示） */
.travelogue-title {
  display: none;
}

/* ランドマークセクション */
.travelogue-landmark-section {
  margin: 2.5rem 0;
}

/* 動画リンクブロック（旅行記内） */
.travelogue-video-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem 0.4rem 0.4rem;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 6px;
  text-decoration: none;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s;
}
.travelogue-video-link:hover {
  background: rgba(0, 0, 0, 1);
}
.travelogue-video-link img {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: none !important;
  cursor: default !important;
}

.travelogue-landmark-section h3 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
}

/* ──────────────────────────────────────────
   旅行記: 地図 ＋ 目次の横並びレイアウト（デスクトップ）
   ────────────────────────────────────────── */
.travelogue-map-toc-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 1rem 0 1.5rem;
}
.travelogue-map-col {
  flex: 1 1 0;
  min-width: 0;
}
/* 地図コンテナ自体の余白を上書き */
.travelogue-map-col #travelogue-map-container {
  margin: 0 !important;
  min-height: 320px;
  border-radius: 8px;
  overflow: hidden;
}
.travelogue-toc-col {
  flex: 0 0 180px;
  width: 180px;
  padding: 0.5rem 0.6rem;
  background: #f8f9fb;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  position: sticky;
  top: 1rem;
}
.travelogue-toc-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  padding: 0 0.2rem;
}
.travelogue-toc-col .travelogue-toc-nav {
  padding: 0;
}
.travelogue-toc-col .travelogue-toc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.travelogue-toc-col .travelogue-toc-nav li a {
  text-decoration: none;
  font-size: 0.7rem;
  line-height: 1.4;
  padding: 0.18rem 0.3rem;
  border-radius: 4px;
  display: block;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.travelogue-toc-col .travelogue-toc-nav li a:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

/* ──────────────────────────────────────────
   旅行記: サマリー下のアニメストリップ
   ────────────────────────────────────────── */
.travelogue-detail-animes-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0 0.6rem;
  margin: 0.25rem 0 0.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.travelogue-detail-animes-strip img {
  height: 143px;
  width: auto;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  object-fit: cover;
}
.travelogue-detail-animes-strip img:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
@media (max-width: 768px) {
  .travelogue-detail-animes-strip img {
    height: 107px;
  }
}

/* ──────────────────────────────────────────
   旅行記: モバイル用アコーディオン（目次）
   ────────────────────────────────────────── */
.travelogue-toc-details {
  margin: 0.5rem 0 0.75rem;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  background: #f8f9fb;
  overflow: hidden;
}
.travelogue-toc-summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #999;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}
.travelogue-toc-summary::-webkit-details-marker { display: none; }
.travelogue-toc-summary::before {
  content: '▶';
  font-size: 0.6rem;
  transition: transform 0.2s;
  display: inline-block;
}
.travelogue-toc-details[open] .travelogue-toc-summary::before {
  transform: rotate(90deg);
}
.travelogue-toc-nav {
  padding: 0.2rem 0.5rem 0.5rem;
}
.travelogue-toc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.travelogue-toc-nav li a {
  text-decoration: none;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  display: block;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}
.travelogue-toc-nav li a:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.04);
}

/* ──────────────────────────────────────────
   旅行記: モバイル用アコーディオン（地図）
   ────────────────────────────────────────── */
.travelogue-map-details {
  margin: 0.5rem 0 0.75rem;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  overflow: hidden;
}
.travelogue-map-summary {
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  background: #f5f7fa;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}
.travelogue-map-summary::-webkit-details-marker { display: none; }
.travelogue-map-summary::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform 0.2s;
  display: inline-block;
}
.travelogue-map-details[open] .travelogue-map-summary::before {
  transform: rotate(90deg);
}
.travelogue-map-details #travelogue-map-container {
  margin: 0 !important;
}

@media (max-width: 768px) {
  .travelogue-content img {
    max-width: 100%;
  }

  .travelogue-title {
    font-size: 1.4rem;
  }

  .travelogue-photo-section {
    flex-direction: column;
    gap: 1rem;
  }

  .travelogue-photo-left {
    max-width: 100%;
    min-width: 100%;
  }

  .travelogue-photo-name {
    font-size: 1rem;
  }

  /* モバイルでの旅行記写真レイアウト：写真の下にテキストを表示 */
  .travelogue-content div[style*="display:flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .travelogue-content img[style*="width:500px"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  .travelogue-content div[style*="flex:1"] {
    flex: none !important;
    min-width: 100% !important;
    margin-top: 1rem !important;
  }

  /* モバイルの旅行記：御朱印帳スタンプ一覧を小さく、横幅に収めて改行表示 */
  .travelogue-content div[style*="grid-template-columns:repeat(3"],
  .travelogue-content div[style*="f9f5e8"][style*="grid"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    padding: 0.75rem !important;
  }
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div,
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div {
    padding: 0.5rem !important;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div img,
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div img {
    margin-bottom: 0.35rem !important;
  }
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div > div,
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div > div {
    font-size: inherit;
  }
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div [style*="font-size:1.5rem"],
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div [style*="font-size:1.5rem"] {
    font-size: 1.1rem !important;
  }
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div [style*="font-size:0.95rem"],
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div [style*="font-size:0.95rem"] {
    font-size: 0.75rem !important;
    line-height: 1.3;
    word-break: break-all;
    overflow-wrap: break-word;
  }
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div [style*="font-size:0.75rem"],
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div [style*="font-size:0.75rem"] {
    font-size: 0.6rem !important;
  }
  /* ランドマーク番号とポイント名の並びを改行可能に */
  .travelogue-content div[style*="grid-template-columns:repeat(3"] > div div[style*="display:flex"],
  .travelogue-content div[style*="f9f5e8"][style*="grid"] > div div[style*="display:flex"] {
    flex-wrap: wrap !important;
    justify-content: center !important;
  }

  /* モバイルでのアップロードゾーンを使いやすく */
  .upload-zone {
    padding: 2rem 1rem;
    font-size: 0.95rem;
  }

  .upload-icon {
    font-size: 2.5rem;
  }

  /* モバイルでの写真編集ポップアップ */
  .photo-popup-edit {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .photo-popup-edit-inline {
    right: 3rem;
  }

  .photo-popup-video-btn {
    right: 6rem;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .photo-popup-edit-mode {
    max-width: 90vw;
  }

  .photo-popup-edit-form {
    padding: 1rem;
    gap: 0.8rem;
  }

  .photo-popup-edit-form input,
  .photo-popup-edit-form textarea {
    font-size: 16px; /* iOS のズーム防止 */
  }
}

.travelogue-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* スタンプラリーモーダル - 御朱印帳風デザイン */
.modal-stamp-rally {
  max-width: 900px;
  width: 95%;
}

.modal-stamp-rally .stamp-rally-body {
  overflow-y: auto;
  padding: 2rem;
  background: linear-gradient(to bottom, #f9f5e8 0%, #f5f0e0 100%);
}

.stamp-rally-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stamp-rally-header-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stamp-rally-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.stamp-rally-modal-header .stamp-rally-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stamp-rally-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 0;
}

.stamp-card {
  background: #fffef8;
  border: 3px double #c1272d;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  box-shadow: 0 4px 8px rgba(193, 39, 45, 0.15), inset 0 0 20px rgba(255, 253, 239, 0.8);
}

.stamp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(193, 39, 45, 0.25), inset 0 0 20px rgba(255, 253, 239, 0.8);
}

.stamp-card-stamped {
  background: #fff;
  border-color: #c1272d;
  box-shadow: 0 4px 8px rgba(193, 39, 45, 0.2), inset 0 0 30px rgba(193, 39, 45, 0.05);
}

.stamp-card-inner {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #faf8f0 0%, #f5f2e8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-bottom: 2px solid rgba(193, 39, 45, 0.2);
}

.stamp-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.95;
}

.stamp-card-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #d4c5a9;
  font-weight: 300;
}

.stamp-card-info-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.7rem 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 80%, transparent 100%);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  line-height: 1.4;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.stamp-card-no {
  display: inline-block;
  background: rgba(193, 39, 45, 0.95);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72em;
  box-shadow: 0 2px 6px rgba(193, 39, 45, 0.4);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.stamp-card-name {
  font-size: 0.95em;
  line-height: 1.3;
  word-break: break-word;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.stamp-card-badge {
  display: block;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  background: #f5f0e0;
  color: #8b7355;
  letter-spacing: 0.05em;
}

.stamp-card-stamped .stamp-card-badge {
  background: linear-gradient(to right, #c1272d 0%, #d4332d 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.stamp-rally-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem;
}

@media (max-width: 768px) {
  .modal-stamp-rally {
    max-width: 95%;
  }

  .stamp-rally-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .stamp-card-inner {
    min-height: 200px;
  }

  .stamp-card-empty {
    font-size: 4rem;
  }

  .stamp-card-info-overlay {
    font-size: 1.05rem;
    padding: 0.9rem 1rem;
  }

  .stamp-card-badge {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
  }
}

.modal-blog-body iframe {
  width: 100%;
  height: 70vh;
  min-height: 400px;
  border: none;
  display: block;
}

/* モバイル用トリップシート */
.trip-sheet-trigger-container {
  display: none;
}

.trip-sheet-trigger {
  display: none;
}

.trip-sheet-overlay {
  display: none;
}

.map-playback-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.play-stop-btn-mobile {
  display: flex;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 3px solid var(--trip-color, var(--accent));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2), 0 3px 12px rgba(0, 0, 0, 0.15);
  font-size: 1rem;
  font-weight: 600;
  color: var(--trip-color, var(--accent));
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.map-photo-nav-btn {
  display: flex;
  width: auto;
  height: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, color 0.2s, text-shadow 0.2s;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.play-stop-btn-mobile:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25), 0 4px 14px rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 1);
}

.play-stop-btn-mobile:active {
  transform: translateY(-1px) scale(1.02);
}

.map-photo-nav-btn:hover {
  transform: scale(1.2);
  color: rgba(255, 255, 255, 1);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.8), 0 2px 6px rgba(0, 0, 0, 0.6);
}

.map-photo-nav-btn:active {
  transform: scale(1.1);
}

.play-stop-btn-mobile::before {
  content: '▶';
  font-size: 1.6rem;
  display: block;
  line-height: 1;
  margin-left: 4px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

body.app-playing .map-playback-controls {
  bottom: 4%;
}

body.app-playing .play-stop-btn-mobile {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.app-playing .play-stop-btn-mobile::before {
  content: '■';
  font-size: 1.1rem;
  margin-left: 0;
  color: white;
  filter: none;
}

body.app-playing .map-photo-nav-btn {
  display: flex;
  font-size: 1.8rem;
}


@media (max-width: 768px) {
  /* モバイルでは検索窓を非表示 */
  .map-search {
    display: none;
  }

  /* モバイルではトリップ名とタブを表示 */
  .header-mobile-content {
    display: flex !important;
  }

  .header-info {
    display: none;
  }

  .header-controls {
    display: none;
  }

  .header-info-mobile .header-line2 {
    display: none;
  }

  .header-info-mobile .header-line1 {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* モバイルでは写真ポップアップのボタンを2行に */
  .photo-popup-save-delete-row {
    flex-wrap: wrap;
  }

  .photo-popup {
    max-width: min(95vw, 450px);
  }

  .photo-popup img {
    max-width: 450px;
    max-height: 350px;
  }

  .header-travelogue-link-mobile {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: rgba(241, 90, 34, 0.6);
    text-underline-offset: 2px;
  }

  .header-travelogue-link-mobile:hover {
    text-decoration-color: rgba(241, 90, 34, 1);
  }

  .header-controls .btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
  }
  .header-controls {
    gap: 0.35rem;
  }

  /* モバイルでのレイヤーコントロール */
  .gmap-layer-toggle {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .gmap-layer-panel {
    top: 40px;
  }

  .gmap-layer-btn {
    padding: 8px 10px;
    min-width: 120px;
    gap: 6px;
  }

  .gmap-layer-icon {
    font-size: 18px;
  }

  .gmap-layer-label {
    font-size: 12px;
  }

  /* モバイルではアイコンのみの小さいボタンに */
  .header-video-btn,
  .header-travelogue-btn,
  .header-stamp-btn {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    font-size: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
  }
  .header-video-btn::before {
    content: '🎬';
    font-size: 1.1rem;
  }
  .header-travelogue-btn::before {
    content: '📖';
    font-size: 1.1rem;
  }
  .header-stamp-btn::before {
    content: '🎫';
    font-size: 1.1rem;
  }
  .hamburger-btn {
    width: 36px;
    height: 36px;
  }
  .hamburger-btn span {
    width: 16px;
  }
  .app {
    min-height: 100vh;
    min-height: 100dvh;
  }
  .main {
    flex: 1;
    flex-direction: column;
    min-height: 0;
    position: relative;
  }
  .map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* モバイルでは地図ナビゲーションを非表示 */
  .map-nav-controls {
    display: none;
  }

  /* モバイルでは丸い再生ボタンと前後ボタンを表示 */
  .map-playback-controls {
    position: fixed;
    bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    z-index: 1100;
  }

  /* モバイルでの旅行記ビュー - map-container内でフルスクリーン */
  .mobile-travelogue-view {
    bottom: 0 !important;
  }

  .mobile-travelogue-header {
    position: sticky;
    top: 0;
  }

  .mobile-travelogue-content {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 20px));
  }

  /* 旅行記表示時は map-container を画面下まで拡大 */
  body:has(.mobile-travelogue-view[style*="display: block"]) .map-container {
    bottom: 0 !important;
  }

  .play-stop-btn-mobile {
    width: 54px;
    height: 54px;
  }

  .play-stop-btn-mobile::before {
    font-size: 1.3rem;
    margin-left: 3px;
  }

  .map-photo-nav-btn {
    font-size: 2rem;
  }

  /* モバイルの自動再生時は停止ボタンをシンプルに、下寄りに配置 */
  body.app-playing .map-playback-controls {
    bottom: 4%;
  }

  body.app-playing .play-stop-btn-mobile {
    width: 39px;
    height: 39px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  }

  body.app-playing .play-stop-btn-mobile::before {
    font-size: 1rem;
  }
  /* 自動再生時は地図を画面下まで拡大 */
  body.app-playing .map-container {
    bottom: 0;
  }
  .thumbnail-strip {
    display: none;
  }
  .trip-sheet-trigger-container {
    display: flex;
    align-items: stretch;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 900;
  }
  .trip-nav-btn {
    flex-shrink: 0;
    width: 50px;
    background: var(--bg-card);
    border: none;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .trip-nav-btn:active {
    background: var(--bg);
    color: var(--accent);
  }
  .trip-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
  }
  .trip-sheet-trigger {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
  }
  .trip-sheet-trigger:active {
    background: var(--bg);
  }
  .trip-sheet-trigger-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    opacity: 0.5;
  }
  .trip-sheet-trigger-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-height: 1.2em;
  }
  .trip-sheet-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .trip-sheet-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }
  .trip-panel {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  .trip-panel.open {
    transform: translateY(0);
  }
  .trip-list-header {
    position: relative;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
  }
  .trip-list-header-top {
    position: relative;
    padding-right: 90px;
  }
  .trip-list-header h3 {
    padding-top: 0.5rem;
    margin: 0;
    text-align: center;
  }
  .trip-order-reset {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
  .trip-panel .trip-list {
    max-height: calc(70vh - 80px);
    overflow-y: auto;
  }
  .modal-blog {
    width: 95vw;
    max-height: 90vh;
  }
  .modal-blog-body iframe {
    height: 60vh;
    min-height: 300px;
  }
}

/* 旅行記共有ボタン */
.travelogue-share-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid var(--border);
}

.travelogue-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  text-decoration: none;
  color: white;
}

.travelogue-share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.travelogue-share-btn.twitter {
  background: #1DA1F2;
}

.travelogue-share-btn.instagram {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.travelogue-share-btn.facebook {
  background: #1877F2;
}

.travelogue-share-btn.copy-url {
  background: #6c757d;
}

.travelogue-share-btn.copy-url.copied {
  background: #28a745;
}

/* 地図上のトリップ名の「旅行記」ラベル */
.map-trip-travelogue-label {
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 0.45rem;
  color: #fff;
  opacity: 1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9),
               0 1px 3px rgba(0, 0, 0, 0.8),
               0 0 1px rgba(0, 0, 0, 1);
  white-space: nowrap;
  display: inline;
  line-height: 1.2;
}

/* 旅行記の出来事セクション */
.travelogue-event-item {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.travelogue-event-anime {
  width: 48%;
  max-width: 240px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  flex-shrink: 0;
}

.travelogue-event-text {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.7;
  padding: 0.75rem;
  background: #fff;
  border-radius: 6px;
  flex: 1;
  margin: 0;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .travelogue-event-item {
    flex-direction: column;
  }

  .travelogue-event-anime {
    width: 100%;
    max-width: 100%;
  }
}

/* ─── アプリ共通トースト通知 ─────────────────────────────────────────────── */
.app-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  white-space: pre-wrap;
  max-width: min(88vw, 380px);
  z-index: 99999;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: appToastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             appToastOut 0.3s ease 2.5s both;
}

@keyframes appToastIn {
  from { opacity: 0; transform: translate(-50%, -42%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
@keyframes appToastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translate(-50%, -56%); }
}
