/* AIS Viewer: 最小限のスタイル。地図を画面いっぱいに表示する(phase 1) */

:root {
  color-scheme: light;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif;
}

/* 文字の大きさ(設定「1. アプリ共通」)の基準。ここを書き換えると、rem で指定している
   文字サイズがすべて一緒に変わる(固定サイズのボタンのアイコン等は px 指定のため変わらない)。
   viewer/js/settings.js の applyFontScale が書き換える */
html {
  font-size: 100%;
}

/* Leaflet 本体(vendor/leaflet/leaflet.css)がポップアップの中身に 13px 固定の
   font-size を指定しているため、rem に置き換える(「1. アプリ共通」の設定が効くように) */
.leaflet-popup-content {
  font-size: 0.8125rem;
}

/* ポップアップ(船メニュー等)の閉じる「×」を 2 倍の大きさにする(既定は 24px 四方・16px) */
.leaflet-container a.leaflet-popup-close-button {
  width: 48px;
  height: 48px;
  font-size: 32px;
  line-height: 48px;
}

#map {
  position: absolute;
  inset: 0;
  /* 画面端の切り欠き(ノッチ等)を避ける */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 画面中心の目印(docs/viewer.md「目的地」)。操作を妨げないよう、タップは下の地図に通す */
#map-center-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 500;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* 地図の拡大縮小ボタン(Leaflet 標準、左下)を少し大きくする(既定の 120% 程度) */
.leaflet-control-zoom {
  transform: scale(1.2);
  transform-origin: bottom left;
}

/* 距離の目盛り(右下。viewer/js/scale.js)。Leaflet のコントロールは既定で z-index: 1000 のため、
   そのままだと追跡モードパネル(#tracking-mode-panel、z-index: 950)だけでなく、船のマーカー
   (.leaflet-marker-pane、z-index: 600)・船名ラベル・簡易ラベル(.leaflet-tooltip-pane、
   z-index: 650)よりも前面に出てしまい、重なった船を覆い隠してしまう。右下にはこの目盛りしか
   置いていないため、このコーナーの重なり順だけ下げて、地図のタイル・航跡より前面・
   マーカー/ラベルより背面(最背面)にする */
.leaflet-bottom.leaflet-right {
  z-index: 550;
}

/* 船のマーカー(divIcon)。回転させるため中心を軸にする */
.vessel-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}
.vessel-marker > div {
  will-change: transform;
}

/* 船舶以外の AIS 目標(基地局・航路標識/AtoN・SAR 機。viewer/js/otherTargets.js) */
.other-target-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}
.other-target-marker > div {
  will-change: transform;
}

/* ポップアップ内の「航跡を表示」ボタン(main.js の buildPopupContent) */
.popup-action-button {
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid #1565c0;
  border-radius: 6px;
  background: #fff;
  color: #1565c0;
  font-size: 0.75rem;
  cursor: pointer;
}
.popup-action-button:active {
  background: #e3f0fb;
}

/* 「ラベル: 値」の一覧を見やすく並べる2列表示(main.js の buildInfoGrid)。
   船の簡易情報・船の詳細・目的地へは?・目的地の位置・航跡の点の詳細などで使う */
.info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 3px;
}
.info-grid-label {
  color: #777;
  text-align: right;
  white-space: nowrap;
}
.info-grid-value {
  color: #222;
  font-weight: 500;
}

/* 船の詳細ポップアップのグループ見出し(識別情報・位置/動き 等。viewer/js/vesselMenu.js)。
   先頭に ● を付け、青字で表示する。配下の項目(.vessel-detail-section-body)はインデントする */
.vessel-detail-section-title {
  font-weight: bold;
  font-size: 0.8125rem;
  color: #1565c0;
  margin-top: 10px;
  margin-bottom: 4px;
}
.vessel-detail-section-title:first-of-type {
  margin-top: 6px;
}
.vessel-detail-section-body {
  margin-left: 1em;
}
/* 船の詳細だけ、ラベル部 40%・データ部 60% の固定幅にし、両方左寄せにする。
   複数行になった場合、行(グリッドの1行)は高い方のセルに合わせて自動的に揃うので、
   align-items: center でその行の中で上下中央に揃える */
.info-grid.vessel-detail-section-body {
  grid-template-columns: 40% 60%;
  align-items: center;
}
.vessel-detail-section-body .info-grid-label {
  text-align: left;
  white-space: normal;
}
.vessel-detail-section-body .info-grid-value {
  text-align: left;
}
.vessel-detail-updated-at {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  font-size: 0.75rem;
  color: #777;
}

/* ポップアップ内のボタン(お気に入り・航跡・目的地・船の詳細)を 1 行に 1 機能で並べる(viewer/js/vesselMenu.js) */
.vessel-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}
/* > で直接の子だけに絞る(お気に入りの追加行の中にあるボタンは別扱いにしたいため) */
.vessel-menu > .popup-action-button {
  margin-top: 0;
  width: 100%;
}

/* お気に入りへの追加(フォルダ選択 + 追加ボタン)/ 削除ボタンをまとめる。
   これも全体として 1 行として扱う(中の部品が複数あるだけ) */
.vessel-menu-favorite {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.vessel-menu-favorite .popup-action-button {
  margin-top: 0;
  flex: 1;
}
.vessel-menu-folder-select {
  font-size: 0.75rem;
  padding: 3px 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 120px;
}

/* 目的地の「位置の修正」フォーム(viewer/js/destination.js) */
.destination-edit-form label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  margin-top: 6px;
}
.destination-edit-form input {
  width: 9em;
  font-size: 0.75rem;
  padding: 3px 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* お気に入りの船のマーカーに常時表示する簡易情報(viewer/js/main.js の applyVesselLabel) */
.vessel-label {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  font-size: 0.6875rem; /* 「1. アプリ共通」の文字の大きさ設定で、他の文字と一緒に変わる */
  line-height: 1.3;
  padding: 2px 6px;
  white-space: nowrap;
  cursor: pointer;
}
.vessel-label::before {
  border-top-color: rgba(255, 255, 255, 0.9);
}
/* 選択中(タップして追跡・メニュー対象にしている)船のラベルだけ、背景色を変えて目立たせる
   (地図の海の色(青系)と被らないよう、薄い赤系にする。viewer/js/main.js の refreshSelectedVesselLabelStyle) */
.vessel-label-selected {
  background: rgba(255, 205, 205, 0.95);
}
.vessel-label-selected::before {
  border-top-color: rgba(255, 205, 205, 0.95);
}
/* 船が密集していて重なる場合、優先順位の低いラベルを隠す(viewer/js/main.js の resolveLabelCollisions)。
   display: none にすると、次にラベルの中身が更新された際(setTooltipContent)に Leaflet が
   offsetWidth を 0 として内部キャッシュ(_containerWidth)してしまい、再表示後の中央寄せが崩れて
   マーカーの右下などにずれて見えるようになる。そのため寸法を保つ visibility: hidden を使う */
.vessel-label-hidden-by-collision {
  visibility: hidden;
}

/* ---- お気に入りパネル(docs/viewer.md「お気に入り」。viewer/js/favorites.js) ---- */

.favorites-add-folder {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.favorites-add-folder input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.8125rem;
}
.favorites-add-folder button {
  border: 1px solid #1565c0;
  background: #fff;
  color: #1565c0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
}

.favorites-folder {
  margin-bottom: 10px;
}
.favorites-folder:last-child {
  margin-bottom: 0;
}

.favorites-folder-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
  font-size: 0.8125rem;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

/* フォルダの展開・格納ボタン(Windows のエクスプローラーのフォルダ表示のイメージ) */
.favorites-folder-toggle {
  border: none;
  background: none;
  font-size: 0.625rem;
  color: #666;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}

.favorites-folder-name {
  color: #1565c0;
  flex: 1;
  cursor: pointer;
}

.favorites-folder-delete {
  border: none;
  background: none;
  color: #c62828;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 6px;
}

/* フォルダ・船の表示順を入れ替える ↑↓ ボタン */
.favorites-folder-reorder {
  border: none;
  background: none;
  font-size: 0.625rem;
  color: #666;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.favorites-item-reorder:disabled,
.favorites-folder-reorder:disabled {
  opacity: 0.3;
  cursor: default;
}

.favorites-vessel-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

/* フォルダ配下の船は、フォルダ名の開始位置より半角 4 つ分(2em)右にインデントする。
   最大 5 隻分の高さに制限し、6 隻以上ならスクロールする(max-height/overflow-y は固定 px
   ではなく、文字サイズ設定で行の高さが変わっても正しく 5 隻分になるよう viewer/js/favorites.js
   の adjustFavoritesListHeights で実際の行の高さを測って付け替える) */
.favorites-folder-vessel-list {
  margin-left: 2em;
}

/* フォルダを選ばずに登録した船(ルート直下)。フォルダの一覧との間を少し空ける */
.favorites-root-list {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid #eee;
}
.favorites-vessel-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* 移動先の <select> を開いたときは、下に折り返して表示する */
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px;
  border-bottom: 1px solid #f3f3f3;
  font-size: 0.8125rem;
  cursor: grab; /* 行自体をドラッグして、フォルダへドロップで移動できる(主に PC 向け) */
}
.favorites-vessel-list li:last-child {
  border-bottom: none;
}
.favorites-item-name {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.favorites-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.favorites-vessel-list li button {
  border: none;
  background: none;
  color: #888;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
}
.favorites-item-move {
  color: #1565c0;
}

/* .favorites-vessel-list li button より詳細度を上げて確実に上書きする */
.favorites-vessel-list li button.favorites-item-remove {
  font-size: 1.5rem; /* 「×」を 2 倍(元は 0.75rem) */
}

/* 「移動」ボタンで開く、移動先を選ぶ <select>。下に折り返して全幅で表示する */
.favorites-move-select {
  flex-basis: 100%;
  font-size: 0.75rem;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 2px;
}

/* ドラッグ中の行をフォルダの見出しの上に重ねたときの見た目 */
.favorites-folder-header-dragover {
  background: #e3f0fb;
}

/* ---- 航跡表示(docs/viewer.md「航跡の表示」。viewer/js/track.js) ---- */

/* 航跡の点(●) */
.track-dot {
  background: #d32f2f;
  border: 1.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* 航跡の向き(→)。回転させるため中心を軸にする */
.track-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
}
.track-arrow > div {
  will-change: transform;
}

/* 航跡表示中の操作パネル。船舶数表示のすぐ下(#vessel-count の top を基準に計算)。
   1行目=日数指定、2行目=期間指定、右側の中央に閉じるボタン */
#track-controls {
  position: absolute;
  top: calc(12px + 44px + 6px + 22px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  max-width: 336px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 950; /* 検索結果より下、船マーカーの操作は妨げない程度 */
  font-size: 0.75rem;
}

/* display を明示しているだけでは [hidden] が効かないため、明示的に上書きする
   (.panel と同じ理由。docs/viewer.md 参照) */
#track-controls[hidden] {
  display: none;
}

/* 追跡モード中の情報パネル(#track-controls と同じ位置)。viewer/js/trackingMode.js */
#tracking-mode-panel {
  /* 表示位置(top/bottom/left/right)は js/trackingMode.js の positionTrackingModePanel が
     船の進行方向に応じて毎回インラインで設定する */
  position: absolute;
  max-width: 280px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  z-index: 950;
  font-size: 0.75rem;
}
#tracking-mode-panel[hidden] {
  display: none;
}
#tracking-mode-panel hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid #eee;
}

.track-controls-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

#track-days-label {
  min-width: 2.5em;
}

#track-days-slider {
  flex: 1;
  min-width: 0;
}

.track-row button {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  line-height: 1;
  font-size: 0.625rem;
  cursor: pointer;
  padding: 0;
}

#track-from-input,
#track-to-input {
  min-width: 0;
  flex: 1;
  font-size: 0.6875rem;
}

#track-close {
  border: none;
  background: #eee;
  border-radius: 50%;
  width: 52px; /* 「×」を 2 倍にしたのに合わせて、ボタン自体も 2 倍にする */
  height: 52px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 1.5rem;
  align-self: center;
}

/* ---- 常時表示ボタン(docs/viewer.md「画面の常時表示ボタン」) ---- */

/* 船舶の検索ボックス。画面左上に固定。右上のボタン列(#action-buttons)と
   重ならないよう、幅は控えめにする。左下のズームボタン(main.js で位置変更)とも重ならない */
#search-container {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  width: 80%;
  max-width: 336px; /* 初回実装時の上限(420px)の 80% */
  z-index: 1000;
}

/* 画面内に表示されている船の数。検索ボックス(入力欄)のすぐ下、検索結果の有無に関わらず
   同じ位置に固定する(#search-results の高さの影響を受けないよう、#search-container の
   外に置く。#search-icon 等と同じ理由。上のコメント参照) */
#vessel-count {
  position: absolute;
  top: calc(12px + 44px + 6px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  color: #1565c0;
  font-size: 0.8125rem;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* 地図の上でも読みやすくする */
  z-index: 900; /* 検索結果(#search-results)より下にして、開いたときは隠れてよい */
}

/* 入力欄(アイコン・入力・クリアボタン)だけの位置基準。
   #search-container には検索結果(#search-results)も入るため、そちらを基準にすると
   結果が表示されたときにアイコン・クリアボタンが全体の中央(下にずれた位置)に来てしまう */
#search-box {
  position: relative;
}

#search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}

#search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 30px 10px 36px; /* 右側はクリアボタンの分あける */
  border: none;
  border-radius: 8px;
  font-size: 16px; /* iOS でズームされない最小サイズ */
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* 入力を全削除する「×」ボタン */
#search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  font-size: 1.75rem; /* 「×」を 2 倍 */
  color: #888;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

#search-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  max-height: 50vh;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover,
.search-result-item:active {
  background: #f0f4f8;
}

/* 船籍(登録国)の国旗。1・2 行目(船名・MMSI/船種)の高さに合わせて少し大きめにする */
.search-result-flag {
  flex-shrink: 0;
  font-size: 1.375rem;
  line-height: 1;
}

.search-result-text {
  display: flex;
  flex-direction: column;
  min-width: 0; /* はみ出した文字を省略(...)できるようにする */
}

.search-result-name {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 0.75rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-empty {
  padding: 10px 12px;
  color: #777;
}

/* 現在地・お気に入り・設定の丸いボタン。画面右上に縦に並べる */
#action-buttons {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right, 0px));
  top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.action-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444; /* SVG アイコン(currentColor で塗る)の色 */
  text-decoration: none; /* #btn-help(<a> タグ)の既定の下線を消す */
}
.action-button:active {
  background: #f0f4f8;
}

/* お気に入りボタンの★は黄色にする */
#btn-favorites {
  color: #ffc107;
}

/* 設定ボタンの歯車は 1.5 倍の大きさにする(ボタン自体の大きさは変えない) */
#btn-settings {
  font-size: 27px;
  color: #1565c0; /* アプリ共通の青(お気に入りフォルダ名等と同じ) */
}

/* 追跡モードボタン。追跡中は背景を塗って有効中であることを示す。
   船を選択していないと押せない(disabled)ので、その見た目も付ける */
#btn-tracking-mode.active {
  background: #1565c0;
  color: #fff;
}
#btn-tracking-mode:disabled {
  opacity: 0.4;
  cursor: default;
}

/* 追跡モード中、他の常時表示ボタンをロック中として薄く表示する(viewer/js/trackingMode.js) */
.action-button-group.locked {
  opacity: 0.4;
}

/* ボタン本体 + その下のボタン名(.action-button-caption) */
.action-button-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.action-button-caption {
  font-size: 0.625rem;
  color: #444;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* 地図の上でも読みやすくする */
}

/* お気に入り・設定のパネル。右上のボタン列のすぐ下に開く */
.panel {
  position: absolute;
  /* #action-buttons の下(ボタン7個分のグループ: 1個あたり 44px(ボタン) + 2px(隙間) +
     12px(ボタン名) = 58px。隙間10px x6 + 余白10px。ボタンの数・大きさを変えたら、ここも合わせて直す。
     実際には positionPanelNearLocateButton(viewer/js/ui.js)が毎回位置を計算して上書きするため、
     この値が使われるのは JS 実行前の一瞬だけ(フォールバック) */
  top: calc(12px + 58px * 7 + 10px * 6 + 10px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  max-width: 320px;
  margin-left: auto; /* 幅が余ったら右寄せにする */
  max-height: 75vh; /* 表示領域の 75%。超える場合は .panel-body 側でスクロールする */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* [hidden] より後ろに書き、display を明示しているだけでは隠れないのを防ぐ。
   [hidden] のほうが詳細度が高いので、これが無くても本来は効くはずだが、
   確実にするため明示しておく */
.panel[hidden] {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  font-weight: bold;
}

.panel-close {
  border: none;
  background: none;
  font-size: 2rem; /* 「×」を 2 倍 */
  cursor: pointer;
  padding: 4px 8px;
}

.panel-body {
  padding: 14px;
  overflow-y: auto;
}

.panel-placeholder {
  color: #777;
  margin: 0;
}

/* ---- 設定パネル(docs/viewer.md「アプリの設定」。viewer/js/settings.js) ---- */

.settings-section {
  margin-bottom: 16px;
}
.settings-section-title {
  font-weight: bold;
  font-size: 0.8125rem;
  color: #1565c0;
  margin-bottom: 6px;
}

/* セクション内の小見出し(「● 識別情報」等)。セクション見出しより 1 段階右にインデントする */
.settings-subsection-title {
  font-weight: bold;
  font-size: 0.8125rem;
  color: #444;
  margin-left: 1.5em;
  margin-top: 10px;
  margin-bottom: 10px; /* 見出しとチェックボックスの間隔を、セクション見出しとの間隔に揃える */
}
.settings-subsection-title:first-child {
  margin-top: 0;
}

/* 小見出し配下のチェックボックス等は、.settings-row よりさらに 1 段階右にインデントする。
   .settings-row より詳細度を上げて、CSS の記述順によらず確実に上書きする */
.settings-row.settings-row-indent2 {
  margin-left: 3em; /* 「4. 船の詳細」から見てインデント2段階分(1段階 = .settings-subsection-title の 1.5em) */
}

/* 受信局の位置(緯度・経度の数値入力)。チェックボックスが無いので cursor は通常のまま、
   入力欄は折り返して縦に並べる */
.settings-receiver-location {
  flex-direction: column;
  align-items: flex-start;
  cursor: default;
  gap: 4px;
}
.settings-receiver-location-inputs {
  display: flex;
  gap: 8px;
}
.settings-receiver-location-inputs input[type="number"] {
  width: 8em;
  font-size: 0.8125rem;
}

/* スライダー1行分(ラベル・つまみ・現在値)。船のラベル・航跡の設定などで使う */
.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  margin-bottom: 8px;
  margin-left: 1.5em; /* 見出しより少し右にインデントする */
}
.settings-slider-row label {
  flex-shrink: 0;
}
.settings-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
}
.settings-slider-row button {
  flex-shrink: 0;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  line-height: 1;
  font-size: 0.625rem;
  cursor: pointer;
  padding: 0;
}
.settings-slider-row .settings-slider-value {
  flex-shrink: 0;
  min-width: 3em;
  text-align: right;
  color: #666;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  margin-bottom: 8px;
  margin-left: 1.5em; /* 見出しより少し右にインデントする */
  cursor: pointer;
}
.settings-section .settings-row:last-child {
  margin-bottom: 0;
}

/* 船舶の表示(船種カテゴリ)の各行。船種名が長い行は折り返す。
   チェックボックス・見本はその先頭行に揃える(インデント自体は .settings-row と共通) */
.settings-ship-category-row {
  font-size: 0.8125rem;
  align-items: flex-start;
}

/* 船マーカーと同じ形・色の見本。白いマーカーも見えるよう、背景に淡いグレーを敷く */
.settings-ship-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: #eee;
  border-radius: 4px;
}
.settings-ship-swatch svg {
  width: 16px;
  height: 16px;
}

/* その他の AIS 目標の設定行(基地局・AtoN・SAR 機)。アイコン(.settings-ship-swatch)の
   見本をラベル名の直前にくっつけて表示する(viewer/js/settings.js) */
#setting-other-targets-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.settings-other-target-sample {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 船種名(船種コード付き)。幅が足りなければ複数行に折り返す */
.settings-ship-category-label {
  min-width: 0;
  overflow-wrap: break-word;
  line-height: 1.4;
}

/* 一時的なお知らせ(画面下部に数秒だけ表示) */
#notice {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 0);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  max-width: 80vw;
  text-align: center;
}
#notice.visible {
  opacity: 1;
}

/* ---- お知らせパネル(docs/viewer.md「お知らせ」。viewer/js/notices.js) ---- */

#notices-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notice-item {
  padding: 8px 2px;
  border-bottom: 1px solid #f3f3f3;
}
.notice-item:last-child {
  border-bottom: none;
}
.notice-item-meta {
  font-size: 0.75rem;
  color: #777;
  margin-bottom: 4px;
}
.notice-item-text {
  font-size: 0.8125rem;
  white-space: pre-wrap; /* 本文中の改行はそのまま折り返す */
  word-break: break-word;
}
