/* ==========================================================================
   都道府県シルエット＆ちしきクイズ - Style Sheet
   明るくポップで親しみやすい小学生向けデザイン
   ========================================================================== */

:root {
    --bg-gradient: linear-gradient(135deg, #FFDEE9 0%, #B5FFFC 100%);
    --card-bg: #FFFFFF;
    --primary-color: #FF5964;
    --primary-hover: #E03E49;
    --secondary-color: #35A7FF;
    --secondary-hover: #1F8CE0;
    --accent-yellow: #FFE600;
    --accent-green: #38B000;
    --accent-purple: #9D4EDD;
    
    --text-main: #2B2D42;
    --text-muted: #5C677D;
    
    --font-family: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-pop: 0 8px 0px rgba(0, 0, 0, 0.15);
    --shadow-btn: 0 6px 0px #C93B45;
    --shadow-btn-sec: 0 6px 0px #1E79C4;

    --border-radius-lg: 28px;
    --border-radius-md: 18px;
    --border-radius-sm: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    user-select: none;
    -webkit-user-select: none;
}

body {
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    overflow-x: hidden;
    padding: 16px;
    position: relative;
}

/* 浮遊する背景オブジェクト */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-shape {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.25;
    animation: floatAnim 12s infinite ease-in-out;
}

.shape-1 { top: 10%; left: 8%; animation-delay: 0s; }
.shape-2 { top: 75%; left: 12%; animation-delay: 2s; }
.shape-3 { top: 15%; right: 10%; animation-delay: 4s; }
.shape-4 { top: 80%; right: 15%; animation-delay: 1s; font-size: 1.5rem; font-weight: bold; }
.shape-5 { top: 50%; left: 5%; animation-delay: 3s; }
.shape-6 { top: 45%; right: 6%; animation-delay: 5s; }

@keyframes floatAnim {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* メインコンテナ */
.app-container {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ヘッダー */
.app-header {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.icon-btn {
    background: #FFFFFF;
    border: 3px solid #35A7FF;
    color: #1F8CE0;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, background-color 0.2s;
}

.icon-btn:hover {
    transform: scale(1.05);
    background: #EBF7FF;
}

/* カード基底スタイル */
.card {
    background: var(--card-bg);
    width: 100%;
    border-radius: var(--border-radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-soft);
    border: 4px solid #FFFFFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

/* 画面切り替え表示 */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   1. スタート画面 ＆ モード選択
   -------------------------------------------------------------------------- */
.title-badge {
    background: var(--accent-purple);
    color: #FFFFFF;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 6px 18px;
    border-radius: 50px;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.main-title {
    font-size: 2.1rem;
    font-weight: 900;
    color: #FF3366;
    line-height: 1.25;
    text-shadow: 2px 2px 0px #FFE600;
    margin-bottom: 20px;
}

.title-sub {
    font-size: 1.05rem;
    color: #35A7FF;
    text-shadow: none;
    display: inline-block;
    background: #EBF7FF;
    padding: 4px 14px;
    border-radius: 20px;
}

.mascot-box {
    background: #FFF9DB;
    border: 3px dashed #FFE600;
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}

.mascot-img {
    font-size: 2.8rem;
    flex-shrink: 0;
}

.mascot-bubble {
    font-size: 0.95rem;
    font-weight: 700;
    color: #4A4E69;
    text-align: left;
    line-height: 1.4;
}

/* モード選択タブ */
.mode-select-section {
    width: 100%;
    margin-bottom: 18px;
}

.mode-select-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
    text-align: left;
}

.mode-select-container {
    display: flex;
    gap: 8px;
    width: 100%;
}

.mode-btn {
    flex: 1;
    background: #F1F5F9;
    border: 3px solid #CBD5E1;
    color: var(--text-muted);
    padding: 10px 4px;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

@media (hover: hover) {
    .mode-btn:hover {
        background: #E2E8F0;
        transform: translateY(-2px);
    }
}

.mode-btn.active {
    background: #FFE600;
    border-color: #FFC700;
    color: #2B2D42;
    box-shadow: 0 4px 0px #E5B200;
    transform: translateY(-2px);
}

.mode-icon {
    font-size: 1.3rem;
}

.mode-name {
    font-size: 0.85rem;
}

.rule-box {
    background: #F8F9FA;
    border-radius: var(--border-radius-md);
    width: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.rule-icon {
    font-size: 1.4rem;
}

/* ボタン共通 */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-weight: 900;
    border-radius: 50px;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: #FFFFFF;
    font-size: 1.4rem;
    padding: 16px 40px;
    box-shadow: var(--shadow-btn);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

@media (hover: hover) {
    .btn-primary:hover {
        background: var(--primary-hover);
        transform: translateY(-2px);
    }
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0px #C93B45;
}

.pulse-btn {
    animation: pulseGlow 2s infinite ease-in-out;
}

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

/* --------------------------------------------------------------------------
   2. クイズ画面 ＆ 問題カード
   -------------------------------------------------------------------------- */
.quiz-info-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-badge {
    background: #E0F2FE;
    color: #0284C7;
    font-weight: 900;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.95rem;
}

.mode-type-badge {
    background: #F3E8FF;
    color: #7E22CE;
    font-weight: 900;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.95rem;
}

.score-badge {
    background: #FEF3C7;
    color: #D97706;
    font-weight: 900;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.95rem;
}

/* タイマーバー */
.timer-container {
    width: 100%;
    margin-bottom: 16px;
}

.timer-label {
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.timer-bar-outer {
    width: 100%;
    height: 16px;
    background: #E2E8F0;
    border-radius: 50px;
    overflow: hidden;
    padding: 3px;
}

.timer-bar-inner {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #38B000 0%, #FFE600 70%, #FF5964 100%);
    border-radius: 50px;
    transition: width 0.1s linear;
}

.timer-bar-inner.warning {
    animation: blinkTimer 0.5s infinite alternate;
}

@keyframes blinkTimer {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* 問題ボックス */
.question-box {
    width: 100%;
    margin-bottom: 20px;
}

/* 1. シルエットカード */
.silhouette-card {
    background: radial-gradient(circle, #F8FAFC 0%, #E2E8F0 100%);
    border: 4px solid #CBD5E1;
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.silhouette-svg-wrapper {
    width: 100%;
    max-width: 260px;
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.silhouette-svg-wrapper svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(4px 6px 8px rgba(0, 0, 0, 0.25));
    transition: filter 0.3s ease, transform 0.3s ease;
}

.silhouette-svg-wrapper path {
    fill: #1E293B;
    transition: fill 0.4s ease;
}

.silhouette-svg-wrapper.revealed path {
    fill: #FF5964;
}

/* 2. 知識クイズカード */
.knowledge-card {
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    border: 4px solid #7DD3FC;
    border-radius: var(--border-radius-md);
    padding: 24px 20px;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
    position: relative;
}

.knowledge-category {
    background: #0284C7;
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 800;
    padding: 4px 16px;
    border-radius: 50px;
    letter-spacing: 0.5px;
}

.knowledge-text {
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.5;
    color: var(--text-main);
    word-break: break-word;
}

.knowledge-explanation {
    background: #FFFFFF;
    border: 2px solid #38BDF8;
    color: #0369A1;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 8px 14px;
    border-radius: var(--border-radius-sm);
    line-height: 1.4;
    animation: fadeInExp 0.3s ease;
}

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

/* 4択グリッド */
.options-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.option-btn {
    background: #FFFFFF;
    border: 3px solid #E2E8F0;
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 800;
    padding: 16px 12px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 6px 0px #CBD5E1;
    cursor: pointer;
    position: relative;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease, border-color 0.2s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

@media (hover: hover) {
    .option-btn:hover:not(:disabled) {
        border-color: #35A7FF;
        background: #F0F9FF;
        transform: translateY(-2px);
    }
}

.option-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0px #CBD5E1;
}

.option-btn.correct {
    background: #DCFCE7 !important;
    border-color: #22C55E !important;
    color: #15803D !important;
    box-shadow: 0 6px 0px #86EFAC !important;
    animation: correctBounce 0.4s ease;
}

.option-btn.wrong {
    background: #FEE2E2 !important;
    border-color: #EF4444 !important;
    color: #B91C1C !important;
    box-shadow: 0 6px 0px #FCA5A5 !important;
    animation: wrongShake 0.4s ease;
}

.option-btn:disabled {
    cursor: default;
}

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

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* --------------------------------------------------------------------------
   3. 結果画面
   -------------------------------------------------------------------------- */
.result-header {
    margin-bottom: 16px;
}

.result-emoji {
    font-size: 3.5rem;
    margin-bottom: 8px;
}

.result-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-main);
}

.score-card {
    background: #FFF9DB;
    border: 3px solid #FFE600;
    border-radius: var(--border-radius-md);
    width: 100%;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.score-main {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.score-num {
    font-size: 3.8rem;
    font-weight: 900;
    color: #FF3366;
    line-height: 1;
}

.score-unit {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-muted);
}

.rank-badge {
    background: #FF5964;
    color: #FFFFFF;
    font-size: 1.15rem;
    font-weight: 900;
    padding: 6px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(255, 89, 100, 0.3);
}

.result-message {
    font-size: 1.05rem;
    font-weight: 800;
    color: #4A4E69;
}

/* 振り返りリスト */
.review-container {
    width: 100%;
    margin-bottom: 24px;
    text-align: left;
}

.review-title {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 12px;
    color: var(--text-main);
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 6px;
}

.review-list::-webkit-scrollbar {
    width: 6px;
}
.review-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

.review-item {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: var(--border-radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 800;
}

.review-item.is-correct {
    border-color: #86EFAC;
    background: #F0FDF4;
}

.review-item.is-wrong {
    border-color: #FCA5A5;
    background: #FEF2F2;
}

.review-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.review-pref {
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-status {
    font-size: 1.1rem;
}

.review-explanation-text {
    font-size: 0.82rem;
    color: #475569;
    font-weight: 700;
    margin-top: 2px;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99;
}

.app-footer {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 16px;
    text-align: center;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 20px 16px;
        border-radius: 22px;
    }
    
    .main-title {
        font-size: 1.75rem;
    }
    
    .title-sub {
        font-size: 0.95rem;
    }

    .silhouette-svg-wrapper {
        height: 180px;
    }

    .knowledge-card {
        min-height: 190px;
        padding: 16px 14px;
    }

    .knowledge-text {
        font-size: 1.15rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .option-btn {
        font-size: 1.15rem;
        padding: 14px 10px;
    }

    .btn-primary {
        font-size: 1.2rem;
        padding: 14px 30px;
    }

    .score-num {
        font-size: 3rem;
    }
}
