:root {
  --bg: #0b1020;
  --card: #121a34;
  --text: #e7ebff;
  --muted: #a2a9c7;
  --accent: #6ea8ff;
  --ok: #58d68d;
  --warn: #ffcc66;
  --err: #ff7b7b;
  --border: #2a355f;
}

/* ===========================
   グローバルリセット & ベースレイアウト
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", sans-serif;
  background-color: #eef1f4; /* 検索結果ページの基本背景色 */
  color: gray;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative; /* ::before 疑似要素の基準 */
}

/* 背景のわずかなアニメーション (検索ページ用) */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1; /* 内容の背後に配置 */
  animation: bgPulse 15s infinite ease-in-out alternate;
}

@keyframes bgPulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0.8;
    transform: scale(1.03);
  }
}

/* ===========================
   ヘッダー & コンテナ
=========================== */

/* ヘッダー (結果画面 H1, 検索画面ロゴ共通) */
header {
  padding: 32px 20px 10px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.02em;
}

/* ヘッダーサブテキスト (結果画面の検索条件サマリー用) */
.sub {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* メインコンテンツ (結果画面用) */
main {
  margin: 20px auto 40px;
  padding: 0 16px;
}

/* アプリのメインカードコンテナ (検索画面用) */
.container {
  background-color: #ffffff;
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(70, 70, 70, 0.3);
  padding: 55px;
  width: 100%;
  max-width: 700px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* アプリのヘッダー (ロゴ) */
.app-header {
  margin-bottom: auto;
  position: relative;
}

/* (削除された .app-subtitle) */

/* ページ内 details (メモ等) */
details {
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  color: #707070;
}

/* ===========================
   検索フォーム (index.html)
=========================== */
form {
  background: var(--card); /* フォーム自体はダーク */
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25);
}

/* 出発地と到着地の横並び */
.airport-inputs {
  display: flex;
  gap: 25px;
}

/* ラベル＋入力セット */
.form-group {
  flex: 1;
  text-align: left;
  position: relative;
  margin-bottom: 30px;
}

/* フォーム内ラベル (ダーク背景用) */
.form-group label {
  display: block;
  margin-bottom: 12px;
  font-weight: 500;
  color: #b0b0b0; /* ダーク背景なので明るい色 */
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

/* フォーム内テキスト入力 (ライト背景用) */
.form-group input[type="text"] {
  width: 100%;
  padding: 18px 20px;
  border: 2px solid #404040;
  border-radius: 10px;
  font-size: 18px;
  color: #000000; /* ライト背景なので暗い色 */
  background-color: #ffffff; /* 入力欄はライト */
  transition: border-color 0.3s ease, box-shadow 0.3s ease,
    background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input[type="text"]::placeholder {
  color: #707070;
}

/* 空港入力欄のフォーカス */
.form-group input[type="text"]:focus:not(#dayInput):not(#timeInput) {
  outline: none;
  border-color: #e4002b;
  box-shadow: 0 0 0 4px rgba(228, 0, 43, 0.4);
  background-color: #ffffff;
}

.form-group input[type="text"]:hover {
  background-color: #e8e8e8;
}

/* 日付・時刻入力欄 (フォーム内) */
#dayInput,
#timeInput {
  margin-bottom: 0;
  margin-top: 0;
  border: none;
}

/* --- 汎用フォーム要素 (ダーク) --- */
/* (現状の検索フォームでは .form-group 側が優先されているが、汎用スタイルとして定義) */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

input,
select {
  background: #0d1530;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(110 168 255 / 0.2);
}

input[type="number"] {
  width: auto;
}
/* --- 汎用フォーム要素 (ここまで) --- */


/* 日付・時刻入力欄は白背景を優先 */
#dayInput,
#timeInput {
  background: #ffffff;
  color: #000;
}

/* 日付・時刻入力はフォーカス時も枠色/影を変えない */
#dayInput:focus,
#timeInput:focus {
  border-color: transparent;
  box-shadow: none;
}

.hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ===========================
   フォーム部品: トグル (出発/到着)
=========================== */

/* メイン画面のトグル (上下マージン調整) */
.time-type-inline {
  margin-bottom: 15px;
}

.time-type-select {
  display: flex;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

.time-type-select input[type="radio"] {
  display: none; /* ラジオボタン自体は隠す */
}

.time-type-select div {
  position: relative;
  flex: 1;
}

.timeOption {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 32px;
  border: 1px solid #b6b6b6;
  background: #b6b6b6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  color: #555;
}

.time-type-select div:first-child .timeOption {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.time-type-select div:last-child .timeOption {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.timeOption:hover {
  background-color: #ffffff;
}

/* 選択状態 */
.time-type-select input[type="radio"]:checked+.timeOption {
  background: #ffffff;
  font-weight: 600;
  color: #e4002b;
  border-color: #e4002b;
}

/* ===========================
   フォーム部品: 日付・時刻ボックス
=========================== */

.datetime-group {
  margin-top: 0;
}

/* "日付" "時刻" のラベル */
.datetime-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.datetime-label-left,
.datetime-label-right {
  font-size: 15px;
  flex: 1;
}

.datetime-label-right {
  padding-left: 40px;
  text-align: left;
}

/* 入力ボックス本体 (モーダルを開くトリガー) */
.datetime-box {
  width: 100%;
  border-radius: 10px;
  background-color: #ffffff;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  cursor: pointer;
}

/* ボックス内の 2 つの入力 (表示用) */
.datetime-input-left,
.datetime-input-right {
  flex: 1;
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 18px 20px;
  font-size: 18px;
  background-color: transparent;
  cursor: pointer;
}

.datetime-input-left {
  border-right: 1px solid #e0e0e0;
}

.datetime-input-left:focus,
.datetime-input-right:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.datetime-box:hover {
  background-color: #f3f3f3;
}

/* ===========================
   フォーム部品: 乗り継ぎ回数
=========================== */

.max-transfers-group {
  display: flex;
  width: 100%;
  gap: 8px;
  margin-top: 6px;
}

.max-transfers-group label {
  flex: 1;
}

.max-transfers-group input[type="radio"] {
  display: none;
}

.max-transfers-group span {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #b6b6b6;
  background: #b6b6b6;
  color: #333;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.max-transfers-group input[type="radio"]:checked+span {
  background: #ffffff;
  border-color: #e4002b;
  color: #e4002b;
  box-shadow: 0 0 0 2px rgba(228, 0, 43, 0.15);
}

/* ===========================
   ボタン (検索, 戻る, もっと見る)
=========================== */
.search-button {
  width: 100%;
  padding: 15px;
  background: linear-gradient(to right, #e4002b 0%, #ff5c7d 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(228, 0, 43, 0.5);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

/* 検索ボタンのホバーエフェクト */
.search-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transform: skewX(-20deg);
  transition: all 0.3s ease;
}

.search-button:hover::before {
  left: 100%;
}

.search-button:hover {
  box-shadow: 0 12px 35px rgba(228, 0, 43, 0.7);
  transform: translateY(-4px);
  background: linear-gradient(to right, #ff5c7d 0%, #e4002b 100%);
}

.search-button:active {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(228, 0, 43, 0.3);
  background: linear-gradient(to right, #e4002b 0%, #d40028 100%);
}

/* 「戻る」「もっと見る」 (検索ボタンとほぼ共通) */
.back-button,
#load-more-btn {
  width: 40%;
  height: 3rem;
  margin-top: 4%;
  background: linear-gradient(to right, #e4002b 0%, #ff5c7d 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(228, 0, 43, 0.5);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

#load-more-btn {
  width: 100%;
}

.back-button:hover,
#load-more-btn:hover {
  box-shadow: 0 12px 35px rgba(228, 0, 43, 0.7);
  transform: translateY(-4px);
  background: linear-gradient(to right, #ff5c7d 0%, #e4002b 100%);
}

.back-button:active,
#load-more-btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(228, 0, 43, 0.3);
  background: linear-gradient(to right, #e4002b 0%, #d40028 100%);
}

/* 「検索に戻る」リンク (a タグ) */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(to right, #e4002b 0%, #ff5c7d 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border: none;
  box-shadow: 0 4px 14px rgba(228, 0, 43, 0.45);
  cursor: pointer;
}

.primary:hover {
  box-shadow: 0 8px 20px rgba(228, 0, 43, 0.7);
  transform: translateY(-2px);
}

.primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(228, 0, 43, 0.4);
}

/* (未使用の .button.leg) */

/* ===========================
   メッセージ (検索中, エラー)
=========================== */
#messages {
  margin: 18px 0;
}

.msg {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  color: var(--bg);
  font-size: 14px;
}

.msg.info {
  border-color: #2a3b7a;
}

.msg.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.msg.error {
  border-color: var(--err);
  color: var(--err);
}

/* ===========================
   結果カード (results.html)
=========================== */
#results {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

/* 0件の場合 */
.empty {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

/* 各ルート全体のカード */
.route-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px 12px;
  color: var(--text);
}

.route-card h2 {
  margin: 4px 6px 10px;
  font-size: 15px;
  color: #e7ebff;
  font-weight: 700;
}

/* レグ一覧 */
.legs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 1レグ (フライト) */
.leg-item {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid #2a355f;
  padding: 10px 12px;
}

/* 上段: 便名 + 時刻 */
.leg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums; /* 等幅フォント */
}

.code {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.num {
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.route {
  color: var(--muted);
  font-size: 12px;
}

.time {
  font-variant-numeric: tabular-nums;
}

.arrow {
  opacity: 0.8;
}

/* 下段: 空港名 */
.leg-airports {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  margin-top: 2px;
}

/* 始点・終点の空港 */
.ap-main {
  font-weight: 700;
  color: #ffffff;
}

/* 経由地の空港 */
.ap-sub {
  font-weight: 500;
  color: #a2a9c7;
}

/* 乗継待ち */
.layover-row {
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(231, 235, 255, 0.45);
  font-size: 13px;
  color: var(--muted);
}

.layover-row .label {
  font-weight: 600;
}

.layover-row .mins {
  font-weight: 700;
  color: #ffffff;
}

.layover-row .dots {
  flex: 1;
  text-align: center;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

/* ===========================
   モーダル共通
=========================== */
.modal {
  display: none;
  position: fixed; /* オーバーレイ */
  z-index: 100;
  inset: 0; /* 画面全体 */
  background-color: rgba(0, 0, 0, 0.4); /* 背景グレー */
}

/* 日付モーダルは少し上から表示 */
#date-modal {
  padding-top: 20vh;
}

.modal-content {
  background-color: #fefefe;
  margin: 8vh auto; /* 画面中央 (padding-top がない場合) */
  padding: 12px 16px 16px;
  border: 0 solid #888;
  width: min(90vw, 420px);
  max-height: 80vh;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close {
  border-radius: 8px;
  border: none;
  background-color: #f3f3f3;
  width: 32px;
  height: 32px;
  color: #999;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: #000;
  background-color: #e4e4e4;
}

.close-left {
  align-self: flex-start;
}

/* ===========================
   モーダル: 空港選択
=========================== */

#airport-list {
  max-height: 60vh;
  overflow-y: auto;
}

.airport-region {
  text-align: left;
  margin-bottom: 8px;
}

.airport-region>summary {
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f6fb;
  font-size: 13px;
  font-weight: 600;
}

.airport-region>summary::-webkit-details-marker {
  color: #555;
}

.airport-region ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.airport-region li {
  padding: 6px 10px;
  border-top: 1px solid #efefef;
  color: #333333;
  cursor: pointer;
}

.airport-region li:hover {
  background-color: #e8e8e8;
}

/* ===========================
   モーダル: 日付・時刻ドラムロール
=========================== */

/* 日付と時刻を横並び */
.date-time-row {
  display: flex;
  gap: 12px;
}

.date-time-row .dayy,
.date-time-row .time {
  flex: 1;
}

/* モバイルでは縦並び (レスポンシブセクションで定義) */

/* ドラムロール外枠 */
.selecter {
  margin-inline: auto;
  margin-top: 2%;
  margin-bottom: 2%;
  position: relative;
  width: 100%;
  background: #f4f6fb;
  border-radius: 16px;
  padding: 8px;
  font-size: 1rem;
  line-height: 1.2;
}

/* 中央の選択ライン (疑似要素) */
.selecter::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  bottom: 0;
  margin: auto;
  height: 2.4em;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid rgba(110, 168, 255, 0.4);
  pointer-events: none; /* クリック貫通 */
}

/* スクロール領域 */
.selecter__inner {
  margin-inline: auto;
  max-height: calc(2.4em * 3); /* 3行分 */
  overflow-y: scroll;
  padding: 0;
  scroll-snap-type: y proximity;
  position: relative;
}

.selecter__inner::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.selecter__inner::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

.selecter__inner::-webkit-scrollbar-thumb:hover {
  background-color: #bbb;
}

.selecter__inner::-webkit-scrollbar-track {
  background-color: transparent;
}

/* ドラムロール 1 行分 */
.choice {
  height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  color: #8087a5;
  font-weight: 500;
  position: relative;
}

.choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  pointer-events: none;
}

/* 選択されている行 (中央) */
.choice input[type="radio"]:checked+span {
  color: #000;
  font-weight: 700;
}

/* モーダル完了ボタン */
#completeBtn {
  align-self: flex-end; /* 右寄せ */
  margin-top: 6px;
  padding: 6px 20px;
  border-radius: 999px;
  border: none;
  background: #e4002b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#completeBtn:hover,
#completeBtn:focus {
  background: #ff5c7d;
  color: #fff;
}

/* ===========================
   フッター
=========================== */
footer {
  width: 100%;
  padding: 0px 10px;
  text-align: center;
  color: #666;
  font-size: 15px;
  background: #ffffff;
}

/* 検索カード内のフッター */
.app-footer {
  margin-top: 50px;
  font-size: 14px;
  color: #909090;
  line-height: 1.8;
  font-weight: 300;
  letter-spacing: 0.3px;
  background: transparent;
}

/* ===========================
   ソートタブ (results.html)
=========================== */
.tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid #b6b6b6;
  background: #b6b6b6;
  color: #333;
  transition: all .2s ease;
}

.tab:hover {
  background: #ffffff;
}

.tab.active {
  background: #ffffff;
  border-color: #e4002b;
  color: #e4002b;
  box-shadow: 0 0 0 2px rgba(228, 0, 43, 0.15);
}

/* ===========================
   昇順/降順ボタン (results.html)
=========================== */

#direction-toggle-btn {
  min-height: 0;
  padding: 8px 20px;
  background: linear-gradient(to right, #e4002b 0%, #ff5c7d 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(228, 0, 43, 0.5);
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

#direction-toggle-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  transform: skewX(-20deg);
  transition: all .3s ease;
}

#direction-toggle-btn:hover::before {
  left: 100%;
}

#direction-toggle-btn:hover {
  box-shadow: 0 12px 35px rgba(228, 0, 43, 0.7);
  transform: translateY(-4px);
}

#direction-toggle-btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(228, 0, 43, 0.3);
}

/* ===========================
   候補便アコーディオン (results.html)
=========================== */

/* 候補便があるレグ */
.leg-row.has-alt {
  position: relative;
  cursor: pointer;
  padding-right: 25px; /* ▶ のスペース確保 */
}

/* ▶ アイコン */
.leg-row.has-alt::after {
  content: "▶";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.leg-row.has-alt:hover {
  background: rgba(228, 0, 43, 0.06); /* ほんのり赤く */
}

/* 候補便パネル */
.alt-panel {
  margin: 6px 4px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f7f7f7;
  border: 1px solid rgba(42, 53, 95, 0.25);
  font-size: 12px;
}

.alt-panel h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #666;
}

.alt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.alt-table th,
.alt-table td {
  padding: 4px 6px;
  border-top: 1px solid #e0e3ee;
  font-size: 14px;
  text-align: left;
  color: #888;
}

.alt-table tr:nth-child(odd) td {
  background: #f9fafc;
}

.alt-code,
.alt-num,
.alt-route {
  font-weight: 600;
}

.alt-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ===========================
   レスポンシブ (モバイル)
=========================== */
@media (max-width: 600px) {
  body {
    padding: 20px;
  }

  .container {
    padding: 35px;
    border-radius: 15px;
    max-width: 100%;
  }

  h1 {
    font-size: 30px;
    margin-bottom: 35px;
  }

  /* 空港入力を縦並び */
  .airport-inputs {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .airport-inputs .form-group {
    margin-bottom: 4px;
  }

  .airport-inputs .form-group input[type="text"] {
    padding: 14px 16px !important;
    font-size: 16px !important;
  }

  .airport-inputs .form-group label {
    font-size: 13px !important;
    margin-bottom: 0 !important;
  }

  .time-type-inline {
    margin-top: 18px;
    margin-bottom: 24px;
  }

  .form-group {
    flex: none;
    width: 100%;
  }

  .form-group input,
  .search-button {
    padding: 16px;
    font-size: 16px;
  }

  .search-button {
    font-size: 18px;
  }

  .app-footer {
    margin-top: 35px;
    font-size: 13px;
  }

  /* モーダルは画面いっぱいに */
  .modal-content {
    margin: 20px;
    width: auto;
  }

  /* 日付ドラムロールを縦並び */
  .date-time-row {
    flex-direction: column;
  }

  /* .leg-row の .route (HND=CTS) を非表示 */
  .leg-row .route {
    display: none !important;
  }

  /* --- 結果画面 nav (モバイル) --- */
  main>nav {
    width: 100%;
    margin: 12px auto 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 8px;
  }

  main>nav .primary {
    flex: 1 1 45%;
  }

  #sort-direction-switch {
    flex: 1 1 45%;
    margin-left: 0;
    justify-content: flex-end;
  }

  #direction-toggle-btn {
    width: 100%;
    min-width: 0;
    padding: 8px 0;
  }

  #sort-tabs {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto; /* 横スクロール */
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin: 4px auto 8px;
    text-align: center;
  }

  #sort-tabs .tab {
    flex: 1 1 0;
    padding: 8px 6px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* --- 結果カード (モバイル) --- */
  #results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
  }

  .route-card {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
  }

  /* 候補便テーブル: 2列目(区間)を非表示 */
  .alt-table th:nth-child(2),
  .alt-table td:nth-child(2) {
    display: none;
  }

  .alt-table th,
  .alt-table td {
    white-space: nowrap;
  }
}

/* ===========================
   レスポンシブ (PC)
=========================== */
@media (min-width: 768px) {

  /* --- 結果画面 nav (PC) --- */
  main>nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap; /* 折り返さない */
    justify-content: flex-start;
    width: 100%;
    margin: 12px auto 16px;
  }

  #sort-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
  }

  /* 昇順ボタンを右端に */
  #sort-direction-switch {
    margin-left: auto !important;
    flex: 0 0 auto;
    display: block;
  }

  #direction-toggle-btn {
    width: auto;
    min-width: 0;
    padding: 8px 20px;
  }
}