/* =================================================================
 * Depth Perception Test Simulator - Ultimate Peep-Hole Version
 * =================================================================
 */

/* --- キャリブレーション --- */
#calibration-target {
    transform-origin: center center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    margin: 0 auto;
}

.calib-card {
    background: linear-gradient(135deg, #444, #222);
    border-radius: 12px;
    color: white;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.calib-coin {
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f0f0f0, #999);
    border: 2px solid #777;
    color: #333;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold;
    font-size: 1.5rem;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.5) !important;
}

.calib-ruler {
    background-color: #eee;
    border: 1px solid #777;
    color: black;
    display: flex;
    align-items: flex-end;
    background-image: linear-gradient(90deg, #000 2px, transparent 2px);
    background-size: 20% 40%;
    background-repeat: repeat-x;
    background-position: bottom;
    padding-bottom: 5px;
    padding-left: 8px;
    font-weight: bold;
}


.peep-hole-outer {
    background-color: #111;
    padding: 80px 20px;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    /* data-bs-theme="dark" 単体ではDOM継承の color が body から伝わるため、
       明示的に CSS 変数を参照してダーク値を取得させる */
    color: var(--bs-body-color);
}

/* モバイルでの余白圧縮 */
@media (max-width: 576px) {
    .peep-hole-outer {
        padding: 30px 8px;
    }
    /* モード切替ボタンのテキストが長いため、モバイルでは少し縮める */
    .mode-panel .btn-group .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.4rem;
    }
    /* 計測開始・ストップボタンが横並びだと窮屈なため余白調整 */
    #btn-depth-start,
    #btn-depth-stop {
        font-size: 0.95rem;
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

/* --- 究極の「のぞき窓」ステージ (Peep Hole Window) --- */
.real-peep-container {
    background-color: #000;
    padding: 80px 20px;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.real-peep-window {
    background-color: #fef2c2; 
    width: 100%;
    max-width: 600px;
    height: 240px;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.3);
    clip-path: inset(0 0 0 0); 
    border-top: 4px solid #333;
    border-bottom: 4px solid #333;
}

.rod {
    position: absolute;
    height: 100%; 
    top: 0;
    background-color: #000;
    border-radius: 2px;
    z-index: 2;
    transform: translateX(-50%);
}

.rod-moving {
    left: 50%;
    z-index: 1;
    transition: none !important;
    will-change: transform;
}

/* 計測時のポップアップ表示（位置を下に移動） */
.real-peep-flash {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    z-index: 100;
    padding: 6px 16px;
    border-radius: 4px;
    transition: all 0.5s ease-out;
    pointer-events: none;
}

/* 共通UI・ダークモード対応の補足 */
.prose { line-height: 1.8; }

/* bg-warning-subtle のダークモードは暗い茶色(#332701)になるため
   text-dark(#212529)との組み合わせはコントラスト比が1:1近くになる。
   モーダルタイトルのみ明色に差し替えて視認性を確保する */
[data-bs-theme="dark"] .modal-title.text-dark {
    color: #f8f9fa !important;
}

/* 傾向分析やテキストの視認性確保 */
#depth-result .text-body-secondary,
.spec-panel .text-body-secondary {
    color: var(--bs-secondary-color) !important;
}

[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

@media (max-width: 576px) {
    .real-peep-container { padding: 50px 10px; }
    .real-peep-window { height: 220px; }
}