* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: #fff;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  color: #FF6B35;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 20px;
  font-weight: 600;
}

.step {
  display: none;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.step.active {
  display: block;
}

.step h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1a1a1a;
}

.hint {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.banner {
  background: #FFF4ED;
  color: #FF6B35;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid #FFCDA8;
}

.banner code {
  background: rgba(255, 107, 53, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="email"]:focus,
input[type="text"]:focus {
  border-color: #FF6B35;
}

input[type="text"] {
  letter-spacing: 8px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
}

button,
.primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #FF6B35;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.05s;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

button:active,
.primary:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link-btn {
  background: transparent;
  color: #FF6B35;
  font-size: 14px;
  margin-top: 16px;
  text-decoration: underline;
  width: auto;
  padding: 8px 12px;
}

.error {
  color: #DC2626;
  font-size: 14px;
  margin-top: 12px;
  min-height: 18px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f3f4f6;
  border-top-color: #FF6B35;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.success-icon,
.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 16px;
}

.success-icon {
  background: #10B981;
}

.error-icon {
  background: #DC2626;
}

.reward {
  font-size: 24px;
  font-weight: 700;
  color: #FF6B35;
  margin-bottom: 12px;
}

.error-message {
  color: #DC2626;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* 禮物盒列表 */
.giftbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  text-align: left;
}

.gift-card {
  background: #FAFAFA;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gift-card.used {
  opacity: 0.5;
}

.gift-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #FF6B35, #F7931E);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.gift-card-body {
  flex: 1;
  min-width: 0;
}

.gift-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.gift-card-meta {
  font-size: 12px;
  color: #888;
}

.gift-card-action {
  background: #FF6B35;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  flex-shrink: 0;
}

.gift-card-action:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.empty {
  padding: 40px 20px;
  color: #888;
  font-size: 14px;
  text-align: center;
}

.footer-note {
  font-size: 12px;
  color: #999;
  margin-top: 12px;
  font-style: italic;
}

/* 手動輸入兌換碼區 */
.manual-redeem {
  margin: 12px 0 20px;
  text-align: left;
}

.ghost {
  background: transparent;
  color: #FF6B35;
  border: 1px dashed #FF6B35;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
}

.ghost:active {
  background: #FFF4ED;
}

.manual-redeem-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-direction: row;
}

.manual-redeem-form input[type="text"] {
  flex: 1;
  letter-spacing: 1px;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  text-transform: lowercase;
}

.manual-redeem-form button {
  width: auto;
  padding: 14px 24px;
  flex-shrink: 0;
}

footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

footer a {
  color: #fff;
  text-decoration: underline;
}
