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


:root {
  --orange:  #f5a030;
  --blue:    #3a6bbf;
  --teal:    #3ab5b0;
  --coral:   #d95f3b;
  --cream:   #ffffff;
  --card:    #f8f8f8;
  --card-done: #f8f8f8;
  --ink:     #1a1a1a;
  --muted:   #888;
}

@keyframes ghost-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-14px); }
}

#loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  z-index: 9999;
  transition: opacity 0.4s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading-ghost {
  animation: ghost-float 1.6s ease-in-out infinite;
  opacity: 0.5;
}

body {
  font-family: 'Mulish', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 60px 20px;
  scrollbar-gutter: stable both-edges;
  touch-action: manipulation;
}

.container {
  width: 100%;
  max-width: 520px;
}

h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #000;
  margin-bottom: 28px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.add-btn {
  margin-right: 4px;
  padding: 5px 14px;
  border-radius: 999px;
  border: none;
  background: var(--teal);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.add-btn:hover { background: #37a08a; }

.status {
  width: 26px;
  height: 26px;
  margin-left: auto;
  border-radius: 50%;
  background: #e0e0e0;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Material Symbols Rounded';
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s, color 0.2s, opacity 0.4s;
  cursor: default;
  flex-shrink: 0;
  user-select: none;
}

.status.loading { background: #e0e0e0; color: #aaa; animation: spin 1s linear infinite; }
.status.saving  { background: #fdefc3; color: #8a6200; }
.status.saved   { background: #c4ede5; color: #1e6e5a; }
.status.faded   { opacity: 0; }
.status.error   { background: #f5cfc4; color: #8a2010; }
.status.offline { background: #e8e0f5; color: #5a3a8a; }

@keyframes spin { to { transform: rotate(360deg); } }

#pull-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-48px);
  opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.2s;
  z-index: 9999;
  pointer-events: none;
}

[data-theme="dark"] #pull-indicator img,
body.dark #pull-indicator img { filter: invert(1); }

@keyframes todoFadeOut {
  0%   { opacity: 1; transform: scale(1);    max-height: 80px; }
  40%  { opacity: 0; transform: scale(1.04); max-height: 80px; }
  100% { opacity: 0; transform: scale(1.04); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; }
}

li.completing {
  animation: todoFadeOut 0.2s ease-in forwards;
  pointer-events: none;
  overflow: hidden;
}


form#todo-form {
  display: none;
  gap: 0;
  margin-bottom: 16px;
  background: whitesmoke;
  border-radius: 999px;
  padding: 4px 4px 4px 20px;
  align-items: center;
}

@keyframes formPop {
  0%   { opacity: 0; transform: scale(0.95); }
  60%  { opacity: 1; transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1);    }
}

form#todo-form.visible {
  display: flex;
  animation: formPop 0.18s ease-out forwards;
}

input[type="text"] {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 0;
  font-size: 0.95rem;
  font-family: 'Mulish', sans-serif;
  font-weight: 600;
  background: transparent;
  outline: none;
  color: var(--ink);
  min-width: 0;
}

input[type="text"]::placeholder { color: var(--muted); font-weight: 400; }

button[type="submit"] {
  padding: 8px 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

button[type="submit"]:hover { background: #2e5fa8; }

ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }

li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  background: var(--card);
  border-radius: 999px;
}

li.done { background: var(--card-done); }

li.done .todo-text {
  text-decoration: line-through;
  color: var(--muted);
}

.check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

li.done .check {
  background: var(--teal);
  border-color: var(--teal);
}

li.done .check::after {
  content: '';
  display: block;
  width: 4px;
  height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

.todo-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.todo-text {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  cursor: text;
}

.todo-edit {
  flex: 1;
  font-family: 'Mulish', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  border: none;
  background: transparent;
  outline: none;
  padding: 0;
  min-width: 0;
  width: 100%;
}

.due-label {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}


.due-label:hover { opacity: 0.7; }

.add-due {
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.add-due:hover { color: var(--ink); }

#picker-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 998;
}

#due-picker {
  position: fixed;
  background: var(--card);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 999;
}

#due-picker.open { display: flex; }

#picker-quick-btns {
  display: flex;
  gap: 4px;
}

.picker-quick-btn {
  flex: 1;
  font-family: 'Mulish', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 0;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.picker-quick-btn:hover { background: whitesmoke; }

#due-picker-input {
  font-family: 'Mulish', sans-serif;
  font-size: 16px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
  color: var(--ink);
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}

#due-clear-btn {
  font-family: 'Mulish', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 2px 0;
}

#due-clear-btn:hover { color: var(--coral); }

.delete-wrap {
  flex-shrink: 0;
  display: none;
  align-items: center;
}

.delete {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  transform: translateY(-2px);
}

.delete:hover { color: var(--muted); }

.delete-confirm {
  display: flex;
  align-items: center;
  gap: 4px;
}

.delete-yes {
  font-size: 0.75rem;
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
}

.delete-yes:hover { background: var(--orange); color: #1a1a1a; }

.delete-cancel {
  font-size: 0.75rem;
  background: none;
  color: var(--muted);
  border: none;
  cursor: pointer;
  padding: 2px 4px;
}

.delete-cancel:hover { color: var(--ink); }

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 16px 0;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field {
  background: whitesmoke;
  border-radius: 999px;
  padding: 4px 4px 4px 20px;
  display: flex;
  align-items: center;
}

.auth-field input {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  font-family: 'Mulish', sans-serif;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
}

.auth-field input::placeholder { color: var(--muted); font-weight: 400; }

#auth-form button {
  padding: 12px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s;
}

#auth-form button:hover { background: #2e5fa8; }

#auth-error {
  font-size: 0.82rem;
  color: var(--coral);
  padding: 4px 20px;
  min-height: 1.2em;
}

#ghost-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#ghost-btn:hover { opacity: 0.7; }

#settings-menu {
  position: fixed;
  background: var(--card);
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 999;
  min-width: 160px;
}

#settings-menu.open { display: flex; }

.settings-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 6px;
  font-family: 'Mulish', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  width: 100%;
}

.settings-item:hover { background: whitesmoke; }

.settings-icon {
  font-family: 'Material Symbols Rounded';
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}

.theme-active-icon {
  font-family: 'Material Symbols Rounded';
  font-size: 14px;
  line-height: 1;
  color: var(--coral);
  margin-left: auto;
}

.settings-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 2px 0;
}

.submenu-arrow {
  margin-left: auto;
  transition: transform 0.15s;
}

.settings-submenu-toggle.open .submenu-arrow {
  transform: rotate(90deg);
}

.settings-submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
}

.settings-submenu.open {
  display: flex;
}

.settings-credit {
  font-size: 0.7rem;
  color: var(--muted);
  padding: 6px 10px 4px;
  line-height: 1.4;
}

@media (max-width: 480px) {
  body { padding: 40px 24px; }
  li { padding: 10px 14px; gap: 8px; }
  .todo-text { font-size: 0.9rem; }
.delete-yes, .delete-cancel { font-size: 0.72rem; }
  button[type="submit"] { padding: 8px 14px; font-size: 0.78rem; }
}



.done-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--card);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

.done-header:hover { background: #e8e8e8; }

.done-header > span:first-child {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.done-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.done-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.clear-done-btn {
  font-family: 'Mulish', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.clear-done-btn:hover { color: var(--coral); }

.color-btn {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #ddd;
  padding: 0;
  display: flex;
}

#color-picker {
  position: fixed;
  background: var(--card);
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  display: none;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  z-index: 999;
}

#color-picker.open { display: flex; }

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.12);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.color-swatch.clear {
  background: whitesmoke;
  font-size: 0.7rem;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* ── inline icons in todo text ─────────────────────────────── */
i.todo-icon {
  font-size: 1em;
  vertical-align: -0.1em;
  margin: 0 0.1em;
}

/* ── icon picker dropdown ──────────────────────────────────── */
#icon-dropdown {
  display: none;
  position: fixed;
  z-index: 9999;
  background: var(--cream, #fff);
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 160px;
}

#icon-dropdown.visible { display: block; }

.icon-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.icon-item:hover,
.icon-item.active { background: rgba(0,0,0,0.07); }

body.dark .icon-item:hover,
body.dark .icon-item.active,
body.jellybean-dark .icon-item:hover,
body.jellybean-dark .icon-item.active,
body.spooky .icon-item:hover,
body.spooky .icon-item.active { background: rgba(255,255,255,0.15); }

.icon-picker-img  { font-size: 1.1rem; width: 20px; text-align: center; }
.icon-picker-name { font-size: 0.88rem; color: var(--muted, #888); }

/* ── landing banner ────────────────────────────────────────── */
#landing-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card, #f8f8f8);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 100;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #888);
  white-space: nowrap;
}
#landing-bar.hidden { display: none; }
body.demo-mode { padding-top: 80px; }
@media (max-width: 480px) {
  body.demo-mode { padding-top: 68px; }
  #landing-bar { font-size: 0.72rem; padding: 7px 14px; white-space: normal; text-align: center; max-width: 80vw; }
}

/* ── login modal ───────────────────────────────────────────── */
#login-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
}
#login-backdrop.open { display: block; }

#login-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10001;
  background: var(--cream, #fff);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: min(320px, 90vw);
  padding: 20px;
  flex-direction: column;
  gap: 0;
}
#login-modal.open { display: flex; }

#login-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}
#login-modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted, #888);
  line-height: 1;
  padding: 0 2px;
}
#login-modal #auth-error { padding: 4px 0; }
