/* --- 基本設定とデザイン変数 --- */
:root {
    --bg-color: #1a1a1a;
    --text-color: #e8e6e3;
    --primary-color: #c89c6d;
    --primary-color-dark: #a17c52;
    --surface-color: #2a2a2a;
    --border-color: rgba(255, 255, 255, 0.1);
}

/* --- 全体スタイル --- */
body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    touch-action: manipulation;
}

#game-container {
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.screen {
    animation: screen-fade-in 0.5s ease-out;
}
@keyframes screen-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* --- タイポグラフィ --- */
h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    color: #fff;
}
h1.title {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    color: var(--primary-color);
    text-shadow: 0 0 15px rgba(200, 156, 109, 0.3);
    margin-bottom: 1rem;
}
p.description {
    font-size: 1rem;
    color: #b0b0b0;
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

/* --- ボタン --- */
.btn {
    background: var(--primary-color);
    color: #1a1a1a;
    font-weight: bold;
    padding: 15px 40px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn:hover:not(:disabled) {
    background: var(--primary-color-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* --- ゲーム画面 --- */
#info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    font-weight: bold;
}
.timer-container { width: 40%; }
#timer-bar {
    height: 8px;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s linear;
}
#game-area { 
    position: relative;
    width: 100%;
    margin: 0 auto;
}
#game-canvas {
    cursor: crosshair;
    border-radius: 0.75rem;
    background: #222;
    border: 1px solid var(--border-color);
    width: 100%;
    height: auto;
    display: block;
}
#sample-display {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background: rgba(42, 42, 42, 0.8);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
}
#sample-title { font-size: 0.7rem; font-weight: bold; color: #ccc; margin-bottom: 0.25rem; }

/* --- モーダル (ステージ紹介・結果) --- */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--surface-color);
    padding: 2rem 2.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    animation: modal-fade-in 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* --- 結果画面 --- */
.result-header { font-size: 1.2rem; color: #aaa; letter-spacing: 2px; margin-bottom: 1rem; }
.score-label { color: #ccc; margin-bottom: 0.5rem; }
.final-score-wrapper {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}
.percent-sign { font-size: 1.5rem; margin-left: 0.25rem; }
#result-title { font-size: 1.8rem; margin: 1.5rem 0 0.5rem 0; }
#result-message { color: #b0b0b0; margin-bottom: 2rem; }

/* BGMボタン */
.bgm-controls { margin-top: 1rem; display: flex; justify-content: center; align-items: center; gap: 0.5rem; }
.btn-bgm {
    background: var(--surface-color);
    color: #aaa;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-bgm:hover:not(:disabled) { background: #444; color: #fff; }
.btn-bgm.active { background: var(--primary-color); color: #1a1a1a; font-weight: bold; }
.btn-bgm:disabled { opacity: 0.5; cursor: not-allowed; }
