/* src/public/css/roulette.css */

/* =========================================
   オプションパネル（上部ボタンエリア）
   ========================================= */
.options-panel {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}
.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.option-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.opt-select {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 220px;
    outline: none;
    transition: border-color 0.2s;
}
.opt-select:focus {
    border-color: #2a5298;
}
.option-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 💡 トグルボタンの見た目（ここを強化） */
.opt-icon-btn {
    padding: 10px 16px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.opt-icon-btn:hover {
    border-color: #2a5298;
    color: #2a5298;
    background: #f0f4f8;
}
/* 💡 ボタンがON（アクティブ）になった時の主役カラー */
.opt-icon-btn.active {
    border-color: #2a5298;
    background: #2a5298;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(42, 82, 152, 0.3);
}

/* =========================================
   トースト通知（画面右上のフワッと出る案内）
   ========================================= */
.toast-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast-msg {
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-msg.show {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   レイアウト構成
   ========================================= */
.roulette-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}
.config-side {
    flex: 1;
    min-width: 300px;
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.wheel-side {
    flex: 1.2;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 35px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* =========================================
   Canvasルーレット盤のラップ
   ========================================= */
.wheel-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}
/* 12時方向の固定三角矢印 */
.pointer {
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 28px solid #e74c3c;
    margin-bottom: -10px;
    /* 💡 修正：z-index は position 指定が無いと効かないため relative を追加しました
                （盤面より前に出せず、矢印が隠れることがありました） */
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
/* 💡 追加：hidden 属性で隠せるようにする */
.pointer[hidden] { display: none; }
#roulette-wheel {
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    max-width: 100%;
    height: auto;
    display: block;
}
/* 矢印・ボトル用の重ね合わせCanvasエリア */
.center-overlay {
    position: absolute;
    top: 18px; /* ポインターのオフセット調整 */
    bottom: 0; /* 💡 height:100%をやめ、bottom:0で固定することでCanvasサイズと完全一致させる */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}
/* 💡 追加：display:flex を指定しているため、hidden 属性だけでは隠れません。
            hidden の時に非表示になる指定を明示します。 */
.center-overlay[hidden] { display: none; }
#overlay-canvas {
    max-width: 100%;
    height: auto;
}

/* =========================================
   入力フォームとアイテムリスト
   ========================================= */
.item-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.item-input-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
}
.item-input-group input:focus {
    border-color: #2a5298;
}
.btn-add {
    background-color: #2a5298;
    color: white;
    border: none;
    padding: 0 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}
.btn-add:hover { background-color: #1e3c72; }

.item-list {
    list-style: none;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
}
.item-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.95rem;
    color: #334155;
}
.item-list li:last-child { border-bottom: none; }
/* 💡 追加：全員選択モードで「選ばれ済み」の項目の見た目（旧 JS の style 指定をここへ移動） */
.item-list li.is-excluded {
    opacity: 0.3;
    text-decoration: line-through;
}
.btn-remove {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
    padding: 2px 6px;
}
.btn-remove:hover { color: #ef4444; }

/* =========================================
   設定エリアの見出し・回転速度スライダー
   💡 追加：blade に直接書かれていた style 属性をここへ移動しました
   ========================================= */
.config-title {
    font-size: 1.2rem;
    color: #2a5298;
    margin-bottom: 15px;
}
.speed-control-wrapper {
    margin-top: 20px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.speed-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #475569;
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}
.speed-range {
    width: 100%;
    cursor: pointer;
}

/* =========================================
   全員選択（カウントダウン）モードUI
   ========================================= */
/* 💡 追加：旧 style 属性（margin-top）をここへ移動。
            display は指定しないので hidden 属性がそのまま効きます。 */
.countdown-reset-wrapper {
    margin-top: 20px;
}
.countdown-info {
    font-size: 0.9rem;
    font-weight: bold;
    color: #475569;
    margin-bottom: 8px;
    text-align: center;
    background: #f8fafc;
    padding: 6px;
    border-radius: 4px;
}
.btn-countdown-reset {
    width: 100%;
    padding: 11px;
    background: #ffffff;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-countdown-reset:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* =========================================
   当選履歴エリア
   ========================================= */
/* 💡 追加：旧 style 属性をここへ移動（display 未指定なので hidden がそのまま効きます） */
.history-wrapper {
    margin-top: 25px;
}
.history-title {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 10px;
    border-left: 4px solid #94a3b8;
    padding-left: 8px;
}
.history-list {
    list-style: none;
    padding: 10px;
    max-height: 160px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
}
.history-list li {
    padding: 6px 4px;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
}
.history-list li:last-child { border-bottom: none; }
.btn-history-clear {
    font-size: 0.8rem;
    padding: 5px 12px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    color: #64748b;
    font-weight: bold;
    transition: all 0.2s;
}
.btn-history-clear:hover {
    background: #cbd5e1;
    color: #334155;
}

/* =========================================
   メインスタートボタン & 結果表示
   ========================================= */
.btn-spin {
    width: 260px;
    padding: 16px;
    background-color: #f39c12;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
    transition: all 0.2s;
    margin-top: 5px;
    text-align: center;
}
.btn-spin:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(230, 126, 34, 0.4);
}
.btn-spin:active {
    transform: translateY(1px);
}
.btn-spin:disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.result-display {
    font-size: 1.6rem;
    font-weight: bold;
    color: #2a5298;
    margin-top: 20px;
    min-height: 38px;
    text-align: center;
}

/* =========================================
   全画面シアターモード（Fullscreen API）
   ========================================= */
#roulette-fullscreen-target:fullscreen,
#roulette-fullscreen-target:-webkit-full-screen {
    background: #0f172a !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    width: 100% !important;
    height: 100% !important;
}
#roulette-fullscreen-target:fullscreen .wheel-wrapper,
#roulette-fullscreen-target:-webkit-full-screen .wheel-wrapper {
    transform: scale(1.2);
    margin-bottom: 40px;
}
#roulette-fullscreen-target:fullscreen .result-display,
#roulette-fullscreen-target:-webkit-full-screen .result-display {
    color: #ffffff;
    font-size: 2.8rem;
    margin-top: 30px;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}
#roulette-fullscreen-target:fullscreen .btn-spin,
#roulette-fullscreen-target:-webkit-full-screen .btn-spin {
    font-size: 1.6rem;
    padding: 18px 80px;
    width: auto;
}

/* 💡 擬似全画面（iPhone/iPad等）でも同じシアター表示にする（盤面は画面幅に合わせて縮小） */
#roulette-fullscreen-target.pseudo-fullscreen {
    background: #0f172a !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#roulette-fullscreen-target.pseudo-fullscreen #roulette-wheel,
#roulette-fullscreen-target.pseudo-fullscreen #overlay-canvas {
    width: min(88vw, 78vmin) !important;
    height: min(88vw, 78vmin) !important;
}
#roulette-fullscreen-target.pseudo-fullscreen .result-display {
    color: #ffffff;
    font-size: 2rem;
    margin-top: 20px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}
#roulette-fullscreen-target.pseudo-fullscreen .btn-spin {
    font-size: 1.3rem;
    padding: 14px 50px;
    width: auto;
}
/* === 最下部に追記 === */
/* 💡 追加：blade に直接書かれていた style 属性をここへ移動しました */
.permanent-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.permanent-actions .btn-common-action {
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-share-link {
    background: #2ecc71;
    color: #fff;
    border: none;
}
.btn-full-reset {
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}
.share-note {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    text-align: center;
}
/* 💡 変更：インラインstyleを廃止したため、!important での上書きが不要になりました */
#btn-roulette-share:hover {
    background-color: #27ae60;
}
#btn-roulette-full-reset:hover {
    background-color: #e74c3c;
    color: #fff;
}

/* =========================================
   💡 追加：スマートフォン・タブレット対応（〜768px）
   以前は指定が無く、360px 幅の端末では左右の設定欄と盤面が
   はみ出して横スクロールが発生していました。
   ========================================= */
@media (max-width: 768px) {
    .options-panel {
        gap: 12px;
        padding: 12px 14px;
    }
    .opt-select {
        min-width: 0;
        width: 100%;
    }
    .option-group {
        width: 100%;
    }
    .roulette-container {
        gap: 20px;
    }
    /* 盤面・設定欄の最小幅を解除して、画面幅に収まるようにする */
    .config-side,
    .wheel-side {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
        padding: 18px 14px;
    }
    /* 盤面と重ね合わせCanvasは同じ幅でないと矢印の中心がずれるため、
       包む要素の幅を決めてから両方を100%にそろえます */
    .wheel-wrapper {
        width: 100%;
        max-width: 340px;
    }
    #roulette-wheel,
    #overlay-canvas {
        width: 100%;
        height: auto;
    }
    .btn-spin {
        width: 100%;
        max-width: 320px;
        font-size: 1.1rem;
        padding: 14px;
    }
    .result-display {
        font-size: 1.3rem;
        word-break: break-all;
    }
    .toast-area {
        top: 12px;
        right: 12px;
        left: 12px;
    }
    .toast-msg {
        font-size: 0.85rem;
        padding: 10px 14px;
    }
    .item-list li {
        font-size: 0.9rem;
        word-break: break-all;
    }
}