:root {
  --g-bg: #3e2723;
  --g-panel: #ffffff;
  --g-orange: #ff7043;
  --g-orange-deep: #f4511e;
  --g-ink: #212121;
  --g-muted: #616161;
  --g-line: #eceff1;
  --g-font: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.gift-body {
  font-family: var(--g-font);
  background: var(--g-bg);
  color: var(--g-ink);
  min-height: 100vh;
}

.gift-topbar {
  background: #fff;
  color: var(--g-orange);
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.1rem, 3vw, 1.65rem);
  padding: 0.85rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.gift-shell {
  width: min(1100px, calc(100% - 1.5rem));
  margin: 1.25rem auto 2rem;
  background: var(--g-panel);
  border-radius: 18px;
  padding: 1.5rem 1.25rem 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.gift-heading {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 800;
  color: var(--g-ink);
}
.gift-lead {
  margin: 0 0 1.1rem;
  color: var(--g-muted);
  font-size: 0.98rem;
  line-height: 1.45;
  max-width: 40rem;
}

.gift-panel label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--g-muted);
  margin-bottom: 0.4rem;
}
.gift-code-row {
  display: flex;
  gap: 0.55rem;
  max-width: 520px;
}
.gift-code-row input {
  flex: 1;
  border: 2px solid var(--g-line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  font-family: ui-monospace, Menlo, monospace;
  text-transform: uppercase;
  outline: none;
}
.gift-code-row input:focus {
  border-color: var(--g-orange);
  box-shadow: 0 0 0 3px rgba(255, 112, 67, 0.2);
}
.gift-btn {
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  font-weight: 800;
  font-family: var(--g-font);
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--g-orange), var(--g-orange-deep));
  white-space: nowrap;
}
.gift-btn:disabled { opacity: 0.55; cursor: wait; }
.gift-status {
  min-height: 1.2rem;
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--g-muted);
}
.gift-status.err { color: #c62828; }
.gift-status.ok { color: #2e7d32; }

.gift-reveal { margin-top: 0.25rem; }
.gift-reveal[hidden] { display: none !important; }

.gift-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.1rem;
  margin-top: 1rem;
}

.gift-pack {
  background: #fafafa;
  border: 1px solid var(--g-line);
  border-radius: 14px;
  padding: 0.85rem 0.75rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  animation: gift-pop 0.45s ease both;
}
.gift-pack:nth-child(1) { animation-delay: 0.02s; }
.gift-pack:nth-child(2) { animation-delay: 0.06s; }
.gift-pack:nth-child(3) { animation-delay: 0.1s; }
.gift-pack:nth-child(4) { animation-delay: 0.14s; }
.gift-pack:nth-child(5) { animation-delay: 0.18s; }
.gift-pack:nth-child(6) { animation-delay: 0.22s; }
.gift-pack:nth-child(7) { animation-delay: 0.26s; }
.gift-pack:nth-child(8) { animation-delay: 0.3s; }

.gift-pack-exp {
  color: var(--g-orange);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  min-height: 2.4em;
}
.gift-pack-code {
  font-size: 0.78rem;
  color: var(--g-ink);
  word-break: break-all;
}
.gift-pack-code strong { font-weight: 800; }
.gift-pack-art {
  width: min(100%, 150px);
  aspect-ratio: 5 / 7;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--g-line);
}
.gift-pack-art-ph {
  width: min(100%, 150px);
  aspect-ratio: 5 / 7;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(160deg, #ffe0b2, #ffccbc);
  color: #bf360c;
  font-weight: 800;
  font-size: 0.85rem;
}
.gift-pack canvas,
.gift-pack .gift-pack-qr img {
  width: 110px !important;
  height: 110px !important;
  margin-top: 0.15rem;
}
.gift-pack-actions {
  display: flex;
  gap: 0.35rem;
  width: 100%;
  justify-content: center;
}
.gift-copy {
  border: 1px solid var(--g-line);
  background: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--g-ink);
  font-family: var(--g-font);
}
.gift-copy:hover { border-color: var(--g-orange); color: var(--g-orange-deep); }
.gift-copy.done { background: #e8f5e9; border-color: #81c784; }

.gift-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
}
.gift-btn-ghost {
  border: 1px solid var(--g-line);
  background: #fff;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: 800;
  font-family: var(--g-font);
  cursor: pointer;
  color: var(--g-ink);
}
.gift-btn-ghost:hover { border-color: var(--g-orange); color: var(--g-orange-deep); }

.gift-foot {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  padding: 0 1rem 1.5rem;
}
.gift-foot a { color: #ffab91; font-weight: 700; }

@keyframes gift-pop {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .gift-code-row { flex-direction: column; }
  .gift-pack-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
}
