/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: #f4f5f7;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* アプリコンテナ */
#app {
    //min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0px;
    position: relative;
}

/* 紙吹雪エフェクト */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b35;
    animation: confetti-fall 1s linear forwards;
    opacity: 0;
}

.confetti:nth-child(2n) {
    background: #f7931e;
    width: 8px;
    height: 8px;
}

.confetti:nth-child(3n) {
    background: #6c5ce7;
    width: 12px;
    height: 12px;
}

.confetti:nth-child(4n) {
    background: #00b894;
    width: 6px;
    height: 6px;
}

.confetti:nth-child(5n) {
    background: #e17055;
    width: 14px;
    height: 14px;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* 画面管理 */
.screen {
    display: none;
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* コンテナ */
.container {
    background: #f4f5f7;
    border-radius: 10px;
    padding: 30px;
    box-shadow: none;
    backdrop-filter: none;
    border: none;
}

/* ロゴとスタート画面 */
.logo {
    margin-bottom: 40px;
}

.logo-container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    //text-align:center;
}

.logo-image {
    max-width:90px;
    height: auto;
    flex-shrink: 0;
}

.logo-text {
    flex: 1;
    text-align: left;
}

.logo-text p {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 10px;
    margin-top: 0;
    font-weight: 700;
}

.logo-text p:last-child {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0;
    font-weight: normal;
}

.logo-text p:last-child a {
    text-decoration: none;
    color: #0645ad;
    
}

.logo-text p:last-child a:hover {
    text-decoration: underline;
    color: #ff6b35;
}

/* ボタンスタイル */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 150px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #0066cc, #004499);
    color: white;
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 102, 204, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(108, 92, 231, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-back {
    background: linear-gradient(135deg, #636e72, #74b9ff);
    color: white;
    padding: 10px 20px;
    font-size: 0.9rem;
}

.btn-icon {
    font-size: 1.2em;
}

/* 選択エリア */
.selection-area {
    display: flex;
    gap: 30px;
    margin: 30px 0;
}

/* カテゴリー選択 */
.category-selection {
    flex: 1;
    padding: 20px;
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.category-selection h3 {
    color: #ffffff;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    font-size: 1.3rem;
    font-weight: 700;
    margin: -20px -20px 20px -20px;
    text-align: center;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
}

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

.category-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.category-item:hover {
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.2);
}

.category-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #ff6b35;
}

.category-item input[type="checkbox"]:checked + .category-label {
    color: #ff6b35;
    font-weight: 700;
}

.category-item input[type="checkbox"]:checked {
    background: #ff6b35;
}

.category-label {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
}

/* 問題数選択 */
.question-count-selection {
    flex: 1;
    padding: 20px;
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.question-count-selection h3 {
    color: #ffffff;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    font-size: 1.3rem;
    font-weight: 700;
    margin: -20px -20px 20px -20px;
    text-align: center;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
}

.question-count-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.question-count-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
    justify-content: center;
}

.question-count-item:hover {
    border-color: #6c5ce7;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.2);
}

.question-count-item input[type="radio"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    accent-color: #6c5ce7;
}

.question-count-item input[type="radio"]:checked + .question-count-label {
    color: #6c5ce7;
    font-weight: 700;
}

.question-count-item input[type="radio"]:checked {
    background: #6c5ce7;
}

.question-count-label {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
}

/* スタート画面 */
.start-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* ヘッダー */
.header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.header h2 {
    color: #ff6b35;
    font-size: 1.8rem;
    font-weight: 700;
}

/* 設定画面 */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 700;
    color: #333;
    font-size: 1.1rem;
}

.select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.select:focus {
    outline: none;
    border-color: #ff6b35;
}

/* ゲーム画面 */
.game-header {
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: #666;
}

.question-number {
    color: #ff6b35;
    font-size: 1.1rem;
}

.score {
    color: #6c5ce7;
    font-size: 1.1rem;
}

/* 問題カード */
.question-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.1);
}

.question-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-badge, .difficulty-badge {
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid;
    display: inline-block;
}

.category-badge {
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
    border-color: rgba(108, 92, 231, 0.3);
}

.difficulty-badge {
    background: rgba(0, 184, 148, 0.1);
    color: #00b894;
    border-color: rgba(0, 184, 148, 0.3);
}

.question-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    line-height: 1.5;
}

/* 回答選択肢 */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.answer-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.answer-option:hover {
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.2);
}

.answer-option.selected {
    border-color: #ff6b35;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3);
}

.answer-option.correct {
    border-color: #00b894;
    background: linear-gradient(135deg, #00b894, #55efc4);
    color: white;
}

.answer-option.incorrect {
    border-color: #e17055;
    background: linear-gradient(135deg, #e17055, #fd79a8);
    color: white;
}

.answer-option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* ゲームコントロール */
.game-controls {
    display: flex;
    justify-content: center;
}

/* 結果画面 */
.result-content {
    text-align: center;
}

.result-header h2 {
    font-size: 2.2rem;
    color: #ff6b35;
    margin-bottom: 20px;
    font-weight: 900;
}

.final-score {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3);
}

.score-label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.score-value {
    font-size: 3rem;
    font-weight: 900;
    display: block;
}

.score-total {
    font-size: 1.5rem;
    opacity: 0.8;
}

.result-details {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.result-stat {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    min-width: 120px;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 900;
    color: #ff6b35;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #ffffff;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    font-size: 1.5rem;
    font-weight: 700;
    margin: -20px -20px 20px -20px;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: #f0f0f0;
}

.explanation-content {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    .logo-container {
        flex-direction: row;
        align-items: center;
        text-align: center;
        display:block;
    }
    
    .logo-image {
        width: 38%;
        max-width: none;
        margin: 0 auto;
        
    }
    
    .logo-text {
        text-align: left;
        flex: 1;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .answer-option {
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .result-details {
        flex-direction: column;
        gap: 15px;
    }
    
    .result-stat {
        min-width: auto;
    }
    
    /* 選択エリアのレスポンシブ */
    .selection-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .category-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .category-item {
        padding: 10px 12px;
    }
    
    .question-count-options {
        flex-direction: column;
        align-items: center;
    }
    
    .question-count-item {
        width: 100%;
        max-width: 100%;
    }
    
    .category-label {
        font-size: 0.9rem;
    }
    
    /* 問題数選択のレスポンシブ */
    .question-count-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .question-count-item {
        min-width: auto;
        padding: 12px 20px;
    }
    
    .question-count-label {
        font-size: 0.9rem;
    }
}


/* アニメーション効果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.answer-option.correct {
    animation: pulse 0.6s ease;
}

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

.answer-option.incorrect {
    animation: shake 0.5s ease;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0,0,0); }
    40%, 43% { transform: translate3d(0, -8px, 0); }
    70% { transform: translate3d(0, -4px, 0); }
    90% { transform: translate3d(0, -2px, 0); }
}

.btn:hover {
    animation: bounce 1s ease;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(255, 107, 53, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 107, 53, 0.8), 0 0 30px rgba(255, 107, 53, 0.6); }
    100% { box-shadow: 0 0 5px rgba(255, 107, 53, 0.5); }
}

.answer-option.selected {
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes slideInUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.question-card {
    animation: slideInUp 0.6s ease-out;
}

@keyframes scoreUp {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #00b894; }
    100% { transform: scale(1); }
}

.score-update {
    animation: scoreUp 0.5s ease;
}

/* フッター */
.footer {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
}

/* アプリ情報画面 */
.app-info-content {
    max-width: 800px;
    margin: 0 auto;
}

.info-section {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.info-section h3 {
    color: #ffffff;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    font-size: 1.8rem;
    font-weight: 700;
    margin: -20px -20px 15px -20px;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
}

.info-section p {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 15px;
}

/* SNSリンク */
.sns-links {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    justify-content: center;
}

.sns-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 5px;
    background: transparent;
    color: #333;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: none;
}

.sns-link:hover {
    transform: translateY(-2px);
    box-shadow: none;
    color: #ff6b35;
    text-decoration: none;
}

.sns-icon {
    width: 40px;
    object-fit: contain;
}

.sns-text {
    font-size: 0.9rem;
}

.info-section ul, .info-section ol {
    margin: 15px 0;
    padding-left: 20px;
}

.info-section li {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 8px;
}

.info-section strong {
    color: #ff6b35;
    font-weight: 700;
}

/* 戻るボタンコンテナ */
.back-button-container {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
}

.back-button-container .btn-back {
    background: linear-gradient(135deg, #666, #999);
    color: white;
    border: 1px solid #666;
    box-shadow: 0 4px 10px rgba(102, 102, 102, 0.3);
}

.back-button-container .btn-back:hover {
    background: linear-gradient(135deg, #555, #777);
    box-shadow: 0 6px 15px rgba(102, 102, 102, 0.4);
}

/* ローディング効果 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ff6b35;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
