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

:root {
  --g: #22c55e;
  --gd: #16a34a;
  --gl: #f0fdf4;
  --t: #111827;
  --tm: #6b7280;
  --bg: #f9fafb;
  --card: #ffffff;
  --br: #e5e7eb;
}

body {
  background: var(--bg);
  color: var(--t);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px 24px;
}

.wordmark {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--tm);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.app-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 24px;
  align-items: start;
}

.panel,
.result {
  background: var(--card);
  border: 1px solid var(--br);
  border-radius: 28px;
}

.panel {
  padding: 28px;
}

.panel-header {
  margin-bottom: 22px;
}

.panel-header h1 {
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.panel-header p,
.field small,
.r-sublabel {
  color: var(--tm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  font-size: 13px;
  font-weight: 600;
}

textarea,
select,
input[type="text"],
input[type="range"] {
  width: 100%;
}

textarea,
select {
  border: 1px solid var(--br);
  border-radius: 14px;
  padding: 14px 15px;
  background: var(--card);
  color: var(--t);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

textarea:focus,
select:focus {
  border-color: var(--g);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}

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

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.color-field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--br);
  border-radius: 14px;
  background: transparent;
  padding: 4px;
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--g);
}

.actions-row {
  margin: 6px 0 12px;
}

.file-btn,
.primary-btn,
.ghost-btn,
.preset-btn {
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, opacity .2s;
}

.file-btn,
.ghost-btn,
.preset-btn {
  border: 1px solid var(--br);
  background: var(--card);
  color: var(--t);
}

.file-btn:hover,
.ghost-btn:hover,
.preset-btn:hover {
  border-color: var(--g);
  background: var(--gl);
}

.file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-btn input {
  display: none;
}

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

.preset-btn {
  padding: 10px 12px;
  font-size: 13px;
}

.preview-panel {
  position: sticky;
  top: 72px;
}

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 28px 28px;
}

.r-code {
  font-family: 'Orbitron', monospace;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: .2em;
  color: var(--t);
  margin-bottom: 6px;
}

.r-sublabel {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

#qr-wrap {
  margin-bottom: 22px;
  background: #fff;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--br);
  line-height: 0;
  min-height: 220px;
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-wrap canvas,
#qr-wrap svg {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--br);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

#content-preview {
  flex: 1;
  font-size: 12px;
  color: var(--gd);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tm);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.icon-btn:hover,
.icon-btn.copied {
  color: var(--gd);
}

.primary-btn {
  width: 100%;
  background: var(--g);
  color: #fff;
  border: none;
}

.primary-btn:hover {
  background: var(--gd);
}

.ghost-btn.full {
  width: 100%;
}

.button-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  body {
    padding-inline: 16px;
  }

  .panel,
  .result {
    padding: 22px;
    border-radius: 24px;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  #qr-wrap {
    min-width: 0;
    width: 100%;
  }
}
