:root {
  color-scheme: dark;
  --blue: #0100fe;
  --yellow: #ffff01;
  --magenta: #ff00ff;
  --green: #a6f445;
  --orange: #ff7504;
  --ink: #050505;
  --paper: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(1, 0, 254, 0.22), transparent 28%),
    linear-gradient(160deg, transparent 45%, rgba(255, 0, 255, 0.16)),
    #000;
}

.generator {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(360px, 1.14fr);
  gap: 28px;
  align-items: stretch;
}

.controls,
.preview-panel {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 8, 8, 0.82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  border-radius: 8px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: clamp(24px, 4vw, 40px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 9ch;
  color: #fff;
  font-size: clamp(2.7rem, 6vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.form {
  display: grid;
  gap: 14px;
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label {
  font-size: 0.92rem;
  font-weight: 700;
}

.link-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.72fr) minmax(180px, 1fr) 88px;
  gap: 10px;
}

input,
button {
  min-height: 52px;
  border-radius: 8px;
  font: inherit;
}

input {
  width: 100%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 0 16px;
  color: #fff;
  background: #090909;
  outline: none;
}

input:focus {
  border-color: var(--yellow);
}

button,
.meta a {
  border: 0;
  color: #050505;
  background: var(--yellow);
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.meta a:hover {
  background: var(--green);
}

.ghost-button,
.remove-link {
  min-height: 40px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0 12px;
}

.ghost-button:hover,
.remove-link:hover {
  color: #050505;
  background: var(--magenta);
}

.primary-action {
  width: 100%;
}

.palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 58px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.palette span {
  background: var(--swatch);
}

.status {
  min-height: 46px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
}

.status.error {
  color: var(--orange);
}

.preview-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: min(72vw, 680px);
  overflow: hidden;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 480px;
  padding: clamp(20px, 4vw, 52px);
  background: #000;
}

.preview-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  pointer-events: none;
}

#qrPreview {
  display: none;
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  height: auto;
  image-rendering: pixelated;
}

#qrPreview.ready {
  display: block;
}

.empty-state {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(100%, 420px);
  aspect-ratio: 1;
  border: 30px solid var(--yellow);
  color: rgba(255, 255, 255, 0.56);
  text-align: center;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.meta span {
  color: rgba(255, 255, 255, 0.72);
}

.meta a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 8px;
}

.batch-results {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
  padding: 16px 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.55);
}

.batch-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.batch-summary span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.9rem;
}

.result-row a {
  color: var(--yellow);
  font-weight: 800;
  text-decoration: none;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 92px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.result-row strong,
.result-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
}

.result-row img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  image-rendering: pixelated;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
}

.copy-image {
  min-height: 40px;
  color: #050505;
  background: var(--green);
  padding: 0 12px;
}

.copy-image:hover {
  background: var(--yellow);
}

@media (max-width: 820px) {
  .app-shell {
    padding: 16px;
  }

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

  h1 {
    max-width: none;
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    min-height: auto;
  }

  .preview-stage {
    min-height: 360px;
  }

  .meta {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .result-row img {
    width: min(100%, 220px);
    height: auto;
    justify-self: center;
  }
}
