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

html, body {
  background: #232736;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ── Neural Background ── */

.neural-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
}

.neural-svg {
  width: 100%;
  height: 100%;
}

.neural-line {
  opacity: 0;
  animation: neural-pulse 6s ease-in-out infinite;
}

.neural-node {
  opacity: 0;
  animation: neural-dot 4s ease-in-out infinite;
}

@keyframes neural-pulse {
  0%, 100% { opacity: 0; }
  30% { opacity: 0.8; }
  70% { opacity: 0.6; }
}

@keyframes neural-dot {
  0%, 100% { opacity: 0; r: 1.5; }
  50% { opacity: 0.8; r: 2.5; }
}

/* ── Header ── */

.header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.title-prompt {
  color: #5781d6;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}

.title-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #e8eeff;
  letter-spacing: -0.01em;
  margin: 0;
}

.cursor-blink {
  width: 8px;
  height: 16px;
  background: #75a0f5;
  border-radius: 1px;
  opacity: 0.7;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0; }
}

.github-link {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #5a6a8a;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #75a0f51f;
  background: #75a0f50a;
  transition: all 0.15s ease;
}

.github-link:hover {
  color: #97b7f7;
  background: #75a0f51f;
  border-color: #75a0f547;
}

/* ── Wrapper ── */

.wrapper {
  position: relative;
  z-index: 1;
  background: #292d3e;
  width: calc(100% - 48px);
  max-width: 440px;
  border-radius: 12px;
  padding: 28px 32px;
  margin: 24px 24px;
  border: 1px solid #75a0f514;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease;
}

.wrapper:hover {
  border-color: #75a0f526;
}

/* ── Form ── */

#fqr {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a6a8a;
  margin: 0;
}

#furl {
  background: #1e2130 !important;
  border: 1px solid #75a0f51a !important;
  border-radius: 8px !important;
  color: #e8eeff !important;
  font-size: 14px;
  height: 46px;
  padding: 0 14px;
  transition: border-color 0.15s ease;
}

#furl:focus {
  border-color: #75a0f566 !important;
  box-shadow: 0 0 0 3px #75a0f512 !important;
  outline: none;
}

#furl::placeholder {
  color: #3e4560 !important;
}

/* ── Options toggle ── */

.options-toggle {
  border: 1px solid #75a0f514;
  border-radius: 8px;
  overflow: hidden;
}

.options-toggle summary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5a6a8a;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  user-select: none;
}

.options-toggle summary::-webkit-details-marker {
  display: none;
}

.options-toggle summary::before {
  content: '>';
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #75a0f5;
  transition: transform 0.2s ease;
  display: inline-block;
}

.options-toggle[open] summary::before {
  transform: rotate(90deg);
}

.options-toggle summary:hover {
  color: #97b7f7;
  background: #75a0f50a;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 14px 14px;
}

.option-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.option-field .form-select,
.option-field .form-control-color {
  background: #1e2130 !important;
  border: 1px solid #75a0f51a !important;
  border-radius: 8px !important;
  color: #c8d4f0 !important;
  font-size: 13px;
  height: 40px;
  padding: 0 10px;
  transition: border-color 0.15s ease;
  cursor: pointer;
}

.option-field .form-select:focus,
.option-field .form-control-color:focus {
  border-color: #75a0f566 !important;
  box-shadow: 0 0 0 3px #75a0f512 !important;
  outline: none;
}

.option-field .form-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.option-field .form-control-color {
  width: 100%;
  padding: 5px;
}

.form-control-color::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.form-control-color::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

/* ── File upload ── */

.option-field--full {
  grid-column: 1 / -1;
}

.file-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #1e2130;
  border: 1px dashed #75a0f52e;
  border-radius: 8px;
  height: 40px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-upload:hover,
.file-upload.dragover {
  border-color: #75a0f566;
  background: #75a0f50a;
}

.file-upload.has-file {
  border-style: solid;
  border-color: #75a0f533;
}

.file-upload-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #4a5a7a;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 30px 0 12px;
  max-width: 100%;
}

.file-upload.has-file .file-upload-text {
  color: #97b7f7;
}

.file-upload-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none !important;
  color: #5a6a8a;
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.file-upload-clear:hover {
  color: #e8eeff;
  background: #75a0f51a;
  transform: translateY(-50%);
  box-shadow: none;
}

/* ── Generate button ── */

.btn-gradient-wrap {
  position: relative;
  padding: 2px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5781d6, #a78bfa, #75a0f5);
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
  transition: box-shadow 0.3s ease;
}

.btn-gradient-wrap:hover {
  box-shadow: 0 0 24px #75a0f540, 0 0 48px #a78bfa1a;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-generate {
  width: 100%;
  height: 46px;
  background: #292d3e;
  color: #e8eeff;
  border: none;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-generate:hover {
  background: #232736;
  transform: translateY(-1px);
}

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

.btn-generate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-arrow {
  display: inline-block;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.btn-generate:hover .btn-arrow {
  transform: translateX(3px);
}

/* ── QR output ── */

.wrapper #qr {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 16px;
  border: 1px solid #75a0f51f;
  border-radius: 10px;
  background: #1e2130;
  margin-top: 16px;
  gap: 12px;
}

.wrapper.active #qr {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.4s ease 0.15s;
}

#qr img, #qr canvas {
  max-width: 100%;
  height: auto;
}

.download-gradient-wrap {
  width: 100%;
  padding: 2px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5781d6, #a78bfa, #75a0f5);
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
  transition: box-shadow 0.3s ease;
}

.download-gradient-wrap:hover {
  box-shadow: 0 0 20px #75a0f540, 0 0 40px #a78bfa1a;
}

#download {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1e2130;
  color: #e8eeff;
  border: none !important;
  border-radius: 8px;
  padding: 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.2s ease;
}

#download:hover {
  background: #232736;
}

#download span.size {
  font-size: 9px;
  font-weight: 500;
  margin-top: 1px;
  opacity: 0.6;
}

/* ── Input hint ── */

.input-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #4a5a7a;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.input-hint code {
  color: #75a0f5;
  background: #75a0f512;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
}

/* ── Privacy note ── */

.privacy-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #4a5a7a;
  letter-spacing: 0.03em;
  margin: 0;
  opacity: 0.6;
}

/* ── Spinner ── */

.spinner-border {
  width: 0.9rem;
  height: 0.9rem;
  border-width: 2px;
}

/* ── Footer ── */

.footer {
  text-align: center;
  z-index: 1;
  padding-bottom: 16px;
}

.footer a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #4a5a7a;
  text-decoration: none;
  letter-spacing: 0.04em;
  opacity: 0.6;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.footer a:hover {
  opacity: 1;
  color: #75a0f5;
}

.footer-sep {
  color: #4a5a7a;
  opacity: 0.4;
  margin: 0 6px;
  font-size: 11px;
}

/* ── Responsive: Tablet & small screens ── */

@media (max-width: 540px) {
  .wrapper {
    padding: 20px 16px;
    margin: 16px 20px;
    border-radius: 10px;
  }

  .header {
    margin-bottom: 20px;
  }

  .title-prompt {
    font-size: 11px;
  }

  .title-text {
    font-size: 16px;
  }

  .options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 4px 10px 10px;
  }

  #furl {
    font-size: 13px;
    height: 42px;
  }

  .btn-generate {
    height: 42px;
  }
}