@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* =========================================
   Variables (モダンカラーパレット)
========================================= */
:root {
    /* ベースカラー */
    --primary: #2563EB;      /* Clyzerブルー (モダンな青) */
    --bg-base: #F8FAFC;      /* 背景 (わずかに青みがかった白) */
    --surface: #FFFFFF;      /* カード等の背景 */
    --text-main: #1E293B;    /* 濃いグレー (真っ黒を避ける) */
    --text-muted: #64748B;   /* サブテキスト */
    --border: #E2E8F0;       /* 境界線 */

    /* 科目別テーマカラー (鮮やかでモダンな色合) */
    --sub-chisai: #EF4444;   /* 知災Ⅰ・Ⅱ */
    --sub-bosai: #F59E0B;    /* 防災実践 */
    --sub-climate: #10B981;  /* 風土・共生 */
    --sub-info: #0EA5E9;     /* 情報・解析/探究 */
    --sub-media: #8B5CF6;    /* メディア表現 */
    --sub-railway: #334155;  /* 鉄道基礎/探究 */
    --sub-math: #06B6D4;     /* 理数探究 */

    /* ページテーマカラー（初期値はプライマリ） */
    --theme-color: var(--primary);
}

/* テーマ適用クラス */
.theme-chisai { --theme-color: var(--sub-chisai); }
.theme-bosai { --theme-color: var(--sub-bosai); }
.theme-climate { --theme-color: var(--sub-climate); }
.theme-info { --theme-color: var(--sub-info); }
.theme-media { --theme-color: var(--sub-media); }
.theme-railway { --theme-color: var(--sub-railway); }
.theme-math { --theme-color: var(--sub-math); }

/* =========================================
   Base & Typography
========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; transition: opacity 0.2s; }
img { max-width: 100%; height: auto; display: block; }

/* =========================================
   Header (グラスモーフィズム)
========================================= */
.edu-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-color);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-icon img { height: 32px; width: auto; }

/* =========================================
   Breadcrumbs (モダンなピル形状)
========================================= */
.breadcrumbs {
    padding: 12px 20px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.breadcrumbs::-webkit-scrollbar { display: none; } /* スクロールバー非表示 */
.breadcrumbs a {
    background: var(--surface);
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.breadcrumbs span.current {
    background: var(--theme-color);
    color: #fff;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 500;
}

/* =========================================
   Main Layout & Typography
========================================= */
.edu-main {
    padding: 24px 20px 80px;
    max-width: 768px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 32px 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 18px;
    background: var(--theme-color);
    border-radius: 4px;
}

/* =========================================
   Character Dialog (モダンなチャットUI風)
========================================= */
.dialog-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 24px;
}
.dialog-wrapper.reverse {
    flex-direction: row-reverse;
}
.char-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    background: var(--surface);
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 2px solid var(--theme-color);
}
.char-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.bubble {
    background: var(--surface);
    padding: 16px;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    font-size: 0.95rem;
    color: var(--text-main);
    max-width: calc(100% - 76px);
    position: relative;
    border: 1px solid var(--border);
}
.dialog-wrapper.reverse .bubble {
    border-radius: 16px 16px 4px 16px;
}
.bubble-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--theme-color);
    margin-bottom: 4px;
    display: block;
}

/* =========================================
   Subject Grid Cards (ホバーアニメーション付き)
========================================= */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.subject-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.subject-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--card-color, var(--primary));
    transition: height 0.3s;
}
.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: transparent;
}
.subject-card:hover::before { height: 6px; }
.subject-en {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.subject-jp {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}
.card-badge {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.7rem;
    background: var(--bg-base);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

/* =========================================
   Footer & Floating Action
========================================= */
.edu-footer {
    text-align: center;
    padding: 24px 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.fab-konyaha {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(10px);
}
.fab-konyaha.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.fab-konyaha img {
    width: 56px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    margin-bottom: 4px;
}
.fab-label {
    background: rgba(30, 41, 59, 0.8);
    color: #fff;
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

/* =========================================
   Accordion & Resource List (章ごとのコンテンツ展開用)
========================================= */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}
.accordion-item {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    overflow: hidden;
}
/* detailsタグのデフォルトの三角形を消す */
.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item summary { list-style: none; }

.accordion-header {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    transition: background 0.2s;
    border-left: 4px solid var(--theme-color);
}
.accordion-header:hover { background: var(--bg-base); }
.accordion-header::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--theme-color);
    transition: transform 0.3s ease;
}
.accordion-item[open] .accordion-header::after { transform: rotate(45deg); }

.accordion-content {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-base);
}

/* =========================================
   Resource Links (資料リンクカード)
========================================= */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.resource-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-main);
}
.resource-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: var(--theme-color);
}
.resource-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-base);
    border-radius: 8px;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.resource-info { flex-grow: 1; }
.resource-title {
    font-weight: 700;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 2px;
}
.badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 700;
    vertical-align: middle;
}
.badge-pdf { background: #FEE2E2; color: #EF4444; }
.badge-link { background: #E0F2FE; color: #0EA5E9; }
.badge-video { background: #F3E8FF; color: #8B5CF6; }
.badge-ans { background: #DCFCE7; color: #10B981; }