:root {
  --bg: #06070f;
  --bg-grid: #0a0e1c;
  --card: #0c1122;
  --card2: #0f1730;
  --line: #1e3a5f;
  --line-bright: #2c5f8a;
  --text: #d9f6ff;
  --muted: #6d84ab;
  --accent: #00f0ff;
  --accent-dim: #0a8fa8;
  --accent2: #ff2bd6;
  --accent2-dim: #a4159b;
  --warn: #ffe93b;
  --danger: #ff3864;
  --success: #39ff9d;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 500px at 12% -10%, rgba(255, 43, 214, .16), transparent 60%),
    radial-gradient(ellipse 900px 600px at 100% 0%, rgba(0, 240, 255, .14), transparent 55%),
    repeating-linear-gradient(0deg, rgba(0, 240, 255, .035) 0px, rgba(0, 240, 255, .035) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(90deg, rgba(0, 240, 255, .035) 0px, rgba(0, 240, 255, .035) 1px, transparent 1px, transparent 28px),
    var(--bg);
  color: var(--text);
  font-family: "Share Tech Mono", "Consolas", "Malgun Gothic", monospace;
  font-size: 15px;
  line-height: 1.55;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, .12) 1px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 3px
  );
  mix-blend-mode: overlay;
  opacity: .5;
}

.wrap { max-width: 840px; margin: 0 auto; padding: 32px 16px 64px; position: relative; }

.head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.head h1 {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 22px;
  margin: 0;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 6px rgba(0, 240, 255, .55), 0 0 18px rgba(0, 240, 255, .25);
}
.head h1 .accent { color: var(--accent2); text-shadow: 0 0 6px rgba(255, 43, 214, .65); }
.head a { color: inherit; text-decoration: none; }

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  font-family: "Share Tech Mono", monospace;
}
.user-bar button { padding: 6px 12px; font-size: 12px; }

.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 0 0 1px rgba(0, 240, 255, .04), 0 0 24px rgba(0, 240, 255, .06), inset 0 1px 0 rgba(255, 255, 255, .02);
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  opacity: .8;
}
.card::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 14px; height: 14px;
  border-bottom: 2px solid var(--accent2);
  border-right: 2px solid var(--accent2);
  opacity: .8;
}

.card h2 {
  margin: 0 0 16px;
  font-family: "Orbitron", sans-serif;
  font-size: 16px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
}

.add-form { display: flex; flex-wrap: wrap; gap: 8px; }
.add-form .grow { flex: 1 1 260px; }
.add-form .memo-input { flex: 1 1 100%; resize: vertical; }

input[type="text"], input[type="search"], input[type="date"], input[type="password"], select, textarea {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font: inherit;
  background: #060a16;
  color: var(--text);
  caret-color: var(--accent);
}

input::placeholder, textarea::placeholder { color: #3f5578; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, .18), 0 0 10px rgba(0, 240, 255, .25);
}

select option { background: #060a16; color: var(--text); }

button, .btn {
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: rgba(0, 240, 255, .08);
  color: var(--accent);
  font: inherit;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: box-shadow .15s ease, background-color .15s ease, transform .05s ease;
}

button:hover, .btn:hover {
  background: rgba(0, 240, 255, .18);
  box-shadow: 0 0 12px rgba(0, 240, 255, .45);
}
button:active, .btn:active { transform: translateY(1px); }

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn.ghost:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 240, 255, .06);
  box-shadow: 0 0 10px rgba(0, 240, 255, .2);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover {
  background: rgba(255, 56, 100, .12);
  box-shadow: 0 0 12px rgba(255, 56, 100, .45);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.stats {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
}
.stats strong { color: var(--accent); font-weight: 700; }

.filters { display: flex; gap: 6px; }

.chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-family: "Orbitron", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: box-shadow .15s ease, background-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--accent-dim); color: var(--text); }

.chip.on {
  background: rgba(0, 240, 255, .14);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 240, 255, .3);
}

.search { margin-left: auto; display: flex; gap: 6px; }

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

.todo {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-dim);
  border-radius: 3px;
  padding: 12px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.todo:hover { border-left-color: var(--accent); box-shadow: 0 0 14px rgba(0, 240, 255, .12); }

.todo.is-done { opacity: .55; border-left-color: var(--success); }
.todo.is-done .title { text-decoration: line-through; text-decoration-color: var(--success); }

.check {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(0, 240, 255, .5);
}
.is-done .check { color: var(--success); text-shadow: 0 0 6px rgba(57, 255, 157, .6); }

.body { flex: 1; min-width: 0; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.title { font-weight: 700; word-break: break-word; color: var(--text); }

.badge {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "Orbitron", sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge.p-high { background: rgba(255, 43, 214, .1); border-color: var(--accent2); color: var(--accent2); text-shadow: 0 0 6px rgba(255, 43, 214, .4); }
.badge.p-normal { background: rgba(0, 240, 255, .08); border-color: var(--accent-dim); color: var(--accent); }
.badge.p-low { background: rgba(109, 132, 171, .08); border-color: var(--line); color: var(--muted); }
.badge.due.over {
  background: rgba(255, 56, 100, .12);
  border-color: var(--danger);
  color: var(--danger);
  text-shadow: 0 0 6px rgba(255, 56, 100, .5);
  animation: pulse-danger 1.6s ease-in-out infinite;
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 56, 100, 0); }
  50% { box-shadow: 0 0 10px rgba(255, 56, 100, .45); }
}

.memo { margin: 6px 0 0; color: #a9c3e0; white-space: pre-wrap; }
.meta { margin: 6px 0 0; font-size: 11px; color: var(--muted); }

.actions { display: flex; gap: 6px; align-items: center; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 4px;
  font-family: "Orbitron", sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-size: 13px;
}

.clear { margin-top: 16px; text-align: right; }

.edit-form { display: grid; gap: 12px; }
.edit-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-family: "Orbitron", sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.edit-form .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.edit-form .row.end { justify-content: flex-end; }
.edit-form label.inline { display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--text); text-transform: none; }

.auth-card { max-width: 360px; margin: 40px auto 0; }
.auth-switch { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--accent); text-shadow: 0 0 6px rgba(0, 240, 255, .4); }

.flash { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.flash li {
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 13px;
  border: 1px solid transparent;
  font-family: "Share Tech Mono", monospace;
}
.flash-success { background: rgba(57, 255, 157, .08); border-color: var(--success); color: var(--success); }
.flash-error { background: rgba(255, 56, 100, .1); border-color: var(--danger); color: var(--danger); }

@media (max-width: 600px) {
  .search { margin-left: 0; width: 100%; }
  .search input { flex: 1; }
  .todo { flex-wrap: wrap; }
  .actions { width: 100%; justify-content: flex-end; }
}
