/* reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* テーマ変数 */
:root {
  --bg: #05060a;
  --surface: #020617;
  --border: #1f2937;
  --text: #f7f7f7;
  --muted: #9ca3af;
  --header-bg: radial-gradient(circle at top left, #22c55e 0, #0f172a 40%),
    radial-gradient(circle at top right, #0ea5e9 0, #020617 40%);
  --nav-bg: #020617;
  --nav-border: #111827;
  --chip-bg: rgba(15, 23, 42, 0.5);
  --chip-border: rgba(148, 163, 184, 0.7);
  --chat-in: #0b2036;
  --chat-out: #111827;
}

body.light-theme {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #d1d5db;
  --text: #0f172a;
  --muted: #6b7280;
  --header-bg: linear-gradient(135deg, #e0f2fe, #e0f7e9);
  --nav-bg: #e5e7eb;
  --nav-border: #cbd5e1;
  --chip-bg: #e2e8f0;
  --chip-border: #cbd5e1;
  --chat-in: #e0f2fe;
  --chat-out: #f8fafc;
}

/* 基本 */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

/* 共通コンポーネント */

.hidden {
  display: none !important;
}

.btn-primary {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #041016;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.35);
  transition: transform 0.08s ease, box-shadow 0.1s ease,
    background 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.btn-ghost,
.btn-ghost-small {
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: transparent;
  color: inherit;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost-small {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-ghost:hover,
.btn-ghost-small:hover {
  background: rgba(148, 163, 184, 0.15);
}

.btn-danger-small {
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.6);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}

.btn-danger-small:hover {
  background: rgba(248, 113, 113, 0.18);
  transform: translateY(-1px);
}

.btn-accent {
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #fb7185, #f97316);
  color: #111827;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(251, 113, 133, 0.5);
}

/* ① ログイン画面 */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #22c55e 0, #020617 40%),
    radial-gradient(circle at bottom right, #0ea5e9 0, #020617 45%);
  overflow: hidden;
}

.login-panel {
  position: relative;
  z-index: 2;
  width: 360px;
  max-width: 90vw;
  padding: 28px 26px 22px;
  border-radius: 24px;
  backdrop-filter: blur(18px);
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.9);
}

.login-logo {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.login-subtitle {
  margin: 0 0 18px;
  font-size: 12px;
  color: #e5e7eb;
}

.login-label {
  display: block;
  font-size: 12px;
  margin-bottom: 10px;
}

.login-label input {
  margin-top: 4px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
  font-size: 13px;
}

.login-label input:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
}

.login-btn {
  width: 100%;
  margin-top: 6px;
}

.login-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: #9ca3af;
}

.login-error {
  margin-top: 6px;
  font-size: 12px;
  color: #fecaca;
}

/* ふわふわ背景オブジェクト */
.login-bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.7;
  animation: float-orb 20s ease-in-out infinite alternate;
}

.login-bg-orb-1 {
  width: 240px;
  height: 240px;
  background: #22c55e;
  top: 12%;
  left: 10%;
}

.login-bg-orb-2 {
  width: 280px;
  height: 280px;
  background: #0ea5e9;
  bottom: 8%;
  right: 8%;
  animation-delay: -5s;
}

@keyframes float-orb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(20px, -30px) scale(1.1);
  }
  100% {
    transform: translate(-30px, 10px) scale(0.95);
  }
}

/* ② 管理画面のシェル */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  font-size: 22px;
}

.app-title-main {
  font-size: 16px;
  font-weight: 600;
}

.app-title-sub {
  font-size: 11px;
  color: #d1d5db;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  font-size: 12px;
}

/* タスクバー */

.app-nav {
  display: flex;
  gap: 4px;
  padding: 6px 12px 8px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
}

.nav-item {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.nav-item-active {
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #020617;
  border-color: transparent;
}

/* メイン */

.app-main {
  flex: 1;
  padding: 12px 18px 18px;
}

.view {
  display: none;
}

.view.view-active {
  display: block;
}

/* カード系 */

.card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.card-fullwidth {
  width: 100%;
}

.card-fullheight {
  height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-header h2 {
  margin: 0;
  font-size: 15px;
}

.card-header-sub {
  font-size: 11px;
  color: var(--muted);
}

.card-body {
  font-size: 13px;
}

.card-footer {
  margin-top: 8px;
}

.card-subsection {
  margin-top: 16px;
  font-size: 13px;
}

.card-subsection h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

/* レイアウト */

.grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .grid-2col {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* テーブル */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table th,
.table td {
  border-bottom: 1px solid #1f2937;
  padding: 4px 6px;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: #e5e7eb;
}

.table tr:hover {
  background: rgba(15, 23, 42, 0.7);
}

/* pill */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.pill-outline {
  border: 1px dashed #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.pill-warning {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

/* 小さい文字 */

.small-muted {
  font-size: 11px;
  color: #9ca3af;
}

/* リスト */

.list-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ダッシュボード：マップサマリー */

.map-summary-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

@media (max-width: 900px) {
  .map-summary-layout {
    grid-template-columns: 1fr;
  }
}

.map-box {
  width: 100%;
  position: relative;
  min-height: 320px;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
}

.map-box .leaflet-container {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 40% 40%, #0f172a 0%, #0b1022 55%, #050816 100%);
}

.map-summary-list {
  font-size: 12px;
  max-height: 260px;
  overflow-y: auto;
}

/* マップ一覧 */

.map-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.map-list-panel {
  overflow-y: auto;
}

.map-sighting-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

/* sighting item */

.sighting-item {
  border-radius: 10px;
  padding: 6px 8px;
  border: 1px solid #1f2937;
  background: #020617;
  cursor: pointer;
}

.sighting-item:hover {
  border-color: #22c55e;
}

/* コメント */

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.chat-item {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--chat-out);
  border: 1px solid var(--border);
  font-size: 12px;
  display: grid;
  gap: 4px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.chat-item.me {
  background: var(--chat-in);
  border-color: rgba(14, 165, 233, 0.4);
  margin-left: 40px;
}

.chat-item.other {
  margin-right: 40px;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.chat-text {
  white-space: pre-wrap;
}

.chat-mention {
  color: #bbf7d0;
  font-weight: 600;
}

.chat-mention-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: inherit;
  font-size: 11px;
}

.chat-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.chat-form input,
.chat-form select {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  padding: 6px 10px;
  font-size: 13px;
}

.admin-panel .admin-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-panel input[type="text"],
.admin-panel input[type="password"] {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: var(--surface);
  color: inherit;
}

.admin-panel label.inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-only-col,
.admin-only-cell {
  display: none;
}

.is-admin .admin-only-col,
.is-admin table .admin-only-cell {
  display: table-cell;
}

.is-admin .admin-only-cell {
  display: inline-flex;
  align-items: center;
}

/* フィルタ */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-group label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* フィールド */

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.field input,
.field textarea {
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #020617;
  color: inherit;
  padding: 5px 8px;
  font-size: 12px;
}

/* AI 処理 */

.ai-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

/* AI詳細 */

.ai-detail-header {
  align-items: center;
}

.ai-detail-actions {
  display: flex;
  gap: 6px;
}

.ai-detail-layout {
  display: grid;
  grid-template-columns: 2fr 1.3fr;
  gap: 10px;
}

.ai-flow {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ai-step .card-body {
  padding-top: 0;
}

.ai-list-wrapper {
  overflow-x: auto;
}

.ai-select-table tr {
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  font-size: 1.05rem;
  line-height: 1.4;
}

.ai-select-table tr:hover {
  background: rgba(251, 146, 60, 0.08);
  transform: translateX(3px) scale(1.01);
}

.ai-row-selected {
  background: radial-gradient(circle at 30% 30%, rgba(251, 146, 60, 0.28), rgba(30, 41, 59, 0.75));
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.6), 0 0 14px rgba(249, 115, 22, 0.35);
  transform: translateX(2px) scale(1.01);
}

.ai-select-table td {
  padding: 14px 10px;
}

@media (max-width: 1100px) {
  .ai-detail-layout {
    grid-template-columns: 1fr;
  }
}

/* 動画エリア（既存CSSを参考） */

#videoArea {
  position: relative;
  background: #000;
  border-radius: 8px;
  border: 1px solid #1f2937;
  padding: 4px;
}

#canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #000;
}

#video {
  display: none; /* videoは裏方で再生し canvas に描画 */
}

.video-fallback {
  display: grid;
  gap: 6px;
  place-items: center;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(2, 6, 23, 0.85));
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
}

.video-fallback img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

/* クイックスタート */
.quickstart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.quickstart-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(132, 204, 22, 0.18));
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 14px;
  color: #f8fafc;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.quickstart-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(251, 146, 60, 0.35);
  border-color: rgba(251, 146, 60, 0.65);
}

.quickstart-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(132, 204, 22, 0.25));
  font-size: 24px;
}

.quickstart-title {
  font-size: 16px;
  margin-bottom: 4px;
  color: #e2e8f0;
  font-weight: 700;
}

.quickstart-desc {
  font-size: 13px;
  color: #cbd5e1;
}

.pulse-b {
  animation: pulseGlowB 7s ease-in-out infinite;
}

@keyframes pulseGlowB {
  0% {
    box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.0);
  }
  20% {
    box-shadow: 0 0 0 18px rgba(251, 146, 60, 0.45);
  }
  35% {
    box-shadow: 0 0 0 24px rgba(251, 146, 60, 0.0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.0);
  }
}

/* Google Drive picker */
.drive-picker select {
  min-width: 200px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
}

.field-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* AI 選択行サイズ */
.ai-select-table tbody tr {
  height: 64px;
  font-size: 1.05rem;
}

.ai-select-table tbody tr.ai-row-selected {
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.6);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.25), rgba(251, 146, 60, 0.18));
}

/* 詳細チャット */
.sighting-chat {
  display: grid;
  gap: 8px;
}

.chat-thread {
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  background: #0b1224;
  border: 1px solid #1f2937;
  display: grid;
  gap: 4px;
}

.chat-bubble .meta {
  font-size: 11px;
  color: #94a3b8;
}

.chat-form {
  display: grid;
  gap: 6px;
}

.mapping-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-progress-section {
  display: flex;
  justify-content: center;
}

#aiProgressWrapper {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 40%, rgba(15, 23, 42, 0.35), rgba(0, 0, 0, 0.85));
  border: 1px solid rgba(15, 23, 42, 0.6);
  min-width: 240px;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

#aiProgressWrapper.ai-progress-clickable {
  cursor: pointer;
  border-color: rgba(251, 146, 60, 0.75);
  box-shadow: 0 12px 30px rgba(251, 146, 60, 0.25), 0 0 0 1px rgba(251, 146, 60, 0.35);
}

#aiProgressWrapper.ai-progress-clickable:hover {
  transform: translateY(-2px) scale(1.01);
}

/* ブラックホール枠（外側にぼかしを入れて背景に同化） */
.ai-progress-orb {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: visible;
  background: radial-gradient(circle at 50% 50%, #030712 0 55%, #000 75% 100%);
  box-shadow: inset 0 0 45px rgba(0, 0, 0, 0.8), 0 0 50px rgba(0, 0, 0, 0.7);
}

/* 周囲に黒いボケを足して、背景との境界を溶かす */
.ai-progress-orb::before {
  content: "";
  position: absolute;
  inset: -24%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0 55%, rgba(3, 7, 18, 0.7) 82%, #000 100%);
  filter: blur(26px);
  opacity: 0.9;
  z-index: -1;
}


/* ブラックホール本体 = オレンジのグラデーションの外側の光 */
#progressInner {
  --progress: 0%;
  --wave-speed: 4s;        /* 波打つ速さ（JSで進捗に応じて更新） */
  --spin-speed: 18s;       /* 粒子の回転速度（JSで更新） */
  --particle-speed: 26s;   /* ぼかし粒子の回転速度（JSで更新） */

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0%;
  height: 0%;
  border-radius: 50%;

  /* 外側のオレンジの光（進捗に応じて半径が広がるイメージ） */
  background:
    radial-gradient(
      circle at 50% 50%,
      rgba(0, 0, 0, 0) 0,
      rgba(249, 115, 22, 0.4) calc(var(--progress) * 0.7),
      rgba(249, 115, 22, 0.0) calc(var(--progress) * 1.15)
    );

  box-shadow:
    0 0 20px rgba(249, 115, 22, 0.55),
    0 0 60px rgba(249, 115, 22, 0.4);
  filter: drop-shadow(0 0 22px rgba(249, 115, 22, 0.65));

  /* 完了時の「脈打つ光」をベースにした波アニメーション */
  animation: glow-wave var(--wave-speed) ease-in-out infinite;

  /* 進捗による大きさの変化をスムーズに */
  transition:
    width 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    height 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.7s ease-out,
    filter 0.7s ease-out;
}

/* 粒子レイヤー（細かい砂のような粒子） */
#progressInner::before {
  content: "";
  position: absolute;
  inset: -32%;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0.95;

  /* たくさんの細かい粒子（砂っぽく） */
  background-image:
    radial-gradient(circle at 5% 10%, rgba(249, 250, 251, 0.5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 18% 40%, rgba(255, 237, 213, 0.8) 0 1px, transparent 1.6px),
    radial-gradient(circle at 32% 18%, rgba(251, 191, 36, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle at 46% 70%, rgba(249, 115, 22, 0.95) 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 64% 26%, rgba(254, 215, 170, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle at 78% 12%, rgba(248, 250, 252, 0.7) 0 1px, transparent 1.6px),
    radial-gradient(circle at 88% 34%, rgba(252, 211, 77, 0.85) 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 12% 72%, rgba(249, 115, 22, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle at 28% 86%, rgba(255, 247, 237, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle at 74% 80%, rgba(255, 237, 213, 0.8) 0 1px, transparent 1.6px),
    radial-gradient(circle at 60% 60%, rgba(249, 115, 22, 0.9) 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.6px);

  /* 回転しながら少しだけ拡大 → 吸い込まれていく感じ */
  animation: particle-orbit var(--spin-speed) linear infinite;
}

/* ぼかしの粒子レイヤー（奥行きと量感を追加） */
#progressInner::after {
  content: "";
  position: absolute;
  inset: -38%;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0.65;
  filter: blur(2px);

  background-image:
    radial-gradient(circle at 15% 20%, rgba(249, 250, 251, 0.4) 0 1px, transparent 1.7px),
    radial-gradient(circle at 80% 30%, rgba(254, 215, 170, 0.7) 0 1.1px, transparent 1.8px),
    radial-gradient(circle at 30% 78%, rgba(249, 115, 22, 0.8) 0 1.2px, transparent 1.9px),
    radial-gradient(circle at 70% 72%, rgba(252, 211, 77, 0.75) 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 50% 50%, rgba(249, 115, 22, 0.7) 0 1.2px, transparent 2px);

  animation: particle-orbit var(--particle-speed) linear infinite;
}

/* 外側のオレンジの光が波打つ（完了アニメをベースに全体をスケール） */
@keyframes glow-wave {
  0% {
    transform: translate(-50%, -50%) scale(0.96);
    box-shadow:
      0 0 18px rgba(249, 115, 22, 0.45),
      0 0 45px rgba(249, 115, 22, 0.3);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.04);
    box-shadow:
      0 0 26px rgba(249, 115, 22, 0.85),
      0 0 80px rgba(249, 115, 22, 0.7);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 0 20px rgba(249, 115, 22, 0.55),
      0 0 60px rgba(249, 115, 22, 0.4);
  }
}

/* 粒子の回転アニメーション（進捗に合わせて JS から速度を変える） */
@keyframes particle-orbit {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(360deg) scale(1.02);
  }
}


/* 完了時に近い、ふわっとした脈動（既存「完了」アニメの雰囲気を踏襲） */
@keyframes innerGlowPulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(249, 115, 22, 0.5),
      0 0 30px rgba(249, 115, 22, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 14px rgba(249, 115, 22, 0.0),
      0 0 55px rgba(249, 115, 22, 0.75);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(249, 115, 22, 0.0),
      0 0 30px rgba(249, 115, 22, 0.4);
  }
}

.ai-progress-label {
  position: relative;
  font-size: 22px;
  font-weight: 700;
  color: #ffedd5;
  text-shadow: 0 0 12px rgba(251, 146, 60, 0.55);
  z-index: 1;
}

.ai-progress-caption {
  margin-top: 8px;
  font-size: 13px;
  color: #e2e8f0;
}

/* 再生コントローラ */

#playbackControls {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #020617;
  font-size: 12px;
}

.playback-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

#seekSlider {
  width: 100%;
}

/* シーン切り替え */

.scene-switch {
  font-size: 12px;
  margin: 4px 0 6px;
  display: flex;
  gap: 14px;
}

/* デバッグJSON */

#debugSection {
  margin-top: 12px;
}

#debugSection h2 {
  margin: 0 0 4px;
  font-size: 13px;
}

#debug {
  max-height: 160px;
  overflow: auto;
  font-size: 11px;
  background: #020617;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #1f2937;
  color: #bbf7d0;
}

.ai-queue {
  border-top: 1px solid #1f2937;
  padding-top: 8px;
}

.ai-queue-list {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.ai-queue-item {
  width: 100%;
  text-align: left;
  border: 1px solid #1f2937;
  background: #020617;
  border-radius: 10px;
  padding: 8px 10px;
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.ai-queue-item:hover {
  border-color: #38bdf8;
  transform: translateX(2px);
}

.ai-queue-item-active {
  border-color: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4);
}

.ai-queue-title {
  font-weight: 700;
  font-size: 13px;
}

@keyframes particleOrbit {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes particleDrift {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.04);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

/* 熊アラート（既存 bear-alert クラスを維持） */

body.bear-alert {
  background: #3b0a0a;
}


/* ===========================
   目撃情報追加オーバーレイ
   =========================== */

   .overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
  }
  
  .overlay.hidden {
    display: none !important;
  }
  
  .overlay-content {
    width: min(900px, 96vw);
    max-height: 90vh;
    background: #020617;
    color: #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.8);
    display: flex;
    flex-direction: column;
  }
  
  .overlay-header,
  .overlay-footer {
    padding: 12px 16px;
    border-bottom: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .overlay-footer {
    border-top: 1px solid #1f2937;
    border-bottom: none;
  }
  
  .overlay-body {
    padding: 12px 16px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .overlay-section {
    margin-bottom: 12px;
  }

  .overlay-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  .overlay-inline label {
    flex: 1;
    min-width: 160px;
  }
  
  .overlay-section h3 {
    margin: 0 0 4px;
    font-size: 14px;
  }

  .overlay-form label {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
  }

/* 目撃追加ページ */
.add-sighting-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-sighting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 2px;
}

.add-sighting-body {
  display: flex;
  flex-direction: column;
}

.add-sighting-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .add-sighting-grid {
    grid-template-columns: 1fr;
  }
}

.add-sighting-actions {
  display: flex;
  gap: 8px;
}

.add-sighting-page .map-box {
  height: 360px;
}

.ai-detail-placeholder .placeholder-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.placeholder-actions {
  display: flex;
  gap: 8px;
}
  
/* etc… */
