:root {
  --brand: #6f52e5;
  --brand-dark: #5138ba;
  --brand-soft: #eeeafe;
  --ink: #17152f;
  --muted: #6f6b83;
  --line: #e5e2ed;
  --surface: #ffffff;
  --page: #f5f5f7;
  --success: #23866c;
  --shadow: 0 28px 80px rgba(42, 34, 90, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1100;
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--ink);
  border-radius: 0.5rem;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.app-container {
  max-width: 1120px;
}

.brand {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand:hover,
.brand:focus-visible {
  color: var(--brand-dark);
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  color: #fff;
  background: var(--brand);
  border-radius: 0.55rem;
  place-items: center;
}

.brand-mark svg {
  width: 1.35rem;
  fill: currentColor;
}

.header-note {
  color: var(--muted);
  font-size: 0.75rem;
}

.page-title {
  margin: 0 0 1.25rem;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.035em;
}

.maker-section {
  scroll-margin-top: 1rem;
}

.app-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  box-shadow: 0 8px 28px rgba(42, 34, 90, 0.06);
}

.form-panel,
.preview-panel {
  padding: clamp(1.5rem, 4vw, 3rem);
}

.form-panel {
  background: rgba(255, 255, 255, 0.94);
}

.preview-panel {
  position: relative;
  background: #fafafa;
  border-left: 1px solid var(--line);
}

.section-title,
.preview-heading h3 {
  margin: 0 0 1.15rem;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.preview-heading h3 {
  margin-bottom: 0;
}

.form-label {
  margin-bottom: 0.55rem;
  color: #3e3a50;
  font-size: 0.82rem;
  font-weight: 800;
}

.form-control,
.form-select {
  color: var(--ink);
  background-color: #fbfafd;
  border: 1px solid #dcd8e7;
  border-radius: 0.75rem;
}

.form-control:focus,
.form-select:focus {
  background-color: #fff;
  border-color: #9c89ed;
  box-shadow: 0 0 0 0.22rem rgba(111, 82, 229, 0.13);
}

textarea.form-control {
  min-height: 8rem;
  padding: 1rem;
  font-size: 1rem;
  line-height: 1.65;
  resize: vertical;
}

.form-select {
  min-height: 3.15rem;
}

.form-text {
  color: #898598;
  font-size: 0.73rem;
}

.count-text.is-over-limit {
  color: #bd3d4c;
  font-weight: 700;
}

.style-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.style-option {
  display: flex;
  min-height: 3.65rem;
  gap: 0.55rem;
  align-items: center;
  justify-content: center;
  padding: 0.7rem;
  cursor: pointer;
  background: #fbfafd;
  border: 1px solid #dcd8e7;
  border-radius: 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.style-option:hover {
  border-color: #aaa0c5;
  transform: translateY(-1px);
}

.btn-check:focus-visible + .style-option {
  outline: 3px solid rgba(111, 82, 229, 0.22);
  outline-offset: 2px;
}

.btn-check:checked + .style-option {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.dot-sample {
  width: 1rem;
  height: 1rem;
  background:
    linear-gradient(90deg, currentColor 42%, transparent 42% 58%, currentColor 58%),
    linear-gradient(currentColor 42%, transparent 42% 58%, currentColor 58%);
  color: currentColor;
}

.dot-sample.rounded {
  border-radius: 0.28rem;
}

.dot-sample.dots {
  background: radial-gradient(circle, currentColor 42%, transparent 45%) 0 0 / 50% 50%;
}

.color-field {
  display: flex;
  min-height: 3.15rem;
  gap: 0.7rem;
  align-items: center;
  padding: 0.4rem 0.75rem;
  background: #fbfafd;
  border: 1px solid #dcd8e7;
  border-radius: 0.75rem;
}

.color-field:focus-within {
  background: #fff;
  border-color: #9c89ed;
  box-shadow: 0 0 0 0.22rem rgba(111, 82, 229, 0.13);
}

.form-control-color {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0.15rem;
  border: 0;
  border-radius: 50%;
}

.form-control-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-control-color::-webkit-color-swatch,
.form-control-color::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.color-field output {
  color: #5f5a70;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.contrast-warning {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  color: #765617;
  background: #fff7dd;
  border: 1px solid #f1dda2;
  border-radius: 0.65rem;
  font-size: 0.78rem;
}

.contrast-warning svg {
  flex: 0 0 auto;
  width: 1.1rem;
  fill: currentColor;
}

.btn {
  border-radius: 0.75rem;
  font-size: 0.88rem;
  font-weight: 800;
}

.btn-lg {
  min-height: 3.3rem;
  padding-right: 1.25rem;
  padding-left: 1.25rem;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 10px 24px rgba(111, 82, 229, 0.22);
}

.btn-primary:hover,
.btn-primary:focus-visible,
.btn-primary:active {
  background: var(--brand-dark) !important;
  border-color: var(--brand-dark) !important;
}

.btn-primary svg,
.btn-download svg {
  width: 1.15rem;
  margin-right: 0.4rem;
  fill: currentColor;
}

.btn-light {
  color: #5b566a;
  background: #f1eff5;
  border-color: #f1eff5;
}

.preview-sticky {
  position: sticky;
  top: 1.5rem;
}

.preview-heading {
  margin-bottom: 1.25rem;
}

.size-badge {
  padding: 0.38rem 0.68rem;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 800;
}

.qr-stage {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 21rem;
  min-height: 20rem;
  padding: clamp(1rem, 3vw, 1.65rem);
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e6e2ef;
  border-radius: 1.3rem;
  box-shadow: 0 18px 44px rgba(54, 45, 99, 0.1);
  place-items: center;
}

#qr-preview {
  display: grid;
  width: 100%;
  place-items: center;
}

#qr-preview canvas,
#qr-preview svg {
  display: block;
  width: 100% !important;
  max-width: 18rem;
  height: auto !important;
}

.qr-loading {
  position: absolute;
  inset: 0;
  display: grid;
  color: var(--brand);
  background: rgba(255, 255, 255, 0.82);
  place-items: center;
}

.generation-status {
  min-height: 1.25rem;
  margin: 0.9rem 0;
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.generation-status.is-error {
  color: #bd3d4c;
}

.btn-download {
  position: relative;
  min-height: 3.2rem;
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.btn-download:hover,
.btn-download:focus-visible {
  color: #fff;
  background: #2d2949;
  border-color: #2d2949;
}

.btn-download-secondary {
  color: var(--ink);
  background: #fff;
  border-color: #dcd8e7;
}

.btn-download-secondary:hover,
.btn-download-secondary:focus-visible {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: #c8bff0;
}

.privacy-note {
  padding-top: 1rem;
  margin-top: 1.35rem;
  color: #777286;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  line-height: 1.6;
}

.privacy-note svg {
  flex: 0 0 auto;
  width: 1.2rem;
  fill: var(--success);
}

.privacy-note p {
  margin: 0;
}

@media (max-width: 991.98px) {
  .preview-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .preview-sticky {
    position: static;
  }
}

@media (max-width: 575.98px) {
  .site-header .app-container {
    padding-right: 1.2rem;
    padding-left: 1.2rem;
  }

  main.app-container {
    padding-right: 0.8rem;
    padding-left: 0.8rem;
  }

  .app-card {
    border-radius: 0.8rem;
  }

  .form-panel,
  .preview-panel {
    padding: 1.3rem;
  }

  .style-option {
    min-height: 3.35rem;
    padding: 0.55rem 0.35rem;
    font-size: 0.69rem;
  }

  .qr-stage {
    min-height: 16rem;
  }

  #qr-preview canvas,
  #qr-preview svg {
    max-width: 14.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
