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

:root {
  --bg-primary: #0b1120;
  --bg-secondary: #111827;
  --surface: rgba(17, 24, 39, 0.8);
  --surface-border: rgba(99, 102, 241, 0.15);
  --surface-hover: rgba(99, 102, 241, 0.08);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-dim: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.25);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.25);
  --disabled: #374151;
  --disabled-text: #6b7280;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 600px 400px at 50% 0%, rgba(99,102,241,0.08), transparent),
    radial-gradient(ellipse 400px 300px at 80% 80%, rgba(59,130,246,0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 520px;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  margin-bottom: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 1px;
  letter-spacing: 0.04em;
}

/* Verify Card */
.verify-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 20px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-wrap {
  flex: 1;
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  letter-spacing: 0.02em;
}

.input-wrap input::placeholder {
  color: var(--text-dim);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  letter-spacing: 0;
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
}

#verify-btn {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  min-width: 80px;
}

#verify-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

#verify-btn:active:not(:disabled) {
  transform: scale(0.97);
}

#verify-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Message */
.message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  animation: fadeIn 0.25s ease;
}

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

.message.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.message.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* Downloads */
.downloads-section {
  margin-top: 24px;
  animation: slideUp 0.35s ease;
}

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

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.download-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s, background 0.2s;
}

.download-card:hover:not(.disabled) {
  border-color: rgba(99,102,241,0.35);
  background: var(--surface-hover);
}

.download-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 14px;
}

.card-icon.app {
  background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.05));
  color: #22c55e;
}

.card-icon.firmware {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(59,130,246,0.05));
  color: #3b82f6;
}

.card-icon.disabled-icon {
  background: rgba(55,65,81,0.3);
  color: var(--disabled-text);
}

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

.card-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.download-card.disabled .card-info h3 {
  color: var(--disabled-text);
}

.card-info p {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 2px;
}

.card-action {
  margin-left: 14px;
  flex-shrink: 0;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.download-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

.download-btn svg {
  width: 14px;
  height: 14px;
}

.disabled-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--disabled);
  color: var(--disabled-text);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: not-allowed;
  white-space: nowrap;
  position: relative;
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: #1f2937;
  color: var(--text);
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999;
  pointer-events: none;
  animation: fadeIn 0.2s ease;
  max-width: 220px;
  text-align: center;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #1f2937;
  border-right: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

/* Responsive */
@media (max-width: 480px) {
  .container { padding: 16px; }
  .input-row { flex-direction: column; }
  #verify-btn { width: 100%; }
  .download-card { flex-wrap: wrap; gap: 12px; }
  .card-action { margin-left: 0; width: 100%; }
  .download-btn, .disabled-btn { width: 100%; justify-content: center; }
}
