/* --- 1. 基本設定（UD重視） --- */
:root {
    /* カービィの世界をイメージしたパステルカラー */
    --kirby-pink: #ffdae9;
    --kirby-blue: #d0f0ff;
    --kirby-yellow: #fff9c4;
    --text-color: #4a4a4a; /* 目に優しいダークグレー */
    --accent-color: #ff80ab;
    --card-bg: rgba(255, 255, 255, 0.7);
    --border-radius: 24px;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif;
    color: var(--text-color);
    line-height: 1.8;
    background: linear-gradient(135deg, var(--kirby-pink), var(--kirby-blue), var(--kirby-yellow));
    background-attachment: fixed;
    overflow-x: hidden;
}

/* --- 2. レイアウト構造 --- */
.app-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    flex: 2;
    padding: 20px;
}

.sidebar {
    flex: 1;
    margin-left: 30px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* スマホ表示の対応（UD） */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        margin-left: 0;
        margin-top: 40px;
    }
}

/* --- 3. セクション・共通パーツ --- */
.section {
    margin-bottom: 80px;
    animation: fadeInUp 1s ease-out;
}

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

.section-title {
    color: var(--accent-color);
    font-size: 1.8rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
}

/* --- 4. 吹き出し（Balloon）デザイン --- */
.balloon {
    position: relative;
    background: #fff;
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border: 3px solid #fff;
}

/* 吹き出しのしっぽ（やさしく丸い） */
.balloon::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 40px;
    border-width: 15px 15px 0;
    border-style: solid;
    border-color: #fff transparent transparent;
}



.intro-balloon { border-color: var(--kirby-pink); }
.pink-balloon { border-color: var(--kirby-pink); }
.blue-balloon { border-color: var(--kirby-blue); }
.yellow-balloon { border-color: var(--kirby-yellow); }

/* --- 5. レイヤーカード（Layer Cards） --- */
.layer-card {
    background: var(--card-bg);
    backdrop-filter: blur(5px); /* 背景を少しぼかす */
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    transition: transform 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.layer-card:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 30px rgba(255, 128, 171, 0.2);
}

.layer-label {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 10px;
}

/* 各レイヤーの色味調整 */
.l0 { border-left: 10px solid #ffd1dc; }
.l1 { border-left: 10px solid #b3e5fc; }
.l2 { border-left: 10px solid #fff9c4; }
.l3 { border-left: 10px solid #c8e6c9; }

/* 専門的メモのスタイル */
.technical-note, .academic-note {
    background: rgba(0, 0, 0, 0.03);
    padding: 15px;
    border-radius: 12px;
    margin-top: 15px;
    font-size: 0.9rem;
    border-left: 3px solid var(--text-color);
}

/* --- 6. 比較テーブル（UD重視） --- */
.comparison-table-wrapper {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.comparison-table th, .comparison-table td {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.comparison-table th {
    background-color: var(--kirby-blue);
    color: var(--text-color);
}

.highlight-row {
    background-color: rgba(255, 128, 171, 0.1);
    font-weight: bold;
}

/* --- 7. 数学・数理セクション --- */
.math-container {
    background: #fff;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px dashed var(--kirby-blue);
    margin: 20px 0;
}

.formula-legend {
    list-style: none;
    padding: 0;
    text-align: left;
    display: inline-block;
    margin-top: 20px;
}

/* --- 8. サイドバー（星の観測塔） --- */
.sidebar-inner {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 2px solid #fff;
}

.sidebar-title {
    color: var(--accent-color);
    font-size: 1.4rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.sidebar-title span {
    font-size: 0.8rem;
    opacity: 0.6;
}

.side-note {
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.side-note h3 {
    font-size: 1rem;
    margin-top: 0;
    color: var(--accent-color);
}

.small-text {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* --- 9. フッター（やさしい締めくくり） --- */
.site-footer {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.3);
    margin-top: 50px;
    border-top: 2px solid #fff;
}

.site-footer p {
    margin: 5px 0;
    font-weight: bold;
    color: var(--accent-color);
}

.small-footer {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* --- 10. ユニバーサルデザイン (UD) & アクセシビリティ --- */

/* リンクやボタンを押しやすく（フォーカス時の強調） */
a:focus, button:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 4px;
}

/* 読みやすさのための文字間隔と選択色 */
::selection {
    background: var(--accent-color);
    color: #fff;
}

/* --- 11. 「あ」理論の特別演出（アニメーション） --- */

/* ふわふわ浮いているようなアニメーション */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.site-title, .balloon {
    animation: float 4s ease-in-out infinite;
}

/* 数式を強調するボックス */
.math-container math {
    font-size: 1.2rem;
    padding: 10px;
}

/* 視覚的な区切り線（雲や星） */
.cloud-divider, .star-divider, .heart-divider {
    text-align: center;
    margin: 40px 0;
    font-size: 2rem;
    opacity: 0.5;
}

.cloud-divider::after { content: "☁️ ☁️ ☁️"; }
.star-divider::after { content: "✨ ✨ ✨"; }
.heart-divider::after { content: "💖 💖 💖"; }

/* スクロールバーのカスタマイズ（ぷにぷに感） */
::-webkit-scrollbar {
    width: 12px;
}
::-webkit-scrollbar-track {
    background: var(--kirby-blue);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
    border: 3px solid var(--kirby-blue);
}

/* 検証方法セクションの装飾 */
#verification .layer-card {
    border: 2px solid var(--kirby-blue);
    background: rgba(255, 255, 255, 0.8);
}

#verification h3 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

/* まとめセクションの特別な装飾 */
.academic-deep-dive {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-top: 40px;
    box-shadow: inset 0 0 20px var(--kirby-blue);
    border: 2px solid var(--kirby-pink);
}

.academic-deep-dive h3 {
    text-align: center;
    color: var(--text-color);
    border-bottom: 2px dashed var(--kirby-pink);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.academic-deep-dive h4 {
    color: var(--accent-color);
    margin-top: 20px;
    font-size: 1.1rem;
}

.theory-box p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 15px;
}

