* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    min-height: 100vh;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* スタート画面 */
#start-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2e7d32;
    color: white;
}

.title {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 40px;
}

.rules {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 40px;
}

.rules h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.rules ul {
    list-style: none;
}

.rules li {
    margin-bottom: 15px;
    padding-left: 30px;
    position: relative;
}

.rules li:before {
    content: "•";
    position: absolute;
    left: 10px;
    font-size: 1.5rem;
}

.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.btn-primary {
    background: white;
    color: #2e7d32;
}

.btn-primary:hover {
    background: #f5f5f5;
}

#start-btn {
    display: block;
    margin: 0 auto;
}

/* ゲーム画面 */
#game-screen {
    background: #f5f5f5;
    position: relative;
    overflow-y: auto;
}

/* 歴史進行バー */
#history-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30vh;  /* 画面高さの30% */
    min-height: 250px;
    max-height: 350px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#history-canvas {
    width: 100%;
    height: 100%;
}

.game-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

#timeline-svg {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#quiz-nodes {
    position: relative;
    z-index: 2;
    padding-top: calc(30vh + 50px);
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 50px;
    min-padding-top: 300px;
}

/* クイズノード */
.quiz-node {
    background: white;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    padding: 30px;
    margin: 0 auto 50px;
    max-width: 600px;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-number {
    background: #2e7d32;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.question-text {
    font-size: 1.2rem;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    padding: 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    text-align: left;
}

.choice-btn:hover:not(:disabled) {
    border-color: #4caf50;
    background: #f1f8e9;
}

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

.choice-btn.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.choice-btn.incorrect {
    border-color: #f44336;
    background: #ffebee;
}


/* 解説表示 */
.explanation {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.8;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.explanation.correct {
    background: #e8f5e9;
    color: #2e7d32;
}

.explanation.incorrect {
    background: #ffebee;
    color: #c62828;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* ゲームオーバー表示 */
.game-over-text {
    font-size: 2rem;
    font-weight: bold;
    color: #f44336;
    text-align: center;
    margin: 20px 0;
    animation: pulse 1s infinite;
}

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

/* クリア画面 */
.clear-node {
    background: #4caf50;
    color: white;
    text-align: center;
    padding: 50px;
}

.clear-node h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

/* フィードバックフォーム */
#feedback-form {
    background: white;
    padding: 50px 20px;
}

#feedback-form h2 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 10px;
}

#feedback-form p {
    text-align: center;
    margin-bottom: 40px;
    color: #666;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4caf50;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* タイムライン線のスタイル */
.timeline-line {
    stroke: #4caf50;
    stroke-width: 3;
    fill: none;
}

.timeline-line.branch {
    stroke: #f44336;
    stroke-dasharray: 5, 5;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .quiz-node {
        padding: 20px;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .choice-btn {
        padding: 15px;
    }
}