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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(96, 120, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(95, 125, 255, 0.08), transparent 28%),
    #080a13;
  color: #e0e0e0;
  display: flex;
  align-items: stretch;
}

/* ---- Layout ---- */
.container {
  display: grid;
  grid-template-columns: 320px 1fr;
  width: 100%;
  height: 100vh;
}

/* ---- Sidebar ---- */
.panel {
  background: rgba(12, 16, 34, 0.98);
  border-right: 1px solid rgba(70, 80, 150, 0.18);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(71, 88, 197, 0.2);
  background: linear-gradient(180deg, rgba(30, 37, 74, 0.98), rgba(11, 14, 30, 0.98));
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.brand-logo {
  width: 96px;
  height: auto;
  min-width: 96px;
  border-radius: 18px;
  padding: 8px;
  background: transparent;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  filter: drop-shadow(0 0 18px rgba(95, 125, 255, 0.35));
}

.brand-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8ea0ff;
  margin-bottom: 4px;
}

.panel-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin: 0;
}

.tool-tagline {
  margin: 6px 0 0;
  font-size: 12px;
  color: #b5bfff;
  max-width: 260px;
}

.author {
  font-size: 11px;
  color: #7f8cff;
  margin-top: 12px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }

/* ---- Sections ---- */
.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #444;
  margin-bottom: 8px;
}

/* ---- Textarea ---- */
textarea {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 13px;
  padding: 8px 10px;
  resize: none;
  height: 56px;
  outline: none;
  transition: border-color .15s;
}
textarea:focus { border-color: #3a3a3a; }

/* ---- Row layouts ---- */
.row { display: flex; gap: 8px; align-items: center; }
.row label { flex: 1; font-size: 12px; color: #888; }

/* ---- Select ---- */
select {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  color: #e0e0e0;
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
  flex: 1.5;
}
select:focus { border-color: #3a3a3a; }

/* ---- Range ---- */
.range-wrap { display: flex; align-items: center; gap: 6px; flex: 1.5; }
input[type=range] {
  flex: 1;
  accent-color: #fff;
  cursor: pointer;
  height: 2px;
}
.range-val { font-size: 11px; color: #555; width: 30px; text-align: right; }

/* ---- Color ---- */
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row label { font-size: 12px; color: #888; flex: 1; }
.color-inputs { display: flex; align-items: center; gap: 6px; }
input[type=color] {
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  cursor: pointer; background: none; padding: 0;
  flex-shrink: 0;
}
.hex-input {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  color: #e0e0e0;
  font-size: 11px;
  padding: 4px 7px;
  width: 72px;
  outline: none;
  font-family: monospace;
}
.hex-input:focus { border-color: #3a3a3a; }


/* ---- Logo upload ---- */
.logo-area {
  border: 1px dashed #252525;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
  position: relative;
}
.logo-area:hover { border-color: #3a3a3a; }
.logo-area input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-area p { font-size: 12px; color: #444; }
.logo-area p span { display: block; font-size: 10px; margin-top: 3px; color: #333; }
#logo-name { font-size: 11px; color: #666; margin-top: 5px; }

/* ---- Divider ---- */
hr { border: none; border-top: 1px solid #1c1c1c; }

/* ---- Btn small ---- */
.btn-sm {
  background: #1a1a1a;
  color: #888;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-sm:hover { border-color: #3a3a3a; color: #ccc; }

/* ---- Preview ---- */
.preview-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 100vh;
}

#qr-preview {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Download buttons ---- */
.download-row { display: flex; gap: 8px; }

.btn {
  background: #5f7dff;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, background-color .15s;
}
.btn:hover { transform: translateY(-1px); background: #718cff; }
.btn.secondary {
  background: rgba(95, 125, 255, 0.1);
  color: #e2e8ff;
  border: 1px solid rgba(95, 125, 255, 0.25);
  font-weight: 500;
}
.btn.secondary:hover { background: rgba(95, 125, 255, 0.18); }

/* ---- Mobile ---- */
@media (max-width: 640px) {
  html, body { overflow: auto; height: auto; }

  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
  }

  /* QR preview on top */
  .preview-side {
    order: -1;
    height: auto;
    padding: 24px 16px 16px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0f0f0f;
    border-bottom: 1px solid #1e1e1e;
  }

  #qr-preview canvas,
  #qr-preview svg {
    width: 180px !important;
    height: 180px !important;
  }

  /* Controls below */
  .panel {
    height: auto;
    overflow: visible;
    border-right: none;
  }

  .panel-body {
    overflow: visible;
    padding: 16px;
  }

  .btn { padding: 8px 14px; font-size: 12px; }
}
