/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'メイリオ', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: white;
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
    font-size: 18px;
}

/* 共通カード */
.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* スタート画面 */
.start-screen {
    text-align: center;
}

.start-screen h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 28px;
}

.start-screen p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 30px;
    font-size: 16px;
}

/* ゲーム説明 */
.game-description {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.game-description h3 {
    color: #667eea;
    font-size: 18px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.game-description h3:first-child {
    margin-top: 0;
}

.game-description p {
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.game-description ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 15px;
}

.game-description li {
    color: #333;
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.game-description li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
}

.prefecture-select {
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

/* ゲーム画面 */
.game-screen {
    display: none;
}

/* ステータスバー */
.status-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: white;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.status-item-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-item-inline .status-label {
    font-size: 20px;
}

.status-item-inline .status-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.lives {
    display: flex;
    gap: 5px;
}

.life {
    font-size: 20px;
}

/* 地図コンテナ（フルスクリーン） */
.map-container-fullscreen {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    border: 3px solid #667eea;
    border-radius: 10px;
    background: #ffffff;
    max-width: 100%;
    height: auto;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: #ff6b6b;
    color: white;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    line-height: 1;
    padding: 0;
}

.modal-close-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* クイズパネル */
.quiz-panel h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 20px;
}

.quiz-difficulty {
    display: inline-block;
    padding: 5px 15px;
    background: #ffd93d;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 15px;
}

.quiz-question {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
}

.quiz-choices {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

/* ボタン */
.btn {
    padding: 15px 40px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin: 10px;
}

.btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.prefecture-btn, .choice-btn, .destination-btn {
    padding: 15px 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    text-align: left;
}

.prefecture-btn:hover, .destination-btn:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

.choice-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

.choice-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.choice-btn.correct {
    background: #51cf66;
    border-color: #51cf66;
    color: white;
}

.choice-btn.wrong {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
}

/* 結果パネル */
.result-panel {
    display: none;
    background: #fff3e0;
    border-left: 5px solid #ff9800;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.result-panel.show {
    display: block;
}

.result-panel h4 {
    color: #e65100;
    margin-bottom: 10px;
    font-size: 18px;
}

.result-panel p {
    color: #333;
    line-height: 1.6;
}

/* 移動パネル */
.move-panel h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 20px;
}

.destination-list {
    display: grid;
    gap: 10px;
}

/* 都道府県紹介カード */
.prefecture-card {
    max-width: 500px;
}

.prefecture-card-panel h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 28px;
    text-align: center;
}

.prefecture-card-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.travel-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.travel-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.travel-icon {
    font-size: 32px;
}

.travel-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.travel-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.prefecture-specialty {
    background: #fff3e0;
    border-left: 5px solid #ff9800;
    padding: 20px;
    border-radius: 10px;
}

.prefecture-specialty h3 {
    color: #e65100;
    margin-bottom: 10px;
    font-size: 18px;
}

.prefecture-specialty p {
    color: #333;
    font-size: 16px;
    line-height: 1.6;
}

/* ゲームオーバー画面 */
.gameover-screen {
    display: none;
    text-align: center;
}

.gameover-screen h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 36px;
}

.new-record-notice {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.new-record-notice p {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.total-score-section {
    margin-bottom: 20px;
}

.score-display {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0 30px 0;
}

.name-input-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.name-input-section h3 {
    color: #667eea;
    font-size: 20px;
    margin-bottom: 15px;
}

.name-input-section input {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.name-input-section input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.highscore-section {
    margin: 30px 0;
}

.highscore-section h3 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 20px;
}

/* スタート画面のハイスコアセクション */
.start-highscore-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.start-highscore-section h3 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 20px;
}

.highscore-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.highscore-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.highscore-item:hover {
    transform: translateX(5px);
}

.highscore-item:last-child {
    margin-bottom: 0;
}

.highscore-rank {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    width: 40px;
    text-align: center;
}

.highscore-rank.rank-1 {
    color: #FFD700;
}

.highscore-rank.rank-2 {
    color: #C0C0C0;
}

.highscore-rank.rank-3 {
    color: #CD7F32;
}

.highscore-info {
    flex: 1;
    margin: 0 15px;
}

.highscore-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.highscore-details {
    font-size: 12px;
    color: #666;
}

.highscore-score {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.highscore-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.hidden {
    display: none !important;
}

/* PWA インストールプロンプト */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

.install-prompt-content {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 3px solid #667eea;
}

.install-prompt-content h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 20px;
}

.install-prompt-content p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.install-prompt-buttons {
    display: flex;
    gap: 10px;
}

.btn-primary {
    background: #667eea;
    flex: 1;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
    flex: 1;
}

.btn-secondary:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* レスポンシブ */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 5px;
    }

    .subtitle {
        font-size: 14px;
        margin-bottom: 15px;
    }

    .card {
        padding: 20px;
        border-radius: 15px;
    }

    .start-screen h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .start-screen p {
        font-size: 14px;
        margin-bottom: 15px;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
        max-width: 90%;
    }

    .status-bar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .status-item-inline .status-label {
        font-size: 16px;
    }

    .status-item-inline .status-value {
        font-size: 14px;
    }

    .quiz-panel h3 {
        font-size: 18px;
    }

    .quiz-question {
        font-size: 16px;
    }

    .map-container-fullscreen {
        padding: 10px;
    }

    canvas {
        border: 2px solid #667eea;
        touch-action: none; /* タッチイベントの改善 */
    }

    .btn {
        padding: 12px 30px;
        font-size: 16px;
        margin: 5px;
    }

    .prefecture-btn, .choice-btn, .destination-btn {
        padding: 12px 15px;
        font-size: 14px;
    }

    .gameover-screen h2 {
        font-size: 28px;
    }

    .score-display {
        font-size: 36px;
        margin: 20px 0;
    }

    .stat-value {
        font-size: 24px;
    }
}

/* 極小画面（古いスマホなど） */
@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .card {
        padding: 15px;
    }

    .modal-content {
        padding: 15px;
    }

    .status-bar {
        padding: 8px;
        font-size: 14px;
    }

    .stats {
        gap: 10px;
    }

    .stat-item {
        padding: 15px;
    }
}

/* 横向き対応（スマホ） */
@media (max-width: 768px) and (orientation: landscape) {
    .map-container-fullscreen {
        max-height: 60vh;
    }

    .modal-content {
        max-height: 80vh;
    }
}
