* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ヘッダー */
header {
    position: fixed;
    top: 20px;
    left: 20px;
}

.text-logo {
    font-size: 24px;
    font-weight: bold;
    color: #5953c3;
    text-decoration: none;
    transition: 0.3s;
}

.text-logo:hover {
    opacity: 0.7;
}

body {
    font-family: Arial, sans-serif;
    background: #faf6d7;
    /* 背景設定 */
    display: flex;
    justify-content: center;
    padding: 50px 20px;
    min-height: 100vh;
    transition: 0.3s;
}

.container {
    /* アプリ全体のカードの設定 */
    width: 100%;
    max-width: 700px;
    background: #d1fcb3;
    padding: 70px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    color: #1a9c00;
}

#themeToggle {
    /* 背景モード切替ボタン設定 */
    background: #006e3d;
}

.input-area {
    display: flex;
    gap: 10px;
    margin: 25px 0;
}

input,
select {
    font-size: 1.2rem;
    padding: 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
}

input {
    flex: 1;
}

button {
    /* id="addTask"の設定 */
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: #0074b7;
    font-size: 1.1rem;
    color: white;
    cursor: pointer;
}

.controls {
    /* 残り件数表示 */
    display: flex;
    flex-direction: column;
    /* 縦並びに変更 */
    margin-bottom: 20px;
    gap: 0;
}

.controls-top {
    /* 残り件数表示 */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#taskCount {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
}

#taskCountNum {
    font-size: 2rem;
    font-weight: bold;
    color: #e86101;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

ul {
    list-style: none;
}

li {
    /* タスクボックスの設定 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #d5d5d5;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
}

.task-text {
    /* 登録タスクカードの設定 */
    font-size: 1.3rem;
    flex: 1;
    cursor: pointer;
}

.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.edit-btn {
    /* 追加ボタン設定 */
    font-size: 1.1rem;
    background: #00a6cb;
}

.delete-btn {
    /* 削除ボタン設定 */
    font-size: 1.1rem;
    background: #9e0000;
}

/* 削除チェックボックス設定 */
.delete-confirm-toggle {
    margin-bottom: 0;
}

.delete-confirm-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    width: fit-content;
}

.delete-confirm-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff0000;
    /* チェック時の色 */
}

/* エラーメッセージ設定 */
#errorMsg {
    color: #fc4949;
    font-size: 0.9rem;
    margin-top: -15px;
    margin-bottom: 10px;
    display: none;
    /* 普段は非表示 */
}

#errorMsg.show {
    display: block;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.shake {
    animation: shake 0.3s ease;
}

/* 確認モーダル設定 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 400px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.modal-icon {
    font-size: 24px;
}

.modal-title {
    font-size: 1rem;
    font-weight: bold;
}

.modal-message {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ダークモード対応 */
body.dark .modal {
    background: #485e7d;
    color: white;

}

body.dark .modal-message p {
    color: #ffffff;
}

/* ダークモード */
body.dark {
    background: #111827;
}

body.dark .container {
    background: #1f2937;
    color: white;
}

body.dark li {
    background: #374151;
}

body.dark input,
body.dark select {
    background: #374151;
    color: white;
    border-color: #4b5563;
}

body.dark input::placeholder {
    color: #ffffff;
}

/* 上部に戻るアイコン設定 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;

    width: 50px;
    height: 50px;

    background: #4f46e5;
    color: white;
    text-decoration: none;

    display: flex;
    justify-content: center;
    align-items: center;

    border-radius: 50%;
    font-size: 24px;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: 0.3s;
}

.back-to-top:hover {
    opacity: 0.8;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        width: 90%;
        padding: 20px;
    }

    .input-area {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    #themeToggle {
        /* ダークモードアイコンの
        IDセレクタは、タグセレクタより、詳細度（優先度）が高い
        上記のbuttonで、設定されるが、アイコンだけ上書きする*/
        width: auto;
    }

    li {
        /* タスクアイテムを縦並びに変更 */
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .task-text {
        /* タスクテキストを全幅表示 */
        width: 100%;
        word-break: break-all;
    }

    .action-buttons {
        /* ボタンを右寄せ・全幅に */
        width: 100%;
        justify-content: flex-end;
    }

    .action-buttons button {
        /* 編集・削除ボタンは幅を均等に */
        flex: 1;
    }
}