:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #10a37f;
  --primary-hover: #0d8c6d;
  --primary-soft: #ecfdf5;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top center, #e6f7f2 0%, var(--bg) 52%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.is-hidden {
  display: none !important;
}

.page-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.redeem-shell {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.redeem-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 28px 30px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(16, 163, 127, 0.28);
}

.redeem-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
}

.lead {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

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

.redeem-form input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  text-align: center;
  letter-spacing: 0.6px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.redeem-form input:focus {
  border-color: var(--primary);
  background: #fff;
}

.trust-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.trust-row span {
  font-size: 12px;
  color: var(--muted);
  background: #f1f5f9;
  padding: 5px 10px;
  border-radius: 999px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-lg {
  padding: 13px 20px;
  font-size: 15.5px;
  border-radius: 13px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(16, 163, 127, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-blue {
  background: var(--blue);
  color: #fff;
}

.btn-blue:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-warn {
  background: var(--amber-soft);
  border-color: #fde68a;
  color: #b45309;
}

.btn-warn:hover:not(:disabled) {
  background: #fef3c7;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.alert-err {
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 11px;
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13.5px;
  text-align: left;
}

.ws-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.ws-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10a37f, #0ea5e9);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.ws-brand strong {
  display: block;
  font-family: var(--mono);
  font-size: 13.5px;
}

.tier-pill {
  display: inline-block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.ws-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quota-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #f1f5f9;
  font-size: 12.5px;
  color: var(--muted);
}

.quota-pill strong {
  font-family: var(--mono);
  font-size: 17px;
  color: var(--primary);
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
  margin-bottom: 22px;
}

.hero-empty {
  text-align: center;
  padding: 14px 6px;
}

.hero-empty h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.hero-empty p {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.active-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.live-badge.is-wait {
  background: var(--blue-soft);
  color: var(--blue);
}

.live-badge.is-ok {
  background: var(--primary-soft);
  color: var(--primary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.big-box {
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  padding: 16px;
  margin-bottom: 12px;
}

.big-box.is-code-ready {
  background: var(--primary-soft);
  border-color: #a7f3d0;
}

.big-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.big-phone {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.big-code {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--primary);
  margin: 4px 0 12px;
}

.waiting-code-text {
  font-size: 14.5px;
  color: var(--muted);
  padding: 8px 0;
}

.copy-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.hero-actions .btn {
  flex: 1;
  min-width: 140px;
}

.swap-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  font-weight: 700;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.record-item.is-swapped {
  opacity: 0.62;
}

.rec-phone {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
}

.rec-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.rec-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-pill {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 15px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #a7f3d0;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.status-tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--muted);
}

.status-tag.is-wait {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-tag.is-ok {
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-records {
  text-align: center;
  padding: 26px 14px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.quiet-footer {
  margin-top: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.quiet-footer a {
  color: var(--muted);
  text-decoration: none;
}

.quiet-footer a:hover {
  color: var(--primary);
}

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.toast.is-ok {
  background: var(--primary);
}

.toast.is-err {
  background: var(--danger);
}
