/* 不正解時のシェイクアニメーション */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
.shake-active {
    animation: shake 0.2s ease-in-out;
    border-color: #ef4444 !important;
}

/* ゲームエリア全体のレイアウトコンテナ */
.game-flex-grow-container {
    display: flex;
    flex-direction: column;
}
.game-layout-container {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* ゲームエリア専用ヘッダー (サイト共通headerとのバッティング防止) */
.game-header {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 16px;
}
.game-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.game-header-title-style {
    font-weight: 700;
    margin: 0;
    /* color: #0f172a; */
}
.game-header-progress {
    font-weight: 500;
    /* color: #475569; */
}
.game-progress-highlight {
    color: #10b981;
    font-weight: 700;
    font-family: monospace;
}
.game-progress-max {
    /* color: #64748b; */
    font-family: monospace;
}

/* A. スタート画面カード */
#start-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    margin-top: 10px;
}
.start-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}
.start-title {
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 8px;
    /* color: #0f172a; */
}
.start-desc {
    /* color: #64748b; */
    line-height: 1.5;
    margin-bottom: 24px;
}
.mode-select-box {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}
.mode-select-title {
    font-weight: 600;
    /* color: #64748b; */
    text-transform: uppercase;
    margin-top: 0;
    margin-bottom: 12px;
    text-align: left;
}
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
@media (min-width: 640px) {
    .radio-group {
        flex-direction: row;
    }
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    flex: 1;
    transition: background-color 0.15s, border-color 0.15s;
}
.radio-label:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}
.radio-text-title {
    font-weight: 700;
    /* color: #1e293b; */
    text-align: left;
    margin: 0;
}
.grid-label {
    font-weight: 600;
    /* color: #64748b; */
    margin-bottom: 12px;
    text-align: left;
}
.start-regions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.btn-start-all {
    grid-column: span 2;
    background-color: #10b981;
    color: #ffffff;
    font-weight: 700;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}
.btn-start-all:hover {
    background-color: #059669;
}
.btn-start-region {
    background-color: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-start-region:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* B. ゲームメイン盤面レイアウト */
.game-row-top-grid {
    display: grid;
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}
.game-layout-split {
    grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
    .game-layout-split {
        grid-template-columns: 2fr 1fr;
    }
}
.game-layout-full {
    grid-template-columns: 1fr;
    max-width: 750px;
    margin: 0 auto;
}
.hidden {
    display: none !important;
}

/* 地図コンテナ */
#map-container {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    box-sizing: border-box;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* 操作サイドバー領域 */
.game-sidebar-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.game-sidebar-fixed-height {
    height: 400px;
}
.game-sidebar-auto-height {
    height: auto;
}

/* プレイ中操作ボード */
#sidebar-active {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.game-timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.game-timer-labels {
    display: flex;
    align-items: center;
    gap: 16px;
}
.timer-label-item {
    color: #64748b;
}
.timer-num {
    font-family: monospace;
    color: #d97706; /* amber-600 */
    font-weight: 700;
}
.elapsed-num {
    font-family: monospace;
    color: #0284c7; /* sky-600 */
    font-weight: 700;
}
#feedback {
    font-weight: 700;
    color: #64748b;
    height: 20px;
}
.game-timer-bar-container {
    width: 100%;
    background-color: #e2e8f0;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}
#timer-bar {
    background-color: #eab308;
    height: 100%;
    width: 100%;
    transition: all 1s linear;
}
#game-form {
    display: flex;
    gap: 16px;
    margin: 0;
}
#country-input {
    flex: 1;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 12px 16px;
    outline: none;
    /* color: #0f172a; */
    transition: border-color 0.15s, box-shadow 0.15s;
}
#country-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
#giveup-btn {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}
#giveup-btn:hover {
    background-color: rgba(239, 68, 68, 0.15);
}

/* 結果発表ボード */
.game-sidebar-results {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    height: 100%;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.end-title-text {
    font-weight: 700;
    margin: 0;
}
.end-title-text.text-emerald {
    color: #10b981;
}
.end-title-text.text-red {
    color: #ef4444;
}
.end-title-desc {
    /* color: #64748b; */
    margin-top: 4px;
    margin-bottom: 0;
}
.score-box {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 8px 0;
}
.score-label {
    /* color: #64748b; */
    margin: 0;
}
#end-score-display {
    font-family: monospace;
    font-weight: 700;
    color: #10b981;
    margin-top: 4px;
    margin-bottom: 4px;
}
.end-time-label {
    /* color: #64748b; */
    margin: 0;
}
#end-time-display {
    font-weight: 700;
    color: #0284c7;
}
#end-desc {
    /* color: #64748b; */
    margin-top: 4px;
    margin-bottom: 0;
}
#share-btn {
    width: 100%;
    background-color: #0ea5e9; /* sky-500 */
    color: #ffffff;
    font-weight: 700;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}
#share-btn:hover {
    background-color: #0284c7;
}
#restart-btn {
    width: 100%;
    background-color: #475569; /* slate-600 */
    color: #ffffff;
    font-weight: 700;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}
#restart-btn:hover {
    background-color: #334155;
}

/* 下部地域別詳細ボード */
.game-regions-box {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    margin-top: 20px;
}
.game-regions-title-label {
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
    margin-top: 0;
    margin-bottom: 16px;
    /* color: #1e293b; */
}
#regions-container {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
}
@media (min-width: 640px) {
    #regions-container { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
    #regions-container { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    #regions-container { grid-template-columns: repeat(4, 1fr); }
}

/* 各地域カード */
.game-region-card {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: start;
    gap: 8px;
    box-sizing: border-box;
    transition: border-color 0.15s, background-color 0.15s;
}
.region-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
    margin-bottom: 4px;
}
.region-card-title {
    font-weight: 700;
    /* color: #334155; */
}
.game-region-progress {
    font-family: monospace;
    background-color: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    /* color: #475569; */
}
.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 4px;
}
.badge-label {
    font-weight: 700;
    /* color: #64748b; */
    display: block;
    margin-bottom: 2px;
}

/* 国名バッジ用スタイル */
.game-badge-green {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}
.game-badge-red {
    background-color: rgba(239, 68, 68, 0.08);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}
.game-badge-none {
    color: #94a3b8;
}

/* 全問正解した地域の特別装飾 */
.game-region-completed {
    border-color: rgba(16, 185, 129, 0.4) !important;
    background-color: rgba(16, 185, 129, 0.04) !important;
}
.game-progress-completed {
    background-color: #10b981 !important;
    color: #ffffff !important;
    font-weight: 700;
}

/* D3 Projection 補間用CSS設定 */
#map-group {
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: 0 0;
}