/* Light and fresh like the app icon: a coloured band on top, rows like sheets
   of paper. The two accent colours follow the list on screen (set from app.js)
   and animate when switching lists. */
@property --a1 { syntax: "<color>"; inherits: true; initial-value: #1aa36b; }
@property --a2 { syntax: "<color>"; inherits: true; initial-value: #0b8a72; }
html { transition: --a1 .45s ease, --a2 .45s ease; }

:root {
  color-scheme: light;
  --a1: #1aa36b;
  --a2: #0b8a72;
  --bg: #f3f6f1;
  --page: color-mix(in srgb, var(--a1) 7%, var(--bg));
  --paper: #fffefa;
  --field: #eef2ed;
  --line: rgba(20, 60, 45, .1);
  --text: #15241e;
  --muted: #687a72;
  --shadow: 0 1px 2px rgba(16, 48, 36, .06), 0 6px 16px -8px rgba(16, 48, 36, .2);
  --ink: color-mix(in srgb, var(--a2) 78%, #000);   /* accent-coloured text on paper */
  --toast: #1d2925;
  --danger: #c22f45;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1512;
    --page: color-mix(in srgb, var(--a1) 6%, var(--bg));
    --paper: #17221d;
    --field: #1f2b26;
    --line: rgba(255, 255, 255, .08);
    --text: #e8f0eb;
    --muted: #8ea29a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -10px rgba(0, 0, 0, .6);
    --ink: color-mix(in srgb, var(--a1) 55%, #fff);
    --toast: #2a3833;
    --danger: #ff97a3;
  }
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  overscroll-behavior: none;
  background: var(--page);
  color: var(--text);
  font: 16px/1.4 ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  /* Exactly one screen tall: the list scrolls inside it. */
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 16px;
}

/* ---------- The coloured band: list name, share, name, and the add field ---------- */
.hero {
  flex: none;
  margin: 0 -16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 18px;
  border-radius: 0 0 28px 28px;
  background: linear-gradient(to bottom, var(--a1), color-mix(in srgb, var(--a1) 35%, var(--a2)));
  box-shadow: 0 12px 28px -18px color-mix(in srgb, var(--a2) 80%, transparent);
  color: #fff;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }

.title-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 21px;
  font-weight: 700;
  cursor: pointer;
}
.title-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn svg { flex: none; fill: none; stroke: currentColor; opacity: .85; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.actions { flex: none; display: flex; gap: 8px; }
.chip {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px -4px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.icon-chip { display: grid; place-items: center; width: 36px; padding: 0; }
.icon-chip[hidden] { display: none; }
.icon-chip svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* Keep the name chip from crowding out the list name on narrow phones. */
#who { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.add { display: flex; gap: 8px; margin-top: 12px; }
.add input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: var(--paper);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .25);
}
.add input::placeholder { color: var(--muted); }
.add input:focus { outline: 3px solid rgba(255, 255, 255, .55); outline-offset: 0; }
.add-btn {
  flex: none;
  width: 52px;
  border: 1.5px solid rgba(255, 255, 255, .45);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  cursor: pointer;
}
.add-btn svg { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.add-btn:active { transform: scale(.96); background: rgba(255, 255, 255, .28); }

/* ---------- Rows ---------- */
.scroller {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -16px;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}
.state { padding: 48px 0; text-align: center; color: var(--muted); }
.state[hidden] { display: none; }

.items { list-style: none; padding: 0; display: grid; gap: 8px; }
.row {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 60px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
  user-select: none;
  -webkit-user-select: none;
}
.row button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.row svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.row .grip {
  flex: none;
  width: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  touch-action: none;   /* the finger drags the row instead of scrolling the list */
  cursor: grab;
  border-radius: 16px 0 0 16px;
}
.row .grip svg { fill: currentColor; stroke: none; opacity: .55; }
.row .grip:disabled { visibility: hidden; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  text-align: left;
}
/* Round like the dots in the icon: a ring, filled when checked. */
.box {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--a1) 70%, var(--paper));
  display: grid;
  place-items: center;
  color: #fff;
  transition: background .2s, border-color .2s;
}
.box svg { stroke-width: 3; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s; }
.body { display: flex; flex-direction: column; min-width: 0; }
.text { font-size: 17px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.row .del {
  flex: none;
  width: 48px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: 0 16px 16px 0;
}
.row .del svg { opacity: .8; }
.row .del:active { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
@media (hover: hover) {
  .row .del:hover { color: var(--danger); }
  .main:hover .box { border-color: var(--a1); }
}
.row button:focus-visible { outline: 2px solid var(--a1); outline-offset: -2px; border-radius: 12px; }

/* Checked rows */
.row.done { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.row.done .box { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; }
.row.done .box svg { opacity: 1; transform: none; }
.row.done .text { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 70%, transparent); }
.row.done .meta { opacity: .75; }

.done-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 8px 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.done-head[hidden] { display: none; }
.done-head .text-btn { letter-spacing: normal; text-transform: none; color: var(--ink); font-weight: 700; padding: 6px 8px; }

/* While dragging: the lifted row floats above, the others make room. */
.sorting .row { transition: transform .18s ease; }
.row.dragging {
  z-index: 2;
  transition: none;
  box-shadow: 0 18px 36px -12px rgba(16, 48, 36, .45), 0 0 0 2px color-mix(in srgb, var(--a1) 60%, transparent);
}
.row.dragging .grip { cursor: grabbing; color: var(--a1); }
.row.dragging .grip svg { opacity: 1; }

/* ---------- Buttons ---------- */
.primary {
  flex: none;
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 17px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--a2) 80%, transparent);
  cursor: pointer;
  transition: transform .1s, opacity .2s;
}
.primary:active { transform: scale(.98); }
.primary:disabled { opacity: .5; }

.secondary, .danger {
  width: 100%;
  padding: 15px;
  border-radius: 16px;
  border: 0;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.secondary { background: var(--field); color: var(--text); }
.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.text-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; padding: 8px; cursor: pointer; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 32px);
  background: var(--toast);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 15px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button {
  flex: none;
  align-self: stretch;
  margin: -11px -14px -11px 4px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: color-mix(in srgb, var(--a1) 45%, #fff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.toast button[hidden] { display: none; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(360px, calc(100% - 32px));
  margin: auto;
  border: 0;
  border-radius: 24px;
  padding: 24px;
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}
dialog::backdrop { background: rgba(10, 30, 22, .45); backdrop-filter: blur(3px); }
dialog h2 { font-size: 22px; margin-bottom: 6px; }
dialog p { color: var(--muted); margin-bottom: 16px; }
dialog input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 17px;
}
dialog input:focus { outline: 2px solid var(--a1); outline-offset: 1px; }

.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }
.close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--field);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.list-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.list-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 0;
  border-radius: 16px;
  background: var(--field);
  border: 1.5px solid transparent;
}
.list-list li.active { border-color: color-mix(in srgb, var(--a1) 60%, transparent); background: color-mix(in srgb, var(--a1) 12%, var(--paper)); }
.list-list .pick {
  flex: 1;
  min-width: 0;
  display: flex;
  padding: 12px 14px 12px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.list-list .pick b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.list-list .icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.list-list .icon:active { background: var(--line); }
.list-list .icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.list-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-left: 14px; }

.field { display: block; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.buttons { display: flex; gap: 10px; }
.buttons > * { flex: 1; }
.stack { display: grid; gap: 10px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  outline: 2.5px solid transparent;
  outline-offset: 3px;
  cursor: pointer;
}
.swatch[aria-checked="true"] { outline-color: var(--text); }

/* ---------- No list yet: only the welcome card ---------- */
.welcome { display: none; }
.app.empty .welcome {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding-bottom: 10vh;
}
.app.empty .hero { background: none; box-shadow: none; padding-bottom: 0; }
.app.empty .add, .app.empty .scroller { display: none; }
.app.empty .title-btn { visibility: hidden; }
.welcome img { width: 112px; height: 112px; filter: drop-shadow(0 14px 24px color-mix(in srgb, var(--a2) 35%, transparent)); }
.welcome h2 { font-size: 28px; }
.welcome p { color: var(--muted); max-width: 30ch; }
.welcome .primary { margin-top: 8px; max-width: 360px; }
.welcome .hint { font-size: 14px; }

.privacy { display: block; margin-top: 14px; text-align: center; color: var(--muted); font-size: 13px; }
/* Language: round flags, the active one ringed (same as the parking app) */
.lang-flags { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.flag {
  display: block;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: none;
  opacity: .45;
  cursor: pointer;
  transition: opacity .2s, outline-color .2s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.flag svg { display: block; width: 100%; height: 100%; }
.flag:hover { opacity: .8; }
.flag[aria-current="true"] { opacity: 1; outline-color: var(--a1); cursor: default; }
/* reCAPTCHA (App Check) is credited in the privacy policy instead of this floating badge. */
.grecaptcha-badge { visibility: hidden; }
