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

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color); 
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15); 
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3); 
}

:root {
  --bg-color: #050b16;
  --glass-bg: rgba(9, 18, 34, 0.78);
  --glass-border: rgba(157, 224, 239, 0.16);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-1: #00f6ff;
  --accent-2: #3b82f6;
  --accent-3: #0ea5e9;
  
  --success: #10b981;
  --warn: #f59e0b;
  --error: #ef4444;

  --font-sans: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  min-height: 100vh;
  color: var(--text-main);
  background-color: var(--bg-color);
  background-image:
    linear-gradient(135deg, rgba(7, 26, 50, 0.92), rgba(3, 8, 20, 0.98) 52%, rgba(4, 33, 42, 0.9)),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 72px);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1320px;
  background: linear-gradient(145deg, rgba(15, 29, 52, 0.88), rgba(5, 12, 25, 0.84));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: clamp(26px, 3vw, 34px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.redeem-container {
  max-width: 980px;
}

.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 246, 255, 0.7), transparent);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-1);
  margin-bottom: 14px;
}

.hero-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 0 4px rgba(0, 246, 255, 0.12), 0 0 16px rgba(0, 246, 255, 0.65);
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 7px;
  letter-spacing: 0;
  background: linear-gradient(135deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  color: #dbeafe;
}

.single-input {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  background: rgba(2, 8, 19, 0.72);
  border: 1px solid rgba(148, 197, 220, 0.2);
  border-radius: 11px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.26);
}

.single-input:focus {
  border-color: var(--accent-1);
  background: rgba(2, 12, 25, 0.9);
  box-shadow: 0 0 0 3px rgba(0, 246, 255, 0.11), 0 0 24px rgba(0, 246, 255, 0.08), inset 0 2px 6px rgba(0, 0, 0, 0.26);
}

.single-input::placeholder {
  color: #475569;
}

.btn {
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 11px;
  border: none;
  background: linear-gradient(100deg, #00d9e6 0%, #19bfe8 42%, #3b82f6 100%);
  color: #020617;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 9px 24px rgba(0, 119, 190, 0.24);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 13px 30px rgba(0, 173, 231, 0.32);
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: #334155;
  color: #94a3b8;
}

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 24px;
  width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(8, 18, 32, 0.96);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok {
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.toast.err {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.filter-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.filter-btn.active { background: rgba(0, 246, 255, 0.1); border-color: var(--accent-1); color: var(--accent-1); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  display: none;
}

.metric {
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.metric::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.metric:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.metric .lbl {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  font-weight: 500;
}

.metric .val {
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  display: none;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.85rem;
  white-space: nowrap;
}

th {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

tbody tr {
  transition: background 0.2s ease;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.checking { background: rgba(245, 158, 11, 0.1); color: var(--warn); }
.badge.live { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge.die { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.badge.quota-exhausted { background: rgba(245, 158, 11, 0.1); color: var(--warn); }
.badge.expired { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.badge.err { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

.key-text {
  font-family: var(--font-mono);
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  letter-spacing: 0.02em;
}

.expiry-cell { color: var(--text-muted); }
.expiry-cell .expiry-date { display: block; color: var(--text-main); font-weight: 500; font-family: var(--font-mono); font-size: 0.9rem;}
.expiry-cell.unlimited { color: var(--text-muted); }
.expiry-cell.is-expired .expiry-date { color: var(--error); }

.spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

@media (max-width: 768px) {
  body { align-items: flex-start; }
  .container { padding: 28px 20px; border-radius: 16px; }
  .redeem-container { max-width: 100%; }
  h1 { font-size: 1.85rem; }
  .metrics { grid-template-columns: 1fr; gap: 12px; }
}
