/* === Airgo — Instagram風テーマ === */

:root {
  --anime-display-width: 360px;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f0;
  --border: #dbdbdb;
  --text: #262626;
  --text-muted: #8e8e8e;
  --accent: #e1306c;
  --accent-hover: #c13584;
  --accent-secondary: #833ab4;
  --gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --gradient-soft: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
  --gradient-airgo: linear-gradient(135deg, #667eea 0%, #764ba2 20%, #f093fb 40%, #f5576c 60%, #4facfe 80%, #00f2fe 100%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --font: 'Inter', 'Hiragino Sans', 'Noto Sans JP', -apple-system, sans-serif;
  --mobile-bg: #0a0a0a;
  --mobile-card: #1a1a1a;
}

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

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

.app {
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* === Header（モバイル用・デスクトップでは非表示） === */
@media (min-width: 769px) {
  .header {
    display: none !important;
  }
  .header-mobile-only {
    display: none !important;
  }
}

.header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  padding-top: max(0.5rem, env(safe-area-inset-top));
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.hamburger-btn:hover {
  background: var(--bg-hover);
}
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 0 auto;
  border-radius: 1px;
}
.header-title {
  flex: 1;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-airgo);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}
.header-title-link {
  cursor: pointer;
}
.header-title-link:hover {
  opacity: 0.9;
}
.menu-app-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0 0 0.5rem;
  margin-bottom: 0.5rem;
}
.db-indicator {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: inline-block;
}
.db-indicator.firestore {
  background: #e3f2fd;
  color: #1565c0;
}
.db-indicator.indexeddb {
  background: #f3e5f5;
  color: #7b1fa2;
}
.db-indicator.offline {
  background: #ffebee;
  color: #c62828;
}
.header-trip-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.header-controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.trip-name-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.trip-info-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-info-name.trip-name-clickable {
  color: var(--accent);
}
.trip-info-name.trip-name-clickable:hover {
  text-decoration: underline;
}
.trip-info-meta-row {
  min-height: 0;
}
.trip-info-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}
.trip-info-meta span {
  white-space: nowrap;
}
.trip-info-meta .trip-url-link,
.trip-info-meta .trip-desc-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.trip-info-meta .trip-url-link:hover,
.trip-info-meta .trip-desc-link:hover {
  text-decoration: underline;
}
.trip-info-meta .trip-meta-date,
.trip-info-meta .trip-meta-speed,
.trip-info-meta .trip-meta-dist {
  margin-left: 0.5rem;
  font-size: 0.8em;
}
.trip-info-meta .trip-meta-detail-link {
  color: var(--accent);
  text-decoration: none;
}
.trip-info-meta .trip-meta-detail-link:hover {
  text-decoration: underline;
}
.auth-area {
  margin-left: auto;
}
.auth-area .btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
}
.header-controls-row select {
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

/* === メニューパネル === */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 800;
  transition: opacity 0.2s;
}
.menu-overlay.visible {
  display: block;
}
.menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.menu-panel.open {
  transform: translateX(0);
}
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.menu-header h2 {
  font-size: 1.1rem;
}
.menu-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}
.menu-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.desktop-only {
  display: block;
}
.header-mobile-only {
  display: none;
}
.menu-mobile-trip-nav {
  display: none;
}
.menu-mobile-trip-list-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.menu-mobile-trip-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}
.menu-mobile-trip-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.5rem 0;
}
.menu-mobile-trip-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: color-mix(in srgb, var(--trip-accent, var(--accent)) 18%, var(--bg));
  border: 2px solid var(--trip-accent, var(--accent));
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.menu-mobile-trip-card:hover,
.menu-mobile-trip-card:active {
  border-color: var(--trip-accent, var(--accent));
  background: color-mix(in srgb, var(--trip-accent, var(--accent)) 15%, transparent);
}
.menu-mobile-trip-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 6px;
}
.menu-mobile-trip-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-section {
  margin-bottom: 1.25rem;
}
.menu-section h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.menu-field {
  margin-bottom: 0.5rem;
}
.trip-gpx-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.menu-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.menu-checkbox input {
  flex-shrink: 0;
}
.menu-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.trip-color-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.trip-color-picker input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg);
}
.trip-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.trip-color-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.trip-color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.menu-input, .menu-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.menu-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.menu-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.menu-upload:hover,
.menu-upload.dragover {
  border-color: var(--accent);
  background: rgba(225, 48, 108, 0.05);
}
.menu-upload-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.menu-upload-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.menu-full {
  width: 100%;
}
.btn-danger {
  color: #ed4956;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(237, 73, 86, 0.1);
}

/* === トリップ一覧パネル === */
.trip-list-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 900;
}
.trip-list-overlay.visible {
  display: block;
}
.trip-list-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.trip-list-panel.open {
  transform: translateX(0);
}
.trip-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.trip-list-header h2 {
  font-size: 1.1rem;
}
.trip-list-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}
.trip-list-close:hover {
  color: var(--text);
}
.trip-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.trip-list-item {
  margin-bottom: 1rem;
}
.trip-list-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border);
  border-left: 4px solid var(--trip-accent, var(--accent));
  transition: all 0.2s;
}
.trip-list-item-header:hover {
  background: var(--bg-hover);
}
.trip-list-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}
.trip-list-item-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trip-list-item-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.trip-list-delete-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.trip-list-delete-btn:hover {
  background: #f85149;
  color: #fff;
  border-color: #f85149;
}
.trip-list-photos {
  display: none;
  padding: 0.75rem 0 0 0.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.trip-list-item.expanded .trip-list-photos {
  display: flex;
}
.trip-list-photo {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.trip-list-photo:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}
.trip-list-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* === Buttons === */
.btn-primary {
  background: var(--gradient-soft);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) {
  background: #e8e8e8;
}

/* === 写真編集モーダル === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open {
  display: flex;
}

/* フルサイズ写真ビューア */
.full-photo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.full-photo-overlay.visible {
  display: flex;
}
.full-photo-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2001;
}
.full-photo-close:hover {
  background: rgba(255, 255, 255, 0.35);
}
.full-photo-content {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.full-photo-content img {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  object-fit: contain;
}

/* モバイル：写真ポップアップを縦長枠で表示 */
@media (max-width: 768px) {
  .full-photo-overlay .full-photo-content {
    width: min(320px, 88vw);
    max-height: calc(100vh - 5rem);
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  .full-photo-overlay .full-photo-content img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
  }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 1rem;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-body {
  padding: 1.25rem;
}
.help-modal-body {
  max-height: 70vh;
  overflow-y: auto;
}
.help-section {
  margin-bottom: 1.5rem;
}
.help-section h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.help-section h4 {
  font-size: 0.9rem;
  margin: 0.75rem 0 0.25rem;
  color: var(--text);
}
.help-section ul {
  margin: 0;
  padding-left: 1.25rem;
}
.help-section li {
  margin-bottom: 0.35rem;
  line-height: 1.4;
}
.help-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.public-trip-config-modal .modal-body {
  max-height: 75vh;
  overflow-y: auto;
}

.anime-modal .modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.anime-modal .modal-header h2 {
  flex: 0 0 auto;
}
.anime-modal-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.anime-modal .modal-close {
  flex-shrink: 0;
}
.anime-modal .modal-body {
  max-height: 95vh;
  overflow-y: auto;
}
.anime-modal-content {
  min-height: 120px;
}

/* Trip Stamps モーダル */
.stamps-modal .modal-body {
  max-height: 85vh;
  overflow-y: auto;
}
.stamps-modal .stamps-modal-grid {
  padding: 0.25rem 0;
}
.anime-loading, .anime-error {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}
.anime-cover-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}
.anime-cover-thumb {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.anime-cover-thumb:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.anime-cover-thumb img {
  display: block;
  max-width: var(--anime-display-width);
  width: auto;
  height: auto;
}
.anime-cover-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.anime-hide-btn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.anime-hide-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.anime-comic-pages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  max-height: 95vh;
  overflow-y: auto;
}
.anime-comic-page {
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-radius: 4px;
  overflow: hidden;
}
.anime-comic-page img {
  display: block;
  width: 100%;
  height: auto;
  max-width: var(--anime-display-width);
  margin: 0 auto;
}
.anime-comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.anime-comic-panel {
  background: #fff;
  border: 3px solid #000;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.anime-comic-panel img {
  width: 100%;
  height: auto;
  max-width: var(--anime-display-width);
  display: block;
  margin: 0 auto;
}
.anime-comic-speech {
  padding: 0.6rem 0.8rem;
  background: #fff;
  border-top: 2px solid #000;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.4;
}

.data-folder-modal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}
.data-folder-section {
  margin-bottom: 1.5rem;
}
.data-folder-section h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.data-folder-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.data-folder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.data-folder-item:hover {
  background: var(--border);
}
.data-folder-item-name {
  font-weight: 500;
}
.data-folder-item-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.data-folder-anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}
.data-folder-anime-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font: inherit;
}
.data-folder-anime-card:hover {
  background: var(--border);
}
.data-folder-anime-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}
.data-folder-anime-name {
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.data-folder-anime-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.data-folder-hidden-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.data-folder-hidden-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.data-folder-anime-card-wrap {
  position: relative;
}
.data-folder-anime-unhide-btn {
  position: absolute;
  bottom: 0.25rem;
  right: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.data-folder-anime-unhide-btn:hover {
  background: var(--bg-hover);
  margin-top: 0.2rem;
}
.data-folder-loading,
.data-folder-empty,
.data-folder-error {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.public-trip-config-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.public-trip-config-visibility {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.public-trip-config-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.public-trip-config-visibility-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.4;
}
.public-trip-config-visibility-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
}
.public-trip-config-visibility-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.public-trip-config-visibility-item input {
  flex-shrink: 0;
}
.public-trip-config-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}
.public-trip-config-section {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.public-trip-config-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.public-trip-config-section-title {
  font-weight: 600;
  font-size: 0.9rem;
}
.public-trip-config-section-actions {
  display: flex;
  gap: 0.25rem;
}
.public-trip-config-order-btn,
.public-trip-config-remove-btn {
  width: 1.75rem;
  height: 1.5rem;
  padding: 0;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
}
.public-trip-config-order-btn:hover:not(:disabled),
.public-trip-config-remove-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.public-trip-config-order-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.public-trip-config-section-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.public-trip-config-trip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.public-trip-config-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-hover);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.public-trip-config-chip-remove {
  padding: 0 0.2rem;
  font-size: 0.9rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.public-trip-config-chip-remove:hover {
  color: var(--accent);
}
.public-trip-config-add-select {
  margin-top: 0.25rem;
}

.modal-field {
  margin-bottom: 1rem;
}
.modal-field label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
}
.modal-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.modal-actions {
  margin-top: 1rem;
}
.auth-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.menu-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
}
.photo-edit-preview {
  margin-bottom: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 160px;
  box-shadow: var(--shadow-sm);
}
.photo-edit-preview img {
  width: 100%;
  height: auto;
  display: block;
}

/* === Upload === */
.upload-section {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.upload-zone {
  flex: 1;
  min-width: 200px;
  background: var(--bg-card);
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius);
  padding: 2rem;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--bg-hover);
}
.upload-zone.secondary {
  flex: 0 1 180px;
}
.upload-content {
  text-align: center;
}
.upload-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}
.upload-zone p {
  font-size: 0.9rem;
  color: var(--text);
}
.upload-hint {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  margin-top: 0.25rem !important;
}

/* === Controls === */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
}
.photo-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.control-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-icon {
  font-size: 0.85rem;
}
select {
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
  margin-left: 0.25rem;
}

/* === Main layout（ヘッダー下に地図エリア） === */
.main {
  display: flex;
  flex: 1;
  min-height: 0;
}
.map-container {
  flex: 1;
  position: relative;
  min-width: 0;
  background: #e8e8e8;
  min-height: 300px;
}
.map-search-box {
  position: absolute;
  top: max(0.5rem, env(safe-area-inset-top));
  left: max(2.5rem, calc(env(safe-area-inset-left) + 2.25rem));
  z-index: 600;
  width: 200px;
}
.map-search-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  outline: none;
}
.map-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(225, 48, 108, 0.2);
}
.map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: none;
}
.map-search-results.visible {
  display: block;
}
.map-search-result-item {
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.map-search-result-item:last-child {
  border-bottom: none;
}
.map-search-result-item:hover {
  background: rgba(225, 48, 108, 0.1);
}
.map-search-result-item .result-name {
  font-weight: 600;
  color: var(--text);
}
.map-search-result-item .result-type {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.map-trip-name-overlay {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  padding: 0.51rem 1.02rem;
  font-size: 1.02rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, rgba(131, 58, 180, 0.96) 0%, rgba(253, 29, 29, 0.96) 50%, rgba(252, 176, 69, 0.96) 100%);
  border-radius: var(--radius);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.5);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  z-index: 700;
  cursor: pointer;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.map-trip-name-overlay.visible {
  opacity: 1;
  transform: translateX(0);
  animation: map-trip-name-float 4s ease-in-out infinite;
}
@media (max-width: 768px) {
  .map-trip-name-overlay {
    font-size: 0.77rem;
    padding: 0.38rem 0.77rem;
  }
}
@keyframes map-trip-name-float {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(-4px) translateY(-2px); }
}
#map {
  width: 100%;
  height: 100%;
  min-height: 400px;
}
@media (min-height: 500px) {
  .map-container, #map {
    min-height: calc(100vh - 60px);
    min-height: calc(100dvh - 60px);
  }
}

/* Leaflet地図のカスタム */
.leaflet-container {
  font-family: var(--font);
}

/* ランドマーク番号マーカー（目立つ表示） */
.landmark-marker-num {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50%;
  background: var(--accent);
  color: #fff !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(225, 48, 108, 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.landmark-marker-plain {
  display: inline-block !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #999;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* モバイル：ポイントマーカーを小さく */
@media (max-width: 768px) {
  .photo-marker-mobile .landmark-marker-num {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    border-width: 2px !important;
  }
  .photo-marker-mobile .landmark-marker-plain {
    width: 16px !important;
    height: 16px !important;
    border-width: 2px !important;
  }
}

/* 自動再生時：地図上に写真オーバーレイ（ポップアップと同じサイズ） */
.play-photo-overlay {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 454px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 1000;
}
.play-photo-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.play-overlay-buttons {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
}
.play-overlay-edit,
.play-overlay-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.play-overlay-close {
  font-size: 1.25rem;
}
.play-overlay-edit:hover,
.play-overlay-close:hover {
  background: rgba(0, 0, 0, 0.6);
}
.play-photo-overlay.play-mode .play-overlay-buttons {
  display: none;
}
.play-overlay-stop-btn {
  display: none;
  position: absolute;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 20;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: rgba(225, 48, 108, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  transition: background 0.2s, transform 0.2s;
}
.play-overlay-stop-btn:hover {
  background: rgba(225, 48, 108, 1);
  transform: scale(1.05);
}
.play-photo-overlay.play-mode .play-overlay-stop-btn {
  display: block;
}
.play-photo-overlay.play-mode {
  /* ポップアップと同じサイズのため scale なし */
}
.play-overlay-photo {
  position: relative;
  width: 100%;
  height: 314px;
  overflow: hidden;
  perspective: 1000px;
  cursor: pointer;
}
.play-overlay-landmark-watermark {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 60%, rgba(0,0,0,0.3) 100%);
  color: #fff;
  font-size: 2.25rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.15em;
  text-shadow: 0 2px 12px rgba(0,0,0,1), 0 0 24px rgba(225,48,108,0.6), 0 0 40px rgba(225,48,108,0.3);
  -webkit-text-stroke: 2px rgba(0,0,0,0.8);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 2;
  pointer-events: none;
}
.play-overlay-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.4s ease;
}
.play-photo-overlay.photo-transition .play-overlay-photo img {
  animation: photo3dFlip 0.6s ease;
}
@keyframes photo3dFlip {
  0% { transform: perspective(800px) rotateY(-15deg) scale(0.95); opacity: 0.7; }
  50% { transform: perspective(800px) rotateY(5deg) scale(1.02); opacity: 1; }
  100% { transform: perspective(800px) rotateY(0) scale(1); opacity: 1; }
}
.play-overlay-gpx {
  display: none;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.03);
  border-top: 1px solid var(--border);
  font-weight: 500;
}
.play-overlay-info {
  padding: 0.6rem 1rem 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.play-overlay-place {
  padding: 0 1rem 0.2rem;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}
.play-overlay-desc {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  background: rgba(225, 48, 108, 0.06);
  border-top: 1px solid var(--border);
}
.play-overlay-url {
  padding: 0 1rem 0.75rem;
  font-size: 0.85rem;
}
.play-overlay-url a,
.play-overlay-url .popup-url-btn {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.play-overlay-url a:hover,
.play-overlay-url .popup-url-btn:hover {
  text-decoration: underline;
}
.popup-url-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
}
.popup-url-btn:hover {
  text-decoration: underline;
}
.url-popup-modal .url-popup-input {
  margin-bottom: 1rem;
  font-family: monospace;
  font-size: 0.85rem;
}

.stamp-upload-modal .stamp-upload-hint {
  margin-bottom: 1rem;
  color: var(--text-muted);
}
.stamp-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.stamp-upload-zone:hover,
.stamp-upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(225, 48, 108, 0.05);
}
.stamp-upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.stamp-upload-preview {
  margin-top: 1rem;
  min-height: 60px;
}

.character-upload-modal .character-upload-hint {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.character-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.character-upload-zone:hover,
.character-upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(225, 48, 108, 0.05);
}
.character-upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.character-upload-preview {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.character-preview-item {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
}
.character-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.character-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.character-preview-remove:hover {
  background: var(--accent);
}

/* プレイモード：地図は通常表示、サムネイル非表示 */
.play-mode-stop-btn {
  display: none;
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 2000;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: rgba(225, 48, 108, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  transition: background 0.2s, transform 0.2s;
}
.play-mode-stop-btn:hover {
  background: rgba(225, 48, 108, 1);
  transform: scale(1.05);
}
.main.play-mode .play-mode-stop-btn {
  display: block;
}
.main.play-mode .public-trips-panel {
  display: none;
}
.main.play-mode .all-photos-thumbnails {
  transform: translateY(100%) !important;
}

/* 自動再生時：ポップアップは通常と同じサイズ */

/* === 公開トリップパネル === */
.public-trips-panel {
  width: 422px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.04);
}

/* 右パネル最上段：AirGo / Trip List / ハンバーガー（デスクトップのみ） */
.panel-header-desktop {
  display: none;
}
@media (min-width: 769px) {
  .panel-header-desktop {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
  }
  .panel-header-desktop .hamburger-btn {
    width: 40px;
    height: 40px;
    margin-left: auto;
  }
  .panel-header-desktop .hamburger-btn span {
    width: 18px;
  }
  .panel-header-title {
    flex: 0 1 auto;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-soft);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
  }
  .panel-header-title-link {
    cursor: pointer;
  }
  .panel-header-title-link:hover {
    opacity: 0.9;
  }
  .panel-header-trip-list-link {
    font-size: 0.95rem;
    font-weight: 600;
    margin-left: 0.5rem;
    letter-spacing: -0.02em;
    background: var(--gradient-soft);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    cursor: pointer;
  }
  .panel-header-trip-list-link:hover {
    opacity: 0.9;
  }
}
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .menu-mobile-trip-nav {
    display: block;
    margin-bottom: 0.75rem;
  }
  .menu-mobile-trip-list-title {
    color: rgba(255, 255, 255, 0.95);
  }
  .menu-mobile-trip-card {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
  }
  .menu-mobile-trip-card:hover,
  .menu-mobile-trip-card:active {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
  }
  .menu-mobile-trip-name {
    color: #fff;
  }
  .menu-mobile-trip-empty {
    color: rgba(255, 255, 255, 0.7);
  }
  .panel-header-desktop {
    display: none !important;
  }
}

.trip-panel-drag-handle {
  display: none;
}
.trip-panel-trip-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.trip-panel-trip-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.trip-menu-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--trip-accent, var(--accent));
  border-radius: var(--radius);
}
.trip-menu-nav-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.trip-menu-nav-arrow {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.trip-menu-nav-arrow:hover:not(:disabled) {
  opacity: 0.8;
}
.trip-menu-nav-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.trip-menu-nav-arrow .trip-menu-nav-arrow-mobile {
  display: none;
}
.trip-menu-title-wrap {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.trip-menu-nav-row .trip-menu-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
  word-break: break-word;
}
.trip-menu-nav-row-bottom {
  margin-top: 1rem;
  margin-bottom: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  border-bottom: none;
}
.trip-menu-nav-label {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
  word-break: break-word;
}
.trip-menu-header-section {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-hover);
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--border);
  border-left: 4px solid var(--trip-accent, var(--accent));
}
.trip-menu-header-section .trip-menu-meta {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.trip-menu-header-section .trip-menu-nav-row {
  margin: 0;
}
.trip-menu-header-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}
.trip-menu-header-divider:first-child {
  margin-top: 0;
}
.trip-menu-header-divider:last-child {
  margin-bottom: 0;
}
.trip-menu-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.35rem;
  line-height: 1.4;
}
.trip-menu-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.trip-menu-summary-section,
.trip-menu-map-section {
  margin: 0.5rem 0;
}
.trip-menu-summary-section .trip-menu-section-title,
.trip-menu-map-section .trip-menu-section-title,
.trip-menu-stamps .trip-menu-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.trip-menu-summary-links-row {
  margin-bottom: 0.75rem;
}
.trip-menu-summary-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.trip-menu-anime-all-wrap {
  flex: 1;
  min-width: 0;
}
.trip-menu-anime-all-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: flex-start;
  overflow-x: auto;
  padding: 0.25rem 0;
}
.trip-menu-anime-all-item {
  flex-shrink: 0;
  position: relative;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.trip-menu-anime-all-item.drag-over {
  border-color: var(--accent);
  background: rgba(225, 48, 108, 0.08);
}
.trip-menu-anime-all-item[draggable] {
  cursor: grab;
}
.trip-menu-anime-all-item[draggable]:active {
  cursor: grabbing;
}
.trip-menu-anime-all-thumb {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  position: relative;
}
.trip-menu-anime-all-thumb:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.trip-menu-anime-all-thumb img {
  display: block;
  max-width: 90px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}
.trip-menu-anime-all-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.25rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 0.65rem;
  pointer-events: none;
}
.trip-menu-anime-all-overlay .trip-menu-anime-all-del {
  pointer-events: auto;
  padding: 0.1rem 0.25rem;
  font-size: 0.6rem;
  border: none;
  border-radius: 3px;
  background: rgba(255,255,255,0.9);
  color: #333;
  cursor: pointer;
}
.trip-menu-anime-all-overlay .trip-menu-anime-all-del:hover {
  background: #fff;
  color: var(--accent);
}
.trip-menu-summary-side {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.trip-menu-summary-btns {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.trip-menu-summary-btns .trip-menu-travelogue-summary-btn {
  white-space: nowrap;
}
.trip-menu-summary-controls {
  margin: 0;
}
.trip-menu-editor-row {
  margin-top: 0.5rem;
}
.trip-menu-anime-gen-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* 旅行記生成・キャラ・アニメ生成ボタンの大きさを統一 */
.trip-menu-editor-row .btn {
  height: 2.25rem;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#tripMenuAnimeCharBtn:not(.trip-menu-char-btn-with-photo) {
  font-size: 0.75rem;
}
.trip-menu-char-btn-with-photo {
  padding: 0.2rem;
  min-width: 0;
  overflow: hidden;
}
.trip-menu-char-btn-with-photo .trip-menu-char-btn-img {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  vertical-align: middle;
}
.trip-menu-anime-gen-row select {
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.trip-menu-section {
  margin-bottom: 0.25rem;
}
.trip-menu-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.trip-menu-section-body {
  font-size: 0.9rem;
  color: var(--text);
}
.trip-menu-desc {
  font-weight: 700;
  line-height: 1.5;
}
.trip-menu-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.25rem 0;
}
.trip-menu-controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.trip-menu-photo-count {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text);
}
.trip-menu-photo-count.trip-menu-photo-count-clickable {
  cursor: pointer;
  color: var(--accent);
}
.trip-menu-photo-count.trip-menu-photo-count-clickable:hover {
  text-decoration: underline;
}
.trip-menu-controls .btn {
  flex: 1;
}
.trip-menu-controls .trip-menu-btn-text-mobile {
  display: none;
}
.trip-menu-travelogue-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.25rem;
}
.trip-menu-travelogue-summary {
  margin: 0;
}
.trip-menu-travelogue-summary-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.trip-menu-travelogue-summary-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.trip-menu-travelogue-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.trip-menu-travelogue-link:hover {
  text-decoration: underline;
}
.trip-menu-travelogue-link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.trip-menu-travelogue-summary-btn.trip-menu-travelogue-link-btn {
  color: #fff;
  background: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
}
.trip-menu-travelogue-date {
  color: var(--text-muted);
  font-weight: normal;
}
.trip-menu-anime-all-wrap:empty {
  min-height: 70px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius);
}
.trip-menu-controls select {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.trip-menu-map-wrap {
  margin: 0.25rem 0;
}
.trip-menu-map {
  display: block;
  position: relative;
  width: 100%;
  min-width: 200px;
  height: 180px;
  min-height: 140px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 0.5rem;
}
.trip-menu-map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}
.trip-menu-thumbnails {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.trip-menu-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.trip-menu-thumb:hover {
  border-color: var(--accent);
}
.trip-menu-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.trip-menu-detail-link {
  color: var(--accent);
  text-decoration: none;
}
.trip-menu-detail-link:hover {
  text-decoration: underline;
}
.trip-menu-detail-link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.trip-menu-meta {
  font-size: 0.75em;
  color: var(--text-muted);
}
.trip-menu-stamps-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.trip-menu-stamps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}
.trip-menu-stamp-card {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  word-break: break-all;
  line-height: 1.2;
}
.trip-menu-stamp-card:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(225,48,108,0.4);
}
.trip-menu-stamp-card-filled {
  position: relative;
  padding: 0;
  overflow: hidden;
}
.trip-menu-stamp-card-filled img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.trip-menu-stamp-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 24px 4px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  text-align: center;
  word-break: break-all;
  line-height: 1.2;
  cursor: pointer;
}
.trip-menu-stamp-check {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #22c55e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
}
.trip-menu-marker span {
  display: block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.public-trips-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.public-trips-title {
  padding: 1rem 1rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.public-trips-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.public-trip-card {
  padding: 0;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--trip-accent, var(--accent));
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}
.public-trip-card:hover {
  background: var(--bg-hover);
  border-color: var(--trip-accent, var(--accent));
  box-shadow: var(--shadow-sm);
}
.public-trip-card-inner {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  align-items: flex-start;
}
.public-trip-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
}
.public-trip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.public-trip-info {
  min-width: 0;
  flex: 1;
}
.public-trip-card .public-trip-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.public-trip-card .public-trip-desc {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.public-trip-card .public-trip-gpx-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}
.public-trip-card .public-trip-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.public-trip-order-btns {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}
.public-trip-order-btn {
  width: 1.5rem;
  height: 1.25rem;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.public-trip-order-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent);
}

.public-trips-section-header {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}
.public-trips-section-header:first-child {
  margin-top: 0;
}
.public-trips-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}
.public-trips-section-link {
  color: var(--accent);
  text-decoration: none;
}
.public-trips-section-link:hover {
  text-decoration: underline;
}

.header-controls-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 0.25rem;
}
.photo-nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.photo-all-photos-btn {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}
.photo-all-photos-btn:hover {
  text-decoration: underline;
}

/* 画面下の全写真サムネイル */
.all-photos-thumbnails {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 0.75rem 3rem 0.75rem 1rem;
  z-index: 900;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.all-photos-thumbnails.visible {
  transform: translateY(0);
}
.all-photos-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  line-height: 1.2;
  z-index: 10;
}
.all-photos-close:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}
.all-photos-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0;
  justify-content: center;
  flex-wrap: wrap;
}
.all-photos-strip::-webkit-scrollbar {
  height: 6px;
}
.all-photos-strip::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 3px;
}
.all-photos-strip::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
.all-photos-strip .all-photo-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}
.all-photos-strip .all-photo-thumb {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.all-photos-strip .all-photo-thumb:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.all-photos-strip .all-photo-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(225, 48, 108, 0.3);
}
.all-photos-strip .all-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.all-photos-strip .all-photo-thumb-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 1px;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px;
  border-radius: 0 0 8px 8px;
}
.all-photos-strip .all-photo-thumb-btn {
  flex: 1;
  padding: 3px 0;
  font-size: 11px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.all-photos-strip .all-photo-thumb-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.all-photos-strip .all-photo-thumb-btn-del:hover {
  background: rgba(237, 73, 86, 0.8);
}
.all-photos-strip .all-photo-add-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(225, 48, 108, 0.1);
  border: 2px dashed var(--accent);
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
}
.all-photos-strip .all-photo-add-point:hover {
  background: rgba(225, 48, 108, 0.2);
}
.all-photos-strip .all-photo-add-point-icon {
  font-size: 1.5rem;
}
.all-photos-strip .all-photo-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  font-size: 0.65rem;
  color: var(--text-muted);
  gap: 2px;
}
.all-photos-strip .all-photo-thumb-placeholder-icon {
  font-size: 1.2rem;
}
.popup-photo-point-placeholder {
  padding: 1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}
.popup-photo-point-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}
.popup-photo-add-photo-btn {
  display: block;
  margin-top: 0.75rem;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
}
.popup-photo-add-photo-btn:hover {
  background: rgba(225, 48, 108, 0.1);
}
.photo-edit-point-preview {
  padding: 2rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}
.photo-edit-point-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

/* === Status === */
.status {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  min-height: 1.5rem;
  flex-shrink: 0;
}

/* Leaflet popup custom */
.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-md);
}
.leaflet-popup-content {
  margin: 0;
  min-width: 120px;
}
.leaflet-popup-tip {
  background: var(--bg-card);
}

/* 写真マーカーのポップアップ */
.photo-popup .leaflet-popup-content-wrapper {
  padding: 0;
  overflow: hidden;
}
.photo-popup .popup-photo-content {
  position: relative;
  width: 454px;
  max-width: 100%;
}
.photo-popup .popup-photo-edit {
  position: absolute;
  top: 0.35rem;
  right: 2.25rem;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s;
}
.photo-popup .popup-photo-edit:hover {
  background: rgba(0, 0, 0, 0.7);
}
.photo-popup .popup-photo-img-wrap {
  position: relative;
  overflow: hidden;
}
.photo-popup .popup-photo-clickable {
  cursor: pointer;
}
.photo-popup .popup-photo-landmark-watermark {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0.2) 100%);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 8px rgba(0,0,0,1), 0 0 16px rgba(225,48,108,0.5), 0 0 24px rgba(225,48,108,0.3);
  -webkit-text-stroke: 1.5px rgba(0,0,0,0.6);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  z-index: 2;
  pointer-events: none;
}
.photo-popup .popup-photo-place-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  left: auto;
  padding: 0.4rem 0.6rem;
  background: linear-gradient(135deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.6) 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  z-index: 2;
  pointer-events: none;
  border-radius: var(--radius) 0 0 0;
}
.photo-popup .popup-photo-img {
  display: block;
  width: 100%;
  height: 314px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}
.photo-popup .popup-photo-info {
  padding: 0.35rem 0.5rem;
}
.photo-popup .popup-photo-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.photo-popup .popup-desc {
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  background: rgba(225, 48, 108, 0.1);
  border-top: 1px solid var(--border);
  font-weight: 500;
}
.photo-popup .popup-url {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
.photo-popup .popup-url a {
  color: var(--accent);
}

/* ヘッダーボタン：デスクトップ時は長いラベル、モバイル時は短いラベル */
.header-btn-text-mobile {
  display: none;
}

/* メニュー内モバイル操作（デスクトップでは非表示） */
.menu-mobile-controls {
  display: none;
}

/* === モバイル対応（Instagram風・コンパクト） === */
@media (max-width: 768px) {
  /* 背景：ダークで写真が映える */
  body {
    background: var(--mobile-bg);
  }
  .app {
    background: var(--mobile-bg);
  }

  /* モバイルヘッダー：AirGo、トリップ名5文字、前、次、▶︎再生、アニメ、ハンバーガー */
  .header-mobile-only {
    display: inline-flex !important;
  }
  .header-btn-text-desktop {
    display: none;
  }
  .header-btn-text-mobile {
    display: inline;
  }
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    background: rgba(26, 26, 26, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }
  .header-title {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 1rem;
    -webkit-text-fill-color: #fff;
    color: #fff;
  }
  .header-trip-area {
    flex: 1;
    min-width: 0;
    order: 0;
  }
  .trip-name-nav .trip-info-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--trip-accent, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .trip-name-nav .trip-info-name.trip-name-clickable {
    color: var(--trip-accent, #fff);
  }
  .trip-info-meta-row {
    display: none !important;
  }
  .auth-area {
    display: none !important;
  }
  .header-controls-row .editor-only,
  .header-controls-row select,
  .header-controls-sep {
    display: none !important;
  }
  .header-controls-row {
    flex-wrap: nowrap;
    gap: 0.4rem;
  }
  .header-controls-row .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
  .header-controls-row .btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
  }
  .header-controls-row .btn:disabled {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
  }
  .header-controls-row .btn-primary,
  .header-controls-row .play-btn {
    background: var(--trip-accent, var(--accent));
    border-color: var(--trip-accent, var(--accent));
    color: #fff;
  }
  .header-controls-row .header-anime-btn {
    background: var(--trip-accent, var(--accent));
    border-color: var(--trip-accent, var(--accent));
    color: #fff;
  }
  .header-controls-row .header-anime-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--trip-accent, var(--accent)) 85%, white);
    border-color: color-mix(in srgb, var(--trip-accent, var(--accent)) 85%, white);
  }
  .hamburger-btn span {
    background: #fff;
  }
  .hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  .menu-mobile-controls {
    display: none !important;
  }

  /* メイン：ヘッダー下に地図・下にボトムシート */
  .main {
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .map-container {
    flex: 1;
    min-height: 200px;
    background: #1a1a1a;
  }
  #map {
    min-height: 100%;
  }
  @media (min-height: 500px) {
    .map-container, #map {
      min-height: calc(100vh - 140px);
      min-height: calc(100dvh - 140px);
    }
  }

  /* 自動再生時：地図を全画面表示、ヘッダー・フッター非表示 */
  .app.play-mode .header {
    display: none !important;
  }
  .app.play-mode .status {
    display: none !important;
  }
  .app.play-mode .all-photos-thumbnails {
    display: none !important;
  }
  .main.play-mode .map-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    z-index: 500;
  }
  .main.play-mode .map-container #map {
    min-height: 100%;
  }

  /* 公開トリップ：ボトムシート・引っ張って展開 */
  .trip-panel-drag-handle {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    background: rgba(26, 26, 26, 0.95);
    -webkit-tap-highlight-color: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .trip-panel-drag-handle::before {
    content: '';
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 3px;
  }
  .trip-panel-drag-handle:hover::before {
    background: rgba(255, 255, 255, 0.85);
  }
  .public-trips-panel {
    width: 100%;
    max-height: calc(88px + env(safe-area-inset-bottom));
    min-height: calc(56px + env(safe-area-inset-bottom));
    border-left: none;
    border-top: none;
    background: rgba(26, 26, 26, 0.98);
    flex-shrink: 0;
    transition: max-height 0.5s cubic-bezier(0.34, 1.12, 0.64, 1);
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
  }
  .public-trips-panel .trip-panel-trip-list {
    min-height: 48px;
  }
  /* トリップメニュー表示時（スタンプラリー含む）はパネルを展開 */
  .public-trips-panel.trip-menu-expanded {
    max-height: 60vh;
    max-height: 60dvh;
  }
  /* ドラッグハンドルタップまたはピンチで手動展開 */
  .public-trips-panel.trip-panel-manually-expanded {
    max-height: 60vh;
    max-height: 60dvh;
  }
  /* トリップメニュー内テキスト：黒背景で見やすく */
  .public-trips-panel .trip-menu-header-section {
    background: rgba(255, 255, 255, 0.12);
  }
  .public-trips-panel .trip-menu-nav-arrow {
    color: var(--trip-accent, #fff);
  }
  .public-trips-panel .trip-menu-nav-row-bottom {
    border-top-color: rgba(255, 255, 255, 0.3);
  }
  /* モバイル：一番下のトリップ説明（前後ナビ）を非表示 */
  .trip-menu-nav-row-bottom {
    display: none !important;
  }
  .public-trips-panel .trip-menu-nav-label {
    color: #fff;
  }
  .public-trips-panel .trip-menu-title,
  .public-trips-panel .trip-menu-name {
    color: #fff;
  }
  .public-trips-panel .trip-menu-photo-count,
  .public-trips-panel .trip-menu-photo-count.trip-menu-photo-count-clickable {
    color: var(--trip-accent, #fff);
  }
  .public-trips-panel .trip-menu-meta {
    color: rgba(255, 255, 255, 0.8);
  }
  .public-trips-panel .trip-menu-section-title {
    color: rgba(255, 255, 255, 0.95);
  }
  .public-trips-panel .trip-menu-section-body,
  .public-trips-panel .trip-menu-meta {
    color: #fff;
  }
  .public-trips-panel .trip-menu-stamps-title,
  .public-trips-panel .trip-menu-summary-section .trip-menu-section-title,
  .public-trips-panel .trip-menu-map-section .trip-menu-section-title,
  .public-trips-panel .trip-menu-stamps .trip-menu-section-title {
    color: #fff;
  }
  .public-trips-panel .trip-menu-controls .btn {
    background: color-mix(in srgb, var(--trip-accent, var(--accent)) 25%, rgba(255, 255, 255, 0.18));
    color: #fff;
    border-color: var(--trip-accent, var(--accent));
  }
  .public-trips-panel .trip-menu-controls .btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--trip-accent, var(--accent)) 35%, rgba(255, 255, 255, 0.28));
  }
  .public-trips-panel .trip-menu-controls .btn-primary {
    background: var(--trip-accent, var(--accent));
    border-color: var(--trip-accent, var(--accent));
    color: #fff;
  }
  .public-trips-panel .trip-menu-travelogue-info {
    color: rgba(255, 255, 255, 0.85);
  }
  .public-trips-panel .trip-menu-travelogue-link {
    color: var(--trip-accent, #f472b6);
  }
  .public-trips-panel .trip-menu-travelogue-summary-btn {
    background: var(--trip-accent, var(--accent));
    color: #fff;
  }
  .public-trips-panel .trip-menu-thumb:hover {
    border-color: var(--trip-accent, var(--accent));
  }
  .public-trips-panel .trip-menu-detail-link {
    color: var(--trip-accent, var(--accent));
  }
  .public-trips-panel .trip-menu-travelogue-date {
    color: rgba(255, 255, 255, 0.7);
  }
  /* モバイル：トリップ詳細の枠線を非表示、ボタン等はトリップ色で統一 */
  .trip-menu-content {
    border: none;
  }
  .trip-menu-header-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
  }
  .public-trips-panel .trip-menu-header-section {
    background: transparent;
  }
  .trip-menu-header-section .trip-menu-meta {
    display: none !important;
  }
  .trip-menu-nav-arrow .trip-menu-nav-arrow-desktop {
    display: none;
  }
  .trip-menu-nav-arrow .trip-menu-nav-arrow-mobile {
    display: inline;
  }
  .trip-menu-nav-arrow {
    width: auto;
    min-width: 2.5rem;
    padding: 0 0.35rem;
    font-size: 1.1rem;
  }
  /* モバイル：トリップ詳細の MAP を非表示、サムネイルは残す */
  .trip-menu-map-section .trip-menu-map {
    display: none !important;
  }
  /* モバイル：アニメボタンは表示、アニメサムネイルは非表示 */
  .trip-menu-anime-all-wrap {
    display: none !important;
  }
  /* モバイル：スタンプボタンは表示、TRIP STAMPS セクションは非表示 */
  .trip-menu-stamps {
    display: none !important;
  }
  /* モバイル：前へ→<<、次へ→>> */
  .trip-menu-controls .trip-menu-btn-text-desktop {
    display: none;
  }
  .trip-menu-controls .trip-menu-btn-text-mobile {
    display: inline;
  }
  /* モバイル：再生秒数選択を非表示（デフォルト3秒） */
  .trip-menu-interval-select {
    display: none !important;
  }
  .public-trips-title {
    display: none;
  }
  .public-trips-section-header {
    display: none !important;
  }
  .public-trips-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    padding: 0.6rem max(1rem, env(safe-area-inset-right));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-bottom: 0.25rem;
    gap: 0.65rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .public-trips-list::-webkit-scrollbar {
    display: none;
  }
  .public-trip-card {
    flex-shrink: 0;
    min-width: 100px;
    padding: 0;
    background: color-mix(in srgb, var(--trip-accent, var(--accent)) 25%, rgba(255, 255, 255, 0.1));
    border: 2px solid var(--trip-accent, var(--accent));
    border-radius: 12px;
  }
  .public-trip-card-inner {
    flex-direction: column;
    padding: 0.6rem 0.85rem;
    align-items: center;
    text-align: center;
  }
  .public-trip-thumb {
    display: none !important;
  }
  .public-trip-card .public-trip-desc,
  .public-trip-card .public-trip-gpx-meta {
    display: none;
  }
  .public-trip-card:hover,
  .public-trip-card:active {
    background: color-mix(in srgb, var(--trip-accent, var(--accent)) 35%, rgba(255, 255, 255, 0.15));
    border-color: var(--trip-accent, var(--accent));
  }
  .public-trip-card .public-trip-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }

  /* 自動再生オーバーレイ：フルスクリーン風・見やすく */
  .play-photo-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    background: #000;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .play-photo-overlay.visible {
    background: #000;
  }
  .play-overlay-buttons {
    top: max(0.5rem, env(safe-area-inset-top));
    right: 0.75rem;
  }
  .play-overlay-edit,
  .play-overlay-close {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
  }
  .play-overlay-photo {
    flex: 1;
    width: 100%;
    max-width: min(383px, calc(100vw - 2rem));
    aspect-ratio: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
  }
  .play-overlay-photo img {
    width: 100%;
    height: 245px;
    max-height: 245px;
    object-fit: cover;
  }
  .play-overlay-info,
  .play-overlay-place,
  .play-overlay-desc,
  .play-overlay-url {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
  }
  .play-overlay-place {
    color: var(--accent);
  }
  .play-overlay-desc {
    background: transparent;
    border-top: none;
  }

  /* 全写真サムネイル：モバイルでは非表示（地図を大きくするため） */
  .all-photos-thumbnails {
    display: none !important;
  }

  /* ステータス */
  .status {
    color: #fff;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }

  /* メニュー */
  .menu-panel {
    width: 100%;
    max-width: 100%;
    padding-top: env(safe-area-inset-top);
    background: var(--mobile-card);
  }
  .menu-header {
    padding: 0.6rem 0.9rem;
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  .menu-header h2 {
    font-size: 1rem;
    color: #fff;
  }
  .menu-close {
    color: #fff;
  }
  .menu-body {
    padding: 0.75rem;
  }
  .menu-app-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  .menu-section h3 {
    color: rgba(255, 255, 255, 0.95);
  }
  .menu-field label {
    color: rgba(255, 255, 255, 0.95);
  }
  .menu-input, .menu-select {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
  }
  .menu-upload {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
  }
  .menu-upload:hover {
    border-color: var(--accent);
    background: rgba(225, 48, 108, 0.1);
  }
  .trip-list-panel {
    padding-top: env(safe-area-inset-top);
    background: var(--mobile-card);
  }
  .trip-list-header h2 {
    color: #fff;
  }
  .trip-list-item-header {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .trip-list-item-name {
    color: #fff;
  }

  /* ポップアップ：写真を小さく */
  .photo-popup .popup-photo-content {
    width: min(383px, calc(100vw - 2rem));
  }
  .photo-popup .popup-photo-img {
    width: 100%;
    height: 245px;
    object-fit: cover;
  }
  .photo-popup .popup-photo-name {
    font-size: 0.8rem;
  }
  .photo-popup .popup-photo-info,
  .photo-popup .popup-desc,
  .photo-popup .popup-url {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
  }
  .leaflet-popup {
    max-width: calc(100vw - 2rem) !important;
  }
  .leaflet-control-zoom a,
  .leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.6) !important;
    color: rgba(255, 255, 255, 0.8) !important;
  }
  .leaflet-control-attribution a {
    color: rgba(255, 255, 255, 0.7) !important;
  }
  .modal-overlay {
    background: rgba(0, 0, 0, 0.85);
  }
  .modal {
    background: var(--mobile-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .modal-header h2 {
    color: #fff;
  }
  .modal-body {
    color: #fff;
  }
  .modal .modal-close {
    color: #fff;
  }
}

@media (max-width: 480px) {
  .public-trips-panel {
    max-height: calc(84px + env(safe-area-inset-bottom));
    min-height: calc(52px + env(safe-area-inset-bottom));
  }
  .public-trips-panel.trip-menu-expanded,
  .public-trips-panel.trip-panel-manually-expanded {
    max-height: 60vh;
    max-height: 60dvh;
  }
  .header {
    padding: 0.45rem 0.6rem;
    padding-top: max(0.45rem, env(safe-area-inset-top));
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom));
    gap: 0.4rem;
  }
  .hamburger-btn {
    width: 36px;
    height: 36px;
    gap: 3px;
  }
  .hamburger-btn span {
    width: 14px;
  }
  .trip-name-nav .trip-info-name {
    font-size: 0.9rem;
  }
  .header-controls-row .btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }
  .public-trip-card {
    min-width: 90px;
  }
  .photo-popup .popup-photo-content {
    width: min(348px, calc(100vw - 1.5rem));
  }
  .photo-popup .popup-photo-img {
    height: 209px;
  }
  .play-overlay-photo {
    max-width: min(348px, calc(100vw - 1.5rem));
  }
  .play-overlay-photo img {
    height: 209px;
    max-height: 209px;
  }
  .all-photos-strip .all-photo-thumb {
    width: 48px;
    height: 48px;
  }
  .menu-header {
    padding: 0.5rem 0.75rem;
  }
  .menu-body {
    padding: 0.6rem;
  }
}
