* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    display: none;
    height: 100vh;
    flex-direction: column;
}

.page.active {
    display: flex;
}

/* メインページレイアウト */
#main-page {
    display: grid;
    grid-template-rows: 1fr 2fr 1fr;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

/* ステータスセクション */
.status-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
    background: #2a2a2a;
    border-radius: 12px;
    padding: 20px;
}

.status-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-item span {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
}

/* 回答ボタンセクション */
.answer-buttons-section {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    border-radius: 12px;
    padding: 20px;
}

.answer-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 400px;
}

.answer-button {
    background: #3a3a3a;
    border: 3px solid #555;
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 600;
    padding: 25px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.answer-button:hover {
    background: #4a4a4a;
    border-color: #666;
    transform: scale(1.05);
}

.answer-button.selected {
    background: #007AFF;
    border-color: #0056CC;
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.3);
}

.answer-button.correct {
    background: #34C759;
    border-color: #28A745;
    animation: correct-flash 0.5s ease-in-out;
}

.answer-button.wrong {
    background: #FF3B30;
    border-color: #DC3545;
    animation: wrong-shake 0.5s ease-in-out;
}

@keyframes correct-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes wrong-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* アクションボタンセクション */
.action-buttons-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    padding: 20px;
    background: #2a2a2a;
    border-radius: 12px;
}

.action-button {
    background: #007AFF;
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    text-align: center;
}

.action-button:hover {
    background: #0056CC;
    transform: scale(1.05);
}

.action-button.secondary {
    background: #555555;
}

.action-button.secondary:hover {
    background: #666666;
}

#start-game {
    grid-column: 1 / -1;
    font-size: 1.5rem;
    padding: 20px;
}

/* 設定ページ */
.settings-container, .scores-container {
    padding: 20px;
    background: #2a2a2a;
    margin: 20px;
    border-radius: 12px;
    overflow-y: auto;
    height: calc(100vh - 40px);
}

.settings-container h2, .scores-container h2 {
    color: #ffffff;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2rem;
}

.setting-group {
    margin-bottom: 25px;
    padding: 20px;
    background: #3a3a3a;
    border-radius: 8px;
}

.setting-group label {
    display: block;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #555;
    border-radius: 3px;
    outline: none;
    margin: 10px 0;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #007AFF;
    border-radius: 50%;
    cursor: pointer;
}

.setting-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
}

.setting-group select {
    background: #555;
    color: #ffffff;
    border: 2px solid #666;
    border-radius: 6px;
    padding: 10px;
    font-size: 1rem;
    margin: 5px;
}

/* スコアページ */
#score-details {
    background: #3a3a3a;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #ffffff;
    font-family: monospace;
    font-size: 1rem;
    line-height: 1.5;
}

.log-section {
    margin-top: 20px;
}

.log-section h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

#text-log {
    width: 100%;
    height: 200px;
    background: #1a1a1a;
    color: #ffffff;
    border: 2px solid #555;
    border-radius: 6px;
    padding: 15px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: none;
    margin-bottom: 15px;
}

/* レスポンシブ対応 */
@media screen and (max-width: 480px) {
    .answer-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .answer-button {
        font-size: 1.5rem;
        padding: 20px;
        min-height: 70px;
    }
    
    .status-item span {
        font-size: 1.5rem;
    }
    
    .action-button {
        font-size: 1rem;
        padding: 12px;
    }
    
    #start-game {
        font-size: 1.3rem;
        padding: 18px;
    }
}

@media screen and (max-height: 600px) {
    #main-page {
        padding: 15px;
        gap: 15px;
    }
    
    .status-section, .answer-buttons-section, .action-buttons-section {
        padding: 15px;
    }
    
    .answer-button {
        padding: 15px;
        min-height: 60px;
        font-size: 1.4rem;
    }
    
    .status-item span {
        font-size: 1.3rem;
    }
}