/* オンラインスタディ ホーム (online_study.php) の画面固有スタイル。共通部品は study_app.css */

/* ---------- 全体: メイン + 右列 (PC) / 縦積み (スマホ) ---------- */
.sh-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    max-width: 1440px;
    margin: 0 auto;
    align-items: start;
}
.sh-main { min-width: 0; }
/* ベトナム語単語ページ (study/words.php) は右列なしの1カラム */
.sh-wrap.is-single { grid-template-columns: minmax(0, 1fr); }
/* 大きい画面では右列も広げ、左右の余白が間延びしないようにする */
@media (min-width: 1600px) {
    .sh-wrap { grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; }
}
.sh-rail { display: grid; gap: 16px; position: sticky; top: calc(var(--sa-bar-h) + 16px); }
@media (max-width: 1200px) {
    .sh-wrap { grid-template-columns: minmax(0, 1fr); }
    .sh-rail { position: static; }
}
.sh-hello { margin-bottom: 18px; }
.sh-hello .sa-lead { margin-bottom: 0; }

/* ---------- コース選択カード ---------- */
.sh-courses {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    margin-bottom: 18px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sh-courses::-webkit-scrollbar { display: none; }
.sh-course-card {
    --c: #376439;
    --c-dark: #264a28;
    flex: 1 1 0;
    min-width: 140px;
    border: 2px solid var(--sa-line);
    border-radius: var(--sa-radius);
    background: #fff;
    overflow: hidden;
    transition: transform .1s, border-color .15s;
}
.sh-course-card.c-basic { --c: #376439; --c-dark: #264a28; }
.sh-course-card.c-inter { --c: #cc973d; --c-dark: #a3772c; }
.sh-course-card.c-adv { --c: #9c2742; --c-dark: #761c31; }
.sh-course-card.c-mytango { --c: #b9b9b9; --c-dark: #9a9a9a; }
.sh-course-card:hover { transform: translateY(-2px); }
.sh-course-card.tab-active {
    border-color: var(--c);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.sh-course-link { display: block; color: var(--sa-text); }
.sh-course-link:hover { color: var(--sa-text); }
.sh-course-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 76px;
    background: var(--c);
}
.sh-course-img img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.sh-course-body { display: block; padding: 10px 14px 14px; }
.sh-course-name { display: block; font-size: 16px; font-weight: 900; }
.sh-course-meta { display: block; font-size: 12px; font-weight: 700; color: var(--sa-muted); margin: 2px 0 8px; }
.sh-course-bar { height: 10px; }
.sh-course-bar > span { background: var(--c); }
@media (max-width: 700px) {
    .sh-course-card { flex: 0 0 172px; min-width: 0; }
    .sh-course-img { height: 62px; }
}

/* ---------- コースパネル ---------- */
.sh-course-panel {
    --c: #376439;
    --c-dark: #264a28;
    --c-soft: #eaf3ea;
    margin-bottom: 8px;
}
.sh-course-panel.c-basic { --c: #376439; --c-dark: #264a28; --c-soft: #eaf3ea; }
.sh-course-panel.c-inter { --c: #cc973d; --c-dark: #a3772c; --c-soft: #fbf2e3; }
.sh-course-panel.c-adv { --c: #9c2742; --c-dark: #761c31; --c-soft: #f8e7eb; }

.sh-continue {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--sa-radius);
    background: var(--c);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    margin-bottom: 22px;
}
.sh-continue-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sh-continue-icon .material-symbols-outlined { font-size: 32px; }
.sh-continue-text { flex: 1; min-width: 0; }
.sh-continue-course { font-size: 12px; font-weight: 900; letter-spacing: .08em; opacity: .85; }
.sh-continue-title { font-size: 19px; font-weight: 900; }
.sh-continue .sh-continue-btn {
    background: #fff;
    color: var(--c);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    flex-shrink: 0;
}
.sh-continue .sh-continue-btn:hover { color: var(--c); }
.sh-continue .sh-continue-btn:active { box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
@media (max-width: 700px) {
    .sh-continue { flex-wrap: wrap; padding: 16px; }
    .sh-continue-icon { width: 46px; height: 46px; }
    .sh-continue-title { font-size: 17px; }
    .sh-continue .sh-continue-btn { flex: 1 1 100%; }
}

/* ---------- タブ (学習進捗 / セクションリスト)。ラジオ + label の順序は JS が参照するので維持 ---------- */
.sh-tabs { display: flex; flex-wrap: wrap; }
.sh-tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.sh-tab-label {
    order: 1;
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    color: #afafaf;
    border-bottom: 3px solid var(--sa-line);
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.sh-tab-label:hover { color: var(--sa-muted); }
.sh-tab-radio:checked + .sh-tab-label { color: var(--c); border-bottom-color: var(--c); }
.sh-tab-panel { order: 2; width: 100%; display: none; padding-top: 18px; }
.sh-tab-radio:checked + .sh-tab-label + .sh-tab-panel { display: block; }

.sh-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 900;
    margin: 6px 0 12px;
}
.sh-group-title .material-symbols-outlined { color: var(--c); font-size: 22px; }

/* ---------- タイル ---------- */
.sh-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.sh-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--sa-line);
    border-radius: 14px;
    background: #fff;
    color: var(--sa-text);
    transition: background .12s, transform .05s;
}
.sh-tile:hover { background: var(--sa-soft); color: var(--sa-text); }
.sh-tile:active { transform: translateY(2px); }
.sh-tile.disabled-link { opacity: .45; pointer-events: none; }
.sh-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.sh-tile-icon .material-symbols-outlined { font-size: 26px; }
.sh-tile-icon.is-green { background: var(--sa-green); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.sh-tile-icon.is-blue { background: var(--sa-blue); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.sh-tile-icon.is-purple { background: var(--sa-purple); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.sh-tile-icon.is-orange { background: var(--sa-orange); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.sh-tile-text { display: flex; flex-direction: column; min-width: 0; }
.sh-tile-title { font-size: 15px; font-weight: 900; line-height: 1.3; }
.sh-tile-sub { font-size: 12px; font-weight: 700; color: var(--sa-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 800px) {
    .sh-tiles { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* ---------- 進捗率 ---------- */
.sh-progress-box {
    padding: 16px;
    border-radius: 14px;
    background: var(--c-soft);
}
.sh-progress-label { display: block; font-size: 15px; font-weight: 900; color: var(--c); margin-bottom: 8px; }
.sh-progress-box .study-progress-bar {
    height: 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .08);
    overflow: hidden;
}
.sh-progress-box .study-progress {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--sa-yellow);
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .08), inset 0 4px 0 rgba(255, 255, 255, .3);
    transition: width .5s ease-in-out;
}
.sh-note { font-size: 12px; color: var(--sa-muted); margin-top: 8px; }
.sh-pdf { text-align: right; margin-top: 16px; }
.sh-pdf .sa-btn .material-symbols-outlined { font-size: 20px; }

/* ---------- セクションリスト ---------- */
.sh-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.sh-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 8px;
}
.sh-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    border: 2px solid var(--sa-line);
    border-radius: 12px;
    background: #fff;
    color: var(--sa-muted);
    font-size: 15px;
    font-weight: 900;
}
.sh-section:hover { background: var(--sa-soft); color: var(--sa-text); }
.sh-section.is-done { background: var(--c); border-color: var(--c-dark); color: #fff; }
.sh-section.is-done:hover { color: #fff; filter: brightness(1.05); }
.sh-section-check {
    position: absolute;
    top: -8px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--sa-yellow);
    color: #fff;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}
@media (max-width: 700px) {
    .sh-sections { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- もっと学ぶ ---------- */
.sh-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sh-feature {
    --f: var(--sa-blue);
    --f-dark: var(--sa-blue-dark);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 2px solid var(--sa-line);
    border-radius: var(--sa-radius);
    background: #fff;
    color: var(--sa-text);
    transition: background .12s, transform .05s;
}
.sh-feature:hover { background: var(--sa-soft); color: var(--sa-text); }
.sh-feature:active { transform: translateY(2px); }
.sh-feature.is-olive { --f: #7a9a3a; --f-dark: #5d7a28; }
.sh-feature.is-blue { --f: var(--sa-blue); --f-dark: var(--sa-blue-dark); }
.sh-feature.is-orange { --f: var(--sa-orange); --f-dark: var(--sa-orange-dark); }
.sh-feature.is-purple { --f: var(--sa-purple); --f-dark: var(--sa-purple-dark); }
.sh-feature.is-dark { --f: #4b4b4b; --f-dark: #2f2f2f; }
.sh-feature.is-gold { --f: #cc973d; --f-dark: #a3772c; }
.sh-feature.is-red { --f: var(--sa-red); --f-dark: var(--sa-red-dark); }
.sh-feature-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--f);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sh-feature-icon .material-symbols-outlined { font-size: 30px; }
.sh-feature-body { display: flex; flex-direction: column; min-width: 0; }
.sh-feature-title { font-size: 16px; font-weight: 900; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sh-feature-desc { font-size: 13px; color: var(--sa-muted); margin-top: 3px; line-height: 1.5; }
@media (max-width: 700px) {
    .sh-feature-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- マイ単語の紹介 ---------- */
.sh-mytango-head { display: flex; align-items: center; gap: 18px; }
.sh-mytango-head img { width: 220px; max-width: 45%; }
.sh-mytango-head p { margin: 0; font-size: 14px; line-height: 1.7; }
.sh-mytango-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.sh-mytango-point { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.6; }
.sh-mytango-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #e5f8ec;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.sh-mytango-more { text-align: right; margin-top: 14px; }
.sh-mytango-more a { display: inline-flex; align-items: center; font-weight: 800; color: var(--sa-blue); }
@media (max-width: 800px) {
    .sh-mytango-head { flex-direction: column; text-align: left; align-items: flex-start; }
    .sh-mytango-head img { max-width: 240px; width: 100%; }
    .sh-mytango-points { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 右列: 診断・ランキング ---------- */
.sh-diagnosis { text-align: center; }
.sh-diagnosis img { width: 100%; max-width: 260px; margin-bottom: 14px; }
.sh-diagnosis .sa-btn { font-size: 14px; letter-spacing: 0; }
.sh-ranking { padding: 16px; }
.sh-ranking-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 900; margin-bottom: 10px; }
.sh-ranking-title .material-symbols-outlined { color: var(--sa-yellow); font-variation-settings: 'FILL' 1; }
.sh-ranking-table { border-collapse: collapse; font-size: 14px; }
.sh-ranking-table th {
    font-size: 11px;
    font-weight: 900;
    color: #afafaf;
    letter-spacing: .06em;
    padding: 6px 4px;
    border-bottom: 2px solid var(--sa-line);
    text-align: left;
}
.sh-ranking-table td { padding: 8px 4px; border-bottom: 1px solid var(--sa-line); vertical-align: middle; }
.sh-ranking-table tr:last-child td { border-bottom: 0; }
.sh-rank { width: 44px; font-weight: 900; color: var(--sa-muted); text-align: center; }
.sh-rank .rank { width: 26px; height: auto; }
.sh-rank-user { display: flex; align-items: center; gap: 8px; font-weight: 700; word-break: break-all; }
.sh-rank-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.sh-rank-score { font-weight: 900; color: var(--sa-green-dark); text-align: right; white-space: nowrap; }
.sh-ranking-table th:last-child { text-align: right; }

/* 長いボタン文言 (特にEN) が大文字化で2行に折れないよう、このページのボタンは大文字化しない */
.sh-diagnosis .sa-btn,
.sh-pdf .sa-btn,
.sh-continue .sh-continue-btn { text-transform: none; letter-spacing: .01em; }
.sh-mytango-point span:last-child { min-width: 0; }

/* プレミアム会員PRバナー (金色はプレミアム共通色) */
.sh-premium-pr { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 16px; background: #fbf5ea; border: 2px solid #ecd9b5; color: #3c3c3c; text-decoration: none; transition: border-color .15s, background .15s; }
.sh-premium-pr:hover, .sh-premium-pr:focus { border-color: #cc973d; background: #f8eedc; color: #3c3c3c; text-decoration: none; }
.sh-premium-pr-icon { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 14px; background: #cc973d; color: #fff; display: flex; align-items: center; justify-content: center; }
.sh-premium-pr-icon .material-symbols-outlined { font-size: 30px; }
.sh-premium-pr-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sh-premium-pr-title { font-weight: 700; font-size: 16px; color: #a3772c; }
.sh-premium-pr-desc { font-size: 13px; line-height: 1.6; color: #666; }
.sa-btn.sh-premium-pr-btn { flex: 0 0 auto; background: #cc973d; border-color: #cc973d; color: #fff; }
.sh-premium-pr:hover .sh-premium-pr-btn { background: #a3772c; border-color: #a3772c; }
.sh-premium-pr-btn .material-symbols-outlined { font-size: 18px; margin-left: 2px; }
@media (max-width: 600px) {
    .sh-premium-pr { flex-wrap: wrap; padding: 16px; }
    .sh-premium-pr-icon { flex-basis: 44px; width: 44px; height: 44px; }
    .sh-premium-pr-body { flex-basis: calc(100% - 60px); }
    .sa-btn.sh-premium-pr-btn { width: 100%; justify-content: center; }
}
