/* ============================================================
   Coriolis アプリ固有スタイル
   共通スタイルは common/styles_common.css で定義
   Bootstrap 5 は initializer-common.js が動的ロード
   ============================================================ */

body { background: var(--rl-surface); }

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 24px);
}
.page-wrapper > .container-xl:not(#ad-container-top-1):not(#ad-container-footer-1) { flex: 1; }
@media (max-width: 575px) {
    .page-wrapper { min-height: calc(100vh - 40px); }
}

/* ========================================
   メインレイアウト（display:contents パターン）
   PC:      左列(S→P) + 右列(R)
   モバイル: S→R→P
======================================== */
.cr-main-layout {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.cr-left-col,
.cr-right-col { display: contents; }
.cr-item-r { order: 2; }
.cr-item-s { order: 1; }
.cr-item-p { order: 3; }

@media (min-width: 992px) {
    .cr-main-layout { flex-direction: row; align-items: flex-start; }
    .cr-left-col {
        display: flex; flex-direction: column; gap: .5rem;
        flex: 0 0 33.333%; max-width: 33.333%;
    }
    .cr-right-col {
        display: flex; flex-direction: column; gap: .5rem;
        flex: 1; min-width: 0;
    }
    .cr-item-r, .cr-item-s, .cr-item-p { order: 0; }
}
@media (min-width: 1200px) {
    .cr-left-col { flex: 0 0 25%; max-width: 25%; }
}

/* ========================================
   設定パネル内のサブラベル
======================================== */
.section-sublabel {
    font-size: .75rem;
    color: var(--rl-text-sub);
    margin-bottom: .3rem;
}

/* スマホでも設定パネルは常時表示（折りたたみなし） */

/* 設定セクション内のサブ項目（方向/速さ/位置等）を1段インデント */
.cr-item-p .search-section > *:not(.section-label) {
    padding-left: .75rem;
}

/* ========================================
   メインキャンバスラッパー
======================================== */

/* モバイルでキャンバスと再生コントロールの順序を入れ替えるために flex 化 */
.result-panel > .p-2 {
    display: flex;
    flex-direction: column;
}
@media (max-width: 991px) {
    .sim-canvas-wrap    { order: 2; }
    .cr-replay-controls { order: 1; }
    .cr-traj-views      { order: 3; }
}

.sim-canvas-wrap {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}
.sim-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--rl-border);
}

/* ========================================
   再生コントロール
======================================== */
.cr-replay-controls {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .4rem;
    padding: .3rem .5rem;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: .75rem;
    color: var(--rl-text-sub);
}
.cr-replay-controls .form-range,
.cr-replay-controls .flex-1 { flex: 1; }
.cr-replay-time {
    min-width: 3.5rem;
    text-align: right;
    font-family: monospace;
    font-size: .8rem;
    font-weight: 700;
    color: #333;
}

/* ========================================
   軌跡比較（固定 + 回転座標系）
======================================== */
.cr-traj-views {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--rl-border);
}
.cr-view-item {
    flex: 1 1 280px;
    text-align: center;
}
.cr-view-item h4 {
    font-size: .82rem;
    color: var(--rl-text-sub);
    margin: 0 0 .4rem;
}
.cr-view-item canvas {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--rl-border);
    border-radius: 6px;
}

/* ========================================
   回転開始ボタン: 実行中はグレー無効化
======================================== */
#startBtn:disabled {
    background: #9e9e9e !important;
    border-color: #9e9e9e !important;
    color: #fff !important;
    cursor: not-allowed;
    opacity: .7;
}

/* ========================================
   ボールを押すボタンのアニメーション（有効時）
   有効時 = 青ベース + 大きめパルスアニメ
======================================== */
@keyframes pulse-attention {
    0%   { box-shadow: 0 0 0 0 rgba(13,110,253,.8); transform: scale(1); }
    50%  { box-shadow: 0 0 0 20px rgba(13,110,253,0); transform: scale(1.07); }
    100% { box-shadow: 0 0 0 0 rgba(13,110,253,0); transform: scale(1); }
}
#pushBtn:not(:disabled) {
    background: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
    animation: pulse-attention 1.4s ease-in-out infinite;
}
#pushBtn:not(:disabled):hover {
    background: #0b5ed7 !important;
    border-color: #0a58ca !important;
}
