* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", sans-serif;
    background-color: #e0e5ec;
    color: #4a5568;
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    width: 100%;
    max-width: 560px;
    margin: auto;
    padding: 16px 16px 94px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}

h1,
h2 {
    font-weight: 600;
}

#todoTitle {
    font-size: 20px;
}

button,
input {
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: #4a5568;
}

button,
.panel,
.input-bar {
    border-radius: 16px;
    box-shadow:
        8px 8px 16px #bec3c9,
        -8px -8px 16px #ffffff;
}

button {
    cursor: pointer;
    padding: 14px 18px;
}

button:active {
    box-shadow:
        inset 4px 4px 8px #bec3c9,
        inset -4px -4px 8px #ffffff;
}

#items,
#todosList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#items > * + *::before,
#todosList > * + *::before {
    content: "";
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0,0,0,0.06);
}

.item {
    position: relative;
    padding: 8px 6px 8px 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.item label {
    flex: 1;
    cursor: pointer;
    word-break: break-word;
}

.item input[type="checkbox"] {
    appearance: none;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 8px;
    background: #e0e5ec;
    box-shadow:
        inset 2px 2px 5px #bec3c9,
        inset -2px -2px 5px #ffffff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.input-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border-radius: 24px;
    max-width: 560px;
    margin: auto;
    padding: 12px 16px 12px 20px;
    background: #e0e5ec;
    z-index: 100;
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: center;
}

.autocomplete-wrapper {
    flex: 1;
    position: relative;
}

input {
    width: 100%;
    padding: 0;
}

#autocomplete {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #e0e5ec;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        8px 8px 16px #bec3c9,
        -8px -8px 16px #ffffff;
}

.suggestion {
    padding: 14px;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.undo {
    margin-top: 20px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px;
    background: #e0e5ec;
    box-shadow:
        inset 4px 4px 8px #bec3c9,
        inset -4px -4px 8px #ffffff;
}

.panel {
    padding: 20px;
    margin-bottom: 24px;
    background: #e0e5ec;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.new-todo {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.todo-row {
    position: relative;
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.todo-row.active {
    font-weight: bold;
}

.pending-remove {
    opacity: 0.5;
}

.subtle-btn {
    margin-top: 20px;
    padding: 0;
    font-size: 11px;
    background: transparent;
    box-shadow: none !important;
    opacity: 0.5;
}

.icon-btn {
    width: 40px;
    height: 40px;
    padding: 10px 0;
    line-height: 20px;
    text-align: center;
}

.danger {
    color: #c53030;
}

@media (max-width: 400px) {
    .input-area {
        flex-wrap: wrap;
    }

    button {
        padding: 12px 14px;
    }
}
