@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=ZCOOL+XiaoWei&display=swap");

:root {
  --bg: #f7efe6;
  --ink: #2b221e;
  --muted: #6b5a52;
  --accent: #d46a3a;
  --accent-dark: #b9562d;
  --card: #fffaf4;
  --line: #ead9c7;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff7ee 0%, #f7efe6 50%, #f2e1d1 100%);
  min-height: 100vh;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -140px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(212, 106, 58, 0.25), rgba(212, 106, 58, 0));
  z-index: 0;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 16px 48px;
  position: relative;
  z-index: 1;
}

h1,
h2 {
  font-family: "ZCOOL XiaoWei", serif;
  margin: 0;
}

h1 {
  font-size: 2.1rem;
}

h2 {
  font-size: 1.6rem;
}

p {
  margin: 0;
}

.hero {
  display: grid;
  gap: 16px;
  animation: rise 0.7s ease both;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  justify-self: center;
}

.brand-logo {
  width: 96px;
  height: 96px;
  display: block;
  object-fit: contain;
  border-radius: 22px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  box-shadow: 0 16px 28px rgba(43, 34, 30, 0.12);
}

.brand-logo--small {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  padding: 6px;
  box-shadow: none;
}

.order-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.price {
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
}

.product {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.8s ease 0.1s both;
}

.product img {
  width: 100%;
  display: block;
  border-radius: 18px;
}

.catalog {
  display: grid;
  gap: 12px;
}

.catalog-item {
  background: #fffdf9;
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.catalog-item.disabled {
  opacity: 0.65;
}

.catalog-title {
  font-weight: 700;
  margin: 0;
}

.tag {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.catalog-qty {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.pay-qr img {
  width: 100%;
  display: block;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.product-info {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 14px 28px rgba(212, 106, 58, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(212, 106, 58, 0.35);
}

.cta.disabled,
.cta[aria-disabled="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-link {
  color: var(--accent-dark);
  text-decoration: underline;
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 999px;
  border: 1px solid rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.12);
  color: #0f3f26;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wa-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 211, 102, 0.18);
}

.wa-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
}

.wa-icon svg {
  width: 100%;
  height: 100%;
  fill: #25d366;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.help-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-weight: 800;
}

.help-btn:active {
  transform: scale(0.98);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 8, 0.45);
  padding: 16px;
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal-card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  font-size: 1.35rem;
}

.modal-card img {
  width: 100%;
  display: block;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.6s ease both;
}

.summary {
  margin-bottom: 16px;
}

.summary-grid {
  display: grid;
  gap: 12px;
}

.summary-grid .label {
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-grid .value {
  font-size: 1.4rem;
  font-weight: 700;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.order-list {
  display: grid;
  gap: 12px;
}

.order-card {
  background: #fffdf9;
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

.order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1rem;
}

.order-card p {
  color: var(--muted);
  font-size: 0.92rem;
}

.meta {
  color: #8b7a70;
  font-size: 0.8rem;
}

.order-header {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.order-header p {
  color: var(--muted);
  font-size: 0.95rem;
}

.back {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.order-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdfb;
  font-family: inherit;
  /* Use 16px to avoid iOS Safari auto-zoom on focus */
  font-size: 16px;
  line-height: 1.2;
}

/* iOS Safari: make date input look aligned with other inputs */
input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  height: 46px;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

textarea {
  resize: vertical;
}

.quantity {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.qty-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  font-size: 1.2rem;
  padding: 6px 0;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.success {
  display: grid;
  gap: 14px;
  text-align: center;
}

.success-info {
  background: #fff4e8;
  border-radius: 16px;
  padding: 12px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.hidden {
  display: none;
}

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

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 420px) {
  .page {
    padding: 18px 14px 40px;
  }

  .catalog-item {
    align-items: flex-start;
  }

  .catalog-qty {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }
}

@media (min-width: 720px) {
  .page {
    padding: 36px 24px 72px;
  }

  h1 {
    font-size: 2.6rem;
  }
}
