@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vi-400.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vi-600.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/be-vietnam-pro-vi-700.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-vi-600.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  color-scheme: light;
  --paper: #f3ecdf;
  --paper-deep: #e7dccb;
  --card: rgba(255, 250, 244, 0.94);
  --ink: #241c16;
  --muted: #6f6256;
  --line: #e3d5c4;
  --thread: #b5523a;
  --terra: #9a3f2c;
  --cream: #fff4e8;
  --sage: #245c3e;
  --sage-wash: #e5f1e7;
  --on-sage: #f4fff6;
  --gold: #8d6b3f;
  --shadow: 0 16px 40px rgba(72, 42, 22, 0.08);
  --topbar: rgba(243, 236, 223, 0.92);
  --font-body: "Be Vietnam Pro", "Avenir Next", sans-serif;
  --font-display: "Source Serif 4", Palatino, "Palatino Linotype", serif;
  --topbar-h: 0px;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --paper: #14110f;
  --paper-deep: #221c18;
  --card: rgba(34, 27, 23, 0.96);
  --ink: #f6efe4;
  --muted: #cbbba8;
  --line: #3c322b;
  --thread: #e07a62;
  --terra: #f0a090;
  --cream: #2a211c;
  --sage: #8fbfa4;
  --sage-wash: #1c2b23;
  --on-sage: #14241c;
  --gold: #e0c39a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --topbar: rgba(20, 17, 15, 0.92);
}

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

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at -10% -10%, rgba(181, 82, 58, 0.16), transparent 60%),
    var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(80, 48, 24, 0.18) 0.6px, transparent 0.65px);
  background-size: 3px 3px;
}

:root[data-theme="night"] body::before {
  opacity: 0.18;
  background-image: radial-gradient(rgba(255, 236, 214, 0.16) 0.6px, transparent 0.65px);
}

body.is-sheet-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  position: relative;
  width: min(680px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
}

.app::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 10px;
  border-left: 2px dashed color-mix(in srgb, var(--thread) 75%, transparent);
  pointer-events: none;
}

.intro {
  padding: calc(16px + env(safe-area-inset-top)) 16px 6px 22px;
}

.sticky-bar {
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 10;
  padding: 8px 16px 6px 22px;
  background: var(--topbar);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.masthead__actions,
.hint__actions,
.confirm__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.masthead__actions {
  flex: none;
  padding-top: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__logo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
}

.brand__subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.hero__kicker,
.sheet__eyebrow,
.links__title,
.note__label {
  margin: 0;
  color: var(--terra);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.05;
}

.text-btn,
.menu__btn,
.segment__btn,
.filters__chip,
.search__clear {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
}

.text-btn--solid,
.filters__chip--active,
.segment__btn--active {
  background: var(--terra);
  border-color: var(--terra);
  color: var(--cream);
}

:root[data-theme="night"] .text-btn--solid,
:root[data-theme="night"] .filters__chip--active,
:root[data-theme="night"] .segment__btn--active {
  color: #2a120d;
}

.hero {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  margin-top: 14px;
}

.seal {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #d37a62 0%, #9a3f2c 48%, #6e2b1d 100%);
  box-shadow:
    inset 0 0 0 7px rgba(255, 236, 214, 0.24),
    0 12px 28px rgba(110, 43, 29, 0.28);
}

.seal svg {
  width: 86%;
  height: 86%;
  transform: rotate(-90deg);
}

.seal__track,
.seal__value {
  fill: none;
  stroke-width: 3.5;
}

.seal__track {
  stroke: rgba(255, 244, 232, 0.28);
}

.seal__value {
  stroke: #fff4e8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease;
}

.seal__value--empty {
  stroke-linecap: butt;
}

.seal__label {
  position: absolute;
  margin: 0;
  color: #fff4e8;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.hero__copy {
  position: relative;
  z-index: 0;
  margin-left: -28px;
  padding: 12px 14px 12px 40px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero__count {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 2.8rem);
  font-weight: 600;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.hero__detail,
.hero__optional,
.result-count,
.menu__lead,
.colophon,
.empty p {
  margin: 2px 0 0;
  color: var(--muted);
}

.hero__optional {
  color: var(--gold);
  font-weight: 600;
}

.hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--thread) 10%, var(--card));
}

.hint p {
  margin: 0 0 8px;
}

.search {
  position: relative;
  margin-top: 12px;
}

.search__field input {
  width: 100%;
  min-height: 48px;
  padding: 0 72px 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.search__clear {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 40px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-top: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filters__chip {
  flex: none;
}

.result-count {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 0.85rem;
}

.list {
  display: grid;
  gap: 14px;
  padding: 8px 16px 12px 22px;
}

.list--enter .category {
  animation: rise 0.45s ease both;
}

.list__add {
  width: 100%;
  min-height: 48px;
  margin: 4px 0 8px;
  border: 1px dashed var(--thread);
  border-radius: 16px;
  background: transparent;
  color: var(--terra);
  font-weight: 700;
}

.list__add-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin: 4px 0 8px;
}

.list__add-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.category {
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.category__head {
  display: flex;
  align-items: stretch;
  position: sticky;
  top: calc(env(safe-area-inset-top) + var(--topbar-h));
  z-index: 2;
  border-radius: 20px 20px 0 0;
  background: var(--card);
}

.category:not(:has(.category__items)) .category__head {
  border-radius: 20px;
}

.category__toggle,
.category__rename {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 14px 8px 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
}

.category__toggle {
  flex: 1;
}

.category__mark {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--thread);
}

.category__name,
.category__input {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
}

.category__input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--thread);
  border-radius: 0;
  background: transparent;
}

.category__edit,
.category__add {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  margin: 8px 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.category__edit {
  margin-right: 6px;
}

.category__remove {
  flex: none;
  width: 44px;
  margin: 8px 6px 8px 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--terra);
  font-size: 1.4rem;
  line-height: 1;
}

.category__rename .category__edit {
  margin: 0;
}

.category__meter {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.category__items {
  list-style: none;
  margin: 0;
  padding: 0 6px 8px;
}

.item {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.item__check,
.item__open {
  border: 0;
  background: transparent;
}

.item__check {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: 4px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 32%, var(--line));
  border-radius: 50%;
  background: var(--paper);
}

.item--bought {
  background: var(--sage-wash);
}

.item--bought .item__check {
  border-color: var(--sage);
  background: var(--sage);
}

.item--bought .item__check::after {
  content: "";
  width: 6px;
  height: 11px;
  border-right: 2px solid var(--on-sage);
  border-bottom: 2px solid var(--on-sage);
  transform: rotate(45deg) translate(-1px, -2px);
}

.item--bought .item__name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.item--skip {
  opacity: 0.72;
}

.item--skip .item__check::after {
  content: "";
  width: 12px;
  border-top: 2px solid var(--muted);
}

.item__open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 56px;
  padding: 10px 10px 10px 8px;
  text-align: left;
}

.item__name {
  font-weight: 600;
  line-height: 1.35;
}

.item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.pill {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
}

.pill--note {
  color: var(--terra);
  border-color: color-mix(in srgb, var(--terra) 40%, var(--line));
}

.empty {
  padding: 28px 8px 12px;
}

.empty__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.colophon {
  padding: 8px 22px calc(28px + env(safe-area-inset-bottom));
  font-size: 0.85rem;
}

.colophon a {
  color: var(--terra);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  visibility: hidden;
}

.sheet.is-open {
  visibility: visible;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 18, 12, 0.46);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet.is-open .sheet__backdrop {
  opacity: 1;
}

.sheet__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(680px, 100%);
  max-height: min(88dvh, 760px);
  margin: 0 auto;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: var(--card);
  box-shadow: var(--shadow);
  transform: translateY(105%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.is-open .sheet__panel {
  transform: none;
}

.sheet__grab {
  width: 42px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: var(--line);
}

.sheet__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet__edit {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.sheet__form {
  display: grid;
  gap: 4px;
}

.sheet__form[hidden],
.sheet__edit[hidden],
.sheet__add[hidden],
#sheet-form-title[hidden],
#add-eyebrow[hidden],
#sheet-delete[hidden] {
  display: none;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.field__input {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

textarea.field__input {
  min-height: 96px;
  resize: vertical;
}

.link-edit {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.link-edit__url {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.link-edit__remove {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.sheet__add {
  justify-self: start;
  margin-top: 10px;
}

.sheet__form .confirm__actions {
  margin-top: 16px;
}

.sheet__remove {
  margin-top: 18px;
  color: var(--terra);
}

.sheet__title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
}

.sheet__qty {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-deep);
  font-weight: 700;
}

.segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.segment__btn {
  min-height: 46px;
  padding: 0 8px;
  border-radius: 14px;
}

.tip {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 0;
  border-left: 3px solid var(--thread);
  border-radius: 0 14px 14px 0;
  background: color-mix(in srgb, var(--thread) 8%, transparent);
  line-height: 1.55;
}

.links {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  background: var(--paper);
}

.link__hint {
  color: var(--terra);
  font-weight: 700;
}

.note {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.note textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  resize: vertical;
}

.menu,
.confirm {
  width: min(420px, calc(100% - 32px));
  padding: 22px 18px 16px;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.menu::backdrop,
.confirm::backdrop {
  background: rgba(28, 18, 12, 0.46);
}

.menu__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
}

.menu__lead {
  margin: 8px 0 14px;
}

.menu:not([open]) {
  display: none;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu__btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font-weight: 600;
}

.menu__btn--danger {
  color: var(--terra);
}

.menu__btn--quiet {
  background: transparent;
}

.confirm__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  padding: 16px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 380px) {
  .seal {
    width: 78px;
    height: 78px;
  }

  .hero {
    grid-template-columns: 78px 1fr;
  }

  .brand__title {
    font-size: 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
