:root {
  --bg-0: #0f1419;
  --bg-1: #171d25;
  --bg-2: #1e2630;
  --bg-3: #263040;
  --line: rgba(232, 220, 196, 0.1);
  --text: #e8dcc4;
  --text-muted: #8a8070;
  --accent: #3dba8c;
  --accent-dim: rgba(61, 186, 140, 0.15);
  --accent-hover: #4fd4a0;
  --danger: #e07a5f;
  --danger-dim: rgba(224, 122, 95, 0.12);
  --running: #f0b429;
  --running-dim: rgba(240, 180, 41, 0.14);
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(61, 186, 140, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(240, 180, 41, 0.08), transparent 45%),
    linear-gradient(165deg, var(--bg-0) 0%, #121820 50%, var(--bg-0) 100%);
  background-attachment: fixed;
}

.app {
  width: min(640px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.header {
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-dim); }
  50% { box-shadow: 0 0 0 7px rgba(61, 186, 140, 0.08); }
}

.brand-name {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-sub {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.create-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.create-form input,
.field input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.create-form input:focus,
.field input:focus {
  border-color: rgba(61, 186, 140, 0.45);
  background: var(--bg-2);
}

.create-form input::placeholder {
  color: var(--text-muted);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.75rem 1.1rem;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

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

.btn-primary {
  background: var(--accent);
  color: #0a1210;
  white-space: nowrap;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-2);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(224, 122, 95, 0.3);
}

.btn-danger:hover {
  background: rgba(224, 122, 95, 0.22);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  font-size: 0.85rem;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.btn-icon:hover {
  background: var(--bg-2);
  border-color: rgba(232, 220, 196, 0.2);
}

.btn-icon.is-running {
  background: var(--running-dim);
  border-color: rgba(240, 180, 41, 0.35);
  color: var(--running);
}

.btn-icon.is-danger:hover {
  background: var(--danger-dim);
  border-color: rgba(224, 122, 95, 0.35);
  color: var(--danger);
}

.filters {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter {
  flex: 1;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.filter:hover {
  color: var(--text);
}

.filter.is-active {
  color: var(--text);
  background: var(--bg-3);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: start;
  padding: 1rem 1.1rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: enter 0.25s ease-out;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.task.is-running {
  border-color: rgba(240, 180, 41, 0.3);
  background: linear-gradient(135deg, var(--bg-1), var(--running-dim));
}

.task.is-done {
  opacity: 0.72;
}

.task.is-done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-main {
  min-width: 0;
}

.task-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.task-time {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.task.is-running .task-time {
  color: var(--running);
}

.task-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--running);
  background: var(--running-dim);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
  margin: 0;
}

.total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.95rem 1.1rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-top: 2px solid rgba(61, 186, 140, 0.35);
}

.total[hidden] {
  display: none;
}

.total-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.total-time {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.list-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.85rem;
}

.list-actions[hidden] {
  display: none;
}

.modal {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--bg-1);
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: min(400px, calc(100% - 2rem));
  width: 100%;
}

.modal::backdrop {
  background: rgba(8, 10, 14, 0.65);
  backdrop-filter: blur(4px);
}

.modal-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.field input {
  width: 100%;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.modal-actions .btn-primary {
  flex: 1;
}

@media (max-width: 520px) {
  .app {
    padding-top: 1.5rem;
  }

  .task {
    grid-template-columns: 1fr;
  }

  .task-actions {
    justify-content: flex-start;
  }

  .create-form {
    flex-direction: column;
  }
}
