:root {
  --purple: #6d38e8;
  --purple-dark: #4820aa;
  --ink: #172033;
  --muted: #657085;
  --line: #ddd9e8;
  --soft: #f7f5fc;
  --green: #087a45;
  --orange: #f58220;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: #fbfaff;
  font:
    16px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
.skip {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  background: #fff;
  padding: 0.7rem;
}
.skip:focus {
  top: 1rem;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}
.brand img {
  width: 46px;
  height: 46px;
}
.brand span {
  display: grid;
}
.brand small {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple);
  font-weight: 850;
}
.brand strong {
  font-size: 1.15rem;
}
.app-header nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-header button,
.app-header a:not(.brand) {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
}
.local-badge {
  color: var(--green);
  font-weight: 800;
}
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 3rem auto 1.4rem;
}
.eyebrow {
  margin: 0;
  color: var(--purple);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.intro h1 {
  max-width: 760px;
  margin: 0.35rem 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}
.intro > div > p:last-child {
  max-width: 720px;
  color: var(--muted);
}
.mode-switch,
.edit-tabs {
  display: flex;
  padding: 0.3rem;
  border-radius: 12px;
  background: #ece8f7;
}
.mode-switch button,
.edit-tabs button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 0.7rem 0.9rem;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}
.mode-switch .active,
.edit-tabs .active {
  background: #fff;
  color: var(--purple-dark);
  box-shadow: 0 4px 14px #2914631a;
}
.studio {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(360px, 1fr);
  gap: 1.3rem;
  width: min(1180px, calc(100% - 2rem));
  margin: auto;
}
.controls,
.preview {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 38px #2d1b5b0d;
}
.controls {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}
.controls label,
dialog label {
  display: grid;
  gap: 0.35rem;
  color: #363f52;
  font-weight: 750;
}
.controls input,
.controls select,
dialog input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd3df;
  border-radius: 9px;
  background: #fff;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  font: inherit;
}
.controls fieldset {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.controls legend {
  padding: 0 0.4rem;
  font-weight: 900;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.controls input[type="color"] {
  padding: 0.2rem;
}
.controls input[type="range"] {
  min-height: auto;
  padding: 0;
}
.controls small {
  color: var(--muted);
}
#centerImageControls {
  display: grid;
  gap: 0.7rem;
  border-radius: 10px;
  background: var(--soft);
  padding: 0.8rem;
}
#centerImageControls[hidden] {
  display: none;
}
.check {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
}
.check input {
  width: 20px;
  min-height: 20px;
}
.button-row,
.export-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.controls button,
.export-actions button,
dialog button {
  min-height: 44px;
  border: 1px solid #cfd3df;
  border-radius: 10px;
  background: #fff;
  padding: 0.6rem 0.8rem;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}
.primary {
  border-color: var(--purple) !important;
  background: var(--purple) !important;
  color: #fff !important;
}
.full {
  width: 100%;
}
.editable-notice {
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  background: #fff8ef;
  padding: 0.85rem;
}
.editable-notice p {
  color: var(--muted);
}
.edit-tabs {
  margin: 0.8rem 0;
}
.security-note {
  color: #8a4a00;
}
.preview {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 2rem);
}
.preview-card {
  display: grid;
  place-items: center;
  min-height: 500px;
  border-radius: 16px;
  background: linear-gradient(145deg, #eee9ff, #fff);
  padding: 1rem;
}
#qrPreview {
  display: grid;
  place-items: center;
  max-width: 100%;
}
#qrPreview svg {
  display: block;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 25px #2b18512b);
}
#scanMessage {
  color: var(--green);
  font-weight: 800;
}
.export-actions {
  justify-content: center;
}
.preview details {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.preview code {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 0.6rem;
  color: var(--muted);
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 3rem auto;
}
.help-grid article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 1.2rem;
}
.help-grid h2 {
  margin-top: 0;
}
.help-grid p {
  color: var(--muted);
}
dialog {
  width: min(600px, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 25px 80px #1d103e4d;
}
dialog::backdrop {
  background: #171029aa;
}
.dialog-close {
  float: right;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
}
dialog form {
  display: grid;
  gap: 1rem;
}
footer {
  padding: 1.5rem;
  text-align: center;
  background: #21173c;
  color: #ddd5ef;
}
footer a {
  color: #fff;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #f5b942;
  outline-offset: 2px;
}
@media (max-width: 800px) {
  .local-badge {
    display: none;
  }
  .intro {
    align-items: stretch;
    flex-direction: column;
  }
  .studio {
    grid-template-columns: 1fr;
  }
  .preview-card {
    min-height: 380px;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .brand small {
    display: none;
  }
  .app-header nav > a {
    display: none;
  }
  .intro {
    margin-top: 2rem;
  }
  .mode-switch {
    width: 100%;
  }
  .mode-switch button {
    flex: 1;
  }
  .two {
    grid-template-columns: 1fr;
  }
  .preview {
    padding: 1rem;
  }
  .export-actions button {
    flex: 1 1 42%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
