/* =================================================================
 * Dice Simulator Specific Styles & Dark Mode Fixes
 * ================================================================= */

/* --- 1. サイコロシミュレーター固有のスタイル --- */
#results-section {
    min-height: 300px;
    perspective: 1500px;
    background-color: var(--bs-tertiary-bg, var(--bs-body-bg));
}

.dice-scene {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    min-height: 200px;
    flex-wrap: wrap;
    padding: 2rem 0;
}

.cube-container {
    width: 100px;
    height: 100px;
    position: relative;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.face {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid #495057;
    border-radius: 10px;
    font-size: 2.8rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    color: #212529;
    backface-visibility: hidden;
    transition: filter 0.3s ease-out;
    filter: blur(0px);
}

.face span {
    display: inline-block;
    transition: filter 0.3s ease-out, transform 0.3s;
    filter: blur(0px);
}

.cube.is-rolling .face {
    filter: blur(1px);
}

.cube.is-rolling .face span {
    filter: blur(4px);
    transform: scale(1.2);
}

/* --- 2. カラーリング機能 --- */
.dice-scene.colored .cube[data-color-index="0"] .face { background-color: #0d6efd; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="1"] .face { background-color: #198754; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="2"] .face { background-color: #dc3545; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="3"] .face { background-color: #ffc107; color: #333; border-color: #333; }
.dice-scene.colored .cube[data-color-index="4"] .face { background-color: #0dcaf0; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="5"] .face { background-color: #6f42c1; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="6"] .face { background-color: #fd7e14; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="7"] .face { background-color: #20c997; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="8"] .face { background-color: #d63384; color: white; border-color: #fff; }
.dice-scene.colored .cube[data-color-index="9"] .face { background-color: #6c757d; color: white; border-color: #fff; }

/* --- 3. 3D Face Positions (立方体の面配置) --- */
.face-1 { transform: rotateY(0deg) translateZ(50px); }
.face-2 { transform: rotateX(-90deg) translateZ(50px); }
.face-3 { transform: rotateY(90deg) translateZ(50px); }
.face-4 { transform: rotateY(-90deg) translateZ(50px); }
.face-5 { transform: rotateX(90deg) translateZ(50px); }
.face-6 { transform: rotateY(180deg) translateZ(50px); }

.result-text-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bs-border-color);
}

/* --- 4. ボタンアニメーション --- */
#roll-btn {
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
[data-bs-theme="dark"] #roll-btn { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); }
#roll-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }
[data-bs-theme="dark"] #roll-btn:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
#roll-btn:active { transform: translateY(1px); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); }

/* =================================================================
 * 5. Dark Mode Visibility Fix for SEO Contents
 * ================================================================= */

/* 見出しやFAQのQ部分（text-dark）を強制的に明るい文字色にする */
[data-bs-theme="dark"] .prose .text-dark {
    color: #f8f9fa !important;
}

/* テーブルの見出し（thead）の背景色と文字色を調整 */
[data-bs-theme="dark"] .table .table-light,
[data-bs-theme="dark"] .table .table-light th {
    background-color: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #495057 !important;
}

/* テーブルの左列（bg-light 指定部分）を暗い背景にする */
[data-bs-theme="dark"] .table td.bg-light {
    background-color: #2b3035 !important;
    color: #e9ecef !important;
}

/* テーブル全体の枠線が白浮きしないように、ダークトーンの枠線に馴染ませる */
[data-bs-theme="dark"] .table-bordered,
[data-bs-theme="dark"] .table-bordered td,
[data-bs-theme="dark"] .table-bordered th {
    border-color: #495057 !important;
}

/* テーブル内の通常セルも視認性を確保 */
[data-bs-theme="dark"] .table {
    color: #e9ecef !important;
}

/* ツール設定エリアの背景調整 */
[data-bs-theme="dark"] .bg-light-subtle {
    background-color: #2b3035 !important;
}


/* =================================================================
 * 6. Page Specific Overrides (index.php / main.jsからの移植)
 * ================================================================= */
.dice-title-text {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.dice-lead-text {
    max-width: 700px;
}

.dice-desc-alert,
.dice-usage-card {
    max-width: 800px;
}

.dice-desc-alert {
    font-size: 0.95rem;
}

.dice-switch-label {
    font-size: 1rem;
}

.dice-total-sum {
    font-size: 1.5em;
}

/* 結果テキスト用のカラークラス */
.result-color-0 { color: #0d6efd; }
.result-color-1 { color: #198754; }
.result-color-2 { color: #dc3545; }
.result-color-3 { color: #ffc107; }
.result-color-4 { color: #0dcaf0; }
.result-color-5 { color: #6f42c1; }
.result-color-6 { color: #fd7e14; }
.result-color-7 { color: #20c997; }
.result-color-8 { color: #d63384; }
.result-color-9 { color: #6c757d; }