:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel-2: #182235;
  --panel-3: #101827;
  --text: #e8eefc;
  --muted: #9fb0cc;
  --accent: #6c8dff;
  --accent-hover: #5d7ef0;
  --accent-soft: rgba(108, 141, 255, 0.14);
  --border: #27324a;
  --success-bg: rgba(67, 160, 71, 0.14);
  --input-bg: #0f1728;
  --edit-bg: #0d1628;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #0a1020 0%, #0d1424 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  padding: 20px;
}

.container {
  width: min(760px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.page-label {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2.25rem);
  color: #f4f7ff;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #1b2842;
  color: #a9bcff;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid #32425f;
}

.home-btn:hover {
  background: #22304d;
}

.list-subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

#addForm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 20px;
  align-items: start;
}

#itemInput,
.inline-edit-input {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
  white-space: pre-wrap;
}

#itemInput::placeholder,
.inline-edit-input::placeholder {
  color: #7f91b0;
}

#itemInput:focus,
.inline-edit-input:focus {
  border-color: #4f71db;
  box-shadow: 0 0 0 4px rgba(108, 141, 255, 0.14);
}

#addBtn,
.clear-btn,
.action-btn {
  min-height: 44px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

#addBtn:hover,
.clear-btn:hover,
.action-btn:hover {
  transform: translateY(-1px);
}

#addBtn {
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
}

#addBtn:hover {
  background: var(--accent-hover);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-3);
}

.checklist-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
}

.checklist-item.selected {
  background: var(--success-bg);
}

.item-check {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  accent-color: var(--accent);
}

.item-content {
  min-width: 0;
}

.item-text {
  margin: 0;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

.checklist-item.selected .item-text {
  text-decoration: line-through;
  color: var(--muted);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action-btn {
  padding: 9px 12px;
  background: #1b2842;
  color: #a9bcff;
  border: 1px solid #32425f;
}

.action-btn:hover {
  background: #22304d;
}

.action-btn.save-btn {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.action-btn.save-btn:hover {
  background: var(--accent-hover);
}

.inline-edit-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
}

.inline-edit-input {
  background: var(--edit-bg);
}

.clear-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px 18px;
  background: #24324d;
  color: #dce7ff;
  border: 1px solid #314465;
}

.clear-btn:hover {
  background: #2a3b5c;
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  .container {
    padding: 18px;
    border-radius: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  #addForm {
    grid-template-columns: 1fr;
  }

  .checklist-item {
    grid-template-columns: auto 1fr;
  }

  .item-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .inline-edit-wrap {
    flex-direction: column;
    align-items: stretch;
  }
}
