:root {
  --gold: #f7d86a;
  --gold-dark: #c89b2e;
  --gold-dim: rgba(0, 214, 255, 0.12);
  --red-primary: #d71932;
  --red-dark: #8b0d1b;
  --cyan: #00d6ff;
  --cyan-soft: rgba(0, 214, 255, 0.18);
  --bg-body: #08090e;
  --bg-card: #11131d;
  --bg-card-border: rgba(0, 214, 255, 0.14);
  --bg-input: #171a25;
  --bg-input-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f0ece4;
  --text-secondary: rgba(240, 236, 228, 0.55);
  --text-muted: rgba(240, 236, 228, 0.3);
  --success: #4ade80;
  --warning: #f59e0b;
  --error: #ef4444;
  --border-radius: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-gold: 0 4px 24px rgba(0, 214, 255, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(0, 214, 255, 0.2), transparent 34%),
    radial-gradient(circle at 8% 22%, rgba(247, 216, 106, 0.09), transparent 24%),
    var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 460px;
  padding: 16px;
  margin: 0 auto;
}

/* ===== Header ===== */
.header {
  text-align: center;
  padding: 24px 0 16px;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header .site-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 14px rgba(0, 214, 255, 0.34));
}

.cover-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.cover-brand-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 18px rgba(0, 214, 255, 0.42))
    drop-shadow(0 0 8px rgba(247, 216, 106, 0.18));
}

.packet-slogan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(100%, 320px);
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 214, 255, 0.38);
  background:
    linear-gradient(135deg, rgba(0, 214, 255, 0.16), rgba(247, 216, 106, 0.08)),
    rgba(4, 12, 24, 0.66);
  color: #eaffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0;
  text-shadow:
    0 0 14px rgba(0, 214, 255, 0.5),
    0 0 18px rgba(247, 216, 106, 0.18);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 22px rgba(0, 214, 255, 0.12);
}

.packet-slogan-hero {
  max-width: min(100%, 360px);
  min-height: 42px;
  padding: 9px 16px;
  color: #f9fdff;
  font-size: 15px;
  border-color: rgba(0, 214, 255, 0.52);
  box-shadow:
    0 0 26px rgba(0, 214, 255, 0.18),
    inset 0 0 18px rgba(0, 214, 255, 0.08);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--gold);
}

/* ===== Envelope (claim / create success) ===== */
.envelope {
  background: linear-gradient(135deg, #061827, #0b1020);
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 214, 255, 0.18);
  margin-bottom: 20px;
}

.envelope::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  border-radius: 20px 20px 0 0;
}

.envelope .coin-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 214, 255, 0.92), var(--gold));
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 4px 24px rgba(0, 214, 255, 0.3);
  position: relative;
  z-index: 1;
}

.envelope .coin-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.envelope .amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
  position: relative;
  z-index: 1;
}

.envelope .amount-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.envelope .sender {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 214, 255, 0.12);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ===== Radio group ===== */
.radio-group {
  display: flex;
  gap: 8px;
}

.radio-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.radio-group input[type='radio'] {
  display: none;
}

.radio-group input[type='radio']:checked + span {
  color: var(--gold);
}

.radio-group label:has(input:checked) {
  border-color: var(--gold-dark);
  background: var(--gold-dim);
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  color: var(--bg-body);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 214, 255, 0.28);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-gold {
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  color: var(--bg-body);
}

.btn-gold:hover {
  opacity: 0.9;
  box-shadow: 0 4px 20px rgba(212, 160, 23, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--gold-dark);
  color: var(--gold);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
  display: inline-block;
}

.btn-red {
  background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
  color: white;
}

.btn-red:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-active {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}

.badge-completed {
  background: var(--gold-dim);
  color: var(--gold);
}

.badge-expired {
  background: rgba(240, 236, 228, 0.06);
  color: var(--text-muted);
}

/* ===== Claim list ===== */
.claim-list {
  list-style: none;
}

.claim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.claim-item:last-child {
  border-bottom: none;
}

.claim-address {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
}

.claim-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

/* ===== Progress ===== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  border-radius: 3px;
  transition: width 0.3s;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  max-width: 90%;
  backdrop-filter: blur(12px);
}

.toast.show {
  opacity: 1;
}

.toast-success {
  background: rgba(74, 222, 128, 0.9);
  color: #052e16;
}

.toast-error {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.toast-info {
  background: rgba(59, 130, 246, 0.9);
  color: white;
}

/* ===== Spinner / Loading ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 9998;
  font-size: 14px;
  color: var(--text-secondary);
  backdrop-filter: blur(4px);
}

.hidden {
  display: none !important;
}

/* ===== Nav bar ===== */
.nav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.nav a {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav a.active,
.nav a:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold-dark);
}

/* ===== Copy field ===== */
.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-field input {
  flex: 1;
}

.copy-field button {
  padding: 12px 16px;
  white-space: nowrap;
}

/* ===== Info rows ===== */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

.info-row .label {
  color: var(--text-secondary);
}

.info-row .value {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Wallet bar ===== */
.wallet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  margin-bottom: 16px;
}

.wallet-address {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
}

/* ===== Cover picker ===== */
.cover-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cover-picker label {
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s;
}

.cover-picker label:hover {
  border-color: rgba(212, 160, 23, 0.3);
}

.cover-picker label:has(input:checked) {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(212, 160, 23, 0.25);
}

.cover-picker input {
  display: none;
}

.cover-picker img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.cover-picker .check-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg-body);
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

.cover-picker label:has(input:checked) .check-mark {
  display: flex;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .envelope {
    padding: 32px 20px;
  }

  .envelope .amount {
    font-size: 28px;
  }
}

@media (min-width: 900px) {
  .container {
    max-width: 520px;
    padding-top: 24px;
  }
}

/* ===== Footer / version ===== */
.brand-footer {
  text-align: center;
  padding: 24px 0 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.2);
}

.brand-footer .app-version {
  color: rgba(255, 255, 255, 0.38);
  font-variant-numeric: tabular-nums;
}

.claim-token-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 0 14px rgba(0, 214, 255, 0.34));
}

.success-token-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.success-token-row .claim-token-icon {
  width: 28px;
  height: 28px;
  margin: 0;
  box-shadow: 0 2px 10px rgba(212, 160, 23, 0.25);
}
