:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2a2a2a;
    --card-border: #444;
    --accent-color: #00bcd4; /* シアン系のアクセントカラー */
    --hover-color: #0097a7;
    --tag-default-bg: #696969; /* デフォルトのタグ色（タグ指定なし用） */
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    background-color: var(--card-bg);
    padding: 1rem;
    text-align: center;
    border-bottom: 2px solid var(--accent-color);
}

h1 {
    margin: 0;
    color: var(--accent-color);
    font-size: 1.8rem;
}

main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 絞り込み/検索パネルのスタイル */
.controls {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    /* ↓上部固定のためのスタイル */
    position: sticky;
    top: 0; /* 画面上部に固定 */
    z-index: 1000; /* 他のコンテンツの上に表示 */
    border-bottom: 1px solid var(--card-border); /* 固定時に下線を追加して区別しやすく */
    /* ↓画面幅いっぱいに広がるように調整 */
    left: 0;
    width: 100%;
    box-sizing: border-box; /* paddingとborderを幅に含める */
    margin-left: auto; /* 中央寄せ解除 */
    margin-right: auto; /* 中央寄せ解除 */
    max-width: none; /* max-widthを解除して全幅に */
    border-radius: 0; /* 角丸をなくす */
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    cursor: pointer; /* クリック可能であることを示す */
    border-bottom: 1px solid var(--card-border); /* ヘッダーとコンテンツの区切り */
    margin-bottom: 1rem;
}

.controls-header h2 {
    margin: 0;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.toggle-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s ease;
}

/* アコーディオンコンテンツのスタイル */
.controls-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 0; /* 初期状態では非表示（高さ0） */
    overflow: hidden; /* はみ出した内容を隠す */
    transition: max-height 0.3s ease-out; /* アニメーション */
    padding-top: 0; /* 展開時のパディングはJSで制御しないため0に */
}

/* 展開時のスタイル */
.controls.is-expanded .controls-content {
    max-height: 500px; /* 十分な高さを設定（コンテンツに合わせて調整） */
    padding-top: 0.5rem; /* 展開時に少しパディングを追加 */
}

.controls.is-expanded .toggle-button .arrow-icon {
    transform: rotate(180deg); /* 矢印を回転 */
}

/* PC表示（アコーディオンを常に開く） */
@media (min-width: 768px) {
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 2rem;
    }
    .controls-header {
        display: none; /* PCではヘッダーとトグルボタンを非表示 */
    }
    .controls-content {
        max-height: none; /* PCでは常に全高を表示 */
        overflow: visible;
        flex-direction: row; /* PCでは横並び */
        width: 100%; /* 親要素の全幅を占める */
        gap: 1.5rem;
        padding-top: 0; /* 不要なパディングを削除 */
    }
    .filter-row {
        flex-direction: row;
        width: calc(70% - 0.75rem); /* 検索グループの幅も考慮して調整 */
        gap: 1.5rem;
    }
    .filter-group {
        flex: 1;
    }
    .search-group {
        width: 30%; /* 検索グループの幅 */
        margin-top: 0; /* PCでは同じ行になるため */
    }
}


.filter-group, .search-group {
    display: flex;
    flex-direction: column;
}

.filter-group label, .search-group label {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

#tag-filter-1, #tag-filter-2, #tag-filter-3, #keyword-search {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    background-color: #333;
    color: var(--text-color);
    font-size: 1rem;
    box-sizing: border-box;
}

#tag-filter-1, #tag-filter-2, #tag-filter-3 {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23e0e0e0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px top 50%;
    background-size: 24px auto;
}


/* スキルカード一覧 */
.skill-list {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin-top: 1.5rem; /* 固定パネルの下にスペースを確保 */
}

.skill-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.skill-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.8rem;
}

.skill-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.skill-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.skill-meta .tag {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    background-color: var(--tag-default-bg);
}

/* クラスタグごとの色分け */
.tag.活力 { background-color: #FFD700; color: #333; } /* Gold */
.tag.戦闘 { background-color: #FF4500; } /* OrangeRed */
.tag.偵察 { background-color: #32CD32; } /* LimeGreen */
.tag.呪文 { background-color: #4169E1; } /* RoyalBlue */
.tag.防御 { background-color: #8A2BE2; } /* BlueViolet */
.tag.強化 { background-color: #DC143C; } /* Crimson */
.tag.補助 { background-color: #00CED1; } /* DarkTurquoise */
.tag.タグ { background-color: #696969; } /* DimGray (運命の開拓者のプレースホルダー用) */


.skill-details p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.skill-details strong {
    color: var(--accent-color);
}

.skill-details h4, .skill-details h5 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 1rem;
    border-bottom: 1px dashed var(--card-border);
    padding-bottom: 0.3rem;
}

.skill-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.skill-details li {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.highlight {
    background-color: rgba(255, 255, 0, 0.3);
    color: black;
    border-radius: 3px;
    padding: 0 2px;
}

footer {
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--card-border);
    color: #888;
    font-size: 0.8rem;
}

/* ページトップボタン */
#page-top-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    opacity: 0;
    visibility: hidden;
    z-index: 1001;
}

#page-top-button.show {
    opacity: 1;
    visibility: visible;
}

/* スマホでの調整 */
@media (max-width: 767px) {
    h1 {
        font-size: 1.5rem;
    }

    .skill-card {
        padding: 1rem;
    }

    .skill-header h2 {
        font-size: 1.2rem;
    }

    .skill-details p, .skill-details li {
        font-size: 0.85rem;
    }

    #page-top-button {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        bottom: 15px;
        right: 15px;
    }
    /* .controlsはstickyで固定されるため、ここで特定の設定は不要 */
    /* filter-rowとsearch-groupは自動で縦に並ぶ */
}