:root {
    color: #1f2937;
    background-color: #f3f6fb;
    font-family: "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
    font-synthesis: none;
    line-height: 1.6;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(180deg, #edf4ff 0, #f8fafc 280px);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

main {
    width: min(calc(100% - 32px), 720px);
    margin-inline: auto;
    padding-block: 40px 64px;
}

h1 {
    margin: 0 0 24px;
    color: #102a43;
    font-size: clamp(1.75rem, 7vw, 2.5rem);
    line-height: 1.3;
    text-align: center;
}

#taskForm {
    display: grid;
    gap: 12px;
    padding: 20px;
    border: 1px solid #dbe5f0;
    border-radius: 16px;
    background-color: #ffffff;
    box-shadow: 0 12px 32px rgb(15 43 68 / 8%);
}

#taskForm label {
    color: #334e68;
    font-weight: 700;
}

#taskInput {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #9fb3c8;
    border-radius: 8px;
    color: #102a43;
    background-color: #ffffff;
}

#taskInput::placeholder {
    color: #627d98;
}

#taskInput:focus-visible,
button:focus-visible,
#taskList input:focus-visible + label {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

#taskForm button {
    min-height: 48px;
    padding: 10px 20px;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: #ffffff;
    background-color: #2563eb;
    font-weight: 700;
}

#message {
    min-height: 1.6em;
    margin: 10px 4px 0;
    color: #b42318;
    font-size: 0.875rem;
}

#taskList {
    display: grid;
    gap: 12px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

#taskList:empty::before {
    padding: 32px 20px;
    border: 1px dashed #9fb3c8;
    border-radius: 12px;
    color: #627d98;
    content: "タスクはまだありません";
    text-align: center;
}

#taskList li {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 16px;
    overflow-wrap: anywhere;
    border: 1px solid #dbe5f0;
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 6px 18px rgb(15 43 68 / 6%);
}

#taskList li:has(input:checked) {
    border-color: #a7d7c5;
    background-color: #f0fdf8;
    color: #52606d;
}

#taskList input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #16835b;
}

#taskList label {
    color: #486581;
    font-size: 0.875rem;
}

#taskList button {
    min-height: 36px;
    margin-left: auto;
    padding: 6px 12px;
    border: 1px solid #f4b4ae;
    border-radius: 8px;
    color: #b42318;
    background-color: #fff7f6;
    font-weight: 700;
}

@media (hover: hover) {
    #taskForm button:hover {
        border-color: #1d4ed8;
        background-color: #1d4ed8;
    }

    #taskList button:hover {
        border-color: #e77970;
        background-color: #fee4e2;
    }
}

@media (min-width: 640px) {
    main {
        padding-top: 64px;
    }

    #taskForm {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 24px;
    }

    #taskForm label {
        grid-column: 1 / -1;
    }

    #taskForm button {
        min-width: 112px;
    }
}
