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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --text: #e0e0e0;
  --muted: #888;
  --accent: #e94560;
  --accent2: #0f3460;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px calc(80px + var(--safe-bottom));
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
  flex-shrink: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
  line-height: 1;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

#list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition:
    opacity 0.2s,
    transform 0.2s;
  animation: slidein 0.25s ease-out;
}

@keyframes slidein {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#list li.checked {
  opacity: 0.55;
}

#list li.checked .name {
  text-decoration: line-through;
  color: var(--muted);
}

.drag-handle {
  color: var(--muted);
  font-size: 14px;
  cursor: grab;
  user-select: none;
}

.check-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.check-btn:hover {
  border-color: var(--accent);
}

.name {
  flex: 1;
  cursor: pointer;
  padding: 4px 0;
  font-size: 17px;
}

.del-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
  opacity: 0.5;
}

.del-btn:hover {
  color: var(--accent);
  background: rgba(233, 69, 96, 0.15);
  opacity: 1;
}

#addForm {
  display: flex;
  gap: 8px;
  padding: 12px 0 calc(12px + var(--safe-bottom));
  background: var(--bg);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
}

#input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid var(--accent2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  outline: none;
  transition: border-color 0.2s;
}

#input:focus {
  border-color: var(--accent);
}

#input::placeholder {
  color: var(--muted);
}

#addForm button[type="submit"] {
  width: 52px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

#addForm button[type="submit"]:hover {
  opacity: 0.85;
}

#addForm button[type="submit"]:active {
  opacity: 0.7;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #1a1a2e;
    --muted: #999;
    --accent: #e94560;
    --accent2: #ddd;
  }

  #input {
    background: #fff;
    border-color: #ccc;
  }
}
