/* ─── Tokens ─── */
:root {
  --black:    #0a0a0a;
  --white:    #f5f5f0;
  --ink:      #1a1a1a;
  --muted:    #888880;
  --accent:   #5b4aff;
  --accent2:  #00e5b4;
  --surface:  #ffffff;
  --border:   #e0e0d8;
  --radius:   16px;
  --mono: 'Space Mono', monospace;
  --sans: 'Space Grotesk', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--white);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* ─── Grid BG ─── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(91,74,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,74,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Header ─── */
header {
  width: 100%;
  max-width: 700px;
  padding: 56px 24px 32px;
  text-align: center;
  position: relative;
  z-index: 1;
}

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

.logo-icon {
  font-size: 2.2rem;
  color: var(--accent);
  line-height: 1;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.93); }
}

.logo-text {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -1px;
}

.logo-text em {
  font-style: normal;
  color: var(--accent);
}

.tagline {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ─── Main ─── */
main {
  width: 100%;
  max-width: 700px;
  padding: 0 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
  z-index: 1;
}

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 4px 32px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Input ─── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fafaf8;
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(91,74,255,.1);
  background: #fff;
}

.input-prefix {
  padding: 0 14px;
  color: var(--accent);
  font-size: 1.15rem;
  flex-shrink: 0;
}

#url-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: .9rem;
  color: var(--ink);
  padding: 14px 0;
  outline: none;
  min-width: 0;
}

#url-input::placeholder { color: #bbb; }

.clear-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  padding: 0 16px;
  cursor: pointer;
  height: 100%;
  transition: color .15s;
}

.clear-btn:hover { color: var(--ink); }

.input-hint {
  font-size: .78rem;
  color: var(--muted);
}

.input-hint.error {
  color: #e53935;
  font-weight: 500;
}

/* ─── Options ─── */
.options-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 120px;
}

.option-group label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

select {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--ink);
  background: #fafaf8;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}

select:focus { border-color: var(--accent); }

.color-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fafaf8;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  transition: border-color .2s;
}

.color-wrap:focus-within { border-color: var(--accent); }

input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-wrap span {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
}

/* ─── Generate Button ─── */
.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 20px rgba(91,74,255,.3);
}

.btn-generate:hover {
  background: #4a39ee;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(91,74,255,.4);
}

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

.btn-icon {
  font-size: 1.2rem;
  transition: transform .3s;
}

.btn-generate:hover .btn-icon { transform: rotate(90deg); }

/* ─── Result ─── */
.result-section { animation: slideUp .4s ease; }

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

.result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 4px 32px rgba(0,0,0,.06);
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.qr-frame {
  flex-shrink: 0;
  padding: 16px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qr-frame::before,
.qr-frame::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--accent);
  border-style: solid;
}

.qr-frame::before {
  top: -2px; left: -2px;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}

.qr-frame::after {
  bottom: -2px; right: -2px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 0;
}

#qr-output img,
#qr-output canvas {
  display: block;
  border-radius: 4px;
}

.result-meta {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-url {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.6;
  max-height: 80px;
  overflow-y: auto;
  padding: 10px;
  background: #fafaf8;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-download {
  padding: 12px 20px;
  background: var(--accent2);
  color: var(--black);
  border: none;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.btn-download:hover {
  background: #00ccaa;
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 12px 20px;
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(91,74,255,.04);
}

.copy-feedback {
  font-size: .8rem;
  color: var(--accent2);
  font-weight: 500;
  min-height: 1.2em;
  text-align: center;
}

/* ─── Tips ─── */
.tips h2 {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 16px;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.tip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .2s, transform .2s;
}

.tip:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.tip-icon { font-size: 1.4rem; }

.tip h3 {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink);
}

.tip p {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Footer ─── */
footer {
  padding: 20px 24px 32px;
  text-align: center;
  position: relative;
  z-index: 1;
}

footer p {
  font-family: var(--mono);
  font-size: .72rem;
  color: #bbb;
  letter-spacing: .04em;
}

/* ─── Responsive ─── */
@media (max-width: 520px) {
  .card, .result-card { padding: 20px; }
  .result-card { flex-direction: column; align-items: center; }
  .result-meta { width: 100%; }
  .options-row { flex-direction: column; }
  .logo-text { font-size: 1.6rem; }
}
