/* --- テーマ変数（ポータルサイトと統合） --- */
:root {
    --mc-danger: #e74c3c;
    --mc-green: #20d2ff;
    --mc-bg: #f4f4f4;
    --card-bg: #ffffff;
    --text-color: #333;
    --mc-dark: #2c3e50;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background-color: var(--mc-bg);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- ヘッダー・ナビゲーション --- */
@keyframes flowRainbow {
    from { background-position: 0% 0%; }
    to { background-position: -200% 0%; }
}

header, nav, .btn, .btn-primary, .btn-success {
    background: linear-gradient(90deg,
                    #00d2ff, #10d2ff, #20d2ff, #30d2ff, #40d2ff, #50d2ff,
                    #60d2ff, #70d2ff, #80d2ff, #90d2ff, #a0d2ff, #b0d2ff,
                    #c0d2ff, #d0d2ff, #d0d2ff, #c0d2ff, #b0d2ff, #a0d2ff,
                    #80d2ff, #70d2ff, #60d2ff, #50d2ff, #40d2ff, #30d2ff,
                    #20d2ff, #10d2ff);

            background-size: 200% 100%;
            animation: flowRainbow 5s linear infinite;
            color: white;
            padding: 1rem 1rem;
            text-align: center;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

nav a {
            color: white;
            text-decoration: none;
            margin: 0 5px;
            font-weight: bold;
        }

nav a:hover {
    text-decoration: underline;
}

/* --- レイアウト --- */
.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
    min-height: 70vh;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.section-title {
    border-bottom: 3px solid var(--mc-green);
    display: inline-block;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

/* --- カードUI --- */
.card-ui {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    transition: transform 0.2s;
}

.list-item:hover {
    transform: translateY(-2px);
}

/* --- ボタン --- */
.btn {
    display: inline-block;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
}

.btn-danger {
    background: var(--mc-danger);
    color: white;
}

.btn-secondary {
    background: #7f8c8d;
    color: white;
}

.btn-full {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* --- フォーム --- */
input[type="text"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.setting-group {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* --- 学習画面 --- */
.study-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: 8px;
}

#study-progress-container {
    flex: 1;
    height: 12px;
    background: #eee;
    border-radius: 6px;
    overflow: hidden;
}

#progress-inner {
    height: 100%;
    background: var(--mc-green);
    width: 0%;
    transition: width 0.3s;
}

/* フラッシュカード演出 */
.flashcard {
    perspective: 1000px;
    width: 100%;
    height: 300px;
    margin-bottom: 25px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flashcard.is-flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: bold;
    border-radius: 15px;
    background: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 30px;
    box-sizing: border-box;
    border: 2px solid var(--mc-green);
}

.flashcard-back {
    transform: rotateY(180deg);
    background: #f0fdf4;
    color: var(--mc-dark);
}

/* 4択 */
#quiz-choice-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.choice-btn {
    background: white;
    border: 2px solid #ddd;
    padding: 20px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    font-weight: bold;
}

.choice-btn:hover {
    border-color: var(--mc-accent);
}

.choice-btn::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 5px;
    font-size: 0.8rem;
    color: #aaa;
}

/* タイピング */
#custom-keyboard {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    margin-top: 15px;
}

#custom-keyboard button {
    padding: 12px 2px;
    background: white;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-weight: bold;
}

/* アニメーション */
@keyframes correct-flash {

    0%,
    100% {
        background-color: white;
    }

    50% {
        background-color: #d4edda;
        border-color: #28a745;
    }
}

@keyframes wrong-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.correct-blink {
    animation: correct-flash 0.5s ease-in-out;
}

.wrong-blink {
    background-color: #f8d7da !important;
}

.anim-correct {
    border: 4px solid var(--mc-green) !important;
}

.anim-wrong {
    display: inline-block;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    animation: wrong-shake 0.3s;
    border: 4px solid var(--mc-danger) !important;
}

/* フッター */
footer {
    text-align: center;
    padding: 40px;
    color: #777;
    border-top: 1px solid #ccc;
    margin-top: 40px;
}

footer a {
    color: var(--mc-dark);
    text-decoration: none;
}