* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 45%, #312e81 100%);
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  opacity: 0.45;
  animation: float 7s ease-in-out infinite;
}

.bg-glow-1 {
  background: #60a5fa;
  top: -120px;
  left: -80px;
}

.bg-glow-2 {
  background: #a78bfa;
  right: -120px;
  bottom: -100px;
  animation-delay: 1.5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(20px); }
}

.container,
.admin-container {
  width: 100%;
  max-width: 980px;
  z-index: 1;
}

.container {
  max-width: 640px;
}

.card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.container .card {
  text-align: center;
}

.main-card h1,
.main-card .subtitle,
.main-card .alert,
.main-card .result-label,
.main-card .result-key {
  text-align: center;
}

.main-card .alert {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

.login-card {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
}

.login-card h1,
.login-card .subtitle,
.login-card .alert,
.login-card .footer-actions,
.login-card .hint,
.login-card p,
.login-card label {
  text-align: center;
}

.pop-in {
  animation: popIn 0.45s ease;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 28px;
  color: #f8fafc;
}

h2 {
  margin-top: 28px;
  font-size: 20px;
}

.subtitle {
  margin-top: 0;
  margin-bottom: 22px;
  color: #cbd5e1;
}

.hint {
  color: #cbd5e1;
  font-size: 14px;
}

.redeem-form {
  display: grid;
  gap: 12px;
}

.container .redeem-form {
  max-width: 460px;
  margin: 0 auto;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  color: #f8fafc;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

textarea {
  min-height: 190px;
  resize: vertical;
}

button {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.35);
}

button:active {
  transform: translateY(0);
}

button.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.alert {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
}

.alert.success {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.alert.error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.result-box {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.main-card .result-box {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.result-label {
  font-size: 13px;
  color: #94a3b8;
}

.result-key {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  word-break: break-all;
}

.copy-btn {
  min-width: 86px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.stat-item {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.7);
  border-radius: 12px;
  padding: 14px;
}

.stat-label {
  color: #94a3b8;
  font-size: 14px;
}

.stat-value {
  margin-top: 6px;
  font-size: 28px;
  color: #f8fafc;
  font-weight: 700;
}

.pair-form {
  margin-top: 10px;
}

.textareas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  text-align: left;
}

.auth-form {
  max-width: 440px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.45);
}

.input-group {
  text-align: center;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #f8fafc;
  padding: 12px 14px;
  text-align: center;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input[type="text"]::placeholder,
.auth-form input[type="password"]::placeholder {
  color: #94a3b8;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="password"]:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.auth-form button {
  margin-top: 4px;
}

.table-wrap {
  margin-top: 10px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  text-align: left;
}

th {
  color: #cbd5e1;
  font-weight: 600;
}

.empty {
  text-align: center;
  color: #94a3b8;
}

.footer-actions {
  margin-top: 16px;
}

.container .footer-actions {
  text-align: center;
}

a {
  color: #93c5fd;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

@media (max-width: 780px) {
  .card {
    padding: 18px;
  }

  .textareas {
    grid-template-columns: 1fr;
  }

  .result-box {
    flex-direction: column;
    align-items: flex-start;
  }
}
