:root {
  --pink: #ef6a8a;
  --pink-deep: #e24b73;
  --pink-soft: #f8c5d4;
  --bg: #fff4f7;
  --card: #ffffff;
  --ink: #4a2a33;
  --muted: #9a6b76;
  --line: #f3d0d8;
  --shadow: 0 12px 30px rgba(226, 75, 115, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100lvh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  font-family: "Yu Gothic", "Hiragino Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background-color: #fff7f9;
  background-image:
    linear-gradient(180deg, #fff7f9 0%, rgba(255, 247, 249, 0) 96px),
    linear-gradient(0deg, #ffe9ef 0%, rgba(255, 233, 239, 0) 120px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cpath fill='%23f5c3d0' fill-opacity='0.35' d='M22 18c2.8-4.6 9.2-5 12.6-1.2L36 18.4 37.4 16.8C40.8 13 47.2 13.4 50 18c2.6 4.2.8 9.8-3.8 12.2L36 36.8 25.8 30.2C21.2 27.8 19.4 22.2 22 18z'/%3E%3C/svg%3E"),
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.9) 0 18px, transparent 19px),
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.85) 0 14px, transparent 15px),
    linear-gradient(180deg, #fff7f9 0%, var(--bg) 45%, #ffe9ef 100%);
}

body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(88px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(to top, #fff7f9 0%, rgba(255, 247, 249, 0.72) 48%, transparent 100%);
}

.page {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) 0 calc(120px + env(safe-area-inset-bottom, 0px));
  min-height: 100lvh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

.hero {
  text-align: center;
  padding: 18px 12px 20px;
}

.content {
  display: block;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
}

.hero h1 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 8vw, 64px);
  color: #ef6e8f;
  letter-spacing: 0.02em;
}

.subtitle,
.hint,
.checkout-note {
  color: var(--muted);
}

.subtitle {
  margin: 6px 0 0;
  font-size: 16px;
}

.hint {
  margin: 14px auto 0;
  max-width: 520px;
  font-size: 13px;
  line-height: 1.6;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 0;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #f4d4dc;
  border-radius: 999px;
}

.tabs button {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.tabs button.active {
  background: var(--pink-deep);
  color: #fff;
}

.user-chip {
  display: inline-block;
  margin-top: 10px;
  border: 1px solid #f4d4dc;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--pink-deep);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  contain: layout;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.card input {
  -webkit-user-select: text;
  user-select: text;
}

.card.active {
  border-color: var(--pink);
  box-shadow: 0 14px 28px rgba(226, 75, 115, 0.2);
}

.card.holding {
  animation: hold-charge 0.8s ease-out forwards;
}

.card.holding .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(226, 75, 115, 0.42) 0%, rgba(226, 75, 115, 0.08) 68%, transparent 72%);
  transform: scale(0.15);
  animation: hold-ripple 0.8s ease-out forwards;
  pointer-events: none;
}

.card.filled {
  animation: hold-pop 0.45s ease;
}

@keyframes hold-charge {
  from { transform: scale(1); }
  to {
    transform: scale(0.96);
    box-shadow: 0 0 0 4px rgba(226, 75, 115, 0.28);
  }
}

@keyframes hold-ripple {
  to { transform: scale(1.35); }
}

@keyframes hold-pop {
  0% { transform: scale(0.96); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 30;
  min-width: 180px;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: #4a2a33;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  background: #fff6f8;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.thumb-img,
.placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.thumb-img {
  object-fit: cover;
  opacity: 0;
}

.thumb-img.is-on {
  opacity: 1;
}

.placeholder {
  display: grid;
  place-items: center;
  color: #d7a0ad;
  text-align: center;
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.variant {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--pink-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.qty {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--pink-deep);
  border: 2px solid var(--pink);
  font-size: 16px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.qty.on {
  background: var(--pink-deep);
  color: #fff;
}

.config-img {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pink-deep);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.meta {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.meta h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.meta p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.price {
  display: block;
  margin-top: 3px;
  color: var(--pink-deep);
  font-weight: 800;
  line-height: 1.2;
}

.need {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.need-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #ffe4eb;
  color: var(--pink-deep);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.stepper input {
  width: 52px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--pink-deep);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.checkout {
  margin-top: 8px;
}

.checkout.hidden,
.hidden {
  display: none;
}

.checkout-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px 20px 24px;
}

.checkout-card h2 {
  margin: 0;
  text-align: center;
  color: var(--pink-deep);
}

.checkout-note {
  text-align: center;
  margin: 6px 0 18px;
}

#checkout-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#checkout-list li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

#checkout-list img,
.checkout-fallback {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff3f6;
}

.checkout-fallback {
  display: grid;
  place-items: center;
  color: var(--pink);
  font-weight: 800;
}

.item-name {
  font-weight: 700;
}

.qty-mark {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--pink-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  vertical-align: middle;
}

.item-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0;
  font-size: 18px;
}

.total-row strong {
  color: var(--pink-deep);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, #f07a97 0%, var(--pink-deep) 100%);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(74, 42, 51, 0.36);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
  text-align: center;
}

.modal-card h2 {
  margin: 0;
  color: var(--pink-deep);
  font-size: 20px;
}

.modal-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn {
  width: auto;
  flex: 1;
}

.modal-card input {
  width: 100%;
  margin-top: 16px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 16px;
  text-align: center;
  color: var(--ink);
  background: #fff8fa;
}

.record-by {
  margin-top: 4px;
  color: var(--pink-deep);
  font-size: 12px;
  font-weight: 800;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 12;
  width: min(1080px, calc(100% - 20px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid #f4d4dc;
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 18px;
}

.dock.hidden {
  display: none;
}

.dock-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dock-info span {
  color: var(--muted);
  font-size: 12px;
}

.dock-info strong {
  color: var(--pink-deep);
  font-size: 18px;
}

.dock .btn {
  width: auto;
  min-width: 108px;
}

.btn.ghost {
  width: 100%;
  background: #ffe4eb;
  color: var(--pink-deep);
}

.remain,
.holders {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.holders {
  color: var(--pink-deep);
}

.holders.hidden {
  display: none;
}

.stats-panel {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px 16px 12px;
  margin-bottom: 16px;
}

.stats-head h2 {
  margin: 0;
  color: var(--pink-deep);
  font-size: 18px;
}

.stats-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.stats-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.stats-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stats-filters select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  background: #fff8fa;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.stats-summary div {
  background: #fff3f6;
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
}

.stats-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.stats-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--pink-deep);
  font-size: 15px;
  line-height: 1.2;
  word-break: break-all;
}

.stats-products {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.stats-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.stats-row:last-child {
  border-bottom: 0;
}

.stats-row img,
.stats-row .checkout-fallback {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff3f6;
}

.stats-row .item-name {
  font-size: 14px;
  font-weight: 800;
}

.stats-row .item-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stats-row strong {
  color: var(--pink-deep);
  font-size: 14px;
}

.stats-empty {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.records {
  display: block;
}

.records.hidden {
  display: none;
}

#records-list {
  display: grid;
  gap: 16px;
}

.record {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 8px 8px 8px;
}

.record.voided {
  opacity: 0.55;
}

.record-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.record-head h3 {
  margin: 0;
  font-size: 16px;
}

.record-head time {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.record-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--pink-deep);
}

.chevron {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.record.open .chevron {
  color: var(--pink-deep);
}

.record-detail {
  display: none;
  padding: 0 10px 10px;
}

.record.open .record-detail {
  display: block;
}

.record ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.record li {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.record li img,
.record li .checkout-fallback {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff3f6;
}

.record-actions {
  margin-top: 14px;
}

.empty-card {
  grid-column: 1 / -1;
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 20px;
  text-align: center;
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: clamp(28px, 9vw, 48px);
  }

  .hero {
    padding-top: 10px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .meta {
    padding: 8px 10px 10px;
  }

  .meta h3 {
    font-size: 13px;
  }
}
