:root {
  --cream: #f7f2e8;
  --paper: #fffdf9;
  --ink: #3f322b;
  --ink-soft: #5d483c;
  --muted: #a08b7b;
  --line: #eadfd2;
  --coral: #e56d52;
  --coral-dark: #d65f45;
  --coral-pale: #fbe9e1;
  --green: #5c8673;
  --green-pale: #eef6f0;
  --shadow: 0 12px 32px rgba(86, 62, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0%, rgba(248, 206, 185, 0.32), transparent 28rem),
    var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 24px 20px 140px;
}

.hero {
  padding: 28px 28px 22px;
  border-radius: 30px;
  background: linear-gradient(135deg, #fffaf2, #f9e9da);
  border: 1px solid rgba(239, 223, 205, 0.9);
  box-shadow: var(--shadow);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow,
.sheet-eyebrow {
  margin: 0;
  color: #c48d78;
  font-size: 11px;
  letter-spacing: 0.2em;
  line-height: 1.5;
}

.hero h1 {
  margin: 8px 0 0;
  color: #3c2c24;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-sub {
  margin: 10px 0 0;
  color: #9b8170;
  font-size: 14px;
  line-height: 1.6;
}

.hero-total {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.7);
  border: 1px solid rgba(232, 210, 190, 0.7);
  color: #c9795e;
  font-family: "Songti SC", "STSong", serif;
  font-size: 24px;
  font-weight: 700;
}

.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  border: 1px solid rgba(232, 216, 200, 0.8);
  color: #8f7767;
  font-size: 12px;
  line-height: 1;
}

.pill strong {
  color: var(--coral-dark);
  font-size: 14px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #dca18a;
}

.meta-note {
  margin-left: auto;
  color: #ad9989;
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  margin-top: 20px;
  align-items: start;
}

.categories {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 10px;
  border-radius: 24px;
  background: rgba(255, 253, 249, 0.78);
  border: 1px solid rgba(238, 225, 210, 0.9);
  box-shadow: 0 8px 24px rgba(86, 62, 45, 0.04);
}

.side-caption {
  padding: 0 8px 6px;
  color: #b6a090;
  font-size: 10px;
  letter-spacing: 0.14em;
}

.category-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #796557;
  font-size: 13px;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.category-btn:hover {
  background: #f7eee4;
}

.category-btn.is-active {
  background: #fff3e8;
  color: #b9634c;
  font-weight: 600;
}

.category-btn .cat-count {
  flex: none;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f3e9dd;
  color: #a68d7a;
  font-size: 10px;
  text-align: center;
}

.category-btn.is-active .cat-count {
  background: #f9ddcf;
  color: #b9634c;
}

.content {
  min-width: 0;
}

.content-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 12px;
}

.content-head h2 {
  margin: 0;
  color: #44332a;
  font-family: "Songti SC", "STSong", serif;
  font-size: 27px;
  line-height: 1.2;
}

.category-items-count {
  display: inline-block;
  margin-top: 4px;
  color: #b09a89;
  font-size: 11px;
}

.content-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.tiny-btn {
  padding: 7px 10px;
  border: 1px solid #e7d8c8;
  border-radius: 999px;
  background: #fffaf3;
  color: #8e7969;
  font-size: 11px;
  line-height: 1.2;
}

.tiny-btn:hover {
  background: #f5ebdf;
}

.items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid rgba(238, 225, 210, 0.95);
  box-shadow: 0 6px 18px rgba(86, 62, 45, 0.045);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.item-card:hover {
  transform: translateY(-1px);
  border-color: #e3cdb9;
}

.item-card.is-picked {
  background: #fffaf4;
  border-color: #e7a88f;
}

.item-image {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  background: #f1e8dc;
}

.item-copy {
  min-width: 0;
  flex: 1;
}

.item-name {
  display: block;
  overflow: hidden;
  color: #4b392f;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-state {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #ab9584;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #e5d7c8;
  background: #fffdf9;
  color: #fff;
  font-size: 12px;
}

.item-card.is-picked .item-check {
  border-color: var(--coral);
  background: var(--coral);
}

.empty {
  grid-column: 1 / -1;
  padding: 64px 20px;
  border: 1px dashed #e2d2c2;
  border-radius: 24px;
  color: #a18c7c;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
}

.bottom-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(247, 242, 232, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(232, 219, 204, 0.8);
}

.bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1100px, 100%);
  margin: 0 auto;
}

.bottom-copy p {
  margin: 0;
  color: #5b4639;
  font-size: 13px;
}

.bottom-copy strong {
  color: var(--coral-dark);
  font-family: "Songti SC", "STSong", serif;
  font-size: 27px;
}

.bottom-copy span {
  display: block;
  margin-top: 2px;
  color: #a28d7d;
  font-size: 11px;
}

.bottom-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.clear-btn,
.done-btn,
.secondary-btn,
.primary-btn {
  height: 42px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 40px;
}

.clear-btn {
  border-color: #e4d6c7;
  background: #fffaf3;
  color: #8f7a6a;
}

.clear-btn:disabled,
.done-btn:disabled,
.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.done-btn,
.primary-btn {
  background: linear-gradient(135deg, #f08a69, #e56d52);
  box-shadow: 0 8px 20px rgba(226, 107, 79, 0.22);
  color: #fff;
}

.done-btn {
  min-width: 92px;
}

.secondary-btn {
  border-color: #e7d8c8;
  background: #fffaf3;
  color: #755f50;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(48, 36, 29, 0.5);
}

.sheet {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 10px 22px 0;
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  box-shadow: 0 -20px 50px rgba(48, 36, 29, 0.18);
  animation: sheet-up 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 4px auto 16px;
  border-radius: 99px;
  background: #e4d8ca;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
}

.sheet-head h2 {
  margin: 5px 0 0;
  color: #3d2e26;
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
  line-height: 1.2;
}

.icon-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f3ebe0;
  color: #8b7565;
  font-size: 22px;
  line-height: 1;
}

.summary-list {
  max-height: 42vh;
  overflow-y: auto;
  padding-bottom: 6px;
}

.summary-group {
  padding: 8px 0;
}

.summary-group h3 {
  margin: 0 0 4px;
  color: #6b5546;
  font-size: 12px;
  font-weight: 600;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.summary-row img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
}

.summary-row span {
  flex: 1;
  color: #4b3a30;
  font-size: 13px;
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding: 14px 0;
  border-top: 1px solid #f0e6da;
  color: #8f7b6b;
  font-size: 12px;
}

.free-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-pale);
  color: #618b76;
  font-size: 11px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  padding: 4px 0 12px;
}

.sheet-actions > * {
  flex: 1;
}

.sheet-safe {
  height: calc(12px + env(safe-area-inset-bottom));
}

.order-form {
  padding: 2px 0 10px;
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  color: #705b4d;
  font-size: 12px;
  font-weight: 600;
}

.text-input,
.text-area {
  width: 100%;
  border: 1px solid #eadfd2;
  border-radius: 14px;
  background: #fbf6ed;
  color: #4b3a30;
  font-size: 14px;
  outline: none;
}

.text-input:focus,
.text-area:focus {
  border-color: #d9a88f;
  box-shadow: 0 0 0 3px rgba(217, 168, 143, 0.16);
}

.text-input {
  height: 46px;
  padding: 0 13px;
}

.text-area {
  min-height: 92px;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.6;
}

.form-tip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 1px 16px;
  color: #9b8676;
  font-size: 11px;
  line-height: 1.5;
}

.form-tip span {
  flex: none;
  color: #6f9483;
}

.full {
  width: 100%;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 18px;
  z-index: 150;
  width: fit-content;
  max-width: calc(100% - 36px);
  margin: 0 auto;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(51, 40, 33, 0.92);
  color: #fffdf9;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.toast.hidden {
  display: none;
}

@media (max-width: 640px) {
  .app {
    padding: 14px 12px 132px;
  }

  .hero {
    padding: 22px 18px 18px;
    border-radius: 24px;
  }

  .hero-total {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }

  .meta-note {
    display: none;
  }

  .layout {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    margin-top: 12px;
  }

  .categories {
    padding: 10px 6px;
    border-radius: 18px;
  }

  .side-caption {
    padding-left: 5px;
    font-size: 9px;
  }

  .category-btn {
    padding: 8px 6px;
    border-radius: 11px;
    font-size: 11px;
  }

  .category-btn .cat-count {
    display: none;
  }

  .content-head h2 {
    font-size: 21px;
  }

  .content-actions {
    gap: 4px;
  }

  .tiny-btn {
    padding: 6px 7px;
    font-size: 10px;
  }

  .items {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .item-card {
    padding: 10px;
    border-radius: 16px;
  }

  .item-image {
    width: 56px;
    height: 56px;
    border-radius: 13px;
  }

  .item-name {
    font-size: 13px;
  }

  .bottom-bar {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .bottom-copy span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .clear-btn,
  .done-btn {
    height: 40px;
    padding: 0 14px;
    font-size: 12px;
    line-height: 38px;
  }

  .sheet {
    padding: 8px 18px 0;
  }

  .sheet-head h2 {
    font-size: 24px;
  }
}

@media (min-width: 900px) {
  .items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}