:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #12151a;
  --surface-raised: #181c22;
  --text: #f2f4f7;
  --muted: #8d96a3;
  --line: #272c34;
  --focus: #7aa2f7;
  --high: #ff6b6b;
  --medium: #f2c14e;
  --low: #58c4a3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.task-card {
  min-height: calc(100vh - 20px);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}

.task-form input,
.task-form select,
.task-form button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-form input,
.task-form select {
  background: var(--surface-raised);
  color: var(--text);
}

.task-form input { min-width: 0; padding: 0 11px; outline: none; }
.task-form input::placeholder { color: var(--muted); }
.task-form select { padding: 0 28px 0 10px; }
.task-form button { padding: 0 15px; background: var(--text); color: var(--bg); font-weight: 750; }

.task-form input:focus-visible,
.task-form select:focus-visible,
.task-form button:focus-visible,
.task-priority:focus-visible,
.delete-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.form-message { min-height: 18px; margin: 4px 0 0; color: var(--high); font-size: 0.75rem; }

.list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 7px;
  border-bottom: 1px solid var(--line);
}

.list-meta p { margin: 0; color: var(--muted); font-size: 0.7rem; }
.sort-note { text-transform: uppercase; letter-spacing: 0.08em; }

.task-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.task-checkbox-control { display: grid; place-items: center; cursor: pointer; }
.task-checkbox-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.checkmark { display: grid; flex: 0 0 auto; place-items: center; width: 20px; height: 20px; border: 1.5px solid #606978; border-radius: 5px; }
.task-checkbox-control input:focus-visible + .checkmark { outline: 2px solid var(--focus); outline-offset: 2px; }
.task-checkbox-control input:checked + .checkmark { border-color: var(--muted); background: var(--muted); }
.task-checkbox-control input:checked + .checkmark::after { content: "✓"; color: var(--bg); font-size: 0.72rem; font-weight: 900; }

.task-content { min-width: 0; }
.task-text { overflow-wrap: anywhere; line-height: 1.25; }
.task-priority {
  width: 78px;
  min-height: 34px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 0.68rem;
  font-weight: 750;
}
.priority-high { color: var(--high); }
.priority-medium { color: var(--medium); }
.priority-low { color: var(--low); }
.is-complete { opacity: 0.52; }
.is-complete .task-text { text-decoration: line-through; text-decoration-thickness: 1.5px; }

.delete-button { min-width: 40px; min-height: 40px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-size: 0.7rem; }
.delete-button:hover { color: var(--high); }

.empty-state { padding: 28px 0; color: var(--muted); text-align: center; font-size: 0.8rem; }
.empty-state p { margin: 0; }

@media (max-width: 420px) {
  .app-shell { padding-inline: 0; }
  .task-card { min-height: 100vh; border-inline: 0; border-radius: 0; }
  .task-form select { width: 88px; }
}
