:root {
  --bg-color: #090a0f;
  --card-bg: #12151f;
  --card-border: rgba(255, 255, 255, 0.08);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --accent-cyan: #38bdf8;
  --accent-green: #22c55e;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;
  
  --transition: all 0.2s ease;
}

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

body {
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-main);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 16px;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.page-exit {
  opacity: 0;
  transform: translateY(-8px);
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.card-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 470px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px 22px 28px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: cardAppear 0.4s ease forwards;
}

@keyframes cardAppear {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--accent-cyan);
  transform: translateX(-2px);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
}

.page-title-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.title-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #181d2a;
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.page-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.page-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  max-width: 320px;
}

.activation-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-paste-compact {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-paste-compact:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
}

.key-slot-container {
  position: relative;
  background: #080a10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: text;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.key-slot-container:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.key-slot-container:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  background: #0b0e17;
}

.key-hidden-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: text;
  z-index: 2;
  font-size: 16px;
}

.key-slots-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}

.k-prefix {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.k-group {
  display: flex;
  gap: 2px;
}

.k-slot {
  width: 13px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.2);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
}

.k-slot.filled {
  color: #ffffff;
  border-bottom-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.k-slot.current {
  color: rgba(56, 189, 248, 0.5);
  border-bottom-color: var(--accent-cyan);
  animation: blinkSlot 1.2s infinite;
}

@keyframes blinkSlot {
  0%, 100% { border-bottom-color: var(--accent-cyan); opacity: 1; }
  50% { border-bottom-color: transparent; opacity: 0.6; }
}

.k-sep {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.2);
  font-weight: bold;
  user-select: none;
  margin: 0 1px;
}

.btn-submit {
  background: #171d2b;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #ffffff;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-submit:hover {
  background: #1e2638;
  border-color: rgba(56, 189, 248, 0.65);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

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

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-submit.loading .btn-spinner {
  display: inline-block;
}

.btn-submit.loading .btn-text {
  opacity: 0.8;
}

.result-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.banner-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.banner-text-group {
  display: flex;
  flex-direction: column;
}

.banner-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.banner-sub {
  font-size: 0.78rem;
  opacity: 0.85;
}

.banner-success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}
.banner-success .banner-icon {
  background: rgba(34, 197, 94, 0.2);
  color: var(--accent-green);
}

.banner-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fde047;
}
.banner-warning .banner-icon {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-yellow);
}

.banner-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.banner-danger .banner-icon {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.token-card {
  background: #080a10;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.token-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.token-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-yellow);
  background: rgba(245, 158, 11, 0.1);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.token-display {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: #0d1018;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
}

.btn-copy-token {
  background: #1a2233;
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #ffffff;
  padding: 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-copy-token:hover {
  background: #232f47;
  border-color: rgba(56, 189, 248, 0.6);
}

.pair-meta-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--text-dim);
  padding: 2px 4px;
}

.bound-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 4px 2px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #161a24;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}

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

.toast-icon {
  color: var(--accent-green);
  font-weight: bold;
}

@media (max-width: 480px) {
  body {
    padding: 18px 10px;
  }
  .card-container {
    padding: 20px 12px;
    border-radius: 20px;
  }
  .key-slot-container {
    padding: 12px 4px;
  }
  .key-slots-display {
    gap: 2px;
  }
  .k-prefix {
    font-size: 0.8rem;
    padding: 1px 4px;
  }
  .k-group {
    gap: 1px;
  }
  .k-slot {
    width: 11px;
    height: 22px;
    font-size: 0.8rem;
  }
  .k-sep {
    margin: 0;
    font-size: 0.8rem;
  }
  .token-display {
    font-size: 0.95rem;
  }
}
