/* --- AI Reach Training (Fireworks Style) --- */

/* リセット & 基本設定 */
* { box-sizing: border-box; }
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    overflow: hidden; /* スクロール禁止 */
    background: #000;
    font-family: "Noto Sans JP", sans-serif;
}

/* カメラ背景 */
.camera-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0;
}
.input_video { display: none; }
.output_canvas {
    width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}

/* UIレイヤー */
.ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    display: flex; flex-direction: column;
    padding: 10px;
    pointer-events: none; /* 下のCanvas操作を通す */
}

/* UI要素有効化 */
.header-bar, .setup-card, .overlay-screen, #game-ui button {
    pointer-events: auto;
}

/* ヘッダー */
.header-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.9);
    padding: 8px 15px; border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 10px; flex-shrink: 0;
}
.btn-menu {
    background: transparent; border: 2px solid #6d4c41;
    color: #6d4c41; padding: 5px 15px; border-radius: 20px;
    font-weight: bold; font-size: 0.85rem; cursor: pointer;
}
.header-title {
    font-weight: bold; color: #6d4c41; font-size: 1.1rem;
}

/* 設定カード (花火大会風) */
.setup-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    width: 95%; max-width: 400px;
    margin: auto; /* 上下左右中央 */
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.card-title {
    margin: 0 0 5px 0; color: #6d4c41; font-size: 1.5rem;
}
.card-desc {
    font-size: 0.9rem; color: #666; margin-bottom: 15px; line-height: 1.4;
}

/* 設定リスト */
.settings-list {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
}
.s-row {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px dashed #ddd; padding-bottom: 5px;
}
.s-row label {
    font-weight: bold; color: #5d4037; font-size: 0.95rem;
}
.s-row select {
    padding: 6px; border-radius: 6px; border: 1px solid #ccc;
    font-size: 1rem; width: 50%; text-align: center; background: #fff;
}

/* 回数×セットの並び */
.double-select {
    display: flex; align-items: center; gap: 5px; width: 50%; justify-content: flex-end;
}
.double-select select { width: 100%; }

/* 開始ボタン */
.start-btn {
    width: 100%; padding: 15px;
    background: #6d4c41; color: white;
    font-size: 1.3rem; font-weight: bold;
    border: none; border-radius: 50px;
    box-shadow: 0 4px 10px rgba(109, 76, 65, 0.4);
    cursor: pointer;
}
.start-btn:active { transform: scale(0.98); }

/* --- ゲーム中UI --- */
#game-ui {
    flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 20px;
}
.game-header {
    display: flex; justify-content: space-around;
    background: rgba(255,255,255,0.8);
    padding: 8px; border-radius: 15px;
    margin-top: 10px;
}
.g-stat {
    font-weight: bold; color: #6d4c41; font-size: 1.1rem;
}
.btn-stop {
    align-self: center;
    background: rgba(255,255,255,0.9); border: 2px solid #999;
    padding: 8px 25px; border-radius: 30px; font-weight: bold; color: #555;
}

/* --- オーバーレイ画面 (休憩・結果) --- */
.overlay-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(250, 247, 242, 0.95);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 100;
}
.big-timer {
    font-size: 5rem; font-weight: 900; color: #d4a373; margin: 20px 0;
}
.result-data {
    background: #fff; padding: 20px; border-radius: 15px; width: 80%;
    margin-bottom: 20px; text-align: left; border: 1px solid #eee;
}
.result-data p { margin: 5px 0; font-size: 1.1rem; font-weight: bold; color: #4a3f35; }

.btn-primary {
    width: 80%; padding: 12px; background: #6d4c41; color: white;
    border: none; border-radius: 30px; font-size: 1.1rem; font-weight: bold; margin-bottom: 10px;
}
.btn-secondary {
    width: 80%; padding: 10px; background: #fff; color: #6d4c41;
    border: 2px solid #6d4c41; border-radius: 30px; font-size: 1rem; font-weight: bold;
}

.hidden { display: none !important; }