@font-face {
  font-family: "Poppins";
  src: url("../assets/fonts/poppins-semibold-webfont.woff") format("woff");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("../assets/fonts/roboto-regular-webfont.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #111317;
  --layer: #21242c;
  --layer-secondary: #373c49;
  --border: #4e5566;
  --heading: #f0f2f4;
  --caption: #848fa4;
  --primary: #00ccaa;
  --primary-100: #002922;
  --primary-200: #005244;
  --radius-lg: 18px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--heading);
  font-family: "Roboto", Arial, sans-serif;
}

button, input, output, select { font: inherit; }

button { color: inherit; }

.qr-app {
  width: min(1296px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(72px, 21vh, 227px) 0 64px;
}

.type-menu {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 1px;
  scrollbar-color: var(--primary-200) transparent;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.type-card {
  display: flex;
  flex: 1 0 0;
  min-width: 0;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-lg);
  background: var(--layer);
  cursor: default;
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  scroll-snap-align: start;
}

.type-card > span:last-child {
  flex: 1;
  padding: 0 6px;
  text-align: center;
  white-space: nowrap;
}

.type-card:disabled { opacity: 1; }

.type-card:not(.is-active):hover {
  border-color: var(--primary);
  background: #292d36;
}

.type-card.is-active { background: var(--primary-100); }

.type-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: var(--radius-sm);
  background: var(--layer-secondary);
  color: var(--primary);
  font-size: 24px;
}

.is-active .type-icon { background: var(--primary); color: var(--page); }

.generator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 24px;
  margin-top: 18px;
}

.settings-section,
.qr-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section {
  min-width: 0;
  padding: 18px 24px 20px;
  background: var(--layer);
}

.settings-section > h2 {
  margin: 0 0 16px;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 30px;
}

.url-setting { display: flex; flex-direction: column; }

.url-section { padding-bottom: 22px; }

.url-setting input {
  width: 100%;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--layer-secondary);
  color: var(--heading);
  font-size: 16px;
  line-height: 24px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.url-setting input::placeholder { color: var(--caption); }

.url-setting input:hover { border-color: #6d768c; }

.url-setting input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(0 204 170 / 18%);
}

.customization-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.logo-section .logo-setting { margin-bottom: 16px; }

.control-group {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid #424856;
  border-radius: 12px;
  background: #292d36;
}

.control-group legend {
  padding: 0 7px;
  color: var(--heading);
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.shape-control,
.color-control,
.logo-design-control,
.tools-control { grid-column: 1 / -1; }

.style-grid { display: grid; gap: 8px; }

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

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

.style-option {
  display: flex;
  min-width: 0;
  min-height: 58px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #4e5566;
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--layer);
  color: var(--caption);
  cursor: pointer;
  font-size: 12px;
  line-height: 16px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.style-option > span:last-child {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}

.style-option:hover {
  border-color: #6d768c;
  background: #303540;
  color: var(--heading);
  transform: translateY(-1px);
}

.style-option:focus-visible { box-shadow: 0 0 0 3px rgb(0 204 170 / 22%); }

.style-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-100);
  color: var(--heading);
}

.shape-swatch,
.frame-swatch,
.corner-swatch,
.dot-swatch {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  color: var(--primary);
}

.shape-swatch { width: 18px; height: 18px; background: currentColor; }
.shape-soft { border-radius: 3px; }
.shape-rounded { border-radius: 6px; }
.shape-circle { border-radius: 50%; transform: scale(.88); }
.shape-diamond { transform: rotate(45deg) scale(.72); }
.shape-horizontal { width: 22px; height: 10px; border-radius: 99px; }
.shape-vertical { width: 10px; height: 22px; border-radius: 99px; }
.shape-liquid,
.shape-bars { width: 24px; height: 20px; background: none; }
.shape-liquid::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 6px 0 currentColor, 12px 0 currentColor, 6px 6px currentColor, 6px 12px currentColor, 12px 12px currentColor;
}
.shape-liquid::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 14px;
  height: 5px;
  border-radius: 99px;
  background: currentColor;
  box-shadow: 3px 8px currentColor;
}
.shape-bars {
  background:
    radial-gradient(circle, currentColor 0 3px, transparent 3.2px) 0 0 / 7px 7px no-repeat,
    radial-gradient(circle, currentColor 0 3px, transparent 3.2px) 17px 13px / 7px 7px no-repeat;
}
.shape-bars::before,
.shape-bars::after {
  content: "";
  position: absolute;
  left: 4px;
  width: 18px;
  height: 6px;
  border-radius: 99px;
  background: currentColor;
}
.shape-bars::before { top: 1px; }
.shape-bars::after { top: 11px; width: 13px; }

.frame-swatch { width: 24px; height: 24px; }
.frame-none::before { content: ""; position: absolute; inset: 4px; border: 1px solid #657087; border-radius: 3px; opacity: .55; }
.frame-none::after { content: ""; position: absolute; top: 11px; left: 2px; width: 20px; height: 2px; background: currentColor; transform: rotate(-45deg); }
.frame-outline { border: 2px solid currentColor; border-radius: 5px; }
.frame-brackets {
  background:
    linear-gradient(currentColor, currentColor) left top / 9px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left top / 2px 9px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 9px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 2px 9px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 9px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 2px 9px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 9px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 2px 9px no-repeat;
}

.corner-swatch { width: 23px; height: 23px; border: 4px solid currentColor; }
.corner-swatch::after { content: ""; position: absolute; inset: 4px; background: currentColor; }
.corner-rounded { border-radius: 6px; }
.corner-rounded::after { inset: 8px; border-radius: 0; }
.corner-circle { border-radius: 50%; }
.corner-circle::after { border-radius: 50%; }
.corner-leaf-a,
.corner-leaf-b { border: 0; background: currentColor; }
.corner-leaf-a { border-radius: 55% 0 55% 0; }
.corner-leaf-b { border-radius: 0 55% 0 55%; }
.corner-leaf-a::before,
.corner-leaf-b::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--layer);
}
.corner-leaf-a::before,
.corner-leaf-a::after { border-radius: 55% 0 55% 0; }
.corner-leaf-b::before,
.corner-leaf-b::after { border-radius: 0 55% 0 55%; }
.corner-leaf-a::after,
.corner-leaf-b::after { inset: 8px; }

.dot-swatch { width: 18px; height: 18px; background: currentColor; }
.dot-rounded { border-radius: 5px; }
.dot-circle { border-radius: 50%; }
.dot-leaf-a { border-radius: 55% 0 55% 0; }
.dot-leaf-b { border-radius: 0 55% 0 55%; }

.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

.color-field {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #4e5566;
  border-radius: var(--radius-sm);
  background: var(--layer);
  color: var(--heading);
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
  transition: border-color 160ms ease, opacity 160ms ease;
}

.color-field:hover { border-color: #6d768c; }
.color-field.is-disabled { opacity: .48; cursor: not-allowed; }

.switch-field {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid #4e5566;
  border-radius: var(--radius-sm);
  background: var(--layer);
  color: var(--heading);
  cursor: pointer;
  font-size: 13px;
  line-height: 18px;
  transition: border-color 160ms ease;
}

.switch-field:hover { border-color: #6d768c; }

.color-input-wrap { display: flex; min-width: 0; align-items: center; gap: 8px; }

.color-input-wrap input[type="color"] {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--layer-secondary);
  cursor: pointer;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-wrap input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.color-input-wrap output { overflow: hidden; color: var(--caption); font-size: 12px; text-overflow: ellipsis; text-transform: uppercase; }

.logo-design-grid,
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.range-field,
.stacked-select {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
  color: var(--heading);
  font-size: 13px;
  line-height: 18px;
}

.range-field > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.range-field output { color: var(--caption); font-size: 12px; }

.range-field input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.stacked-select .select-wrap,
.stacked-select .select-wrap select { width: 100%; }

.tools-grid { align-items: end; }
.randomize-button { width: 100%; }

.logo-setting { display: flex; align-items: center; gap: 18px 28px; min-height: 42px; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  cursor: pointer;
}

.toggle { position: relative; display: inline-flex; }

.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.toggle-track {
  display: block;
  width: 50px;
  height: 26px;
  padding: 3px;
  border: 1px solid #303540;
  border-radius: 999px;
  background: var(--page);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.toggle-knob {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--layer-secondary);
  transition: transform 180ms ease, background 160ms ease;
}

.toggle-label:hover .toggle-track { border-color: var(--primary-200); }

.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgb(0 204 170 / 24%); }

.toggle input:checked + .toggle-track { border-color: var(--primary); background: var(--primary); }

.toggle input:checked + .toggle-track .toggle-knob { transform: translateX(24px); background: var(--page); }

.toggle-small .toggle-track { width: 42px; height: 24px; }
.toggle-small .toggle-knob { width: 16px; height: 16px; }
.toggle-small input:checked + .toggle-track .toggle-knob { transform: translateX(18px); }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 24px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.button i { font-size: 24px; }

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

.button:active { transform: translateY(0); }

.button:focus-visible { outline: 3px solid rgb(0 204 170 / 32%); outline-offset: 2px; }

.button-outline { border-color: var(--border); background: var(--layer); }

.button-outline:hover { border-color: var(--primary); background: #292d36; }

.file-name {
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  color: var(--caption);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-setting {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  color: var(--heading);
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}

.select-wrap { position: relative; display: inline-flex; align-items: center; }

.select-wrap select {
  min-width: 118px;
  height: 42px;
  padding: 8px 40px 8px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  appearance: none;
  background: var(--layer);
  color: var(--heading);
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-size: 14px;
  line-height: 20px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.select-wrap i {
  position: absolute;
  right: 12px;
  color: var(--caption);
  font-size: 18px;
  pointer-events: none;
}

.select-wrap:hover select { border-color: #6d768c; background: #292d36; }
.select-wrap select:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(0 204 170 / 22%); }

.quality-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--page);
}

.quality-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.quality-heading h2 { margin: 0; font-family: "Poppins", sans-serif; font-size: 15px; line-height: 22px; }
.quality-heading p { margin: 2px 0 0; color: var(--caption); font-size: 12px; line-height: 18px; }

.quality-grade {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgb(0 204 170 / 12%);
  color: var(--primary);
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.quality-grade[data-state="risky"] { background: rgb(255 187 51 / 13%); color: #ffbb33; }
.quality-grade[data-state="poor"] { background: rgb(255 91 105 / 13%); color: #ff7380; }

.quality-meter { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: var(--page); }
.quality-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width 220ms ease, background 160ms ease; }
.quality-meter span[data-state="risky"] { background: #ffbb33; }
.quality-meter span[data-state="poor"] { background: #ff5b69; }
.quality-summary { margin: 10px 0 0; color: var(--heading); font-size: 13px; line-height: 19px; }
.quality-messages { display: grid; gap: 4px; margin: 8px 0 0; padding-left: 18px; color: var(--caption); font-size: 12px; line-height: 18px; }

.preview-column {
  position: sticky;
  top: 24px;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.qr-frame { position: relative; padding: 10px; background: var(--page); }

.qr-preview {
  display: grid;
  place-items: center;
  width: 280px;
  height: 280px;
  padding: 15px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #fff;
}

.qr-preview.is-transparent {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e4e7ec 25%, transparent 25%),
    linear-gradient(-45deg, #e4e7ec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e4e7ec 75%),
    linear-gradient(-45deg, transparent 75%, #e4e7ec 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.qr-preview svg { display: block; width: 100%; height: 100%; }

.export-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.button-row .button { padding-inline: 16px; }

.button-wide { width: 100%; }

.button-dark { border-color: var(--layer); background: var(--layer); }

.button-dark:hover { border-color: var(--border); background: #2b2f39; }

.button-primary { border-color: var(--primary); background: var(--primary); color: var(--page); }

.button-primary:hover { border-color: #38e0c4; background: #38e0c4; }

.status {
  min-height: 18px;
  margin: 6px 0 -4px;
  color: var(--caption);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-footer {
  display: flex;
  width: min(1296px, calc(100% - 40px));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  padding: 24px 0 32px;
  border-top: 1px solid var(--layer-secondary);
  color: var(--caption);
  font-size: 13px;
}

.site-footer a {
  color: var(--caption);
  text-underline-offset: 4px;
  transition: color 160ms ease;
}

.site-footer a:hover { color: var(--primary); }

.site-footer a:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

@media (max-width: 1100px) {
  .type-card { flex: 0 0 184px; }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .customization-grid { grid-template-columns: 1fr; }

  .shape-control,
  .color-control,
  .logo-design-control,
  .tools-control { grid-column: auto; }

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

@media (max-width: 760px) {
  .qr-app { width: min(100% - 28px, 560px); padding-top: 44px; }

  .site-footer { width: min(100% - 28px, 560px); }

  .type-menu { padding-right: 14px; padding-bottom: 12px; gap: 10px; }

  .type-card { flex-basis: 164px; border-radius: 15px; }

  .generator-layout { grid-template-columns: 1fr; gap: 18px; margin-top: 18px; }

  .settings-panel { display: contents; }

  .settings-section { padding: 20px; }

  .url-section { grid-row: 1; }

  .design-section { grid-row: 3; }

  .logo-section { grid-row: 4; }

  .tools-section { grid-row: 5; }

  .customization-grid { grid-template-columns: 1fr; }

  .shape-control,
  .color-control,
  .logo-design-control,
  .tools-control { grid-column: auto; }

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

  .style-option { flex-direction: column; }

  .style-option > span:last-child { width: 100%; }

  .color-grid { grid-template-columns: 1fr; }

  .logo-design-grid,
  .tools-grid { grid-template-columns: 1fr; }

  .logo-setting { align-items: flex-start; flex-wrap: wrap; gap: 14px 20px; }

  .file-name { width: 100%; }

  .error-setting { width: 100%; justify-content: space-between; margin-left: 0; }

  .preview-column { position: relative; top: auto; grid-row: 2; }

  .qr-frame { justify-self: stretch; }

  .qr-preview { width: 100%; height: auto; aspect-ratio: 1; }
}

@media (max-width: 420px) {
  .qr-app { width: calc(100% - 20px); padding-top: 28px; }

  .site-footer { width: calc(100% - 20px); }

  .type-card { flex-basis: 150px; padding: 8px; font-size: 15px; }

  .type-icon { width: 42px; height: 42px; flex-basis: 42px; }

  .settings-section { padding: 18px 16px; }

  .settings-section > h2 { font-size: 21px; line-height: 28px; }

  .logo-setting { display: grid; grid-template-columns: 1fr; }

  .error-setting { display: grid; grid-template-columns: 1fr; }

  .select-wrap,
  .select-wrap select { width: 100%; }

  .three-grid { grid-template-columns: 1fr; }

  .style-option { justify-content: center; padding-inline: 14px; }

  .toggle-label { justify-content: space-between; }

  .button-outline { width: 100%; }

  .qr-preview { padding: 12px; }

  .button { padding-inline: 16px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
