:root {
  color-scheme: dark;
  --bg: #07111f;
  --ink: #f6f8fb;
  --panel-ink: #172033;
  --muted: #aab5c5;
  --panel-muted: #617087;
  --surface: rgba(248, 251, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(213, 223, 237, 0.78);
  --accent: #37c7d0;
  --accent-strong: #1497a7;
  --warm: #dc143c;
  --gold: #d6a94f;
  --low: #4ba3ff;
  --medium: #d6a94f;
  --high: #dc143c;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Inter", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    linear-gradient(145deg, rgba(220, 20, 60, 0.34) 0%, rgba(220, 20, 60, 0.14) 21%, transparent 46%),
    linear-gradient(215deg, rgba(55, 199, 208, 0.14) 0%, transparent 36%),
    linear-gradient(180deg, #030712 0%, #07111f 46%, #0b1728 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.header {
  padding: 12px 2px 18px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.title-row > div {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.12;
  letter-spacing: 0;
  color: var(--ink);
  font-weight: 900;
}

.task-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.progress-ring {
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--panel-ink);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 800;
}

.progress-track {
  height: 9px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  transition: width 220ms ease;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 2;
  padding: 10px 0 16px;
  backdrop-filter: blur(14px);
}

.add-form input {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(226, 234, 245, 0.92);
  border-radius: 8px;
  padding: 0 16px;
  outline: none;
  background: rgba(250, 253, 255, 0.96);
  color: var(--panel-ink);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.add-form input::placeholder {
  color: #79889c;
}

.add-form input:focus {
  border-color: rgba(55, 199, 208, 0.72);
  box-shadow: 0 0 0 4px rgba(55, 199, 208, 0.14);
}

.add-form > button[type="submit"] {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-strong), #1a2740);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 14px 28px rgba(34, 36, 42, 0.18);
}

.priority-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.priority-option {
  min-height: 28px;
  border: 1px solid rgba(226, 234, 245, 0.88);
  border-radius: 7px;
  background: rgba(248, 251, 255, 0.88);
  box-shadow: none;
  color: var(--panel-muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.priority-option.is-active {
  color: #fff;
}

.priority-option.priority-low.is-active {
  background: var(--low);
}

.priority-option.priority-medium.is-active {
  background: var(--medium);
}

.priority-option.priority-high.is-active {
  background: var(--high);
}

.list-panel {
  padding-top: 2px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.filter {
  min-height: 40px;
  border: 1px solid rgba(226, 234, 245, 0.82);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.86);
  color: var(--panel-muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.filter.is-active {
  border-color: transparent;
  background: var(--accent-strong);
  color: #fff;
}

.todo-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 0 18px;
  list-style: none;
}

.todo-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 38px 38px;
  align-items: center;
  column-gap: 11px;
  min-height: 72px;
  border: 1px solid rgba(226, 234, 245, 0.9);
  border-radius: 8px;
  padding: 13px 10px 13px 14px;
  background: var(--surface);
  color: var(--panel-ink);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.2);
}

.todo-item.priority-low {
  border-left: 6px solid var(--low);
  background:
    linear-gradient(90deg, rgba(75, 163, 255, 0.16), transparent 42%),
    var(--surface);
}

.todo-item.priority-medium {
  border-left: 6px solid var(--medium);
  background:
    linear-gradient(90deg, rgba(214, 169, 79, 0.18), transparent 42%),
    var(--surface);
}

.todo-item.priority-high {
  border-left: 6px solid var(--high);
  background:
    linear-gradient(90deg, rgba(220, 20, 60, 0.18), transparent 42%),
    var(--surface);
}

.todo-text {
  grid-column: 2;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.35;
}

.priority-pill {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(23, 32, 51, 0.16);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.priority-pill:active {
  transform: scale(0.94);
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.12);
}

.priority-low .priority-pill {
  background: var(--low);
}

.priority-medium .priority-pill {
  background: var(--medium);
}

.priority-high .priority-pill {
  background: var(--high);
}

.todo-item.is-done .todo-text {
  color: var(--panel-muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.check-button,
.delete-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
}

.check-button {
  border: 2px solid rgba(55, 199, 208, 0.52);
  background: rgba(255, 255, 255, 0.92);
}

.todo-item.is-done .check-button {
  border-color: var(--accent);
  background: var(--accent);
}

.todo-item.is-done .check-button::after {
  width: 10px;
  height: 16px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  content: "";
  transform: rotate(45deg) translate(-1px, -1px);
}

.delete-button {
  grid-column: 4;
  border: 0;
  background: rgba(220, 20, 60, 0.1);
  color: var(--warm);
  font-size: 1.5rem;
}

.empty-state {
  display: none;
  min-height: 240px;
  place-items: center;
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state.is-visible {
  display: grid;
}

.empty-mark {
  width: 72px;
  height: 72px;
  border: 2px dashed rgba(55, 199, 208, 0.46);
  border-radius: 50%;
  background:
    linear-gradient(var(--accent), var(--accent)) center / 28px 3px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 3px 28px no-repeat;
}

.empty-state p {
  margin: 14px 0 0;
  font-weight: 800;
}

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

@media (min-width: 680px) {
  .app-shell {
    padding-top: 46px;
  }

  h1 {
    font-size: 1.72rem;
  }
}
