:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --card: rgba(17, 22, 32, 0.86);
  --text: #f4f6f8;
  --muted: #a2aab5;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #59e3c5;
  --accent-ink: #07231d;
  --shadow: rgba(0, 0, 0, 0.45);
  --font-title: "Cinzel", "Times New Roman", serif;
  --font-body: "Work Sans", "Helvetica", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(89, 227, 197, 0.18), transparent 45%),
    radial-gradient(circle at bottom right, rgba(120, 86, 255, 0.18), transparent 50%),
    var(--bg);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  z-index: 0;
}

body::before {
  background: #59e3c5;
  top: -80px;
  right: -60px;
}

body::after {
  background: #7856ff;
  bottom: -90px;
  left: -70px;
}

.app {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 24px 50px var(--shadow);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 1;
  animation: rise 0.6s ease;
}

@keyframes rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.header {
  text-align: center;
}

h1 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: 0.08em;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.add-form input {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(9, 13, 20, 0.8);
  color: var(--text);
  font-size: 1rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.add-form input::placeholder {
  color: #7f8894;
}

.add-form input:focus {
  outline: none;
  border-color: rgba(89, 227, 197, 0.5);
  box-shadow: 0 0 0 3px rgba(89, 227, 197, 0.15);
}

.list-section {
  display: grid;
  gap: 10px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.list::-webkit-scrollbar {
  width: 6px;
}

.list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 19, 28, 0.8);
  transition: border 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item.selected {
  border-color: rgba(89, 227, 197, 0.55);
  box-shadow: 0 0 0 2px rgba(89, 227, 197, 0.12);
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 10;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(360px, 100%);
  background: rgba(16, 20, 30, 0.95);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: 0 18px 30px var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-card input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(9, 13, 20, 0.8);
  color: var(--text);
  font-size: 1rem;
}

.modal-card input:focus {
  outline: none;
  border-color: rgba(89, 227, 197, 0.5);
  box-shadow: 0 0 0 3px rgba(89, 227, 197, 0.15);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.actions {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.result {
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.result.visible {
  opacity: 1;
  transform: translateY(0);
}

.count {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #1b2231;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 26px;
  width: 100%;
  box-shadow: 0 12px 24px rgba(89, 227, 197, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn:focus-visible {
  outline: 2px solid rgba(89, 227, 197, 0.55);
  outline-offset: 2px;
}

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

  .app {
    padding: 20px;
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .btn-primary,
  .btn-accent {
    width: 100%;
  }
}
