/**
 * タイプマスター ひらがな編 - スタイルシート（派手バージョン）
 */

/* ===========================
   基本設定
   =========================== */
:root {
    /* カラーパレット - ビビッドカラー */
    --color-primary: #ff4d8d;
    --color-secondary: #00d4ff;
    --color-accent: #ffe135;
    --color-success: #00ff88;
    --color-error: #ff4757;
    --color-purple: #a855f7;
    --color-orange: #ff9500;
    --color-pink: #ff6bcb;
    --color-lime: #b8ff00;

    /* グラデーション - 超カラフル */
    --gradient-bg: linear-gradient(135deg, #ffecd2 0%, #fcb69f 25%, #ff9a9e 50%, #fecfef 75%, #ffecd2 100%);
    --gradient-button: linear-gradient(135deg, #ff4d8d 0%, #ff6bcb 50%, #a855f7 100%);
    --gradient-button-hover: linear-gradient(135deg, #ff6ba3 0%, #ff85d5 50%, #b86eff 100%);
    --gradient-rainbow: linear-gradient(90deg, #ff4d8d, #ff9500, #ffe135, #00ff88, #00d4ff, #a855f7, #ff4d8d);

    /* フォント */
    --font-main: 'Zen Maru Gothic', sans-serif;

    /* サイズ */
    --border-radius: 25px;
    --border-radius-lg: 40px;

    /* シャドウ - より強め */
    --shadow-soft: 0 15px 40px rgba(255, 77, 141, 0.25);
    --shadow-button: 0 10px 30px rgba(255, 77, 141, 0.5);
    --shadow-glow: 0 0 30px rgba(255, 77, 141, 0.6);
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--gradient-bg);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: #4a4a4a;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ビューポートにフィットするスケーリングコンテナ */
#app-container {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ===========================
   画面共通
   =========================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-sizing: border-box;
}

.screen.active {
    display: flex;
    opacity: 1;
    animation: screenFadeIn 0.6s ease;
}

@keyframes screenFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===========================
   ボタン共通 - 超派手
   =========================== */
.btn {
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 700;
    padding: 20px 55px;
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    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.4), transparent);
    transition: left 0.5s;
}

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

.btn-start {
    background: var(--gradient-button);
    color: white;
    box-shadow: var(--shadow-button);
    font-size: 2.2rem;
    padding: 28px 80px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: buttonPulse 2s ease-in-out infinite, buttonFloat 3s ease-in-out infinite;
}

.btn-start:hover,
.btn-start:active {
    background: var(--gradient-button-hover);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 45px rgba(255, 77, 141, 0.6), var(--shadow-glow);
}

.btn-settings {
    background: white;
    color: var(--color-primary);
    border: 4px solid var(--color-primary);
    font-size: 1.3rem;
    padding: 14px 35px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(255, 77, 141, 0.2);
}

.btn-settings:hover {
    background: linear-gradient(135deg, #fff5f8 0%, #ffe6f0 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 77, 141, 0.3);
}

.btn-check {
    background: var(--gradient-button);
    color: white;
    box-shadow: var(--shadow-button);
    font-size: 2rem;
    padding: 22px 65px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-check:hover,
.btn-check:active {
    background: var(--gradient-button-hover);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 40px rgba(255, 77, 141, 0.5);
}

.btn-back {
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
    color: #555;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-back:hover {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    transform: translateY(-2px);
}

.btn-next-round,
.btn-home {
    background: var(--gradient-button);
    color: white;
    box-shadow: var(--shadow-button);
    font-size: 2rem;
    padding: 25px 60px;
    animation: megaPulse 1.5s ease-in-out infinite;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-next-round:hover,
.btn-home:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 50px rgba(255, 77, 141, 0.7);
}

.btn-adjust {
    width: 55px;
    height: 55px;
    font-size: 2rem;
    font-weight: 700;
    border: 4px solid var(--color-primary);
    background: white;
    color: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(255, 77, 141, 0.2);
}

.btn-adjust:hover {
    background: var(--gradient-button);
    color: white;
    border-color: transparent;
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 8px 25px rgba(255, 77, 141, 0.4);
}

@keyframes buttonPulse {

    0%,
    100% {
        box-shadow: var(--shadow-button);
    }

    50% {
        box-shadow: 0 15px 50px rgba(255, 77, 141, 0.7), 0 0 40px rgba(255, 77, 141, 0.4);
    }
}

@keyframes buttonFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes megaPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: var(--shadow-button);
    }

    50% {
        transform: scale(1.08);
        box-shadow: 0 20px 60px rgba(255, 77, 141, 0.8), 0 0 50px rgba(255, 77, 141, 0.5);
    }
}

/* ===========================
   トップ画面 - 超派手
   =========================== */
.top-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.app-title {
    text-align: center;
    margin-bottom: 25px;
}

.title-main {
    display: block;
    font-size: 4rem;
    font-weight: 900;
    background: var(--gradient-rainbow);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowText 3s linear infinite, titleBounce 2s ease-in-out infinite;
    filter: drop-shadow(3px 3px 0 rgba(255, 77, 141, 0.3));
}

.title-sub {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-purple);
    margin-top: 8px;
    animation: subtitlePop 0.8s ease;
    text-shadow: 2px 2px 0 rgba(168, 85, 247, 0.2);
}

@keyframes rainbowText {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

@keyframes subtitlePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* キャラクター - もっと生き生きと */
.character-container {
    position: relative;
    margin: 35px 0;
}

.character {
    position: relative;
    width: 160px;
    height: 160px;
}

.character-body {
    width: 160px;
    height: 160px;
    background: linear-gradient(135deg, #fff176 0%, #ffd93d 50%, #ffb300 100%);
    border-radius: 50%;
    position: relative;
    animation: characterMegaBounce 1s ease-in-out infinite;
    box-shadow:
        0 15px 40px rgba(255, 217, 61, 0.5),
        0 0 30px rgba(255, 217, 61, 0.3),
        inset 0 -10px 20px rgba(255, 179, 0, 0.3);
}

.character-face {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
}

.eye {
    position: absolute;
    width: 22px;
    height: 30px;
    background: #333;
    border-radius: 50%;
    top: 35%;
    animation: eyeBlink 3s infinite;
}

.eye.left {
    left: 28%;
    animation: eyeSparkle 3s infinite;
}

.eye.right {
    right: 28%;
    animation: eyeSparkle 3s infinite 0.1s;
}

.eye::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    top: 4px;
    left: 3px;
    animation: eyeShine 2s ease-in-out infinite;
}

.mouth {
    position: absolute;
    width: 45px;
    height: 22px;
    border: 5px solid #333;
    border-top: none;
    border-radius: 0 0 45px 45px;
    bottom: 23%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #ff9999 0%, #ff6666 100%);
    animation: mouthTalk 2s ease-in-out infinite;
}

.cheek {
    position: absolute;
    width: 28px;
    height: 16px;
    background: radial-gradient(ellipse, rgba(255, 120, 120, 0.7) 0%, rgba(255, 150, 150, 0.3) 100%);
    border-radius: 50%;
    top: 54%;
    animation: cheekGlow 2s ease-in-out infinite;
}

.cheek.left {
    left: 8%;
}

.cheek.right {
    right: 8%;
    animation-delay: 0.5s;
}

.character-shadow {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 22px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: shadowPulse 1s ease-in-out infinite;
}

@keyframes characterMegaBounce {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    25% {
        transform: translateY(-25px) rotate(2deg);
    }

    50% {
        transform: translateY(-5px) rotate(-1deg);
    }

    75% {
        transform: translateY(-20px) rotate(1deg);
    }
}

@keyframes eyeBlink {

    0%,
    42%,
    44%,
    100% {
        transform: scaleY(1);
    }

    43% {
        transform: scaleY(0.1);
    }
}

@keyframes eyeSparkle {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes eyeShine {

    0%,
    100% {
        opacity: 1;
        transform: translate(0, 0);
    }

    50% {
        opacity: 0.8;
        transform: translate(1px, 1px);
    }
}

@keyframes mouthTalk {

    0%,
    100% {
        transform: translateX(-50%) scaleY(1);
    }

    50% {
        transform: translateX(-50%) scaleY(1.2);
    }
}

@keyframes cheekGlow {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* 星の装飾 - もっとキラキラ */
.stars {
    position: absolute;
    width: 250%;
    height: 250%;
    top: -75%;
    left: -75%;
    pointer-events: none;
}

.star {
    position: absolute;
    font-size: 2.5rem;
    animation: starMegaTwinkle 1.5s ease-in-out infinite;
}

.star:nth-child(1) {
    top: 15%;
    left: 10%;
    color: var(--color-accent);
    animation-delay: 0s;
}

.star:nth-child(2) {
    top: 5%;
    right: 10%;
    color: var(--color-pink);
    animation-delay: 0.2s;
}

.star:nth-child(3) {
    bottom: 20%;
    left: 5%;
    color: var(--color-secondary);
    animation-delay: 0.4s;
}

.star:nth-child(4) {
    bottom: 15%;
    right: 8%;
    color: var(--color-lime);
    animation-delay: 0.6s;
}

.star:nth-child(5) {
    top: 50%;
    right: -5%;
    color: var(--color-orange);
    animation-delay: 0.8s;
}

@keyframes starMegaTwinkle {

    0%,
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 5px currentColor);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.4) rotate(180deg);
        filter: drop-shadow(0 0 15px currentColor);
    }
}

/* 背景装飾 - 超カラフル */
.bg-decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.cloud {
    position: absolute;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 100px;
    box-shadow: 0 5px 20px rgba(255, 107, 203, 0.2);
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 50%;
}

.cloud-1 {
    width: 130px;
    height: 45px;
    top: 8%;
    left: -60px;
    animation: cloudFloat 18s linear infinite;
}

.cloud-1::before {
    width: 55px;
    height: 55px;
    top: -28px;
    left: 22px;
}

.cloud-1::after {
    width: 45px;
    height: 45px;
    top: -22px;
    left: 60px;
}

.cloud-2 {
    width: 110px;
    height: 40px;
    top: 22%;
    right: -110px;
    animation: cloudFloat 22s linear infinite reverse;
}

.cloud-3 {
    width: 90px;
    height: 35px;
    bottom: 18%;
    left: -90px;
    animation: cloudFloat 20s linear infinite;
    animation-delay: 4s;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 200, 255, 0.4) 100%);
    animation: bubbleMegaFloat 8s ease-in-out infinite;
    box-shadow:
        inset 0 0 10px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(255, 77, 141, 0.2);
}

.bubble-1 {
    width: 40px;
    height: 40px;
    bottom: 8%;
    left: 18%;
    animation-delay: 0s;
}

.bubble-2 {
    width: 25px;
    height: 25px;
    bottom: 12%;
    right: 22%;
    animation-delay: 1.5s;
}

.bubble-3 {
    width: 35px;
    height: 35px;
    bottom: 3%;
    left: 55%;
    animation-delay: 3s;
}

@keyframes cloudFloat {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(calc(100vw + 250px));
    }
}

@keyframes bubbleMegaFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-80px) scale(1.2);
        opacity: 1;
    }
}

/* ===========================
   設定画面 - キラキラ
   =========================== */
.settings-content {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 240, 250, 0.95) 100%);
    padding: 45px;
    border-radius: var(--border-radius-lg);
    box-shadow:
        0 20px 50px rgba(255, 77, 141, 0.2),
        0 0 0 4px rgba(255, 77, 141, 0.1);
    text-align: center;
    max-width: 420px;
    width: 90%;
    backdrop-filter: blur(10px);
}

.screen-title {
    font-size: 2.2rem;
    background: var(--gradient-button);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 35px;
}

.setting-group {
    margin-bottom: 35px;
}

.setting-label {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 18px;
}

.setting-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
}

.setting-value {
    font-size: 3.5rem;
    font-weight: 900;
    background: var(--gradient-button);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 70px;
}

.setting-hint {
    font-size: 1rem;
    color: #999;
    margin-top: 8px;
}

/* ===========================
   ゲーム画面 - かっこいい
   =========================== */
.game-header {
    position: relative;
    width: 100%;
    padding: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 240, 250, 0.9) 100%);
    box-shadow: 0 4px 20px rgba(255, 77, 141, 0.15);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    z-index: 10;
}

.round-info {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
}

.round-number {
    font-size: 2rem;
    background: var(--gradient-button);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    width: 160px;
    height: 18px;
    background: linear-gradient(180deg, #f0f0f0 0%, #e0e0e0 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-button);
    border-radius: 12px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 77, 141, 0.5);
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #555;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding-top: 20px;
    flex: 1;
}

.question-area {
    text-align: center;
}

.question-label {
    font-size: 1.4rem;
    color: #777;
    margin-bottom: 18px;
    animation: labelPulse 2s ease-in-out infinite;
}

@keyframes labelPulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

.question-text {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--color-purple);
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 245, 255, 1) 100%);
    padding: 35px 70px;
    border-radius: var(--border-radius-lg);
    box-shadow:
        0 15px 40px rgba(168, 85, 247, 0.2),
        0 0 0 5px rgba(255, 225, 53, 0.8),
        inset 0 0 20px rgba(168, 85, 247, 0.05);
    letter-spacing: 0.25em;
    animation: questionPop 0.5s ease;
}

@keyframes questionPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    60% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.answer-area {
    width: 100%;
    max-width: 420px;
    position: relative;
}

.answer-input {
    width: 100%;
    font-family: var(--font-main);
    font-size: 2.8rem;
    font-weight: 700;
    text-align: center;
    padding: 22px;
    border: 5px solid var(--color-secondary);
    border-radius: var(--border-radius);
    outline: none;
    transition: all 0.3s;
    letter-spacing: 0.15em;
    background: linear-gradient(180deg, #fff 0%, #f8ffff 100%);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.2);
}

.answer-input:focus {
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 6px rgba(255, 77, 141, 0.2),
        0 10px 30px rgba(255, 77, 141, 0.3);
    transform: scale(1.02);
}

.answer-input::placeholder {
    color: #bbb;
    font-size: 1.6rem;
}

/* 間違い表示オーバーレイ */
.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #fff 0%, #f8ffff 100%);
    border: 5px solid var(--color-error);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    letter-spacing: 0.15em;
    z-index: 10;
}

.error-overlay.visible {
    display: flex;
}

.error-char {
    font-family: var(--font-main);
    font-size: 2.8rem;
    font-weight: 700;
    display: inline-block;
}

.error-char.correct {
    color: var(--color-success);
}

.error-char.wrong {
    color: var(--color-error);
    animation: charBlink 0.3s ease-in-out 6;
}

.error-char.missing {
    color: #ccc;
    border-bottom: 3px dashed var(--color-error);
}

@keyframes charBlink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.2;
        transform: scale(1.1);
    }
}

/* フィードバック - 目立つ */
.feedback-area {
    width: 100%;
    max-width: 480px;
    min-height: 50px;
}

.feedback-message {
    background: linear-gradient(180deg, #fff 0%, #fff5f8 100%);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow:
        0 15px 35px rgba(255, 77, 141, 0.15),
        0 0 0 3px rgba(255, 77, 141, 0.1);
    animation: feedbackSlideIn 0.5s ease;
}

@keyframes feedbackSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.feedback-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-error);
    margin-bottom: 18px;
    animation: titleShake 0.5s ease;
}

@keyframes titleShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }
}

.feedback-comparison {
    margin-bottom: 18px;
}

.feedback-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.feedback-label {
    font-size: 1.1rem;
    color: #555;
    min-width: 110px;
    text-align: right;
}

.feedback-chars {
    display: flex;
    gap: 6px;
}

.char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 50px;
    font-size: 1.6rem;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.3s;
}

.char.match {
    background: linear-gradient(180deg, #e8ffe8 0%, #c8ffc8 100%);
    color: #00aa55;
    border: 3px solid #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.char.correct-char {
    background: linear-gradient(180deg, #fff8e8 0%, #ffe8c8 100%);
    color: #ff8800;
    border: 3px solid #ff9500;
    animation: charHighlight 0.5s ease infinite;
}

@keyframes charHighlight {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.char.wrong {
    background: linear-gradient(180deg, #ffe8e8 0%, #ffc8c8 100%);
    color: #ff3344;
    border: 3px solid #ff4757;
    animation: charWrong 0.3s ease;
}

@keyframes charWrong {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

.char.missing {
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
    color: #888;
    border: 3px dashed #aaa;
}

.char.extra {
    background: linear-gradient(180deg, #ffe8f5 0%, #ffc8e8 100%);
    color: #ff4d8d;
    border: 3px solid #ff6bcb;
}

.feedback-hint {
    font-size: 1.2rem;
    color: var(--color-secondary);
    font-weight: 700;
    animation: hintBounce 1s ease infinite;
}

@keyframes hintBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

/* ミニキャラクター */
.mini-character {
    position: fixed;
    bottom: 25px;
    right: 25px;
}

.character.small {
    width: 90px;
    height: 90px;
}

.character.small .character-body {
    width: 90px;
    height: 90px;
}

.character.small .eye {
    width: 14px;
    height: 18px;
}

.character.small .eye::after {
    width: 6px;
    height: 6px;
}

.character.small .mouth {
    width: 28px;
    height: 14px;
    border-width: 3px;
}

/* ===========================
   クリア画面 - 超派手
   =========================== */
.clear-content,
.final-clear-content {
    text-align: center;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.clear-stars {
    margin-bottom: 25px;
}

.big-star {
    font-size: 5rem;
    display: inline-block;
    opacity: 0;
    transform: scale(0);
    filter: drop-shadow(0 0 20px currentColor);
}

.big-star:nth-child(1) {
    color: var(--color-accent);
}

.big-star:nth-child(2) {
    color: var(--color-primary);
    font-size: 6rem;
}

.big-star:nth-child(3) {
    color: var(--color-secondary);
}

.big-star.animate {
    animation: starMegaPop 0.6s ease forwards;
}

@keyframes starMegaPop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-360deg);
    }

    50% {
        transform: scale(1.5) rotate(20deg);
    }

    70% {
        transform: scale(0.9) rotate(-10deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.clear-title {
    font-size: 3.5rem;
    background: var(--gradient-button);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 18px;
    animation: clearTitleBounce 1s ease-in-out infinite;
    filter: drop-shadow(3px 3px 0 rgba(255, 77, 141, 0.3));
}

@keyframes clearTitleBounce {

    0%,
    100% {
        transform: scale(1) rotate(-1deg);
    }

    50% {
        transform: scale(1.08) rotate(1deg);
    }
}

.clear-message {
    font-size: 1.6rem;
    color: #555;
    margin-bottom: 35px;
    animation: messageFloat 2s ease-in-out infinite;
}

@keyframes messageFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* 最終クリア - ド派手 */
.trophy {
    font-size: 10rem;
    animation: trophyMegaBounce 0.8s ease-in-out infinite;
    margin-bottom: 25px;
    filter: drop-shadow(0 10px 30px rgba(255, 193, 7, 0.5));
}

@keyframes trophyMegaBounce {

    0%,
    100% {
        transform: translateY(0) rotate(-8deg) scale(1);
    }

    25% {
        transform: translateY(-30px) rotate(8deg) scale(1.1);
    }

    50% {
        transform: translateY(-10px) rotate(-5deg) scale(1.05);
    }

    75% {
        transform: translateY(-25px) rotate(5deg) scale(1.08);
    }
}

.final-title {
    font-size: 4rem;
    background: var(--gradient-rainbow);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 18px;
    animation: rainbowText 2s linear infinite, finalTitlePulse 1s ease-in-out infinite;
    filter: drop-shadow(4px 4px 0 rgba(255, 77, 141, 0.3));
}

@keyframes finalTitlePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.final-message {
    font-size: 2rem;
    color: var(--color-purple);
    margin-bottom: 35px;
    animation: finalMessageGlow 1.5s ease-in-out infinite;
}

@keyframes finalMessageGlow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
    }

    50% {
        text-shadow: 0 0 25px rgba(168, 85, 247, 0.6), 0 0 40px rgba(168, 85, 247, 0.3);
    }
}

/* 紙吹雪 - もっとカラフル */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    top: -25px;
    animation: confettiMegaFall 3.5s linear forwards;
}

@keyframes confettiMegaFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(50vh) rotate(540deg) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(1080deg) scale(0.8);
        opacity: 0;
    }
}

/* 花火 - 超派手 */
.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.firework {
    position: absolute;
    animation: fireworkMegaExplode 1.8s ease forwards;
}

@keyframes fireworkMegaExplode {
    0% {
        transform: scale(0);
        opacity: 1;
        filter: brightness(2);
    }

    50% {
        filter: brightness(1.5);
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
        filter: brightness(1);
    }
}

.firework-particle {
    position: absolute;
    width: 10px;
    height: 25px;
    border-radius: 50%;
    transform-origin: center bottom;
    animation: particleMegaShoot 1.2s ease-out forwards;
}

@keyframes particleMegaShoot {
    0% {
        transform: rotate(var(--angle)) translateY(0);
        opacity: 1;
    }

    100% {
        transform: rotate(var(--angle)) translateY(-150px);
        opacity: 0;
    }
}

/* ===========================
   結果オーバーレイ - インパクト
   =========================== */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 100;
}

.result-overlay.show {
    opacity: 1;
    visibility: visible;
}

.result-mark {
    font-size: 18rem;
    font-weight: 900;
    animation: markMegaPop 0.6s ease;
}

.result-mark.correct {
    color: var(--color-success);
    text-shadow:
        0 0 30px rgba(0, 255, 136, 0.8),
        0 0 60px rgba(0, 255, 136, 0.5),
        0 0 90px rgba(0, 255, 136, 0.3);
    animation: markMegaPop 0.6s ease, correctGlow 1s ease-in-out infinite;
}

@keyframes correctGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

.result-mark.incorrect {
    color: var(--color-error);
    text-shadow:
        0 0 30px rgba(255, 71, 87, 0.8),
        0 0 60px rgba(255, 71, 87, 0.5);
    animation: markMegaPop 0.6s ease, incorrectShake 0.5s ease;
}

@keyframes markMegaPop {
    0% {
        transform: scale(0) rotate(-20deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.3) rotate(10deg);
    }

    70% {
        transform: scale(0.9) rotate(-5deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes incorrectShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-15px);
    }

    40% {
        transform: translateX(15px);
    }

    60% {
        transform: translateX(-10px);
    }

    80% {
        transform: translateX(10px);
    }
}

/* ===========================
   アニメーション共通
   =========================== */
@keyframes titleBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-12px) scale(1.02);
    }
}

@keyframes shadowPulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.25;
    }

    50% {
        transform: translateX(-50%) scale(0.75);
        opacity: 0.15;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

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

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-12px);
    }

    40% {
        transform: translateX(12px);
    }

    60% {
        transform: translateX(-8px);
    }

    80% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.15);
    }

    50% {
        transform: scale(0.92);
    }

    70% {
        transform: scale(1.08);
    }
}

.bounce {
    animation: bounce 0.7s ease;
}

/* キャラクター喜びアニメーション */
.character.happy .character-body {
    animation: characterMegaBounce 0.2s ease 5;
}

.character.happy .mouth {
    height: 28px;
    bottom: 20%;
}

/* キャラクター励ましアニメーション */
.character.encourage .character-body {
    animation: shake 0.3s ease 3;
}

/* ===========================
   iPad最適化
   =========================== */
@media (min-width: 768px) {
    .title-main {
        font-size: 5.5rem;
    }

    .title-sub {
        font-size: 2.8rem;
    }

    .character {
        width: 220px;
        height: 220px;
    }

    .character-body {
        width: 220px;
        height: 220px;
    }

    .eye {
        width: 28px;
        height: 38px;
    }

    .mouth {
        width: 55px;
        height: 28px;
    }

    .cheek {
        width: 35px;
        height: 20px;
    }

    .btn-start {
        font-size: 2.8rem;
        padding: 35px 100px;
    }

    .question-text {
        font-size: 5.5rem;
        padding: 45px 90px;
    }

    .answer-input {
        font-size: 3.2rem;
        padding: 28px;
    }

    .btn-check {
        font-size: 2.2rem;
        padding: 28px 80px;
    }
}

/* 縦向き（ポートレート）最適化 */
@media (orientation: portrait) and (max-height: 700px) {
    .character-container {
        margin: 18px 0;
    }

    .character {
        width: 110px;
        height: 110px;
    }

    .character-body {
        width: 110px;
        height: 110px;
    }

    .title-main {
        font-size: 2.8rem;
    }

    .title-sub {
        font-size: 1.5rem;
    }
}