@charset "UTF-8";
/*
    Theme Name: SWELL CHILD
    Template: swell
    Theme URI: https://swell-theme.com/
    Description: SWELLの子テーマ（完全分離版 - CSS変数・パーセンテージ版）
    Version: 2.6.1 (Left-aligned summary sections)
    Author: LOOS WEB STUDIO
    Author URI: https://loos-web-studio.com/

    License: GNU General Public License
    License URI: http://www.gnu.org/licenses/gpl.html
    
    ★ このファイルは styles.php の内容を統合した完全版です ★
*/

/* === CSS変数定義（幅管理の統一） === */
:root {
    /* メイン幅設定 - ここを変更するだけで全体が調整される */
    --app-main-width: 1000px;
    --app-padding: 20px;
    
    /* 相対的な幅比率設定 */
    --section-width-ratio: 95.5%;    /* 860px / 900px ≈ 95.5% */
    --table-width-ratio: 88.9%;      /* 800px / 900px ≈ 88.9% */
    --info-width-ratio: 95.5%;       /* セクション幅と同じ */
    
    /* レスポンシブ幅設定 */
    --mobile-width: 95%;
    --small-mobile-width: 98%;
}

/* * 完全分離版フライト検索CSS（CSS変数・パーセンテージ版 + styles.php統合版）
 * - すべてのスタイルを #flight-search-app 内に限定
 * - CSS変数で幅を統一管理
 * - パーセンテージベースの相対的なサイズ設定
 * - 1箇所の変更で全体レイアウト調整可能
 * - styles.php の重要なスタイルを統合
 */

/* === フライト検索アプリ領域のみに適用（CSS変数版） === */
#flight-search-app {
    /* コンテナの基本設定 - CSS変数使用 */
    max-width: var(--app-main-width) !important;
    margin: 0 auto;
    padding: var(--app-padding);
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    
    /* フォント設定 */
    font-family: "Meiryo UI", "メイリオ", Meiryo, "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif !important;
    line-height: 1.7;
    color: #333333;
}

/* 全体のフォント設定（styles.php統合） */
#flight-search-app * {
    font-family: "Meiryo UI", "メイリオ", Meiryo, sans-serif !important;
}

/* === 見出しスタイル（アプリ内のみ） === */
#flight-search-app h1,
#flight-search-app h2,
#flight-search-app h3 {
    color: #333333;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

#flight-search-app #main-app-title,
#flight-search-app h1,
h1#main-app-title {
    font-size: 22px;  /* styles.php統合: 2.5em → 22px */
    font-weight: 700;
    color: rgb(51, 51, 51);
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    border-bottom: 2px solid var(--main_color, #4CAF50);
    font-family: "Meiryo UI", "メイリオ", Meiryo, sans-serif !important;
    line-height: 1.4;
    text-align: center;
}

#flight-search-app h2 {
    font-size: 18px;  /* styles.php統合: 2em → 18px */
    font-weight: 700;
    color: rgb(51, 51, 51);
    margin: 1rem 0 15px 0;
    padding: 0 0 8px 0;
    font-family: "Meiryo UI", "メイリオ", Meiryo, sans-serif !important;
    line-height: 1.4;
    text-align: center;
}

#flight-search-app h3 {
    font-size: 1.5em;
    margin-top: 1.5rem;
}

/* === 空港間移動セルの色統一（★ styles.php統合 - 重要）=== */
.airport-transfer-cell,
.airport-transfer-info {
    background-color: #e3f2fd !important;
    color: #1565c0 !important;
}

td.airport-transfer-cell {
    background-color: #e3f2fd !important;
    color: #1565c0 !important;
    font-weight: 500 !important;
}

.airport-transfer-info,
.airport-transfer-details {
    background-color: #e3f2fd !important;
    color: #1565c0 !important;
    border-left: 4px solid #2196f3 !important;
    padding: 10px !important;
    border-radius: 4px !important;
}

.airport-transfer-text {
    color: #1565c0 !important;
    font-weight: 500 !important;
}

/* === メッセージエリア（styles.php統合） === */
#messages {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

#messages.error-message {
    background-color: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
}

#messages.info-message {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    color: #1565c0;
}

/* === フォーム要素（アプリ内のみ）=== */
#flight-search-app label {
    display: block;
    margin: 0 auto 0.5rem auto;
    font-weight: 600;
    color: #333333;
    font-size: 0.9rem;
    text-align: center;
}

#flight-search-app input[type="text"],
#flight-search-app input[type="time"],
#flight-search-app input[type="date"],
#flight-search-app select {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    margin: 0 auto 1rem auto;
    border: 1px solid #eeeeee;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #ffffff;
    color: #333333;
    text-align: center;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    display: block;
}

#flight-search-app input[type="text"]:focus,
#flight-search-app input[type="time"]:focus,
#flight-search-app input[type="date"]:focus,
#flight-search-app select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* 搭乗日専用スタイル */
#flight-search-app #flightDate {
    width: 300px;
    padding: 0.75rem;
    border: 2px solid #eeeeee;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background-color: #ffffff;
    color: #333333;
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    margin: 0 auto;
    display: block;
}

#flight-search-app #flightDate:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

#flight-search-app #flightDate:invalid {
    border-color: #f44336;
}

/* カレンダーアイコンは元のスタイルを保持 */
#flight-search-app #flightDate::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* === ボタンスタイル（styles.php統合版 - 詳細設定）=== */
#flight-search-app button:not(.c-shareBtns__btn):not(.mode-button),
#flight-search-app .flight-nav-button:not(.c-shareBtns__btn),
#flight-search-app #resetButton,
#flight-search-app #copyItineraryButton,
#flight-search-app #saveItineraryAsImageButton,
#flight-search-app #exportCSVButton,
#flight-search-app #initialSearchButton,
#flight-search-app #abortButton,
#flight-search-app #backButton,
#flight-search-app #backButton-top,
#flight-search-app #completeButton,
#flight-search-app #completeButton-top {
    padding: 12px 20px !important;
    margin: 5px !important;
    min-height: 44px !important;
    min-width: 120px !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    font-family: "Meiryo UI", "メイリオ", Meiryo, sans-serif !important;
    line-height: 1.4 !important;
    letter-spacing: 0.02em !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
    transform: translateY(0) !important;
}

#flight-search-app button:not(.c-shareBtns__btn):not(.mode-button):hover,
#flight-search-app .flight-nav-button:not(.c-shareBtns__btn):hover,
#flight-search-app #resetButton:hover,
#flight-search-app #copyItineraryButton:hover,
#flight-search-app #saveItineraryAsImageButton:hover,
#flight-search-app #exportCSVButton:hover,
#flight-search-app #initialSearchButton:hover,
#flight-search-app #abortButton:hover,
#flight-search-app #backButton:hover,
#flight-search-app #backButton-top:hover,
#flight-search-app #completeButton:hover,
#flight-search-app #completeButton-top:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

#flight-search-app button:not(.c-shareBtns__btn):not(.mode-button):active,
#flight-search-app .flight-nav-button:not(.c-shareBtns__btn):active,
#flight-search-app #resetButton:active,
#flight-search-app #copyItineraryButton:active,
#flight-search-app #saveItineraryAsImageButton:active,
#flight-search-app #exportCSVButton:active,
#flight-search-app #initialSearchButton:active,
#flight-search-app #abortButton:active,
#flight-search-app #backButton:active,
#flight-search-app #backButton-top:active,
#flight-search-app #completeButton:active,
#flight-search-app #completeButton-top:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

/* 個別ボタンの色設定 */
#flight-search-app #initialSearchButton {
    background-color: #2196f3;
    color: white;
}

#flight-search-app #initialSearchButton:hover:not(:disabled) {
    background-color: #1976d2;
}

#flight-search-app #initialSearchButton:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#flight-search-app #abortButton,
#flight-search-app #resetButton {
    background-color: #f44336;
    color: white;
}

#flight-search-app #abortButton:hover,
#flight-search-app #resetButton:hover {
    background-color: #d32f2f;
}

#flight-search-app #copyItineraryButton,
#flight-search-app #saveItineraryAsImageButton,
#flight-search-app #exportCSVButton {
    background-color: #17a2b8;
    color: white;
    font-size: 14px;
    padding: 8px 16px;
}

#flight-search-app #copyItineraryButton:hover,
#flight-search-app #saveItineraryAsImageButton:hover,
#flight-search-app #exportCSVButton:hover {
    background-color: #138496;
}

/* 前の区間に戻るボタン（グレー） */
#flight-search-app #backButton,
#flight-search-app #backButton-top {
    background-color: #757575;
    color: white;
}

#flight-search-app #backButton:hover:not(:disabled),
#flight-search-app #backButton-top:hover:not(:disabled) {
    background-color: #616161;
}

#flight-search-app #backButton:disabled,
#flight-search-app #backButton-top:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 旅程を完了ボタン（緑） */
#flight-search-app #completeButton,
#flight-search-app #completeButton-top {
    background-color: #4CAF50;
    color: white;
}

#flight-search-app #completeButton:hover:not(:disabled),
#flight-search-app #completeButton-top:hover:not(:disabled) {
    background-color: #43a047;
}

#flight-search-app #completeButton:disabled,
#flight-search-app #completeButton-top:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* === モード設定セレクター（時刻表モード＋検索起点統合版） === */
#flight-search-app #mode-settings-selector {
    margin-bottom: 20px !important;
    padding: 15px !important;
    background-color: #f0f8ff !important;
    border: 2px solid #b3d9ff !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1) !important;
}

/* === モード切り替えボタンスタイル === */
/* モードセクション全体 */
#flight-search-app .mode-section {
    margin-bottom: 15px !important;
}

#flight-search-app .mode-section:last-child {
    margin-bottom: 0 !important;
}

#flight-search-app .mode-section {
    width: 100%;
    max-width: calc(var(--app-main-width) * var(--section-width-ratio) / 100);
}

#flight-search-app .mode-section-title {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #1976d2;
}

/* ボタンコンテナ */
#flight-search-app .mode-buttons-container {
    display: flex;
    gap: 1rem;
    width: 100%;
}

/* 個別のモードボタン */
#flight-search-app .mode-button {
    flex: 1;
    padding: 16px;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#flight-search-app .mode-button span {
    display: block;
    line-height: 1.4;
}

#flight-search-app .mode-button span:first-child {
    font-size: 1rem;
    font-weight: 600;
    color: #333333;
}

#flight-search-app .mode-button span:last-child {
    font-size: 0.9rem;
    color: #666666;
}

#flight-search-app .mode-button:hover {
    border-color: #b0b0b0;
    background-color: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#flight-search-app .mode-button.active {
    border-color: #2196F3;
    background-color: #E3F2FD;
    font-weight: 600;
}

#flight-search-app .mode-button.active span:first-child {
    color: #1976d2;
}

#flight-search-app .mode-button.active span:last-child {
    color: #1565c0;
}

/* モバイル対応 */
@media (max-width: 768px) {
    #flight-search-app #mode-settings-selector {
        padding: 12px !important;
    }
    
    #flight-search-app .mode-section {
        margin: 1rem auto;
    }
    
    #flight-search-app .mode-buttons-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #flight-search-app .mode-button {
        padding: 14px;
    }
    
    #flight-search-app .mode-button span:first-child {
        font-size: 1rem;
    }
    
    #flight-search-app .mode-button span:last-child {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #flight-search-app .mode-buttons-container {
        gap: 0.5rem;
    }
    
    #flight-search-app .mode-button {
        padding: 12px;
    }
    
    #flight-search-app .mode-button span:first-child {
        font-size: 0.95rem;
    }
    
    #flight-search-app .mode-button span:last-child {
        font-size: 0.8rem;
    }
}

/* === セクション区切り（パーセンテージ版 + styles.php統合） === */
#flight-search-app #itinerary-section,
#flight-search-app #input-section,
#flight-search-app #flight-selection-section {
    margin: 0 auto 2rem auto;
    width: var(--section-width-ratio) !important;
    max-width: calc(var(--app-main-width) * var(--section-width-ratio) / 100) !important;
    padding: 1.5rem;
    border: 1px solid #ddd;  /* styles.php統合 */
    background-color: #fafafa;  /* styles.php統合 */
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
}

#flight-search-app #input-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

#flight-search-app #itinerary-section:last-child,
#flight-search-app #input-section:last-child,
#flight-search-app #flight-selection-section:last-child {
    border-bottom: none;
}

/* === 情報パネル（パーセンテージ版） === */
#flight-search-app #flight-date-info {
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px auto;
    width: var(--info-width-ratio) !important;
    max-width: calc(var(--app-main-width) * var(--info-width-ratio) / 100) !important;
    border-left-width: 4px;
    border-left-style: solid;
    font-size: 13px;
    line-height: 1.4;
    transition: all 0.3s ease;
    display: none;
    text-align: left;
    box-sizing: border-box;
}

#flight-search-app #flight-date-info strong {
    display: inline-block;
    margin-bottom: 2px;
}

#flight-search-app #flight-date-info.success {
    background-color: #d4edda;
    border-color: #4caf50;
    color: #155724;
}

#flight-search-app #flight-date-info.warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

#flight-search-app #flight-date-info.info {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

#flight-search-app #search-mode-info {
    border-radius: 6px;
    margin: 15px auto;
    width: var(--info-width-ratio) !important;
    max-width: calc(var(--app-main-width) * var(--info-width-ratio) / 100) !important;
    padding: 12px;
    border-left-width: 4px;
    border-left-style: solid;
    font-size: 13px;
    line-height: 1.5;
    transition: all 0.3s ease;
    background-color: #f0f8ff;
    border-color: #2196f3;
    text-align: left;
    box-sizing: border-box;
}

/* === テーブルスタイル（パーセンテージ版） === */
/* === テーブル基本設定（styles.php準拠） === */
#flight-search-app #flight-selection-section table,
#flight-search-app #itinerary-section table,
#flight-search-app #availableFlightsContainer table,
#flight-search-app #itineraryDisplay table {
    min-width: 800px !important;
    width: auto !important;
    table-layout: auto !important;
    white-space: nowrap !important;
    border-collapse: collapse;
    margin: 1rem auto;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#flight-search-app #flight-selection-section th,
#flight-search-app #flight-selection-section td,
#flight-search-app #itinerary-section th,
#flight-search-app #itinerary-section td,
#flight-search-app #availableFlightsContainer th,
#flight-search-app #availableFlightsContainer td,
#flight-search-app #itineraryDisplay th,
#flight-search-app #itineraryDisplay td {
    white-space: nowrap !important;
    min-width: 80px !important;
    padding: 8px 12px !important;
}

/* その他の一般的なテーブル */
#flight-search-app table {
    width: 100%;
    max-width: calc(var(--app-main-width) * var(--table-width-ratio) / 100) !important;
    border-collapse: collapse;
    margin: 1rem auto;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#flight-search-app #flightTable {
    width: 100%;
    max-width: calc(var(--app-main-width) * var(--table-width-ratio) / 100) !important;
    margin: 20px auto;
    table-layout: auto;
}

#flight-search-app th {
    background: linear-gradient(to bottom, #4CAF50, #45a049);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: center;
    border-bottom: 2px solid #388e3c;
    font-size: 0.95rem;
}

#flight-search-app td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #eeeeee;
    font-size: 0.9rem;
    color: #333333;
}

#flight-search-app #flightTable tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#flight-search-app #flightTable tbody tr:hover {
    background-color: #f5f5f5;
}

#flight-search-app #flightTable tbody tr.selected-row {
    background-color: #e3f2fd !important;
    font-weight: 600;
}

/* テーブルのストライプスタイル（styles.php準拠） */
#flight-search-app #flight-selection-section table tbody tr:nth-child(even),
#flight-search-app #itinerary-section table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#flight-search-app #flight-selection-section table tbody tr:nth-child(odd),
#flight-search-app #itinerary-section table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* 選択可能な行であることを視覚的に示す */
#flight-search-app #flight-selection-section table tbody tr[data-clickable="true"],
#flight-search-app #availableFlightsContainer table tbody tr[data-clickable="true"] {
    position: relative !important;
    cursor: pointer !important;
}

#flight-search-app #flight-selection-section table tbody tr[data-clickable="true"]::before,
#flight-search-app #availableFlightsContainer table tbody tr[data-clickable="true"]::before {
    content: "👆" !important;
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 0.5 !important;
    font-size: 12px !important;
    pointer-events: none !important;
}

/* === 横スクロールテーブル === */
#flight-search-app .table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 1rem auto;
}

#flight-search-app .table-wrapper table {
    width: 100%;
    min-width: 600px;
}

/* === 旅程テーブル === */
#flight-search-app #itineraryDisplay table {
    width: 100%;
    max-width: calc(var(--app-main-width) * var(--table-width-ratio) / 100) !important;
    border-collapse: collapse;
    margin: 1rem auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#flight-search-app #itineraryDisplay th {
    background: linear-gradient(to bottom, #4CAF50, #45a049);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: center;
    border-bottom: 2px solid #388e3c;
    font-size: 0.95rem;
}

#flight-search-app #itineraryDisplay td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #eeeeee;
    font-size: 0.9rem;
    color: #333333;
}

/* === 乗り継ぎ情報表示 === */
#flight-search-app .connection-info {
    background-color: #fff3cd;
    color: #856404;
    padding: 8px;
    border-left: 4px solid #ffc107;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: left;
}

#flight-search-app .connection-success {
    background-color: #d4edda;
    border-color: #4caf50;
    color: #155724;
}

#flight-search-app .connection-warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

#flight-search-app .connection-error {
    background-color: #f8d7da;
    border-color: #f44336;
    color: #721c24;
}

/* === 旅程サマリー情報と検索結果の左寄せ（v2.6.1追加） === */

/* サマリー情報（3列カラム） */
#flight-search-app #summaryInfo {
    text-align: left !important;
    margin: 10px 0 !important;
}

#flight-search-app #summaryInfo.wp-block-columns {
    justify-content: flex-start !important;
}

#flight-search-app #summaryInfo .wp-block-column {
    text-align: left !important;
}

/* 空港間移動情報 */
#flight-search-app #summaryInterAirport {
    text-align: left !important;
    margin: 10px 0 !important;
}

/* プロモーション運賃検索ボタンコンテナ */
#flight-search-app #promotionSearchButtonContainer {
    text-align: left !important;
    margin: 10px 0 !important;
}

/* プロモーション運賃検索結果コンテナ */
#flight-search-app #promotionSearchResultsContainer {
    text-align: left !important;
    margin: 10px 0 !important;
}

/* === アコーディオンスタイル === */
#flight-search-app .accordion-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

#flight-search-app .accordion-header {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    padding: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

#flight-search-app .accordion-header:hover {
    background: linear-gradient(to right, #e9ecef, #dee2e6);
}

#flight-search-app .accordion-content {
    padding: 0.5rem;
    background-color: #ffffff;
    display: none;
}

#flight-search-app .accordion-content.active {
    display: block;
}

/* === ステータスバッジ === */
#flight-search-app .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#flight-search-app .status-success {
    background-color: #d4edda;
    color: #155724;
}

#flight-search-app .status-warning {
    background-color: #fff3cd;
    color: #856404;
}

#flight-search-app .status-error {
    background-color: #f8d7da;
    color: #721c24;
}

#flight-search-app .status-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
    :root {
        --app-main-width: var(--mobile-width);
        --section-width-ratio: 100%;
        --table-width-ratio: 100%;
        --info-width-ratio: 100%;
    }
    
    #flight-search-app {
        max-width: var(--mobile-width) !important;
        padding: 0.5rem 0.5rem;
    }
    
    #flight-search-app #input-section,
    #flight-search-app #itinerary-section,
    #flight-search-app #flight-selection-section {
        padding: 0.5rem 0.5rem;
        margin: 10px auto;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #flight-search-app #flight-date-info,
    #flight-search-app #search-mode-info {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* テーブル基本設定（styles.php準拠） */
    #flight-search-app table {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    #flight-search-app th,
    #flight-search-app td {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    /* モバイルでのテーブル横スクロール強化 */
    #flight-search-app #flight-selection-section .table-wrapper,
    #flight-search-app #itinerary-section .table-wrapper,
    #flight-search-app #availableFlightsContainer,
    #flight-search-app #itineraryDisplay {
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }
    
    #flight-search-app #flight-selection-section table,
    #flight-search-app #itinerary-section table,
    #flight-search-app #availableFlightsContainer table,
    #flight-search-app #itineraryDisplay table {
        min-width: 600px !important;
        /*font-size: 12px !important;*/
    }
    
    #flight-search-app #flight-selection-section th,
    #flight-search-app #flight-selection-section td,
    #flight-search-app #itinerary-section th,
    #flight-search-app #itinerary-section td,
    #flight-search-app #availableFlightsContainer th,
    #flight-search-app #availableFlightsContainer td,
    #flight-search-app #itineraryDisplay th,
    #flight-search-app #itineraryDisplay td {
        min-width: 40px !important;
        min-height: 40px !important;
        vertical-align: middle !important;
        line-height: 1.4 !important;
    }
    
    /* モバイルでのテーブル高さとタップ領域の調整 */
    #flight-search-app #flight-selection-section table tr,
    #flight-search-app #itinerary-section table tr,
    #flight-search-app #availableFlightsContainer table tr,
    #flight-search-app #itineraryDisplay table tr {
        min-height: 40px !important;
        height: auto !important;
    }
    
    /* クリッカブルな行（フライト選択など）のタップ領域拡張 */
    #flight-search-app #flight-selection-section table tbody tr,
    #flight-search-app #availableFlightsContainer table tbody tr {
        cursor: pointer !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.3) !important;
        position: relative !important;
    }
    
    /* フライト選択行のホバー・タップ効果を強化 */
    #flight-search-app #flight-selection-section table tbody tr:hover,
    #flight-search-app #availableFlightsContainer table tbody tr:hover,
    #flight-search-app #flight-selection-section table tbody tr:active,
    #flight-search-app #availableFlightsContainer table tbody tr:active {
        background-color: #e3f2fd !important;
        transform: scale(1.01) !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2) !important;
    }
    
    /* モバイルボタンスタイル */
    #flight-search-app button:not(.c-shareBtns__btn):not(.mode-button),
    #flight-search-app .flight-nav-button:not(.c-shareBtns__btn) {
        padding: 10px 16px !important;
        min-height: 40px !important;
        min-width: 100px !important;
        font-size: 13px !important;
        margin: 3px !important;
    }
    
    #flight-search-app #backButton,
    #flight-search-app #backButton-top,
    #flight-search-app #completeButton,
    #flight-search-app #completeButton-top,
    #flight-search-app .flight-nav-button:not(.c-shareBtns__btn) {
        width: 100% !important;
        min-width: auto !important;
    }
    
    #flight-search-app .flight-nav-button {
        font-size: 14px;
        padding: 8px 16px;
        margin: 3px;
    }
    
    #flight-search-app button {
        font-size: 15px;
        padding: 12px 22px;
    }
}

@media (max-width: 480px) {
    :root {
        --app-main-width: var(--small-mobile-width);
    }
    
    #flight-search-app {
        max-width: var(--small-mobile-width) !important;
        padding: 0.5rem;
        margin: 10px auto;
    }
    
    #flight-search-app #input-section,
    #flight-search-app #itinerary-section,
    #flight-search-app #flight-selection-section {
        padding: 6px 8px;
        margin: 6px auto;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #flight-search-app #initialSearchButton,
    #flight-search-app #resetButton,
    #flight-search-app #abortButton {
        width: 90%;
        margin: 5px auto;
        padding: 14px;
        display: block;
        font-size: 16px;
    }
    
    /* 極小画面でのテーブル横スクロール最適化（styles.php準拠） */
    #flight-search-app #flight-selection-section .table-wrapper,
    #flight-search-app #itinerary-section .table-wrapper,
    #flight-search-app #availableFlightsContainer,
    #flight-search-app #itineraryDisplay {
        margin: 10px -0.75rem !important;
        padding: 10px 0.75rem !important;
        width: calc(100% + 1.5rem) !important;
    }
    
    /* テーブル全体の幅を画面に収める */
    #flight-search-app #flight-selection-section table,
    #flight-search-app #itinerary-section table,
    #flight-search-app #availableFlightsContainer table,
    #flight-search-app #itineraryDisplay table {
        min-width: 100% !important;  /* 400px → 100%に変更 */
        width: 100% !important;
        font-size: 0.65rem !important;  /* フォントサイズをさらに縮小 */
    }
    
    /* テーブルセルのパディングを最小化 */
    #flight-search-app #flight-selection-section th,
    #flight-search-app #flight-selection-section td,
    #flight-search-app #itinerary-section th,
    #flight-search-app #itinerary-section td,
    #flight-search-app #availableFlightsContainer th,
    #flight-search-app #availableFlightsContainer td,
    #flight-search-app #itineraryDisplay th,
    #flight-search-app #itineraryDisplay td {
        padding: 0.25rem 0.15rem !important;  /* 左右パディングを削減 */
        font-size: 0.65rem !important;  /* 11px相当 */
        min-width: 35px !important;
    }
    
    /* 便名カラムの幅を調整 */
    #flight-search-app #flight-selection-section td:nth-child(2),
    #flight-search-app #itinerary-section td:nth-child(2),
    #flight-search-app #availableFlightsContainer td:nth-child(2),
    #flight-search-app #itineraryDisplay td:nth-child(2) {
        min-width: 45px !important;  /* 便名 */
    }
    
    /* 出発・到着カラムの幅を調整 */
    #flight-search-app #flight-selection-section td:nth-child(3),
    #flight-search-app #flight-selection-section td:nth-child(4),
    #flight-search-app #itinerary-section td:nth-child(3),
    #flight-search-app #itinerary-section td:nth-child(4),
    #flight-search-app #availableFlightsContainer td:nth-child(3),
    #flight-search-app #availableFlightsContainer td:nth-child(4),
    #flight-search-app #itineraryDisplay td:nth-child(3),
    #flight-search-app #itineraryDisplay td:nth-child(4) {
        min-width: 55px !important;  /* 出発・到着 */
    }
    
    /* 乗継時間カラムの幅を確保 */
    #flight-search-app #flight-selection-section td:nth-child(5),
    #flight-search-app #itinerary-section td:nth-child(5),
    #flight-search-app #availableFlightsContainer td:nth-child(5),
    #flight-search-app #itineraryDisplay td:nth-child(5) {
        min-width: 40px !important;  /* 乗継時間 */
    }
    
    /* ヘッダーセルのフォントサイズ調整 */
    #flight-search-app #flight-selection-section th,
    #flight-search-app #itinerary-section th,
    #flight-search-app #availableFlightsContainer th,
    #flight-search-app #itineraryDisplay th {
        font-size: 0.6rem !important;  /* 10px相当 */
        padding: 0.3rem 0.1rem !important;
        line-height: 1.2 !important;
    }
    
    /* コンテナのパディングも調整 */
    #flight-search-app {
        padding: 10px 5px !important;
    }
    
    /* テーブルコンテナのオーバーフロー対策 */
    #flight-search-app #flight-selection-section,
    #flight-search-app #itinerary-section,
    #flight-search-app #availableFlightsContainer,
    #flight-search-app #itineraryDisplay {
        overflow-x: visible !important;
        padding: 0 0.25rem !important;
    }
    
    /* フォーカス状態の改善 */
    #flight-search-app #flight-selection-section table tbody tr:focus,
    #flight-search-app #availableFlightsContainer table tbody tr:focus {
        outline: 2px solid #007bff !important;
        outline-offset: 2px !important;
        background-color: #e3f2fd !important;
    }
    
    #flight-search-app #copyItineraryButton,
    #flight-search-app #saveItineraryAsImageButton,
    #flight-search-app #exportCSVButton {
        font-size: 12px !important;
    }
    
    #flight-search-app #itinerary-section button:not(.c-shareBtns__btn) {
        width: 100% !important;
        margin: 3px 0 !important;
        display: block !important;
    }
    
    #flight-search-app #flight-selection-section table tbody tr[data-clickable="true"]::before,
    #flight-search-app #availableFlightsContainer table tbody tr[data-clickable="true"]::before {
        font-size: 14px !important;
        right: 6px !important;
    }
}

/* === タッチデバイス向けの追加改善（styles.php準拠） === */
@media (hover: none) and (pointer: coarse) {
    /* タッチデバイスでのみ適用される調整 */
    #flight-search-app #flight-selection-section table tbody tr,
    #flight-search-app #availableFlightsContainer table tbody tr {
        min-height: 56px !important;
        border-bottom: 2px solid #e9ecef !important;
    }
    
    #flight-search-app #flight-selection-section th,
    #flight-search-app #flight-selection-section td,
    #flight-search-app #itinerary-section th,
    #flight-search-app #itinerary-section td,
    #flight-search-app #availableFlightsContainer th,
    #flight-search-app #availableFlightsContainer td,
    #flight-search-app #itineraryDisplay th,
    #flight-search-app #itineraryDisplay td {
        padding: 16px 10px !important;
        min-height: 52px !important;
        font-size: 15px !important;
    }
    
    /* タップフィードバックの強化 */
    #flight-search-app #flight-selection-section table tbody tr:active,
    #flight-search-app #availableFlightsContainer table tbody tr:active {
        background-color: #bbdefb !important;
        transform: scale(0.98) !important;
        transition: all 0.1s ease !important;
    }
}

/* === アクセシビリティ対応（アプリ内のみ） === */
#flight-search-app button:focus,
#flight-search-app input:focus,
#flight-search-app select:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

#flight-search-app .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === 動きの削減設定（アプリ内のみ） === */
@media (prefers-reduced-motion: reduce) {
    #flight-search-app * {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
        transform: none;
    }
}

/* === 印刷対応（アプリ内のみ） === */
@media print {
    #flight-search-app {
        max-width: none;
        box-shadow: none;
        border: 1px solid #000;
        padding: 1rem;
    }
    
    /* ボタンとフライト選択セクションは非表示 */
    #flight-search-app button,
    #flight-search-app #flight-selection-section {
        display: none;
    }
    
    /* 入力セクションは印刷時も表示 */
    #flight-search-app #input-section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    #flight-search-app table {
        break-inside: auto;
        border: 1px solid #000;
        margin: 0 auto;
    }
    
    #flight-search-app th,
    #flight-search-app td {
        border: 1px solid #000;
    }
    
    #flight-search-app tr {
        break-inside: avoid;
        break-after: auto;
    }
}

/* === ハイコントラストモード対応（アプリ内のみ） === */
@media (prefers-contrast: high) {
    #flight-search-app {
        border: 2px solid #000;
    }
    
    #flight-search-app #flightTable th,
    #flight-search-app #itineraryDisplay th {
        background-color: #000;
        color: #fff;
    }
    
    #flight-search-app table,
    #flight-search-app th,
    #flight-search-app td {
        border-color: #000;
        border-width: 2px;
    }
    
    #flight-search-app #messages,
    #flight-search-app #flight-date-info,
    #flight-search-app #search-mode-info {
        border: 2px solid currentColor;
    }
}

/* === ページ全体のコンテンツ幅統一（CSS変数版） === */
/* お知らせアコーディオンなど、同じページの他の要素も同じ幅に統一したい場合 */
.entry-content,
.post-content,
.content-area,
.main-content,
.container,
.page-container,
.site-content,
.wrapper,
.site-main,
.content-wrap,
.entry-wrap {
    max-width: var(--app-main-width) !important;
    margin: 0 auto !important;
}

/* アコーディオン要素の幅統一 */
.accordion,
.notice-section,
.announcement,
[class*="accordion"],
[class*="notice"] {
    max-width: var(--app-main-width) !important;
    margin: 0 auto !important;
}

/* レスポンシブでのページ全体幅調整 */
@media (max-width: 768px) {
    .entry-content,
    .post-content,
    .content-area,
    .main-content,
    .container,
    .page-container,
    .site-content,
    .wrapper,
    .site-main,
    .content-wrap,
    .entry-wrap {
        max-width: var(--mobile-width) !important;
        margin: 0 auto !important;
    }
}

@media (max-width: 480px) {
    .entry-content,
    .post-content,
    .content-area,
    .main-content,
    .container,
    .page-container,
    .site-content,
    .wrapper,
    .site-main,
    .content-wrap,
    .entry-wrap {
        max-width: var(--small-mobile-width) !important;
        margin: 0 auto !important;
    }
}