@charset "UTF-8";

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

/* 背景 */
.app-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #e8f5e9 0%, #a5d6a7 100%);
    z-index: -1;
}

/* レイヤー */
.game-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; display: flex; flex-direction: column;
}
.ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; pointer-events: none;
}
.header-bar, .overlay-screen, #action-area { 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.9); backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); z-index: 20;
}
.header-title { font-weight: bold; color: #2e7d32; font-size: 1.1rem; }
.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.2rem; color: #333; 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; font-size: 0.85rem;
}

/* --- オーバーレイ画面 (設定・結果) --- */
.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;
}

/* 設定カード */
.setup-card {
    background: white; width: 100%; max-width: 420px;
    border-radius: 20px; padding: 25px 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    text-align: center; margin: 0 auto;
    max-height: 95vh; overflow-y: auto;
}

.card-header { position: relative; margin-bottom: 15px; display: flex; justify-content: center; align-items: center; }
.btn-icon-back {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: #555; padding: 5px;
}
.card-title { font-size: 1.3rem; color: #333; margin: 0; font-weight: 800; letter-spacing: 0.05em; }
.card-desc { 
    font-size: 0.85rem; color: #666; margin-bottom: 20px; 
    line-height: 1.5; text-align: left; background: #f1f8e9;
    padding: 10px; border-radius: 8px;
}

/* グリッドレイアウト */
.settings-grid { 
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; text-align: left; width: 100%;
}
.s-item { width: 100%; }
.s-item.full-width { grid-column: 1 / -1; }
.s-item label { display: block; font-weight: bold; font-size: 0.8rem; color: #444; margin-bottom: 5px; margin-left: 2px; }

/* 連結ボタン (ラジオ) */
.radio-group { display: flex; width: 100%; background: #eceff1; border-radius: 8px; padding: 3px; }
.radio-group input { display: none; }
.radio-group label {
    flex: 1; text-align: center; padding: 8px 0; font-size: 0.85rem; color: #607d8b;
    cursor: pointer; border-radius: 6px; transition: all 0.2s; font-weight: 500;
}
.radio-group input:checked + label { background: white; color: #2e7d32; box-shadow: 0 2px 5px rgba(0,0,0,0.1); font-weight: bold; }

select {
    width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #cfd8dc;
    font-size: 0.9rem; background: #fff; color: #333; height: 38px;
}

.start-btn {
    width: 100%; padding: 14px; background: linear-gradient(135deg, #66bb6a, #43a047);
    color: white; border: none; border-radius: 50px; 
    font-size: 1.1rem; font-weight: bold; letter-spacing: 0.05em;
    cursor: pointer; box-shadow: 0 5px 15px rgba(76,175,80,0.4);
    transition: transform 0.1s; margin-top: 5px;
}
.start-btn:active { transform: scale(0.98); }

/* --- ゲームエリア (散らばり) --- */
#scatter-area {
    flex: 1; 
    position: relative;
    background-image: radial-gradient(#a5d6a7 1px, transparent 1px);
    background-size: 20px 20px;
    margin-top: 60px; /* ヘッダー分 */
    overflow: hidden;
}

.scatter-item {
    position: absolute;
    display: flex; flex-direction: column; align-items: center;
    pointer-events: none; user-select: none;
    background: rgba(255,255,255,0.9); /* 少し濃く */
    padding: 2px 5px; border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.s-num {
    font-size: 0.8rem; color: #fff; font-weight: bold;
    background: #2e7d32; padding: 1px 6px; border-radius: 10px;
    margin-bottom: 0px;
}
.s-char {
    font-size: 1.6rem; font-weight: bold; color: #333;
    line-height: 1.2; font-family: "Noto Sans JP";
}

/* --- アクションエリア (入力) --- */
#action-area {
    height: auto; min-height: 120px;
    background: #fff; border-top: 1px solid #ddd;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 15px; padding-bottom: 30px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    z-index: 50; position: relative;
}

/* 入力モード */
#input-container { width: 100%; max-width: 600px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.input-wrapper { display: flex; width: 100%; gap: 10px; }
#answer-input {
    flex: 1; padding: 12px; font-size: 1.2rem;
    border: 2px solid #43a047; border-radius: 8px; outline: none;
    background: #f1f8e9;
}
#answer-input:focus { border-color: #2e7d32; background: #fff; }
.btn-check {
    background: #43a047; color: white; border: none;
    padding: 0 25px; border-radius: 8px; font-weight: bold; font-size: 1rem;
    cursor: pointer; white-space: nowrap;
}
.input-hint { font-size: 0.8rem; color: #888; }

/* 閲覧モード */
#view-controls { width: 100%; text-align: center; }
#correct-display { margin-bottom: 15px; font-size: 1.2rem; color: #d32f2f; background: #ffebee; padding: 5px 15px; border-radius: 8px; display: inline-block; }
#correct-display .label { font-size: 0.8rem; margin-right: 5px; color: #b71c1c; }
#correct-display .val { font-weight: bold; }

.btn-action {
    background: #0277bd; color: white; border: none;
    padding: 12px 50px; border-radius: 30px; font-size: 1.1rem; font-weight: bold;
    box-shadow: 0 4px 0 #01579b; cursor: pointer; transition: transform 0.1s;
}
.btn-action.sub { background: #f57f17; box-shadow: 0 4px 0 #e65100; }
.btn-action:active { transform: translateY(4px); box-shadow: none; }

/* --- 結果表示 --- */
.result-stats { background: #f1f8e9; padding: 15px; border-radius: 12px; margin-bottom: 15px; text-align: left; }
.res-main { text-align: center; font-size: 1.4rem; font-weight: 900; color: #33691e; margin-bottom: 10px; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.res-row { background: white; padding: 8px; border-radius: 8px; text-align: center; border: 1px solid #dcedc8; }
.res-label { display: block; font-size: 0.75rem; color: #666; }
.res-val { font-size: 1.1rem; font-weight: bold; color: #333; font-family: 'Orbitron', sans-serif; }
.res-desc { font-size: 0.85rem; line-height: 1.5; color: #555; border-top: 1px solid #c5e1a5; padding-top: 8px; }
.btn-sub { flex: 1; padding: 10px; background: white; border: 1px solid #ccc; border-radius: 30px; font-weight: bold; color: #555; cursor: pointer; }

/* =========================================
   ★タブレット・PC向けレスポンシブ対応 (iPad等)
   ========================================= */
@media (min-width: 768px) {
    /* 散らばりアイテムのサイズアップ */
    .scatter-item {
        padding: 5px 10px;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    }
    .s-num {
        font-size: 1.2rem; /* 数字大きく */
        padding: 2px 10px;
        border-radius: 15px;
    }
    .s-char {
        font-size: 2.8rem; /* 文字大きく */
        margin-top: 2px;
    }

    /* 入力エリア調整 */
    #action-area {
        min-height: 150px;
        padding-bottom: 40px;
    }
    #answer-input { font-size: 1.5rem; padding: 15px; }
    .btn-check { font-size: 1.3rem; padding: 0 35px; }
    
    /* ボタンサイズ */
    .btn-action { font-size: 1.4rem; padding: 15px 60px; }
    #correct-display { font-size: 1.6rem; }
    
    /* カードサイズ */
    .setup-card { max-width: 600px; padding: 40px; }
    .card-title { font-size: 1.8rem; }
}