:root {
    --secondary-color: #FFA07A;
    --accent-color: #FFD700;
    --bg-gradient-start: #667eea;
    --text-dark: #2c3e50;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --theme-color: transparent;
}

body {
    background: var(--theme-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}
.pre-page-main{
    width: 540px;
    font-family:
            'Noto Sans JP',
            Meiryo,
            'Hiragino Kaku Gothic ProN',
            sans-serif;
}
.main-content{
    /*min-width: 300px;*/
}

/* ========================================
   コンテナ
======================================== */
.container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    max-width: 600px;
    width: 100%;
    padding: 40px 30px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   ヘッダー
======================================== */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.title {
    /*font-family: 'Noto Sans JP', sans-serif;*/
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0;
    text-shadow: none;
}

/* ========================================
   カウント表示
======================================== */
.count-display {
    text-align: center;
    margin-bottom: 20px;
    padding: 30px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: none;
    position: relative;
    overflow: visible;
}







.count-number {
    /*font-family: 'Poppins';*/

    font-size: 6rem;
    font-weight: 900;
    color: #2c3e50;
    line-height: 1;
    margin: 0 0 20px 0;
    position: relative;
    z-index: 1;
    text-shadow: none;
    transition: transform 0.3s ease;
}

.count-number.pulse {
    animation: pulse 0.6s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}



/* ========================================
   キャラクターエリア
======================================== */
.character-area {
    text-align: center;
    margin: 10px 0 0 0;
    position: relative;
}

.character-container {
    display: inline-block;
    position: relative;
}

.character {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-gif {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
}



/* メッセージバブル */


/* ========================================
   ボタンエリア
======================================== */


.count-button,
.finish-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    min-width: unset;
    padding: 0;
    border: none;
    border-radius: 50%;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    /*font-family: 'Noto Sans JP', sans-serif;*/
    z-index: 10;
}

.count-button {
    background: white;
    color: var(--theme-color);
    right: -30px;
}

.count-button:hover,
.finish-button:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.count-button:active,
.finish-button:active {
    transform: translateY(-50%) scale(0.95);
}

.finish-button {
    background: white;
    color: var(--theme-color);
    left: -30px;
}



.button-icon {
    font-size: 2.5rem;
    line-height: 1;
}

/* ========================================
   進捗バー
======================================== */
.progress-container {
    margin-top: 20px;
    text-align: center;
}

.progress-label {
    font-size: 0.85rem;
    color: white;
    margin-bottom: 8px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: white;
    font-weight: 500;
}

/* ========================================
   学習終了ボタン
======================================== */
.end-button-area {
    margin-top: 30px;
    text-align: center;
}

.end-button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /*font-family: 'Noto Sans JP', sans-serif;*/
    color: var(--theme-color);
}

.end-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    background: white;
}

.end-button:active {
    transform: translateY(-1px);
}

/* ========================================
   モーダル
======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 40px 30px;
    max-width: 450px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideUpModal 0.4s ease;
    position: relative;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--bg-gradient-start);
    line-height: 1.4;
}

.modal-body {
    margin-bottom: 30px;
}

.completion-stats {
    background: var(--theme-color);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.stat-value {
    /*font-family: 'Poppins', sans-serif;*/
    font-size: 3.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stat-value::after {
    content: '回';
    font-size: 1.5rem;
    margin-left: 8px;
}

.completion-message {
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-dark);
    line-height: 1.8;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-footer .remaining{
    text-align: center;
    cursor: default;
    border: 1px solid #CCCCCC;
}

.reward-button,
.close-button {
    width: 100%;
    padding: 16px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    /*font-family: 'Noto Sans JP', sans-serif;*/
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.reward-button {
    background: var(--theme-color);
    color: white;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reward-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--theme-color)
}

.close-button {
    background: #ecf0f1;
    color: var(--text-dark);
}

.close-button:hover {
    background: #dfe6e9;
}

/* 特典モーダル */
.reward-modal-content {
    max-width: 400px;
}

.reward-content {
    text-align: center;
}

.reward-badge {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: spin 1s ease;
}

@keyframes spin {
    from {
        transform: rotate(0deg) scale(0);
    }
    to {
        transform: rotate(360deg) scale(1);
    }
}

.badge-icon {
    font-size: 3rem;
    margin-bottom: 5px;
}

.badge-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
}

.reward-message {
    font-size: 1.05rem;
    color: var(--text-dark);
    line-height: 1.8;
    margin-bottom: 20px;
}

.reward-points {
    background: var(--theme-color);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.points-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.points-value {
    /*font-family: 'Poppins', sans-serif;*/
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.points-unit {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   レスポンシブデザイン
======================================== */
@media (max-width: 600px) {
    .pre-page-main{
        width: 100vw;
        padding: 0 20px;
    }
    .container {
        padding: 20px 15px;
    }

    .title {
        font-size: 1.2rem;
    }

    .count-number {
        font-size: 5rem;
    }

    .count-button,
    .finish-button {
        width: 70px;
        height: 70px;
    }

    .count-button {
        right: -25px;
    }

    .finish-button {
        left: -25px;
    }

    .end-button {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .modal-content {
        padding: 30px 20px;
    }
}
