/* One simple, friendly design for a young kid to use — big targets, plain
   words, bright but disciplined color, nothing abstract (no charts, no
   jargon, no rings). Motion budget: near zero (Operate surface) — the few
   transitions that exist are feedback, not decoration. */
:root {
  --tap: 56px;

  --bg: #faf9f6;
  --panel: #ffffff;
  --line: #ece7dc;
  --ink: #221f1a;
  --ink-dim: #6b6355;

  --accent: #037a5f;        /* packed / positive */
  --accent-soft: #d9f3ec;
  --blue: #2f6fe0;          /* "coming home" mode */
  --blue-soft: #dde8fc;
  --star: #a85f00;          /* super-important */
  --star-soft: #fff1da;
  --star-line: #f3ce93;
  --danger: #c33f2f;

  --badge-1: #ff6b5b;
  --badge-2: #4fc3e8;
  --badge-3: #5fc97b;
  --badge-4: #b98ce0;
  --badge-5: #ff8fc4;
  --badge-6: #f5a623;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 10px 24px -16px rgba(34, 31, 26, 0.16);

  --font: 'Nunito', system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

button, input {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2rem) 0 3rem;
}

.board {
  width: 100%;
  max-width: 560px;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.board > * {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.4s var(--ease-out) forwards;
}
.board > *:nth-child(1) { animation-delay: 0ms; }
.board > *:nth-child(2) { animation-delay: 40ms; }
.board > *:nth-child(3) { animation-delay: 80ms; }
.board > *:nth-child(4) { animation-delay: 120ms; }
.board > *:nth-child(n+5) { animation-delay: 150ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* one card system, used everywhere */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card--header { padding: 1.25rem 1.25rem 1.1rem; }

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.trip-name {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 1.9rem;
  padding: 0.15rem 0;
}
.trip-dest {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--ink-dim);
  padding: 0.1rem 0 0.7rem;
}
.trip-name::placeholder, .trip-dest::placeholder { color: var(--ink-dim); opacity: 0.55; }

.mode-switch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.mode-btn {
  flex: 1;
  min-height: var(--tap);
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink-dim);
  border-radius: 16px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 180ms var(--ease-out),
    border-color 180ms var(--ease-out), color 180ms var(--ease-out);
}
.mode-btn:active { transform: scale(0.97); }
.mode-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.board[data-mode="return"] .mode-btn[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
}

.progress { margin-bottom: 0.95rem; }
.progress__track {
  height: 16px;
  border-radius: 999px;
  background: var(--bg);
  border: 2px solid var(--line);
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 400ms var(--ease-out);
}
.board[data-mode="return"] .progress__fill { background: var(--blue); }
.progress__label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-dim);
}

.trip-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
}
.trip-select {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
}
.small-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-dim);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  flex: none;
  transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .small-btn:hover { border-color: var(--accent); color: var(--accent); }
  .small-btn--danger:hover { border-color: var(--danger); color: var(--danger); }
}
.small-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- super important card ---------- */

.card--star {
  background: var(--star-soft);
  border-color: var(--star-line);
  padding: 1.1rem 1.1rem 1rem;
}
.star-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: #7a4d0a;
  margin-bottom: 0.7rem;
}
.star-head__mark { color: var(--star); font-size: 1.2rem; }
#stubCount { margin-left: auto; }
#stubCount { font-size: 0.9rem; font-weight: 700; opacity: 0.75; }

.chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #fff;
  border: 2px solid var(--star-line);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  min-height: var(--tap);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background-color 220ms var(--ease-out), opacity 220ms var(--ease-out);
}
.chip:last-child { margin-bottom: 0; }
.chip__check {
  width: 26px; height: 26px;
  accent-color: var(--star);
  flex: none;
}
.chip__name { flex: 1; font-weight: 700; font-size: 1.05rem; min-width: 0; overflow-wrap: break-word; }
.chip__cat { font-size: 0.78rem; color: var(--ink-dim); flex: none; }
.chip:has(.chip__check:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  opacity: 0.75;
}
.chip:has(.chip__check:checked) .chip__name { text-decoration: line-through; color: var(--ink-dim); }

.star-empty {
  margin: 0;
  font-size: 0.9rem;
  color: #7a4d0a;
  opacity: 0.8;
}

/* ---------- category groups ---------- */

#categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cat__summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  min-height: var(--tap);
  cursor: pointer;
  user-select: none;
}
.cat__summary::-webkit-details-marker { display: none; }

.cat__icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.cat__name {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 0.2rem;
}
.cat__name:hover, .cat__name:focus { border-bottom: 2px dashed var(--line); }

.cat__count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-dim);
  flex: none;
  white-space: nowrap;
}

.cat__chevron {
  color: var(--ink-dim);
  transition: transform 160ms var(--ease-out);
  flex: none;
  font-size: 1rem;
}
.cat[open] > .cat__summary .cat__chevron { transform: rotate(180deg); }

.cat__items {
  display: flex;
  flex-direction: column;
  border-top: 1px dashed var(--line);
}

.item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1.1rem;
  min-height: var(--tap);
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
  transition: background-color 220ms var(--ease-out);
}
.item:last-child { border-bottom: none; }
.item:has(.item__check:checked) { background: var(--accent-soft); }
.board[data-mode="return"] .item:has(.item__check:checked) { background: var(--blue-soft); }

.item__check {
  width: 28px; height: 28px;
  accent-color: var(--accent);
  flex: none;
}
.board[data-mode="return"] .item__check { accent-color: var(--blue); }

.item__name { flex: 1; min-width: 0; font-size: 1.08rem; overflow-wrap: break-word; }
.item:has(.item__check:checked) .item__name { text-decoration: line-through; color: var(--ink-dim); }

.star-toggle {
  appearance: none;
  border: none;
  background: transparent;
  width: var(--tap); height: var(--tap);
  color: var(--line);
  font-size: 1.35rem;
  cursor: pointer;
  flex: none;
  transition: transform 140ms var(--ease-out), color 180ms var(--ease-out);
}
.star-toggle:active { transform: scale(0.9); }
.star-toggle[aria-pressed="true"] { color: var(--star); }

.ghost-btn {
  appearance: none;
  border: none;
  background: transparent;
  width: var(--tap); height: var(--tap);
  color: var(--ink-dim);
  font-size: 1.3rem;
  cursor: pointer;
  flex: none;
  opacity: 0.5;
  transition: opacity 160ms var(--ease-out), color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .ghost-btn:hover { opacity: 1; color: var(--danger); }
}

.cat__add {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px dashed var(--line);
  background: #fffdf8;
  border-radius: 0 0 var(--radius) var(--radius);
}
.cat__add-input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  font-size: 1rem;
}
.cat__add-btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 0.5rem 1.1rem;
  min-height: var(--tap);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  flex: none;
  transition: transform 140ms var(--ease-out);
}
.cat__add-btn:active { transform: scale(0.96); }

.cat__empty {
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  color: var(--ink-dim);
}

.add-category {
  appearance: none;
  border: 2px dashed var(--line);
  background: transparent;
  color: var(--ink-dim);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: var(--tap);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .add-category:hover { border-color: var(--accent); color: var(--accent); }
}

.foot {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-dim);
  padding: 0.3rem 0.5rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .board > * { transform: none; transition: none; animation: fade-only 250ms ease forwards; }
  @keyframes fade-only { from { opacity: 0; } to { opacity: 1; } }
  .mode-btn, .cat__add-btn, .star-toggle { transition: background-color 180ms ease, color 180ms ease; }
  .mode-btn:active, .cat__add-btn:active, .star-toggle:active { transform: none; }
}
