:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --accent: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #0a0e1a;
  --card: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #e2e8f0;
  --text-muted: #64748b;
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
  color: var(--text);
}

/* --- Background Effects --- */
.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  top: -200px;
  left: -100px;
  pointer-events: none;
  animation: glowFloat 8s ease-in-out infinite alternate;
}

.bg-glow-2 {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  top: auto;
  left: auto;
  bottom: -200px;
  right: -100px;
  animation: glowFloat 10s ease-in-out infinite alternate-reverse;
}

@keyframes glowFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.15); }
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 460px;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: containerIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes containerIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Logo --- */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  animation: fadeIn 1s 0.2s both;
}

.logo-icon {
  width: 44px;
  height: 44px;
  color: var(--primary);
  filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.4));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.4)); }
  50% { filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.6)); }
}

.logo-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #0a0e1a;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  padding: 3px 8px;
  border-radius: 6px;
  animation: badgeIn 0.6s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes badgeIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Title --- */
.title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 2px;
  animation: fadeIn 0.8s 0.3s both;
}

.title-frost {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-pos {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 28px;
  animation: fadeIn 0.8s 0.4s both;
}

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

/* --- Card --- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 4px 60px rgba(0, 0, 0, 0.4),
    0 0 120px rgba(59, 130, 246, 0.04);
  animation: cardIn 0.9s 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: box-shadow 0.4s ease;
}

.card:hover {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05) inset,
    0 4px 80px rgba(0, 0, 0, 0.5),
    0 0 150px rgba(59, 130, 246, 0.07);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Form --- */
.form-group {
  text-align: left;
  margin-bottom: 18px;
  position: relative;
}

label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.label-icon {
  font-size: 5px;
  color: var(--primary);
}

input, select {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  outline: none;
  transition: all 0.3s ease;
  -webkit-appearance: none;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

input:focus, select:focus {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

select {
  cursor: pointer;
  color: var(--text);
  background-image: none;
}

option {
  background: #1a1f2e;
  color: var(--text);
}

.select-wrapper {
  position: relative;
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
}

.select-wrapper:focus-within .select-arrow {
  color: var(--primary);
}

/* --- HWID Row --- */
.hwid-row {
  display: flex;
  gap: 8px;
}

.hwid-row input {
  flex: 1;
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

.btn-scan {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  color: var(--text-muted);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-scan:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
  transform: scale(1.05);
}

.btn-scan:active {
  transform: scale(0.97);
}

.btn-scan:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* --- Scanner --- */
.scanner-wrapper {
  margin-top: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  animation: scannerIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes scannerIn {
  from { opacity: 0; transform: scaleY(0.8); max-height: 0; }
  to { opacity: 1; transform: scaleY(1); max-height: 500px; }
}

.scanner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.1);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.scanner-dot {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  animation: dotBlink 1s ease-in-out infinite;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#qr-reader {
  width: 100%;
}

#qr-reader video {
  width: 100% !important;
  border-radius: 0 !important;
}

.btn-close-scan {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: none;
  border-top: 1px solid rgba(239, 68, 68, 0.15);
  cursor: pointer;
  transition: background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-close-scan:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* --- Generate Button --- */
.btn-generate {
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.45);
}

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

.btn-generate:disabled {
  background: linear-gradient(135deg, #475569, #334155);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-text {
  position: relative;
  z-index: 2;
}

.btn-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 3s ease-in-out infinite;
  z-index: 1;
}

@keyframes shimmer {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

/* --- Result --- */
.result {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
  animation: resultIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.result-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.result-check {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  animation: checkPop 0.5s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes checkPop {
  from { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.result-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  animation: itemIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.result-item:nth-child(1) { animation-delay: 0.1s; }
.result-item:nth-child(2) { animation-delay: 0.15s; }
.result-item:nth-child(3) { animation-delay: 0.2s; }
.result-item:nth-child(4) { animation-delay: 0.25s; }

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

.result-item.full-width {
  grid-column: 1 / -1;
}

.result-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-value {
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-all;
}

.result-value.mono {
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.8rem;
}

.result-key-wrap {
  padding: 10px 12px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  margin-top: 4px;
}

.result-value.key {
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.75rem;
  color: var(--primary-light);
  word-break: break-all;
  line-height: 1.5;
}

/* --- Result Actions --- */
.result-actions {
  display: flex;
  gap: 10px;
  animation: itemIn 0.4s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.btn-copy {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-copy:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary-light);
}

.btn-copy:active {
  transform: scale(0.97);
}

.btn-copy.copied {
  color: var(--success);
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

/* --- Error --- */
.error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: var(--danger);
  font-size: 0.85rem;
  text-align: left;
  animation: errorIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes errorIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.error svg {
  flex-shrink: 0;
}

/* --- Footer --- */
.footer-text {
  margin-top: 20px;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  opacity: 0.5;
  animation: fadeIn 0.8s 0.6s both;
}

/* --- Responsive --- */
@media (max-width: 500px) {
  .card {
    padding: 24px 20px;
    border-radius: 16px;
  }

  .title {
    font-size: 2rem;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}