:root {
  --bg: #101114;
  --panel: #1b1d22;
  --panel-2: #242730;
  --text: #f4f4f4;
  --muted: #b8bcc7;
  --accent: #f5c542;
  --accent-dark: #d9a915;
  --border: #3a3d46;
  --danger: #ff7070;
  --good: #6ee7a8;
  --warn: #ffd166;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top left, rgba(245, 197, 66, 0.08), transparent 30%), var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 28px;
  align-items: start;
}

.panel {
  background: rgba(27, 29, 34, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

h1, h2, h3 { margin-top: 0; line-height: 1.15; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: 22px; margin-bottom: 16px; }
h3 {
  margin: 28px 0 4px;
  color: var(--accent);
  font-size: 18px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

p { color: var(--muted); line-height: 1.5; }
code { color: var(--accent); }

.version {
  display: inline-block;
  margin-bottom: 16px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 13px;
  font-weight: bold;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full { grid-column: 1 / -1; }

label {
  display: block;
  margin: 16px 0 7px;
  font-weight: bold;
  color: #fff;
}

input, select, textarea, button {
  width: 100%;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 15px;
}

input, select, textarea {
  background: #111318;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.12);
}

textarea {
  min-height: 105px;
  resize: vertical;
  font-family: Arial, Helvetica, sans-serif;
}

input[type="color"] { height: 44px; padding: 4px; cursor: pointer; }
input[type="range"] { padding: 0; accent-color: var(--accent); }
input[type="file"] { padding: 9px; }

.colour-group, .gradient-options, .score-card, .preset-manager {
  background: #14171d;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.colour-row {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;
  align-items: end;
}

.rgb-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.rgb-row label {
  margin-top: 0;
  font-size: 12px;
  color: var(--muted);
}

.rgb-row input { padding: 9px; }

.range-row { display: flex; gap: 12px; align-items: center; }
.range-row input[type="range"] { flex: 1; }

.range-value {
  min-width: 76px;
  text-align: right;
  color: var(--accent);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.checkbox-row input {
  width: auto;
  transform: scale(1.15);
  accent-color: var(--accent);
}

.checkbox-row label { margin: 0; font-weight: normal; color: var(--text); }

button {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: bold;
  background: var(--accent);
  color: #111;
  border: none;
  transition: transform 0.12s ease, background 0.12s ease;
}

button:hover { background: var(--accent-dark); transform: translateY(-1px); }

button.secondary {
  background: #303440;
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover { background: #3b4050; }

button.danger {
  background: #442426;
  color: #ffd8d8;
  border: 1px solid rgba(255, 112, 112, 0.35);
}

button.danger:hover { background: #563034; }

.preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.preset-row button { font-size: 13px; padding: 10px; }
.gradient-options { margin-top: 16px; }

.gradient-preview {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-top: 12px;
  background: linear-gradient(90deg, #000, #f5c542);
}

.logo-preview-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.logo-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  object-fit: contain;
  padding: 6px;
  display: none;
}

.logo-thumb.visible { display: block; }

.logo-note {
  font-size: 13px;
  color: var(--muted);
  word-break: break-word;
}

.downloads, .button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.downloads { margin-top: 20px; }

.preview-wrap {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

#qrPreview {
  background: #fff;
  padding: 20px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  overflow: auto;
}

#qrPreview canvas, #qrPreview svg {
  max-width: 100%;
  height: auto;
}

.hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.sticky-note {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #14171d;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #14171d;
  color: var(--muted);
  font-size: 14px;
  min-height: 39px;
}

.status.error {
  color: var(--danger);
  border: 1px solid rgba(255, 112, 112, 0.4);
}

.score-card { margin-top: 14px; }

.score-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.score-stars {
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--accent);
  white-space: nowrap;
}

.score-label { font-weight: bold; color: var(--good); }
.score-label.warn { color: var(--warn); }
.score-label.bad { color: var(--danger); }

.score-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.preset-manager textarea {
  min-height: 145px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

@media (max-width: 940px) {
  .wrap { grid-template-columns: 1fr; }
  .preview-wrap { position: static; max-height: none; overflow: visible; }
}

@media (max-width: 700px) {
  .grid, .downloads, .button-row, .preset-row { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}
