:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #e5e7eb;
  --panel: #fbfbfa;
  --paper: #ffffff;
  --accent: #8b1e3f;
  --accent-dark: #28445f;
  --bg: #f7f5f1;
  --shadow: 0 16px 40px rgba(36, 48, 64, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

header {
  background:
    linear-gradient(135deg, rgba(31, 47, 64, 0.96), rgba(43, 68, 92, 0.94)),
    linear-gradient(90deg, rgba(139, 30, 63, 0.18), transparent);
  color: #fff;
  padding: 48px 24px 42px;
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
}

.home-link {
  display: inline-block;
  margin-bottom: 18px;
  color: #d8e1ea;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.home-link:hover {
  color: #fff;
}

header h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 800;
}

header p {
  margin: 16px 0 0;
  color: #d8e1ea;
  font-size: 1.08rem;
  font-weight: 600;
}

.shell {
  max-width: 980px;
  margin: -24px auto 26px;
  padding: 0 24px;
}

.workspace {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(320px, 1fr);
  gap: 22px;
  align-items: stretch;
}

.controls,
.preview-zone {
  background: var(--paper);
  border: 1px solid rgba(229, 231, 235, 0.85);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 28px;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-radius: 8px;
  font-weight: 800;
}

h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel {
  display: grid;
  gap: 18px;
}

.field,
.color-field,
.slider-row {
  display: grid;
  gap: 8px;
}

.field > span,
.color-field > span,
.slider-row > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

input[type="url"],
select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  padding: 0 14px;
  outline: none;
}

input[type="url"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 30, 63, 0.12);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.icon-choice {
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.icon-choice:hover {
  transform: translateY(-1px);
}

.icon-choice.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 30, 63, 0.11);
}

.icon-preview {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
}

.github-icon {
  background: #111820;
  position: relative;
}

.github-icon::before {
  content: "";
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
}

.github-icon::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 7px;
  bottom: 8px;
  background: #111820;
  border-radius: 7px 7px 3px 3px;
}

.arxiv-icon {
  background: #b31b1b;
}

.link-icon {
  background: var(--accent);
  position: relative;
}

.link-icon::before,
.link-icon::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 8px;
  border: 3px solid #fff;
  border-radius: 8px;
  transform: rotate(-32deg);
}

.link-icon::before {
  left: 5px;
  top: 9px;
}

.link-icon::after {
  right: 5px;
  bottom: 9px;
}

.none-icon {
  background: transparent;
  border: 2px dashed var(--line);
}

.upload {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.upload input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.swatch-row,
.grid-two {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.color-field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 5px;
  cursor: pointer;
}

.slider-row input {
  width: 100%;
  accent-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.primary,
.secondary {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.secondary:hover {
  border-color: var(--accent);
}

.preview-zone {
  min-height: 640px;
  padding: 28px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.preview-header strong {
  color: var(--accent);
}

.qr-card {
  min-height: 420px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(31, 41, 51, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(31, 41, 51, 0.045) 1px, transparent 1px),
    var(--panel);
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

#qr {
  width: min(100%, 390px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--paper);
  border-radius: 8px;
  padding: 18px;
}

#qr canvas,
#qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hint {
  text-align: center;
  font-size: 0.94rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--accent-dark);
}

footer {
  color: var(--muted);
  text-align: center;
  padding: 0 24px 28px;
  font-size: 0.82rem;
}

footer p {
  margin: 0;
}

@media (max-width: 880px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-zone {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  header {
    padding: 38px 20px 34px;
  }

  .shell {
    margin-top: -18px;
    padding: 0 16px;
  }

  .controls,
  .preview-zone {
    padding: 18px;
  }

  .brand {
    align-items: start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .swatch-row,
  .grid-two,
  .actions {
    grid-template-columns: 1fr;
  }

  .qr-card {
    min-height: 310px;
    padding: 14px;
  }
}
