:root {
  --bg:            #f5f2ee;
  --surface:       #ffffff;
  --ink:           #1a1a1a;
  --ink-muted:     #999;
  --accent:        #e8623a;
  --accent-dim:    #f2c4b3;
  --border:        #e8e4df;
  --radius:          12px;
  --shadow:          0 2px 16px rgba(255, 255, 255, 0.9);
  --box-shadow:    rgba(255, 255, 255, 0.7);
  --button-danger: #e8c5c0;
  --hover-danger:  #fdf0ee;
}

.dark-theme {
  --bg:            #0e0d0d;
  --surface:       #000000;
  --ink:           #e5e5e5;
  --ink-muted:     #292929;
  --accent:        #179dc5;
  --accent-dim:    #0b3b4c;
  --border:        #171b20;
  --radius:          12px;
  --shadow:          0 2px 16px rgba(255, 255, 255, 0.9);
  --box-shadow:    rgba(255, 255, 255, 0.7);
  --button-danger: #300e08;
  --hover-danger:  #1a0603;
}
  
  /* ─── Reset & Base ───────────────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 48px 20px;
  }
  
  main {
    width: 100%;
    max-width: 420px;
  }
  
  /* ─── Typography ─────────────────────────────────────────── */
  h1, .app-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400;
    letter-spacing: -0.02em;
  }
  
  /* ─── Screen System ──────────────────────────────────────── */
  .screen        { display: none; }
  .screen.active { display: flex; justify-content: center; }
  #list-screen.active { width: 100%; }
  
  /* ─── Landing ────────────────────────────────────────────── */
  .landing-content {
    text-align: center;
    margin-top: 80px;
    animation: fadeUp 0.5s ease both;
  }
  
  .app-title {
    font-size: 3.2rem;
    line-height: 1;
    margin-bottom: 10px;
    color: var(--ink);
  }
  
  /* Orange dot accent on the title */
  .app-title::after {
    content: '.';
    color: var(--accent);
  }
  
  .app-subtitle {
    color: var(--ink-muted);
    font-size: 0.95rem;
    margin-bottom: 36px;
    letter-spacing: 0.01em;
  }
  
  /* ─── Buttons ────────────────────────────────────────────── */
  button {
    padding: 9px 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--ink);
    color: var(--surface);
    border: 1.5px solid var(--ink);
    border-radius: 100px;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.18s, color 0.18s, transform 0.12s;
    letter-spacing: 0.01em;
  }
  
  button:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-1px);
  }
  
  button.secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--border);
    margin-left: 0;
  }
  
  button.secondary:hover {
    background: var(--border);
    border-color: var(--border);
    color: var(--ink);
  }
  
  /* ─── Card wrapper (list & prompt screens) ───────────────── */
  .prompt-box,
  #list-screen main {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    height: fit-content;
    animation: fadeUp 0.4s ease both;
    color: var(--ink-muted);
  }
  
  /* All Lists: no card — just open page */
  #all-lists main {
    width: 100%;
    max-width: 480px;
    animation: fadeUp 0.4s ease both;
    padding: 0 4px;
    color: var(--ink-muted);
  }

  /* Hide goBack button if stack is empty */
  #stackCheck {
    display: none
  }

  /* Hide addSublist input field */
  #sublistName {
    display: none
  }
  #addSublist {
    display: none;
  }
  
  /* ─── Name Prompt ────────────────────────────────────────── */
  .prompt-box {
    margin-top: 80px;
  }
  
  .prompt-box h2 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 16px;
    color: var(--ink);
  }
  
  .prompt-box input,
  #taskInput,
  #sublistName {
    width: 100%;
    padding: 10px 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: var(--bg);
    color: var(--ink);
    transition: border-color 0.18s, box-shadow 0.18s;
    margin: 10px 0 10px 0;
  }
  
  .prompt-box input:focus,
  #taskInput:focus,
  #sublistName:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
  }
  
  .prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
  }
  
  /* ─── List Screen ────────────────────────────────────────── */
  #list-screen h1 {
    font-size: 2rem;
    margin-bottom: 4px;
    cursor: pointer;
    display: inline-block;
    border-bottom: 2px solid transparent;
    transition: border-color 0.18s;
  }
  
  #list-screen h1:hover {
    border-bottom-color: var(--accent);
  }
  
  ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
  }
  
  li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeIn 0.25s ease both;
  }
  
  li:last-child { border-bottom: none; }
  
  /* ─── Bullet (delete) ────────────────────────────────────── */
  .bullet {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--accent-dim);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.18s, border-color 0.18s, transform 0.12s;
    position: relative;
  }
  
  .bullet:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.15);
  }
  
  /* checkmark on hover */
  .bullet:hover::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--surface);
    opacity: 0.6;
  }
  
  .task-text {
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.4;
  }
  .sublist-item { 
    font-weight: 500; 
  }
  #sublistSwatchLabel { 
    display: none; 
  }
  #sublistSwatches { 
    display: none; 
  }
  /* ─── Add-task row ───────────────────────────────────────── */
  #taskInput,
  #sublistName {
    flex: 1;
    margin-left: 0;
  }
  
  /* wrap input + Add button */
  #list-screen main > input + button {
    /* "Add" button */
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface);
  }
  
  #list-screen main > input + button:hover {
    background: #d44f28;
    border-color: #d44f28;
  }
  
  /* All Lists button */
  #list-screen main > button:last-of-type {
    margin-top: 16px;
    margin-left: 0;
    background: transparent;
    border-color: var(--border);
    color: var(--ink-muted);
    font-size: 0.85rem;
    display: block;
    width: 100%;
    text-align: center;
  }
  
  #list-screen main > button:last-of-type:hover {
    color: var(--ink);
    border-color: var(--ink);
    background: transparent;
  }
  
  /* ─── All Lists Screen ───────────────────────────────────── */
  #all-lists.active {
    width: 100%;
    align-items: flex-start;
  }
  
  #all-lists main {
    padding-top: 8px;
  }
  
  #all-lists h1 {
    font-size: 2.2rem;
    margin-bottom: 6px;
  }
  
  /* orange underline bar */
  #all-lists h1::after {
    content: '';
    display: block;
    width: 36px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin-top: 8px;
  }
  
  /* Scattered flex wrap */
  #all-lists ul {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 28px 0 24px;
    padding: 8px 4px;
    align-items: flex-start;
  }
  
  #all-lists li {
    display: block;
    padding: 0;
    border-bottom: none;
    /* natural sizing — notes feel hand-placed */
    width: calc(45% - 4px);
    animation: noteIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  
  /* Alternate tilt directions for a scattered look */
  #all-lists li:nth-child(1)  { transform: rotate(-2deg);   animation-delay: 0.00s; }
  #all-lists li:nth-child(2)  { transform: rotate( 1.5deg); animation-delay: 0.06s; }
  #all-lists li:nth-child(3)  { transform: rotate(-1deg);   animation-delay: 0.12s; }
  #all-lists li:nth-child(4)  { transform: rotate( 2.5deg); animation-delay: 0.18s; }
  #all-lists li:nth-child(5)  { transform: rotate(-1.8deg); animation-delay: 0.24s; }
  #all-lists li:nth-child(6)  { transform: rotate( 1deg);   animation-delay: 0.30s; }
  #all-lists li:nth-child(7)  { transform: rotate(-2.2deg); animation-delay: 0.36s; }
  #all-lists li:nth-child(8)  { transform: rotate( 1.5deg); animation-delay: 0.42s; }
  
  /* Sticky note colours — cycle through soft pastels */
  /* #all-lists li:nth-child(1) .task-text { background: #fff8c5; }
  #all-lists li:nth-child(2) .task-text { background: #ffd6d6; }
  #all-lists li:nth-child(3) .task-text { background: #d6f0ff; }
  #all-lists li:nth-child(4) .task-text { background: #d6ffd9; }
  #all-lists li:nth-child(5) .task-text { background: #f5d6ff; }
  #all-lists li:nth-child(6) .task-text { background: #ffecd6; }
  #all-lists li:nth-child(7) .task-text { background: #fff8c5; }
  #all-lists li:nth-child(8) .task-text { background: #ffd6d6; } */
  
  /* The sticky note itself */
  #all-lists .task-text {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    border-radius: 4px 4px 4px 4px;
    box-shadow: 3px 4px 12px var(--box-shadow);
    padding: 18px 16px 14px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    min-height: 100px;
    border: none;
    transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1),
                box-shadow 0.18s;
    width: 100%;
    /* subtle tape strip at the top */
    position: relative;
  }
  
  #all-lists .task-text::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 14px;
    background: rgba(255,255,255,0.55);
    border-radius: 2px;
    box-shadow: 0 1px 3px var(--box-shadow);
  }
  
  /* task count */
  #all-lists .task-text::after {
    content: attr(data-count);
    font-size: 0.72rem;
    font-weight: 400;
    color: rgba(0,0,0,0.4);
  }
  
  #all-lists li:hover {
    transform: rotate(0deg) translateY(-5px) !important;
  }
  
  #all-lists li:hover .task-text {
    box-shadow: 5px 8px 20px var(--box-shadow);
  }
  
  #all-lists main > button {
    margin-top: 4px;
    margin-left: 0;
    background: var(--accent);
    border-color: var(--accent);
    display: block;
    width: 100%;
    text-align: center;
    border-radius: 100px;
  }
  
  /* ─── Utility ────────────────────────────────────────────── */
  .right { text-align: right; }
  
  /* ─── Animations ─────────────────────────────────────────── */
  @keyframes noteIn {
    from { opacity: 0; transform: rotate(var(--tilt, -2deg)) scale(0.85) translateY(10px); }
    to   { opacity: 1; }
  }
  
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* ─── Drag Handle (for Sortable.js) ────────────────────────── */
  .drag-bar {
  color: var(--ink-muted);
  cursor: grab;
  font-size: 1.1rem;
  margin-left: auto;
  padding: 0 4px;
  flex-shrink: 0;
}

.drag-bar:active {
  cursor: grabbing;
}
/* ─── Auth Screens (Login & Register) ───────────────────────── */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    animation: fadeUp 0.4s ease both;
}

.auth-box h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.4rem;
    font-weight: 400;
    margin-bottom: 6px;
}

/* Orange dot on auth title */
.auth-box h1::after {
    content: '.';
    color: var(--accent);
}

.auth-box p {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.auth-box input {
    width: 100%;
    padding: 10px 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: var(--bg);
    color: var(--ink);
    transition: border-color 0.18s, box-shadow 0.18s;
    margin-bottom: 12px;
    display: block;
}

.auth-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-box button {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
    padding: 11px;
    font-size: 0.95rem;
}

.auth-message {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--accent);
    min-height: 20px;
    text-align: center;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ─── Danger button ──────────────────────────────────────────── */
button.danger {
    background: transparent;
    color: #cc3a2a;
    border-color: var(--button-danger);
    margin-left: 0;
}

button.danger:hover {
    background: var(--hover-danger);
    border-color: #cc3a2a;
    transform: none;
}

/* ─── Swatch Picker ──────────────────────────────────────── */
.swatch-label {
  font-size: 0.8rem;
  color: var(--ink);
  margin: 14px 0 8px;
}

.swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 4px var(--box-shadow);
}

.swatch:hover {
  transform: scale(1.18);
  background: inherit; /* prevent the global button hover from overriding color */
  border-color: var(--ink-muted);
}

.swatch.selected {
  border-color: var(--ink);
  transform: scale(1.18);
  box-shadow: 0 2px 8px var(--box-shadow);
}

/* ─── Shared Lists Header ────────────────────────────────────── */
.shared-lists-header {
    width: 100%;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--ink-muted);
    margin-top: 24px;
    padding-bottom: 8px;
    border-bottom: none;
    cursor: default;
}

/* Orange underline bar to match the My Lists heading style */
.shared-lists-header::after {
    content: '';
    display: block;
    width: 28px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin-top: 6px;
}