/* デザインシステムと共通変数（シニア向け文字拡大・高コントラスト） */
:root {
    --bg-color: #FDFBF7; /* 共通ベージュ背景 */
    --panel-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #555555;
    --accent-color: #E8834A; /* 共通メインオレンジ */
    --accent-hover: #d2723c;
    --correct-color: #5B9E6E;
    --error-color: #ef4444;
    --font-sans: 'Hiragino Maru Gothic ProN', 'BIZ UDPGothic', 'Meiryo', sans-serif;
    --shadow-premium: 0 6px 20px rgba(232, 131, 74, 0.1);
}

/* 全体設定 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 共通固定ナビゲーションバー */
/* グローバルナビ（他ゲームと共通） */
.g-nav {
    position: fixed; top: 0; left: 0; right: 0; height: 52px;
    background: #E8834A; display: flex; align-items: center;
    padding: 0 16px; z-index: 100; gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.g-nav-arrow { color: white; font-size: 1.5rem; text-decoration: none; line-height: 1; }
.g-nav-title { color: white; font-size: 1rem; font-weight: bold; text-decoration: none;
    font-family: 'Hiragino Maru Gothic ProN', 'BIZ UDPGothic', 'Meiryo', sans-serif; }

/* アプリ容器 */
#app-container {
    flex: 1;
    margin-top: 52px; /* 固定ヘッダー分 */
    padding: 24px 16px;
    max-width: 640px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* カードスタイル */
.game-card {
    background: var(--panel-bg);
    border: 3.5px solid rgba(232, 131, 74, 0.25);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-premium);
    text-align: center;
}

.header-panel {
    border-color: var(--accent-color);
}

.game-title {
    font-size: 1.8rem;
    color: var(--accent-color);
    margin-bottom: 6px;
    font-weight: bold;
}

.game-instruction {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

/* ステータスパネル */
#status-panel {
    display: flex;
    justify-content: space-around;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-primary);
    border-top: 2px dashed rgba(0,0,0,0.1);
    padding-top: 10px;
}

#status-panel strong {
    font-size: 1.8rem;
    color: var(--accent-color);
}

/* 3x3 畑グリッド */
#field-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    background: #FFF7ED;
    border: 3.5px solid var(--accent-color);
    border-radius: 24px;
    padding: 16px;
    box-shadow: var(--shadow-premium);
}

/* 穴（うね） */
.field-hole {
    aspect-ratio: 1 / 1;
    background: #5c4033; /* 濃い土の色 */
    border-radius: 20px;
    border: 4px solid #8e624c;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 8px 16px rgba(0,0,0,0.6);
}

/* 土の盛り上がり（手前側） */
.field-soil {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35%;
    background: #3d2a21;
    border-radius: 0 0 16px 16px;
    z-index: 5;
    border-top: 3.5px solid #5c4033;
}

/* キャラクター（野菜・モグラ） */
.field-item {
    position: absolute;
    bottom: -10%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 75%;
    z-index: 2;
    transition: bottom 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
}

/* 出現状態 */
.field-item.popup {
    bottom: 25%;
}

/* 絵柄の定義（CSSで美しく描画してアセット画像不要に） */
/* 大根 */
.item-daikon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50 20 C65 20, 65 80, 50 95 C35 80, 35 20, 50 20 Z" fill="%23fdfdfd" stroke="%23333" stroke-width="4"/><path d="M50 20 C55 10, 45 5, 50 0 C45 10, 40 15, 50 20 Z" fill="%234cc444" stroke="%23333" stroke-width="3"/><circle cx="45" cy="40" r="4" fill="%23333"/><circle cx="55" cy="40" r="4" fill="%23333"/><path d="M47 50 Q50 55 53 50" fill="none" stroke="%23333" stroke-width="3"/></svg>');
}

/* 人参 */
.item-carrot {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50 20 C68 20, 62 80, 50 98 C38 80, 32 20, 50 20 Z" fill="%23ff8822" stroke="%23333" stroke-width="4"/><path d="M50 20 C58 10, 42 5, 50 0 C40 10, 38 12, 50 20 Z" fill="%234cc444" stroke="%23333" stroke-width="3"/><circle cx="44" cy="45" r="4" fill="%23333"/><circle cx="56" cy="45" r="4" fill="%23333"/><path d="M47 55 Q50 60 53 55" fill="none" stroke="%23333" stroke-width="3"/></svg>');
}

/* モグラ */
.item-mole {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M25 90 C25 35, 75 35, 75 90 Z" fill="%238a5a36" stroke="%23333" stroke-width="4"/><circle cx="42" cy="55" r="5" fill="%23333"/><circle cx="58" cy="55" r="5" fill="%23333"/><ellipse cx="50" cy="65" rx="10" ry="6" fill="%23ff9999" stroke="%23333" stroke-width="3"/><path d="M45 50 Q50 45 55 50" fill="none" stroke="%23333" stroke-width="3"/></svg>');
}

/* フッター */
#game-footer {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.action-btn {
    font-size: 1.4rem;
    font-weight: bold;
    padding: 16px 40px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.1s;
    background: var(--accent-color);
    color: #ffffff;
    width: 100%;
}

.action-btn:active {
    transform: scale(0.97);
}

/* モーダル */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #ffffff;
    border: 4px solid var(--accent-color);
    border-radius: 24px;
    padding: 32px;
    width: 90%;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--correct-color);
    margin-bottom: 12px;
}

.modal-message {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-btn {
    font-size: 1.3rem;
    font-weight: bold;
    padding: 14px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    background: var(--accent-color);
    color: #ffffff;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 10px rgba(232, 131, 74, 0.25);
}

.modal-btn.secondary-btn {
    background: #f0f0f0;
    color: #333333;
    box-shadow: none;
}

.hidden {
    display: none !important;
}
