/* =========================
ベース
========================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #f5f6f8;
    color: #222;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        sans-serif;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* =========================
レイアウト骨格
========================= */

header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
}

header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.header-inner {
    width: min(100%, 1000px);
    margin: 0 auto;
}

main {
    width: min(100% - 32px, 1000px);
    margin: 40px auto;
}

section {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

section h2 {
    margin-top: 0;
}

footer {
    padding: 32px 24px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}


/* =========================
画面(section)遷移
========================= */

.js-switchable {
    display: none;
}

.js-switchable.is-active {
    display: block;
}


/* =========================
共通コンポーネント：ボタン
========================= */

button {
    appearance: none;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    background-color: #2563eb;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;

    transition:
        background-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

button:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

button:active {
    background-color: #1e40af;
    transform: translateY(0);
}

button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

/* ボタンを横並び＋右寄せにするラッパー */
.button-group {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* スキップなど、控えめに見せたいボタン */
#skip-button {
    background-color: transparent;
    color: #4b5563;
    border: 1px solid #d1d5db;
    box-shadow: none;
}

#skip-button:hover {
    background-color: #f3f4f6;
    color: #222;
    box-shadow: none;
}


/* =========================
共通コンポーネント：テキストエリア
========================= */

textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px 14px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background-color: #ffffff;
    color: #222;

    font: inherit;
    line-height: 1.6;

    resize: vertical;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

textarea::placeholder {
    color: #9ca3af;
}

textarea:hover {
    border-color: #9ca3af;
}

textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}


/* =========================
共通コンポーネント：科目カード
========================= */

.course-card {
    padding: 12px 16px;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #222;
    cursor: pointer;
}

.course-card.is-selected {
    background: #ffe08a;
    border-color: #e0a800;
}

.course-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

/* 科目カードの一覧レイアウト */
.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}


/* =========================
共通コンポーネント：4択カード
========================= */

.option-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.option-card {
    width: 100%;
    min-height: 64px;
    padding: 14px 20px;

    background-color: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 10px;

    font-size: 1rem;
    font-weight: 500;

    box-shadow: none;
}

.option-card:hover {
    background-color: #f8fafc;
    color: #2563eb;
    border-color: #93c5fd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.option-card:active {
    background-color: #eff6ff;
    transform: translateY(0);
}


/* =========================
画面：スタート
========================= */

.intro {
    width: min(100%, 560px);
    margin: 0 auto;
    text-align: center;
    padding: 12px 0;
}

.intro h2 {
    margin: 0 0 16px;
    font-size: 1.5rem;
}

.intro p {
    margin: 0 0 28px;
    color: #4b5563;
}

.intro-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;

    margin: 0 0 32px;
    padding: 0;
    list-style: none;
}

.intro-steps li {
    position: relative;
    padding: 12px 16px 12px 44px;

    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;

    text-align: left;
    color: #374151;
    font-size: 0.95rem;
}

/* 手順番号を疑似要素で表示 */
.intro-steps li {
    counter-increment: step-counter;
}

.intro-steps li::before {
    content: counter(step-counter);

    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);

    width: 20px;
    height: 20px;

    background-color: #2563eb;
    color: #ffffff;
    border-radius: 50%;

    font-size: 0.75rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.intro-steps {
    counter-reset: step-counter;
}

#start-button button {
    padding: 12px 32px;
    font-size: 1.05rem;
}


/* =========================
画面：履修済み科目登録
========================= */

#course-registration h2 {
    margin-bottom: 28px;
}

.explanation p {
    flex: 1;
    margin: 0;
    color: #4b5563;
    font-size: 0.95rem;
}

#course-paste {
    display: block;
    min-height: 180px;
    margin-bottom: 16px;
}


/* =========================
画面：難しかった科目
========================= */

#difficulty-confirm-button {
    display: block;
    margin-left: auto;
}


/* =========================
画面：診断フォーム
========================= */

#diagnosis {
    padding: 36px 32px 40px;
}

#diagnosis>h2 {
    margin-bottom: 36px;
    text-align: center;
}

.question-container {
    width: min(100%, 700px);
    margin: 0 auto;
}

.question-progress {
    margin: 0 0 12px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.question-container h3 {
    margin: 0 auto 32px;
    text-align: center;
    font-size: 1.25rem;
    line-height: 1.7;
}


/* =========================
画面：結果
========================= */

#result h2 {
    margin-bottom: 28px;
}

/* レーダーチャートの枠 */
.radar-chart-container {
    width: min(100%, 480px);
    aspect-ratio: 1 / 1;
    margin: 0 auto 36px;

    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

/* おすすめ科目の一覧 */
.recommendation-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.recommendation-card {
    padding: 18px 20px;

    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.recommendation-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.recommendation-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

/* ジャンルを示すバッジ */
.recommendation-genre {
    display: inline-block;
    margin: 0 0 14px;

    padding: 3px 10px;

    background-color: #eff6ff;
    color: #2563eb;
    border-radius: 999px;

    font-size: 0.8rem;
    font-weight: 600;
}

.recommendation-card a {
    display: inline-block;

    color: #2563eb;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;

    transition: color 0.15s ease;
}

.recommendation-card a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* シェアボタンのエリア */
.share-container {
    margin-top: 32px;
    padding-top: 24px;

    border-top: 1px solid #e5e7eb;

    text-align: center;
}

.share-container button {
    background-color: #ffffff;
    color: #2563eb;
    border: 1px solid #93c5fd;
    box-shadow: none;
}

.share-container button::before {
    margin-right: 6px;
}

.share-container button:hover {
    background-color: #eff6ff;
    box-shadow: none;
    transform: translateY(-1px);
}

.share-container button:active {
    background-color: #dbeafe;
    transform: translateY(0);
}


/* =========================
レスポンシブ（スマホ）
========================= */

@media (max-width: 600px) {

    .explanation {
        flex-direction: column;
        gap: 16px;
    }

    .explanation img {
        width: 100%;
        max-width: none;
    }

    .button-group {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .button-group button {
        width: 100%;
    }

    #diagnosis {
        padding: 28px 18px 32px;
    }

    .question-container h3 {
        font-size: 1.1rem;
    }

    .option-list {
        grid-template-columns: 1fr;
    }

    .option-card {
        min-height: 56px;
    }
}