body {
    font-family: "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans JP", sans-serif;
    background-color: #f5f7fa;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 840px;
    margin: 30px auto 46px auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    box-sizing: border-box;
}
@media (max-width: 860px) {
    .container {
        margin: 10px;
    }
}

h1 {
    text-align: center;
    margin-top: 0.5em;
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
    line-height: 1.2;
}
h1 img {
    left: auto;
    right: auto;
    max-width: 100%;
}
h1 span {
    display: block;
    margin-top: 4px;
    font-size: 16px;
    font-weight: normal;
}

h2 {
    font-size: 1.4rem;
    margin-top: 0;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}
#recent-courses {
    margin-bottom: 30px;
}

/* ==========================
   グループ構造
========================== */

.group {
    flex: 1 1 100%;
    width: 100%;
    /*margin-bottom: 20px;*/
    margin-bottom: 15px;
}

/* グループ見出し */
.group-header {
    background: linear-gradient(90deg, #e3ebf6, #d6e2f0);
    color: #2c3e50;
    font-weight: bold;
    /* margin-top: 10px;*/
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;                 /* ← 横幅いっぱいに拡張 */
    box-sizing: border-box;      /* ← padding分も含めて100%幅に */
}

.group-header:hover {
    background: linear-gradient(90deg, #d9e6f5, #c8d9ec);
    transform: translateY(-2px);
}

/* 折りたたみアイコン（▶ / ▼） */
.group-header::after {
    content: "▶";
    font-size: 0.9rem;
    transition: transform 0.3s;
}

.group-header.open::after {
    transform: rotate(90deg);
}

/* グループ中身 */
.group-content {
    display: none;
    margin-top: 10px;
    padding-left: 5px;
    border-left: 3px solid #dde5f2;
}

.group-content.open {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* サブグループのネスト */
.sub-container {
    margin-left: 10px;
    padding-top: 10px;
    padding-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

/* ==========================
   コースリスト部分
========================== */

.root-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.course-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.course-item {
    display: inline-block;
    justify-content: center;
}

.course-link {
    text-decoration: none;
}

.course-card {
    background: #eef2f7;
    border-radius: 12px;
    margin-bottom: 6px;
    padding: 20px;
    width: 200px;
    text-align: center;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    color: #2c3e50;
}

.course-card h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.course-card p {
    margin: 0;
    font-size: 0.95rem;
}

/* ホバー時 */
.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

/* 平均点表示 */
.average-score {
    position: absolute;
    top: -10px;
    right: -5px;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease, transform 0.5s ease, background-color 0.4s ease, color 0.4s ease;
}

/* 問題音声再生 */
.q-speak {
    position: absolute;
    top: -10px;
    left: 0;
}

/* ==========================
   アニメーション・メディア対応
========================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    h1 span {
        font-size: 14px;
    }
    .container {
        margin: 10px;
        padding: 15px;
    }
    .course-card {
        width: 100%;
        max-width: 400px;
        box-sizing: border-box;
        padding: 15px;
    }
    .group-header {
        font-size: 1rem;
        padding: 8px 12px;
    }
}
