/* c:\xampp\htdocs\gakumasu\css\skill.css */

/* --- 基本設定 --- */
html {
    height: 100%;
    scroll-behavior: smooth;
    font-family: 'M PLUS Rounded 1c', 'Helvetica Neue', Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    line-height: 1.15; /* reset.css に合わせる */
    letter-spacing: normal; /* reset.css に合わせる */
    color: #333;
    background-color: #fff; /* 基本のページ背景色 */
    /* overflow-y: scroll; は reset.css の scrollbar-gutter: stable; で代替を検討 */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    /* height: 100%; */ /* min-height: 100vh と重複する可能性、または意図しない挙動の原因になることがあるためコメントアウト */
    font-family: inherit; /* htmlから継承 */
    margin: 0;
    padding: 0 0 10px 0; /* stylep.css の body スタイルに合わせる */
    background: linear-gradient(to bottom, #fff, #ffe6e6); /* stylep.css と共通の背景 */
    color: #333;
    min-height: 100vh;
    background-image: radial-gradient(circle, rgba(208, 182, 255, 0.3) 2px, transparent 2px); /* stylep.css と共通 */
    background-size: 10px 10px;
    display: flex; 
    flex-direction: column;
    padding-top: 95px !important; /* PCナビゲーションの高さ変更分を反映 (129px -> 95px) */
    box-sizing: border-box;
    width: 100%;
}

/* ページ全体のコンテナ */
.container {
    width: 100%;
    max-width: 1080px; /* 他のCSSファイルと共通の最大幅 */
    margin: 0 auto; /* 中央揃え */
    padding: 0 15px 20px; /* 上0, 左右15px, 下20px */
    display: flex;
    flex-direction: column;
    flex: 1; /* フッターを最下部に固定するため */
    box-sizing: border-box;
}

main {
    flex: 1; /* .container の中で残りの高さを埋める */
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* --- ページタイトルとイントロダクション --- */
.main-title {
    font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
    font-size: 42px;
    font-weight: 700;
    color: #ff1495; /* stylep.css と共通 */
    margin: 20px 0 15px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    text-align: center;
}

.intro-tight {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    text-align: center;
    padding: 0px; /* stylep.css と共通 */
}

.intro-tight p { /* h2タグはskill.phpに存在しないためpタグにスタイルを適用 */
    font-size: 14px;
    font-family: '游ゴシック', 'Yu Gothic', sans-serif;
    font-weight: 700;
    color: #ff4500; /* stylep.css と共通 */
    line-height: 20px;
    margin: 0;
    padding: 0;
}

/* --- ソートボタン --- */
.sort-options-container {
    text-align: center;
    margin-bottom: 20px;
}

.csv-button.sort-button {
    padding: 8px 15px;
    font-size: 1em;
    font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    margin: 5px;
    border: 2px solid transparent; /* 枠線用のスペース確保 */
    box-sizing: border-box;
}

.csv-button.sort-button.inactive,
.csv-button.sort-button:not(.active) { /* 初期状態も含む非アクティブ時 */
    background-color: #6c757d; /* 灰色 */
    color: white;
    border-color: #545b62;
}
.csv-button.sort-button:not(.active):hover {
     background-color: #5a6268; /* 非アクティブ時のホバー色 */
}

.csv-button.sort-button.active:not(.popularity-active) { /* デフォルト順アクティブ時 */
    background-color: #007bff; /* 青色 */
    color: white;
    border-color: #0056b3;
}

.csv-button.sort-button.active.popularity-active { /* いいね順アクティブ時 */
    background-color: #e83e8c; /* ピンク色 */
    color: white;
    border-color: #c2185b;
}

/* --- デフォルト順表示 --- */
#skill-container-default .category {
    margin-bottom: 30px;
    border: 3px solid #ff69b4; /* stylep.css の .card-detail の枠線に合わせる */
    border-radius: 8px;
    padding: 10px;
}

#skill-container-default .category h2 {
    font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #ff1493; /* stylep.css の評価セクションタイトル色に合わせる */
    margin: 0 0 10px;
    text-align: center;
    border-bottom: 2px dotted #ff69b4;
    padding-bottom: 5px;
}

#skill-container-default .rarity {
    margin: 15px 0;
    position: relative;
    min-height: 70px; /* デスクトップ時の画像高さに合わせる */
    border: 1px solid #9cf1c7; /* tier.php の .tier-image の枠線に似せる */
    border-radius: 4px;
    padding: 5px;
}

#skill-container-default .rarity h3 {
    font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ff4500; /* stylep.css の .filter-title の色に合わせる */
    margin: 0;
    padding: 0 10px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1;
}

#skill-container-default .tier-images { /* デフォルト順の画像コンテナ */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 10px 10px 80px; /* 左にh3分の余白を確保 */
    box-sizing: border-box;
    min-height: 70px; /* 画像がない場合でも高さを保つ (デスクトップ時) */
}

/* デフォルト順表示のカード名テキスト */
#skill-container-default .rank-text {
    font-size: 10px;
    font-weight: 700;
    color: #ff4500; /* stylep.css の .rank-text と共通 */
    margin: 2px 0 0 0;
    text-align: center;
    font-family: '游ゴシック', 'Yu Gothic', sans-serif;
    width: 64px; /* 画像より少し広くして、はみ出しを防ぐ */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- いいね順表示 --- */
#skill-container-popularity .category-popularity {
    margin-bottom: 30px;
    /* デフォルト順の .category スタイルに合わせる */
    border: 3px solid #ff69b4;
    border-radius: 8px;
    padding: 10px;
    /* background-color: #f9f9f9; 背景色はデフォルト順に合わせるか、このままにするか選択 */
}

#skill-container-popularity .category-popularity h2 {
    /* デフォルト順の .category h2 スタイルに合わせる */
    font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #ff1493;
    text-align: center;
    margin: 0 0 10px;
    border-bottom: 2px dotted #ff69b4;
    padding-bottom: 5px;
}

#skill-container-popularity .tier-row {
    display: grid;
    grid-template-columns: 100px 1fr; /* ラベルの幅を固定 */
    align-items: center;
    margin-bottom: 10px;
    padding: 5px; /* デフォルト順の .rarity の padding に合わせる */
    /* デフォルト順の .rarity の枠線スタイルに近づける */
    border: 1px solid #9cf1c7; /* tier.php の .tier-image の枠線に似せる */
    border-radius: 4px;
}
#skill-container-popularity .tier-row:last-child {
    border-bottom: none;
}

#skill-container-popularity .tier-label {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: 10px;
}

#skill-container-popularity .tier-label-image { /* いいね順のランクアイコン */
    width: 80px;
    height: auto;
    object-fit: contain;
}

#skill-container-popularity .tier-images { /* いいね順の画像コンテナ */
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#skill-container-popularity .tier-images a { /* 画像を囲むリンク */
    display: block;
}

/* --- スキルカード画像スタイル (デフォルト順・いいね順共通) --- */
#skill-container-default .tier-images img,
#skill-container-popularity .tier-images img,
.card-image { /* .card-image は skill.js でデフォルト順表示時に使われる想定 */
    width: 70px;  /* デスクトップ表示時の基本サイズ */
    height: 70px; /* デスクトップ表示時の基本サイズ */
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out, border-color 0.2s ease-in-out;
    cursor: pointer;
}

#skill-container-default .tier-images img:hover,
#skill-container-popularity .tier-images img:hover,
.card-image:hover {
    transform: scale(1.1);
    border-color: #007bff; /* ホバー時の枠線色 */
}


/* --- レスポンシブ対応 --- */
@media screen and (max-width: 768px) {
    body {
        padding-top: 70px !important; /* スマホナビゲーションの高さ変更分を反映 (50px -> 65px) */
    }

    /* 共通のタイトルとイントロ */
    .main-title {
        font-size: 28px;
        margin: 15px 0 10px;
    }
    .intro-tight p {
        font-size: 12px;
        line-height: 16px;
    }

    /* スマホ表示時の画像サイズ (デフォルト順・いいね順共通) */
    #skill-container-default .tier-images img,
    #skill-container-popularity .tier-images img,
    .card-image {
        width: 45px;
        height: 45px;
    }

    /* デフォルト順表示の調整 */
    #skill-container-default .category h2 {
        font-size: 22px;
    }
    #skill-container-default .rarity {
        min-height: 45px; /* スマホ時の画像高さに合わせる */
        margin: 10px 0;
    }
    #skill-container-default .rarity h3 {
        font-size: 16px;
        padding: 0 8px;
    }
    #skill-container-default .tier-images {
        gap: 6px; /* 少し詰める */
        padding-left: 70px; /* レアリティヘッダーの幅を考慮 */
        min-height: 45px; /* スマホ時の画像高さに合わせる */
    }
    #skill-container-default .rank-text {
        display: none; /* スマホ表示ではカード名を非表示 */
    }

    /* いいね順表示の調整 */
    #skill-container-popularity .category-popularity h2 {
        font-size: 1.3em; /* 少し小さく */
        /* デフォルト順に合わせたので、この個別指定は不要になるかも */
    }
    #skill-container-popularity .tier-row {
        grid-template-columns: 80px 1fr; /* ラベル幅を少し調整 */
        padding: 8px 0;
    }
    #skill-container-popularity .tier-images {
        gap: 8px;
    }
}

@media screen and (max-width: 600px) {
    /* 共通のタイトルとイントロ */
    .main-title {
        font-size: 35px; /* さらに少し小さく */
        margin: 10px 0 8px;
    }
    /* .intro-tight p は 768px のスタイルを継承 */

    /* 画像サイズは 768px のスタイル (45px) を継承 */

    /* デフォルト順表示の調整 */
    #skill-container-default .category h2 {
        font-size: 20px;
    }
    #skill-container-default .rarity h3 {
        font-size: 14px;
        padding: 0 6px;
    }
    #skill-container-default .tier-images {
        padding-left: 60px;
    }

    /* いいね順表示の調整 */
    #skill-container-popularity .category-popularity h2 {
        /* デフォルト順に合わせたので、この個別指定は不要になるかも */
    }
    #skill-container-popularity .tier-row {
        grid-template-columns: 70px 1fr;
    }
}

@media screen and (max-width: 320px) {
    /* 共通のタイトルとイントロ */
    .main-title {
        font-size: 24px;
    }
    .intro-tight p {
        font-size: 11px;
        line-height: 14px;
    }

    /* 画像サイズは 768px のスタイル (45px) を継承 */

    /* デフォルト順表示の調整 */
    #skill-container-default .category h2 {
        font-size: 18px;
    }
    #skill-container-default .rarity h3 {
        font-size: 12px;
        padding: 0 4px;
    }
    #skill-container-default .tier-images {
        padding-left: 50px;
    }

    /* いいね順表示の調整 */
    #skill-container-popularity .category-popularity h2 {
        /* デフォルト順に合わせたので、この個別指定は不要になるかも */
    }
    #skill-container-popularity .tier-row {
        grid-template-columns: 60px 1fr;
    }
}

/* --- AdSense広告用（インライン） - 他ページとスタイルを統一 --- */
.adsense-ad {
  margin: 20px 0;
  text-align: center;
  width: 100%;
  min-width: 1px; /* 広告表示のための最小幅を確保 */
}

.adsense-ad ins {
  display: block;
  width: 100%;
  max-width: 728px; /* レスポンシブ広告の最大幅の目安 */
  min-height: 50px; /* 広告表示のための最小高さを確保 */
  margin: 0 auto;
  padding: 0 10px; /* 左右に少しパディング */
  box-sizing: border-box;
}
