/* 全体のスタイル */
body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f9f9f9;
}

/* ヘッダーのスタイル */
header {
    display: flex; /* ★ 横並びレイアウトに変更 */
    justify-content: space-between; /* ★ 両端に寄せる */
    align-items: center; /* ★ 上下中央揃え */
    margin-bottom: 30px;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
    font-family: "Yuji Kyokasho", serif;
}

header h1 {
    margin: 0;
    color: #333;
}

/*  単語数と検索ボックスをまとめるコンテナのスタイル */
.header-controls {
    display: flex;
    align-items: center;
}

/*  単語数表示のスタイル */
#word-count-display {
    margin-right: 15px;
    font-size: 0.9em;
    color: #555;
    white-space: nowrap; /* 折り返しを防ぐ */
}

/* 検索ボックスのコンテナのスタイルをリセット */
.search-container {
    position: static;
    transform: none;
}

/* 検索ボックス本体のスタイル */
#search-box {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 1em;
    width: 200px;
}

/* 単語エントリー全体を囲むコンテナ */
.word-entry {
    display: flex;
    align-items: flex-start;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 単語・日付・意味をまとめるコンテナ */
.word-details {
    flex: 3;
    display: flex;
    align-items: baseline;
}

/* 単語と日付をまとめる左側の列 */
.term-column {
    flex: 1;
    padding-right: 10px;
}

/* 単語のスタイル */
.word-term {
    font-size: 1.8em;
    font-weight: bold;
    font-family: "Yuji Kyokasho", serif;
}

/* 登録日のスタイル */
.registered-date {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

/* 意味のスタイル (右側の列) */
.word-definition {
    flex: 2;
    line-height: 1.6;
    font-size: 1.0em;
    padding-top: 5px;
    font-family: "Yuji Kyokasho", serif;
}

/* 画像エリアのスタイル */
.word-image {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 画像ファイル名のスタイル */
.image-toggler {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    margin-bottom: 5px;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}
.image-toggler:hover {
    background-color: #f0f0f0;
}
.image-toggler.active {
    color: #fff;
    background-color: #007bff;
    text-decoration: none;
}

/* 画像のスタイル */
.word-image img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    border: 1px solid #eee;
    margin-top: 10px;
}


/* --- タグ関連のスタイル --- */
#tag-container {
    text-align: center;
    margin-bottom: 30px;
}
.tag-btn {
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 15px;
    padding: 8px 15px;
    margin: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s;
}
.tag-btn:hover {
    background-color: #cccccc;
}
.tag-btn.active {
    background-color: #007bff;
    color: white;
}

/* --- 内部リンク関連のスタイル --- */
.internal-link {
    color: #0056b3;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}
.internal-link:hover {
    color: #003d80;
}
.word-entry[id^="inserted-"] {
    margin-left: 40px;
    border-left: 3px solid #007bff;
    background-color: #f5faff;
}

/* --- レスポンシブデザイン（スマホ対応） --- */
@media (max-width: 768px) {

    body {
        padding: 10px;
    }

    /* ヘッダーを縦積みに */
    header {
        flex-direction: column;
    }
    
    .header-controls {
        margin-top: 15px;
        width: 100%;
        justify-content: center;
    }

    #search-box {
        width: 150px; /* スマホでは少し幅を調整 */
    }

    .word-entry {
        flex-direction: column;
        align-items: flex-start;
    }

    .word-details {
        flex-direction: column;
        width: 100%;
        align-items: flex-start;
    }
    
    .term-column {
        padding-right: 0;
        margin-bottom: 15px;
    }
    
    .word-definition {
        padding-top: 0;
    }

    .word-image {
        width: 100%;
        margin-top: 20px;
    }
}
/* 「除外」選択されたタグボタンのスタイル */
.tag-btn.exclude {
    background-color: rgba(220, 53, 69, 0.8); /* 半透明の赤 */
    color: white;
    text-decoration: line-through; /* 取り消し線 */
    border: 1px solid #dc3545;
}

.tag-btn.exclude:hover {
    background-color: rgb(220, 53, 69);
}