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

body {
  font-family: system-ui, sans-serif;
  background: #0f0f13;
  color: #e8e8f0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.card {
  background: #1a1a24;
  border: 1px solid #2a2a3a;
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -.01em;
}

h1 span { color: #6495ED; }

label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .4rem;
}

input[type="text"] {
  width: 100%;
  padding: .65rem 1rem;
  background: #111118;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  color: #e8e8f0;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}

input[type="text"]:focus { border-color: #6495ED; }

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: 1rem;
}

.option-group { display: flex; flex-direction: column; gap: .4rem; }

select, input[type="color"] {
  width: 100%;
  padding: .6rem .75rem;
  background: #111118;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  color: #e8e8f0;
  font-size: .9rem;
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
}

select:focus { border-color: #6495ED; }

input[type="color"] {
  padding: .3rem .4rem;
  height: 40px;
  cursor: pointer;
}

/* ── Logo upload ── */
.logo-section {
  margin-top: 1rem;
  border: 1px dashed #2a2a3a;
  border-radius: 10px;
  padding: 1rem;
  transition: border-color .2s;
}

.logo-section:has(#logo-input:focus) { border-color: #6495ED; }

.logo-drop {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.logo-upload-btn {
  margin-top: 0;
  width: auto;
  padding: .5rem 1rem;
  font-size: .85rem;
  background: #2a2a3a;
  flex-shrink: 0;
}

.logo-upload-btn:hover { background: #3a3a4f; }

#logo-input { display: none; }

.logo-filename {
  font-size: .85rem;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-options {
  margin-top: .85rem;
  display: none;
  flex-direction: column;
  gap: .6rem;
}

.logo-options.visible { display: flex; }

.logo-preview-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.logo-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 2px;
}

.remove-logo {
  margin-top: 0;
  width: auto;
  padding: .3rem .75rem;
  font-size: .78rem;
  background: #3d1f1f;
  color: #f87171;
}

.remove-logo:hover { background: #521a1a; }

.size-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.size-row label { margin-bottom: 0; white-space: nowrap; }

input[type="range"] {
  flex: 1;
  accent-color: #6495ED;
  cursor: pointer;
}

.size-val {
  font-size: .82rem;
  color: #aaa;
  min-width: 2.5rem;
  text-align: right;
}

.ec-notice {
  font-size: .75rem;
  color: #8ab3f3;
  margin-top: .35rem;
}

/* ── Tracking section ── */
.tracking-section {
  margin-top: 1rem;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  padding: 1rem;
  transition: border-color .2s;
}

.tracking-section.active { border-color: #6495ED; }

.tracking-toggle {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
}

.tracking-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6495ED;
  cursor: pointer;
  flex-shrink: 0;
}

.tracking-toggle-label {
  font-size: .85rem;
  font-weight: 600;
  color: #c8c8d8;
  user-select: none;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
}

.tracking-desc {
  font-size: .78rem;
  color: #666;
  margin-top: .3rem;
}

.tracking-fields {
  margin-top: .85rem;
  display: none;
  flex-direction: column;
  gap: .6rem;
}

.tracking-fields.visible { display: flex; }

.tracking-fields input[type="text"] {
  font-size: .88rem;
  padding: .55rem .85rem;
}

/* ── Buttons ── */
button {
  margin-top: 1.25rem;
  width: 100%;
  padding: .8rem;
  background: #6495ED;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

button:hover { background: #4a7add; }
button:active { transform: scale(.98); }

/* ── Output ── */
.output {
  margin-top: 1.5rem;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.output.visible { display: flex; }

#qr-container {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  line-height: 0;
  position: relative;
}

.download-btn {
  margin-top: 0;
  background: #1e8a4a;
  font-size: .9rem;
  padding: .65rem 1.5rem;
  width: auto;
}

.download-btn:hover { background: #187040; }

.tracking-result {
  width: 100%;
  background: #111118;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .82rem;
}

.tracking-result-label {
  color: #6495ED;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .35rem;
}

.tracking-result-url {
  color: #8ab3f3;
  word-break: break-all;
  font-family: monospace;
  font-size: .83rem;
}

.error {
  color: #f87171;
  font-size: .85rem;
  margin-top: .5rem;
  display: none;
}

/* ── Footer ── */
.footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: .75rem;
  color: #444;
}

.footer a {
  color: #555;
  text-decoration: none;
  transition: color .2s;
}

.footer a:hover { color: #6495ED; }
