/* =================================================================
 * Depth Test Simulator - Complete Styles
 * Includes: Calibration, Animation, Real Mode (Dark Room), Global Dark Theme
 * =================================================================
 */

/* --- キャリブレーション (Calibration) --- */
#calibration-target {
    transform-origin: center center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    /* JSで即時反映させるため transition は無し */
    margin: 0 auto;
    /* 親要素内で中央配置 */
}

/* カードのデザイン修正 */
.calib-card {
    background-color: #333;
    border-radius: 8px;
    color: white;
    position: relative;
    /* 中身を強制的に中央揃え */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

/* 100円玉のデザイン */
.calib-coin {
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f0f0f0, #bdbdbd);
    border: 2px solid #9e9e9e;
    color: #555;
    /* 数字を中央揃え */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.calib-ruler {
    background-color: #f8f9fa;
    border: 1px solid #aaa;
    color: black;
    display: flex;
    align-items: flex-end;
    background-image: linear-gradient(90deg, #333 1px, transparent 1px);
    background-size: 20% 30%;
    background-repeat: repeat-x;
    background-position: bottom;
    padding-bottom: 5px;
    padding-left: 5px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
}

/* --- 深視力ステージ (Standard Mode) --- */
#depth-stage {
    background-color: #ffffff;
    transition: background-color 0.5s ease, border-color 0.5s ease;
    position: relative;
    overflow: hidden;
}

.rod {
    position: absolute;
    width: 8px;
    height: 60%;
    top: 20%;
    background-color: #000;
    border-radius: 4px;
    z-index: 2;
    /* width変更時のアニメーションは不要（即時反映） */
    transition: transform 0.1s linear, box-shadow 0.5s ease;
}

/* 静止している左右の棒：中心基準 */
.rod-static {
    transform: translateX(-50%);
}

.rod-static.rod-left {
    left: 30%;
}

.rod-static.rod-right {
    left: 70%;
}

/* 真ん中の動く棒：中心基準 */
.rod-moving {
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    transition: none !important;
    will-change: transform;
}

/* --- UI調整 (モード・カード等) --- */
.top-view-card {
    color: #212529;
}

.top-view-card .text-muted,
.top-view-card .small {
    color: #6c757d !important;
}

#btn-share-depth-result {
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
}

#btn-share-depth-result:hover {
    border-color: #fff;
    background-color: #000;
}

/* --- リアルモード (Real Mode / Dark Room) --- */
body.real-mode-body {
    background-color: #121212 !important;
    color: #ecf0f1 !important;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.real-mode-body nav,
body.real-mode-body footer {
    opacity: 0.3;
    transition: opacity 0.5s ease;
}

body.real-mode-body nav:hover,
body.real-mode-body footer:hover {
    opacity: 1;
}

body.real-mode-body h1,
body.real-mode-body h2,
body.real-mode-body h3,
body.real-mode-body h4,
body.real-mode-body h5,
body.real-mode-body h6,
body.real-mode-body label {
    color: #fff !important;
}

body.real-mode-body .lead,
body.real-mode-body .text-muted,
body.real-mode-body .small.text-muted {
    color: #bdc3c7 !important;
}

.real-mode-active {
    background-color: #2c3e50 !important;
    color: #ecf0f1 !important;
    border-color: #34495e !important;
}

.real-mode-active .card-header {
    background-color: #1a252f !important;
    border-bottom-color: #34495e;
}

.real-mode-active #depth-stage {
    background-color: #95a5a6 !important;
    border: 4px solid #1a252f !important;
}

.real-mode-active .rod {
    background-color: #000 !important;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.5) 90%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.real-mode-active .vignette-overlay {
    opacity: 1;
}

.real-mode-active .alert-info,
.real-mode-active .alert-light {
    background-color: #34495e;
    color: #ecf0f1;
    border-color: #46637f;
}

.real-mode-active .alert-info strong {
    color: #fff;
}

body.real-mode-body .alert-warning {
    background-color: #4e342e;
    color: #ffccbc;
    border-color: #6d4c41;
}

body.real-mode-body .alert-success {
    background-color: #1b5e20;
    color: #c8e6c9;
    border-color: #2e7d32;
}

.real-mode-active .bg-light-subtle,
.real-mode-active .bg-body-secondary {
    background-color: #2c3e50 !important;
    border: 1px solid #444 !important;
    color: #ecf0f1 !important;
}

.real-mode-active .bg-light-subtle .text-muted {
    color: #d0d3d4 !important;
}

.real-mode-active #depth-counter.badge {
    background-color: #1a252f !important;
    border: 1px solid #7f8c8d;
}

.real-mode-active .top-view-card {
    background-color: #34495e !important;
    border: 1px solid #46637f !important;
    color: #ecf0f1 !important;
}

.real-mode-active .top-view-card .text-muted {
    color: #bdc3c7 !important;
}

.real-mode-active .btn-outline-secondary,
.real-mode-active .btn-outline-primary,
.real-mode-active .btn-outline-danger {
    color: #bdc3c7;
    border-color: #7f8c8d;
}

.real-mode-active .btn-outline-secondary:hover,
.real-mode-active .btn-outline-primary:hover,
.real-mode-active .btn-outline-danger:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.real-mode-active .btn-check:checked+.btn {
    color: #fff !important;
}

body.real-mode-body .list-group-item {
    background-color: #2c3e50;
    color: #ecf0f1;
    border-color: #444;
}

.real-mode-active .table {
    color: #ecf0f1;
    border-color: #444;
}

.real-mode-active .table thead th {
    background-color: #1a252f;
    color: #fff !important;
    border-bottom: 2px solid #555;
}

.real-mode-active .table tbody td {
    background-color: #2c3e50;
    color: #ecf0f1 !important;
    border-bottom: 1px solid #444;
}

.real-mode-active .table-hover tbody tr:hover td {
    background-color: #34495e;
    color: #fff !important;
}

.real-mode-active .text-success {
    color: #4ade80 !important;
}

.real-mode-active .text-danger {
    color: #ff6b6b !important;
}

body.real-mode-body .text-primary {
    color: #5dade2 !important;
}

body.real-mode-body .text-success {
    color: #4ade80 !important;
}

.top-view-diagram {
    width: 200px;
    height: 120px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    position: relative;
    margin: 0 auto;
    border-radius: 4px;
}

.real-mode-active .top-view-diagram {
    background-color: #2c3e50;
    border-color: #7f8c8d;
}

.eye-icon {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    color: #666;
}

.real-mode-active .eye-icon {
    color: #bdc3c7;
}

.base-line {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 1px;
    background-color: #ddd;
    border-top: 1px dashed #999;
}

.real-mode-active .base-line {
    background-color: #7f8c8d;
    border-top-color: #95a5a6;
}

.dot-static {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    background-color: #333;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.real-mode-active .dot-static {
    background-color: #000;
    box-shadow: 0 0 2px #fff;
}

.dot-left {
    left: 30%;
}

.dot-right {
    left: 70%;
}

.dot-moving {
    position: absolute;
    left: 50%;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: top 0.5s ease;
    z-index: 2;
}

.real-mode-active .dot-moving {
    background-color: #ff6b6b;
    box-shadow: 0 0 2px #fff;
}

.transition-bg {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

.vision-tool-card {
    transition: all 0.2s ease;
}

.vision-tool-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    z-index: 1;
}

/* ダークモード対応 */
[data-bs-theme="dark"] #how-to-use-collapse .bg-light {
    background-color: #212529 !important;
    color: #e0e0e0 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] #how-to-use-collapse .bg-white {
    background-color: #343a40 !important;
    color: #e0e0e0 !important;
    border-color: #495057 !important;
}

[data-bs-theme="dark"] #how-to-use-collapse h3,
[data-bs-theme="dark"] #how-to-use-collapse h6,
[data-bs-theme="dark"] #how-to-use-collapse p,
[data-bs-theme="dark"] #how-to-use-collapse strong,
[data-bs-theme="dark"] #how-to-use-collapse .text-dark {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] #how-to-use-collapse .text-muted,
[data-bs-theme="dark"] #how-to-use-collapse .small.text-muted {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] article .bg-light {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] article .bg-light .text-dark {
    color: #fff !important;
}

[data-bs-theme="dark"] article .bg-light .text-muted {
    color: #adb5bd !important;
}

body.real-mode-body article .bg-light {
    background-color: #2c3e50 !important;
    border-color: #444 !important;
    color: #ecf0f1 !important;
}

body.real-mode-body article .bg-light .text-dark {
    color: #fff !important;
}

body.real-mode-body article .bg-light .text-muted {
    color: #bdc3c7 !important;
}