/* ============================================
   TICK — Design System
   Seamless. Zero friction. Every device.
   ============================================ */

/* --- Tokens --- */
:root {
  --bg:             #f5f5f7;
  --bg-card:        #ffffff;
  --bg-overlay:     rgba(255, 255, 255, 0.82);

  --text-primary:   #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary:  #aeaeb2;

  --accent:         #007aff;
  --accent-dark:    #0071e3;
  --accent-light:   rgba(0, 122, 255, 0.10);
  --success:        #30d158;
  --success-light:  rgba(48, 209, 88, 0.13);
  --danger:         #ff453a;
  --danger-light:   rgba(255, 69, 58, 0.10);

  --border:         rgba(0, 0, 0, 0.07);
  --border-strong:  rgba(0, 0, 0, 0.13);

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.0, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:             #000000;
    --bg-card:        #1c1c1e;
    --bg-overlay:     rgba(28, 28, 30, 0.85);
    --text-primary:   #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary:  #48484a;
    --accent:         #0a84ff;
    --accent-dark:    #409cff;
    --accent-light:   rgba(10, 132, 255, 0.15);
    --success:        #30d158;
    --success-light:  rgba(48, 209, 88, 0.15);
    --border:         rgba(255, 255, 255, 0.07);
    --border-strong:  rgba(255, 255, 255, 0.13);
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:  0 2px 12px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg:  0 8px 40px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.35);
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input { font-family: var(--font); }


/* ============================================
   NAV
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-overlay);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  flex: 1;
}

.nav-logo-mark {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.nav-action {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 980px;
  transition: background 160ms var(--smooth);
}
.nav-action:hover { background: var(--accent-light); }

.nav-delete {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-left: 4px;
  transition: background 160ms var(--smooth), color 160ms var(--smooth);
}
.nav-delete svg { width: 17px; height: 17px; }
.nav-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}


/* ============================================
   LANDING — HERO
   ============================================ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px 56px;
  max-width: 580px;
  margin: 0 auto;
}

/* Brand identity block */
.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.hero-logo-mark {
  width: 72px;
  height: 72px;
  color: var(--accent);
  filter: drop-shadow(0 4px 16px rgba(0, 122, 255, 0.25));
}

.hero-brand-name {
  font-size: clamp(52px, 14vw, 88px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-primary);
}

.hero-tagline {
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.25;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 5px 12px;
  border-radius: 980px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(32px, 7.5vw, 52px);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.028em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.hero-sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 36px;
  max-width: 400px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 980px;
  letter-spacing: -0.2px;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.30);
  transition: background 180ms var(--smooth),
              transform 120ms var(--smooth),
              box-shadow 180ms var(--smooth);
}
.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.35);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary svg { width: 17px; height: 17px; }

.hero-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}


/* ============================================
   YOUR LISTS
   ============================================ */
.your-lists {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px 32px;
}

.your-lists-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.your-lists-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.your-lists-items {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Long-press-to-remove wrapper */
.your-list-wrap {
  border-bottom: 1px solid var(--border);
  /* Prevent iOS text-selection popup on long press — applied here so it
     covers the wrap and ALL children without relying on inheritance */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.your-list-wrap:last-child { border-bottom: none; }

.your-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background 500ms linear;
}

/* Explicit on text node so WebKit doesn't override inheritance */
.your-list-name {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Holding state — item slowly turns red over the hold duration as visual countdown */
.your-list-wrap.holding .your-list-item {
  background: var(--danger-light);
  transition: background 480ms linear;
}
.your-list-wrap.holding .your-list-name {
  color: var(--danger);
  transition: color 480ms linear;
}
.your-list-item:hover { background: rgba(0,0,0,0.018); }
@media (prefers-color-scheme: dark) {
  .your-list-item:hover { background: rgba(255,255,255,0.025); }
}

.your-list-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.your-list-icon svg { width: 16px; height: 16px; }

.your-list-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.your-list-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}


/* ============================================
   LANDING — HOW IT WORKS
   ============================================ */
.how {
  padding: 0 24px 88px;
  max-width: 480px;
  margin: 0 auto;
}

.steps {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: none; }

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-body h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: -0.1px;
}
.step-body p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* ============================================
   CHECKLIST PAGE
   ============================================ */
.list-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 16px 120px;
}

/* Title */
.list-title-wrap {
  padding: 0 4px;
  margin-bottom: 28px;
}

.list-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
  width: 100%;
  line-height: 1.2;
  caret-color: var(--accent);
}
.list-title::placeholder { color: var(--text-tertiary); }

.list-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 6px;
  letter-spacing: 0.01em;
}

/* Progress */
.progress-wrap {
  margin-bottom: 20px;
  padding: 0 4px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 380ms var(--ease-out);
}

/* Items list */
.items-list {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 10px;
}

/* Individual item */
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  animation: slideIn 180ms var(--ease-out) both;
}
.item:last-child { border-bottom: none; }
.item:active { background: rgba(0,0,0,0.03); }
@media (prefers-color-scheme: dark) {
  .item:active { background: rgba(255,255,255,0.04); }
}

@keyframes slideIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Completed section divider */
.checked-divider {
  padding: 10px 16px 6px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.checked-divider span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* Checkbox */
.item-check {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1.75px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 180ms var(--smooth),
              background 180ms var(--smooth),
              transform 140ms var(--spring);
}
.item-check:hover {
  border-color: var(--success);
  background: var(--success-light);
}
.item-check:active { transform: scale(0.86); }

/* Checkmark icon */
.item-check svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 160ms var(--smooth),
              transform 200ms var(--spring);
}

.item.checked .item-check {
  background: var(--success);
  border-color: var(--success);
}
.item.checked .item-check svg {
  opacity: 1;
  transform: scale(1);
}

/* Item text input */
.item-text {
  flex: 1;
  font-size: 16px;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
  line-height: 1.4;
  caret-color: var(--accent);
  min-width: 0;
  transition: color 200ms var(--smooth);
}
.item-text::placeholder { color: var(--text-tertiary); }

.item.checked .item-text {
  color: var(--text-tertiary);
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
}

/* Add item */
.add-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: text;
  border: 1.5px solid transparent;
  transition: box-shadow 180ms var(--smooth),
              border-color 180ms var(--smooth);
}
.add-item:focus-within {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light);
}

.add-icon {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.add-icon svg { width: 12px; height: 12px; }

.add-input {
  flex: 1;
  font-size: 16px;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
  caret-color: var(--accent);
}
.add-input::placeholder { color: var(--text-tertiary); }


/* ============================================
   ACTION BAR
   ============================================ */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--bg-overlay);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  transition: transform 200ms var(--smooth);
}

.btn-share {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 28px;
  border-radius: 980px;
  width: 100%;
  max-width: 340px;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.28);
  transition: background 180ms var(--smooth),
              transform 120ms var(--smooth),
              box-shadow 180ms var(--smooth);
  letter-spacing: -0.1px;
}
.btn-share:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.32);
}
.btn-share:active { transform: scale(0.97); }
.btn-share svg { width: 16px; height: 16px; }

.btn-share.copied {
  background: var(--success);
  box-shadow: 0 2px 8px rgba(48, 209, 88, 0.30);
}


/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 44px 24px;
  color: var(--text-tertiary);
}
.empty-state svg {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  opacity: 0.3;
  display: block;
}
.empty-state p {
  font-size: 15px;
  line-height: 1.5;
}


/* ============================================
   ACTION SHEET (long-press delete confirmation)
   ============================================ */
.action-sheet-overlay {
  display: none; /* toggled by JS */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 400;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 240ms var(--smooth);
}
.action-sheet-overlay.visible { opacity: 1; }

.action-sheet {
  width: 100%;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 260ms cubic-bezier(0.34, 1.2, 0.64, 1);
  box-shadow: var(--shadow-lg);
}
.action-sheet-overlay.visible .action-sheet { transform: translateY(0); }

.action-sheet-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.action-sheet-sub {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}
.action-sheet-btn {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  margin-bottom: 10px;
  background: var(--bg);
  color: var(--text-primary);
  transition: opacity 120ms;
}
.action-sheet-btn:active { opacity: 0.7; }
.action-sheet-btn.danger {
  background: var(--danger);
  color: #fff;
}
.action-sheet-btn:last-child { margin-bottom: 0; }


/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--text-primary);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 980px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 200ms var(--smooth),
              transform 240ms var(--spring);
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  letter-spacing: 0.01em;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================
   SPINNER
   ============================================ */
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 650ms linear infinite;
  margin: 56px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 600px) {
  .list-page { padding: 44px 24px 110px; }
  .action-bar { padding: 16px 24px; }
  .hero { padding: 88px 24px 64px; }
}
