/* === topic-dice.css === */
/* step-section / section-title / hint / instructions / note は common/css/components.css で定義 */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}

.form-group input[type="text"],
.topic-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1.5px solid #ccc;
    border-radius: var(--border-radius-small);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.topic-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 96, 100, 0.1);
}

.action-bar {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    padding: var(--spacing-md) 0;
}

.instructions {
    background: var(--gray-lighter);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-large);
    margin-bottom: var(--spacing-sm);
}

.instructions h3 {
    font-size: 1.3em;
    color: var(--gray-darkest);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.instructions h3 i {
    color: var(--primary-color);
}

.instructions ol {
    margin-left: var(--spacing-xl);
    line-height: 1.8;
}

.instructions li {
    margin-bottom: var(--spacing-sm);
    color: var(--gray-darker);
}

.instructions li strong {
    color: var(--primary-color);
    font-weight: 600;
}

.instructions .note {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(0, 96, 100, 0.08);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-small);
    color: var(--gray-darker);
    line-height: 1.7;
}

.instructions .note i {
    color: var(--warning-color);
}

/* --- 教員用: テーマ入力フォーム --- */
#topicInputs {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
}

.topic-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.topic-num {
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 700;
    flex-shrink: 0;
}

.topic-row input {
    flex: 1;
}

/* --- URL生成結果 --- */
.url-box {
    margin-bottom: var(--spacing-lg);
}

.url-box label {
    display: block;
    font-weight: 700;
    font-size: 0.9em;
    color: var(--accent-color);
    margin-bottom: var(--spacing-xs);
}

.url-copy-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.url-copy-row input[type="text"] {
    flex: 1;
    font-size: 0.85em;
    background: #f5f5f5;
    cursor: text;
}

/* --- 生徒用: モード切り替え --- */
.mode-toggle-bar {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.mode-btn {
    padding: 8px 24px;
    border: 2px solid var(--primary-color);
    border-radius: 999px;
    background: transparent;
    color: var(--primary-color);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mode-btn:hover {
    background: rgba(0, 96, 100, 0.08);
}

.mode-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

/* --- サイコロ --- */
.dice-scene {
    perspective: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-xl) 0;
    min-height: 220px;
}

.dice-wrapper {
    width: 140px;
    height: 140px;
    transform-style: preserve-3d;
    position: relative;
}

.dice {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.dice.rolling {
    animation: diceRoll 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes diceRoll {
    0%   { transform: var(--dice-start); }
    30%  { transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg); }
    60%  { transform: rotateX(540deg) rotateY(360deg) rotateZ(180deg); }
    100% { transform: var(--dice-end); }
}

.face {
    position: absolute;
    width: 140px;
    height: 140px;
    border: 3px solid rgba(0, 96, 100, 0.3);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    padding: 10px;
    line-height: 1.3;
    backface-visibility: hidden;
    box-shadow: inset 0 0 12px rgba(0, 96, 100, 0.1);
    word-break: break-word;
    overflow: hidden;
}

.face-front  { transform: translateZ(70px); }
.face-back   { transform: rotateY(180deg) translateZ(70px); }
.face-right  { transform: rotateY(90deg)  translateZ(70px); }
.face-left   { transform: rotateY(-90deg) translateZ(70px); }
.face-top    { transform: rotateX(90deg)  translateZ(70px); }
.face-bottom { transform: rotateX(-90deg) translateZ(70px); }

/* 各面のベース回転 → JSで上書きして出目を制御 */
/* front=0, back=1, right=2, left=3, top=4, bottom=5 */

/* 出目ごとの最終角度マップ（JSから参照） */

/* --- 結果表示 --- */
.result-display {
    text-align: center;
    margin: var(--spacing-md) 0;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-label {
    font-size: 0.85em;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-topic {
    font-size: 2em;
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(0, 96, 100, 0.06);
    border: 2px solid rgba(0, 96, 100, 0.2);
    border-radius: var(--border-radius-large);
    padding: var(--spacing-md) var(--spacing-xl);
    display: inline-block;
}

/* --- ルーレット --- */
.roulette-scene {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg) 0;
}

#rouletteCanvas {
    max-width: 100%;
    border-radius: 50%;
    box-shadow: var(--shadow-xlarge);
}

.roulette-needle {
    position: absolute;
    top: calc(var(--spacing-lg) - 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 28px solid var(--danger-color);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    z-index: 10;
}

/* --- テーマチップ一覧 --- */
.topic-list-area {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(0,0,0,0.08);
}

.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.topic-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 96, 100, 0.08);
    border: 1px solid rgba(0, 96, 100, 0.2);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--primary-color);
}

.topic-chip-num {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
}

/* --- 全画面オーバーレイ（QR用） --- */
.fullscreen-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 60, 70, 0.95);
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.fullscreen-overlay.active {
    display: block;
}

.exit-fullscreen-btn {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    background: rgba(255,255,255,0.15);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.exit-fullscreen-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* --- レスポンシブ --- */
@media (max-width: 480px) {
    .dice-wrapper {
        width: 110px;
        height: 110px;
    }

    .face {
        width: 110px;
        height: 110px;
        font-size: 0.9em;
    }

    .face-front  { transform: translateZ(55px); }
    .face-back   { transform: rotateY(180deg) translateZ(55px); }
    .face-right  { transform: rotateY(90deg)  translateZ(55px); }
    .face-left   { transform: rotateY(-90deg) translateZ(55px); }
    .face-top    { transform: rotateX(90deg)  translateZ(55px); }
    .face-bottom { transform: rotateX(-90deg) translateZ(55px); }

    .result-topic {
        font-size: 1.5em;
    }

    #rouletteCanvas {
        width: 300px;
        height: 300px;
    }
}
