﻿:root { --primary: #00d2ff; --accent: #ff4757; --bg: #f0f2f5; }
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: sans-serif;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

header { 
    width: 100%;
    background: #fff; 
    padding: 10px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 100;
    box-sizing: border-box;
}

main {
    background: white;
    width: 95%;
    max-width: 700px;
    margin: auto;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    position: relative;
}

.screen { display: none; flex-direction: column; width: 100%; }
.screen.active { display: flex; }

/* タイトル画面 */
.region-select-area { display: flex; justify-content: space-around; background: #f8f9fa; padding: 20px; border-radius: 10px; margin: 20px 0; }
.button-group { display: flex; flex-direction: column; gap: 10px; }
.footer-buttons { margin-top: 30px; display: flex; justify-content: center; gap: 15px; }
.small-btn { background: none; border: none; color: #888; text-decoration: underline; font-size: 0.8rem; cursor: pointer; }

#start-screen {
    max-width: 400px;
    margin: 0 auto;
}

#start-screen .diff-btn, 
#start-screen .region-selector {
    width: 100%;
}

/* 難易度ボタンの基本スタイル */
.diff-btn {
    width: 100%;
    padding: 15px;
    margin: 8px 0;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: transform 0.2s, filter 0.2s;
}

/* 各難易度の個別カラー */
.btn-easy {
    background-color: #28a745;
    box-shadow: 0 4px 0 #1e7e34;
}

.btn-normal {
    background-color: #ffc107;
    color: #333;
    box-shadow: 0 4px 0 #d39e00;
}

.btn-hard {
    background-color: #dc3545;
    box-shadow: 0 4px 0 #bd2130;
}

.diff-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.diff-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

#start-screen h1 { width: 100%; text-align: center; color: #333; font-size: 1.8rem; }

/* クイズ画面ヘッダー */
.quiz-header { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.timer-wrapper { flex-grow: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#timer-text { font-size: 0.8rem; font-weight: bold; color: var(--accent); font-family: monospace; }
.timer-container { width: 100%; height: 10px; background: #eee; border-radius: 5px; overflow: hidden; }
#timer-bar { width: 100%; height: 100%; background-color: #ffce54; transition: width 0.1s linear; }

/* 正答表示・画像 */
#ans-space { height: 85px; margin-bottom: 10px; background: #fffafa; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 10px; border: 1px solid #ffebeb; font-weight: bold; }
#image-container { height: 280px; width: 100%; display: flex; justify-content: center; align-items: center; }
#member-img { max-height: 100%; max-width: 100%; object-fit: contain; }
.spacer-40 { height: 40px; }

/* タブとボタン */
.region-tabs { display: flex; border-bottom: 2px solid #eee; margin-bottom: 15px; }
.tab { 
    flex: 1; 
    padding: 10px; 
    cursor: pointer; 
    color: #888; 
    font-weight: bold; 
    text-align: center; 
    background-color: #f9f9f9;
    border-right: 1px solid #eee;
    transition: background-color 0.2s;
}
.tab:last-child {
    border-right: none;
}
.tab:not(.disabled):not(.active):hover {
    background-color: #f0f0f0;
}
.tab.active { 
    color: white;
    background-color: var(--accent);
    border-bottom: none;
}
.tab.disabled { 
    background-color: #ebebeb;
    color: #bbb; 
    cursor: not-allowed; 
    pointer-events: none; 
}
.options-grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(2, 70px); gap: 8px; width: 100%; }
.option-btn { 
    background: white; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    font-size: 0.65rem; 
    cursor: pointer; 
    font-weight: bold; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 2px; 
    text-align: center; 
    overflow-wrap: anywhere; 
    transition: all 0.2s; 
}

.option-btn:hover {
    background-color: #f0faff;
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.option-btn[style*="background: rgb(238, 238, 238)"]:hover {
    background-color: #ddd !important;
    color: #333 !important;
}

.btn-back { background-color: #eee; }
.btn-back:hover { background-color: #ddd !important; border-color: #bbb !important; color: #333 !important; }

/* 進捗 */
#quiz-progress-container { margin-top: 20px; text-align: left; }
progress { width: 100%; height: 12px; }
#progress-text { font-size: 0.8rem; color: #666; margin-top: 4px; }

/* フィードバック */
#feedback { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 15rem; font-weight: bold; z-index: 1000; pointer-events: none; opacity: 0; text-shadow: 4px 4px 0 #fff, -4px 4px 0 #fff, 4px -4px 0 #fff, -4px -4px 0 #fff; transition: opacity 0.2s; white-space: nowrap; }

/* モーダルの本文エリア */
#modal-body {
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

#modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    position: relative;
    text-align: center;
}

#modal-body::-webkit-scrollbar {
    width: 6px;
}
#modal-body::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 10px;
}

#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-content { text-align: center; width: 80%; max-width: 400px; }

/* 進捗バーの外枠 */
.load-bar-container {
    width: 100%; height: 10px;
    background: #eee;
    border-radius: 5px;
    margin: 15px 0;
    overflow: hidden;
}

/* 進捗バーの中身 */
#load-bar {
    width: 0%; height: 100%;
    background: #28a745;
    transition: width 0.2s ease;
}

.spinner {
    width: 40px; height: 40px;
    border: 4px solid #eee;
    border-top: 4px solid #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
