:root {
  --gap-sm: 14px;
  --gap-md: 22px;
  --gap-lg: 40px;
  --radius: 18px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #000;
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body::after {
  content: "";
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 48px 40px 40px;
  width: 520px;
  max-width: 100%;
}

.brand {
  text-align: center;
  margin-bottom: var(--gap-lg);
}

h1 {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 8px;
}

.tagline {
  font-size: 1.125rem;
  color: #b0b0b0;
  font-weight: 400;
  line-height: 1.68;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--gap-md);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 9999px;
  padding: 4px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #999;
  cursor: pointer;
  border-radius: 9999px;
  transition: all 0.3s ease;
  border: none;
  background: none;
  font-family: inherit;
  letter-spacing: 0.3px;
}

.tab:hover {
  color: #ccc;
}

.tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.form-group {
  margin-bottom: var(--gap-md);
}

label {
  display: block;
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="date"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 14px 20px;
  color: #fff;
  font-size: clamp(15px, 1.4vw, 16px);
  font-family: inherit;
  outline: none;
  transition: all 0.3s ease;
  height: 50px;
}

input:focus {
  border-color: #667eea;
}

input::placeholder {
  color: #666;
  font-weight: 400;
}

.uppercase-input {
  text-transform: uppercase;
}

.captcha-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.captcha-row input {
  flex: 1;
}

.captcha-img {
  height: 50px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  min-width: 150px;
  background: rgba(255, 255, 255, 0.03);
}

.captcha-img:hover {
  opacity: 0.7;
}

.captcha-hint {
  font-size: 0.8rem;
  color: #666;
  margin-top: 6px;
}

.submit-btn {
  width: 100%;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 9999px;
  padding: 15px 40px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: var(--gap-md);
  letter-spacing: 0.3px;
}

.submit-btn:hover {
  background: #f0f0f0;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

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

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

.secondary-btn {
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 9999px;
  padding: 10px 28px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-3px);
}

.license-copy-btn {
  margin-top: var(--gap-sm);
}

.result {
  display: none;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeUp 0.4s ease;
}

.result.visible {
  display: block;
}

.result-header {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: var(--gap-sm);
  line-height: 1.4;
}

.success .result-header {
  color: #4ade80;
}

.error .result-header {
  color: #ef4444;
}

.license-type {
  font-size: 0.8rem;
  color: #666;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.license-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 20px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 11.5px;
  word-break: break-all;
  line-height: 1.8;
  color: #4ade80;
  user-select: all;
}

.error-msg {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 20px;
  color: #b0b0b0;
  font-size: clamp(15px, 1.4vw, 16px);
  line-height: 1.6;
}

.device-list {
  margin-top: var(--gap-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  gap: 12px;
}

.device-item.is-unbound {
  opacity: 0.3;
}

.device-info {
  flex: 1;
  min-width: 0;
}

.device-code {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 12px;
  color: #b0b0b0;
  word-break: break-all;
}

.device-time {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.unbind-btn {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.unbind-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

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

.device-empty {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  padding: 32px 0;
}

.device-count {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 10px;
}

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 12px 28px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10000;
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
