@charset "UTF-8";

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: 'Noto Sans JP', sans-serif; overflow: hidden; background: #000; }

#app-container { position: relative; width: 100vw; height: 100vh; overflow: hidden; }

/* カメラ & Canvas */
#webcam {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; transform: scaleX(-1); opacity: 0; /* JSでCanvasに描画するため隠す */
}
#output-canvas {
    position: absolute; top: 0; left: 0; 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; pointer-events: none; }
.header-bar, .overlay-screen, button { pointer-events: auto; }
.hidden { display: none !important; }

/* ヘッダー */
.header-bar {
    position: absolute; top: 0; left: 0; width: 100%; height: 60px;
    padding: 0 15px; display: flex; justify-content: space-between; align-items: center;
    background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); z-index: 20;
}
.header-title { font-weight: bold; color: #d32f2f; font-size: 1.2rem; }
.game-status { display: flex; align-items: baseline; gap: 5px; }
.game-status .label { font-size: 0.7rem; color: #666; font-weight: bold; }
.game-status .value { font-family: 'Orbitron', sans-serif; font-size: 1.5rem; color: #d32f2f; font-weight: 700; }
.btn-menu {
    background: #fff; border: 1px solid #ccc; padding: 5px 12px; border-radius: 20px;
    display: flex; align-items: center; gap: 4px; cursor: pointer; color: #555; font-weight: bold;
}

/* --- ゲームオーバーレイ --- */
#game-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    pointer-events: none;
}

/* 指示テキスト */
#instruction-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 40px; border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 50px; text-align: center;
    border: 4px solid #d32f2f;
    min-width: 300px;
}
#instruction-text {
    font-size: 2.5rem; font-weight: 900; color: #333; line-height: 1.2;
}

/* 判定マーク */
#feedback-mark {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 10rem; font-weight: bold; text-shadow: 0 0 20px rgba(255,255,255,0.8);
    animation: popIn 0.3s forwards;
}
.mark-correct::after { content: "⭕"; color: #4caf50; }
.mark-wrong::after { content: "❌"; color: #f44336; }

@keyframes popIn { 0% { transform: translate(-50%, -50%) scale(0); } 80% { transform: translate(-50%, -50%) scale(1.2); } 100% { transform: translate(-50%, -50%) scale(1); } }

/* お手本表示 */
#model-area {
    position: absolute; bottom: 20px; right: 20px;
    background: rgba(255,255,255,0.9); padding: 10px; border-radius: 10px;
    border: 2px solid #2196f3; text-align: center;
}
#model-area p { margin: 0 0 5px 0; font-weight: bold; color: #1565c0; font-size: 0.8rem; }
#model-canvas { background: #e3f2fd; border-radius: 5px; }

/* --- 設定画面など (共通) --- */
.overlay-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; padding: 15px; z-index: 50;
}
.setup-card {
    background: white; width: 100%; max-width: 450px;
    border-radius: 20px; padding: 30px 20px; text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
}
.card-header { position: relative; margin-bottom: 20px; display: flex; justify-content: center; align-items: center; }
.btn-icon-back { position: absolute; left: 0; background: none; border: none; cursor: pointer; color: #555; }
.card-title { font-size: 1.4rem; color: #d32f2f; margin: 0; font-weight: 800; }
.card-desc { font-size: 0.9rem; color: #555; margin-bottom: 20px; background: #ffebee; padding: 10px; border-radius: 8px; text-align: left; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; text-align: left; }
.s-item label { display: block; font-weight: bold; font-size: 0.8rem; margin-bottom: 5px; }
select { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #ccc; font-size: 1rem; background: #fff; }

.start-btn {
    width: 100%; padding: 15px; background: linear-gradient(135deg, #ef5350, #c62828);
    color: white; border: none; border-radius: 50px; font-size: 1.2rem; font-weight: bold;
    cursor: pointer; box-shadow: 0 5px 15px rgba(244,67,54,0.4);
}
.start-btn:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; }
.btn-sub { flex: 1; padding: 10px; background: white; border: 1px solid #ccc; border-radius: 30px; font-weight: bold; color: #555; cursor: pointer; }

/* 結果 */
.result-stats { background: #fafafa; padding: 15px; border-radius: 12px; margin-bottom: 20px; }
.res-main { font-size: 1.5rem; font-weight: bold; color: #d32f2f; margin-bottom: 10px; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-row { background: white; padding: 10px; border-radius: 8px; border: 1px solid #eee; }
.res-val { font-size: 1.5rem; font-weight: bold; color: #333; display: block; }
.res-desc { font-size: 0.85rem; text-align: left; margin-top: 10px; color: #666; }