:root {
  --bg: #f6f2e8;
  --card: #fffaf0;
  --text: #17130d;
  --muted: #716656;
  --line: #dfd0b8;
  --accent: #111111;
  --accent-soft: #f2df9c;
  --green: #2c6e49;
  --shadow: 0 18px 60px rgba(40, 28, 10, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 222, 120, 0.45), transparent 35%),
    radial-gradient(circle at top right, rgba(230, 255, 210, 0.8), transparent 35%),
    var(--bg);
  color: var(--text);
}

button { font: inherit; }

.hero { padding: 64px 20px 36px; }
.hero-inner { max-width: 980px; margin: 0 auto; text-align: center; }

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.lead {
  max-width: 780px;
  margin: 22px auto 0;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  line-height: 1.8;
  color: #372f23;
}
.lead strong { background: linear-gradient(transparent 55%, var(--accent-soft) 55%); }
.punch { font-weight: 700; }
.punch span { display: block; color: var(--muted); font-weight: 600; }

.money-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 16px;
  align-items: center;
  background: rgba(255, 250, 240, 0.9);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.label { margin: 0 0 4px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.money, .spent { margin: 0; font-weight: 900; letter-spacing: -0.04em; }
.money { font-size: clamp(1.6rem, 4.4vw, 3rem); }
.spent { font-size: clamp(1.2rem, 2.6vw, 2rem); color: var(--green); }

.reset-btn, .receipt-actions button, .buy-btn, .sell-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}
.reset-btn { padding: 12px 18px; background: var(--accent); color: white; font-weight: 800; }
.reset-btn:hover, .receipt-actions button:hover, .buy-btn:hover, .sell-btn:hover { transform: translateY(-1px); }

main { max-width: 1120px; margin: 22px auto 0; padding: 0 20px 64px; }

.summary-card {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 250, 240, 0.78);
}
.summary-card p { margin: 0 0 14px; font-size: 1.05rem; font-weight: 700; }
.progress-shell { height: 12px; background: #eadfcd; border-radius: 999px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.25s ease; }

.items-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.item-card {
  min-height: 285px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 10px 32px rgba(40, 28, 10, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.item-top { display: grid; gap: 12px; }
.emoji { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 20px; background: #f1e5cf; font-size: 2rem; }
.emoji.has-image { overflow: hidden; }
.emoji img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-card h3 { margin: 0; font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.04em; }
.item-card .en { margin: -4px 0 0; color: var(--muted); font-size: 0.93rem; line-height: 1.4; }
.price { margin: 0; font-size: 1.35rem; font-weight: 900; letter-spacing: -0.04em; }

.controls { margin-top: 18px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; }
.buy-btn, .sell-btn { height: 44px; font-weight: 900; font-size: 1.2rem; }
.buy-btn { background: var(--accent); color: #fff; }
.sell-btn { background: #eadfcd; color: var(--text); }
.buy-btn:disabled, .sell-btn:disabled { cursor: not-allowed; opacity: 0.35; transform: none; }
.qty { text-align: center; font-weight: 900; font-size: 1.1rem; padding: 10px; border-radius: 999px; background: #f5eddf; }

.receipt-section { position: relative; overflow: hidden; margin-top: 44px; padding: 34px; border: 1px solid #1b1812; border-radius: 30px; background: #f8e85e; box-shadow: var(--shadow); }
.receipt-header { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 18px; }
.receipt-header h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.06em; }
.receipt-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.receipt-actions button { padding: 11px 15px; background: var(--accent); color: white; font-weight: 800; }
.receipt-body { position: relative; isolation: isolate; border-top: 1px solid rgba(23, 19, 13, 0.45); padding-top: 24px; }
.empty-receipt { margin: 0; color: var(--muted); font-weight: 700; }
.receipt-art { position: absolute; z-index: -1; inset: -120px -80px auto auto; width: 360px; height: 360px; opacity: 0.22; }
.receipt-art span { position: absolute; inset: 0; border: 42px solid #ff5f2e; border-radius: 50%; }
.receipt-art span:nth-child(2) { inset: 58px; border-color: #1d52ff; }
.receipt-art span:nth-child(3) { inset: 116px; border-color: #17130d; }
.receipt-stats { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; margin: 4px 0 30px; }
.receipt-stats > div { min-height: 116px; padding: 16px; border: 1px solid #17130d; border-radius: 18px; background: rgba(255, 255, 255, 0.36); display: flex; flex-direction: column; justify-content: space-between; }
.receipt-stats span, .manifest-label, .receipt-total span { font-size: 0.68rem; letter-spacing: 0.14em; font-weight: 900; }
.receipt-stats strong { font-size: clamp(1.5rem, 3.2vw, 2.7rem); line-height: 0.95; letter-spacing: -0.065em; overflow-wrap: anywhere; }
.receipt-spent { background: #17130d !important; color: #fffaf0; }
.receipt-manifest { padding: 22px; border: 1px solid #17130d; border-radius: 22px; background: rgba(255, 250, 240, 0.88); }
.manifest-label { margin: 0 0 12px; }
.receipt-list { list-style: none; padding: 0; margin: 0; }
.receipt-list li { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 11px 0; border-bottom: 1px solid rgba(23, 19, 13, 0.15); break-inside: avoid; }
.receipt-list strong { display: block; }
.receipt-list span { color: var(--muted); font-size: 0.9rem; }
.receipt-total { margin-top: 16px; padding: 22px; border-radius: 22px; background: #ff6534; color: #17130d; font-weight: 900; display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: end; }
.receipt-total strong { justify-self: end; font-size: clamp(1.6rem, 4vw, 3.2rem); letter-spacing: -0.06em; }
.receipt-total p { grid-column: 1 / -1; margin: 8px 0 0; padding-top: 12px; border-top: 1px solid rgba(23, 19, 13, 0.35); }

footer { padding: 26px 20px 44px; text-align: center; color: var(--muted); font-size: 0.92rem; }

@media (max-width: 860px) {
  .money-bar { grid-template-columns: 1fr; border-radius: 0; border-left: 0; border-right: 0; }
  .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .receipt-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 580px) {
  .hero { padding-top: 42px; }
  .items-grid { grid-template-columns: 1fr; }
  .item-card { min-height: 250px; }
  .receipt-section { padding: 22px; }
  .receipt-stats { grid-template-columns: 1fr 1fr; }
  .receipt-spent { grid-column: 1 / -1; }
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  .hero, .money-bar, .summary-card, .items-grid, footer, .receipt-actions { display: none !important; }
  html, body { margin: 0; background: #f8e85e; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  main { padding: 0; margin: 0; }
  .receipt-section { width: 210mm; min-height: 297mm; margin: 0; padding: 16mm; border: 0; border-radius: 0; box-shadow: none; }
  .receipt-header { margin-bottom: 8mm; }
  .receipt-header h2 { font-size: 28pt; }
  .receipt-stats { margin-bottom: 8mm; }
  .receipt-stats > div { min-height: 28mm; }
  .receipt-stats strong { font-size: 21pt; }
  .receipt-manifest { padding: 7mm; }
  .receipt-list li { padding: 3mm 0; font-size: 9pt; }
  .receipt-total { margin-top: 5mm; }
}
