:root {
  color-scheme: light dark;
  --background: #ffffff;
  --panel: #ffffff;
  --subtle: #f7f9f9;
  --ink: #0f1419;
  --muted: #536471;
  --line: #eff3f4;
  --line-strong: #cfd9de;
  --empty: #c9d2d9;
  --accent: #6d4aff;
  --accent-hover: #5b38e8;
  --accent-ink: #ffffff;
  --edge: #e5484d;
  --guide: #6d4aff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000000;
    --panel: #16181c;
    --subtle: #16181c;
    --ink: #e7e9ea;
    --muted: #71767b;
    --line: #2f3336;
    --line-strong: #3e4144;
    --empty: #333639;
    --accent: #8f78ff;
    --accent-hover: #a693ff;
    --guide: #8f78ff;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  padding: clamp(16px, 5vw, 44px) 16px 72px;
  background: var(--background);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: 100%;
  max-width: 520px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(19px, 5vw, 21px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.frames {
  display: inline-flex;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 9999px;
}

.frames button {
  border: 0;
  padding: 8px 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.frames button + button {
  border-left: 1px solid var(--line-strong);
}

.frames button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.card-frame {
  margin: 0 auto;
  transition: max-width 0.2s ease;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--panel);
}

.profile-card {
  position: relative;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

.profile {
  position: relative;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.banner {
  position: relative;
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: var(--empty) no-repeat;
  cursor: grab;
  touch-action: none;
}

.banner.dragging {
  cursor: grabbing;
}

.drop-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
  text-align: center;
}

.banner.loaded .drop-prompt {
  display: none;
}

.banner.dropping {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.calibration {
  display: none;
  background: no-repeat;
  background-size: 100% auto;
}

.banner-edge {
  display: none;
  border-bottom: 1px dashed var(--edge);
}

.safe-zone {
  position: absolute;
  display: none;
  border: 1px dashed var(--guide);
  pointer-events: none;
}

body[data-overlays~="edge"] .banner-edge,
body[data-overlays~="safe"] .safe-zone {
  display: block;
}

.avatar-slot {
  position: absolute;
  z-index: 5;
  pointer-events: none;
}

.avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--empty) no-repeat;
  box-shadow: 0 0 0 var(--ring, 4px) var(--panel);
}

.avatar::after {
  content: "";
  position: absolute;
  right: 4%;
  bottom: 4%;
  width: 22%;
  height: 22%;
  border: max(2px, calc(var(--ring, 4px) * 0.75)) solid var(--panel);
  border-radius: 50%;
  background: #23a55a;
}

body[data-overlays~="avatar"] .avatar {
  outline: 2px solid var(--edge);
  outline-offset: -1px;
}

.avatar-crosshair {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: none;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
}

.avatar-crosshair::before,
.avatar-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
}

.avatar-crosshair::before {
  top: 5.5px;
  left: 0;
  width: 12px;
  height: 1px;
}

.avatar-crosshair::after {
  top: 0;
  left: 5.5px;
  width: 1px;
  height: 12px;
}

body[data-overlays~="avatar"] .avatar-crosshair {
  display: block;
}

.profile-actions {
  position: absolute;
  z-index: 4;
  right: 14px;
  display: flex;
  gap: 7px;
}

.profile-actions button {
  min-width: 38px;
  min-height: 30px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: #5865f2;
  color: #ffffff;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
}

.profile-actions button:first-child {
  min-width: 32px;
  padding-inline: 9px;
  background: #2b2d33;
  color: #d5d7dc;
}

.profile-body {
  padding: 74px 16px 20px;
}

.display-name {
  font-size: 17px;
  font-weight: 800;
}

.username {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 15px;
}

.username-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-badges {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  min-height: 20px;
  margin-top: 0;
}

.profile-badge {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
}

.profile-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.badge-partner {
  order: 4;
}

.badge-verified-developer {
  order: 5;
}

.badge-gold-bug {
  order: 6;
}

.badge-early-supporter {
  order: 3;
}

.badge-opal {
  order: 1;
}

.badge-booster-24 {
  order: 2;
}

.badge-gifting-legend {
  order: 7;
}

.badge-gifting-legend img {
  width: 16px;
  height: 16px;
}

.profile-rule {
  height: 1px;
  margin: 16px 0 12px;
  background: var(--line);
}

.about-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-body p {
  margin: 0;
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin: 18px 0 12px;
}

.button {
  flex: 1 1 140px;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 9999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.button:hover {
  background: var(--subtle);
}

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

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

.button.small {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 13px;
}

.zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.zoom input {
  flex: 1;
  min-width: 0;
}

.zoom output {
  flex: 0 0 44px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

input[type="range"] {
  height: 4px;
  border-radius: 9999px;
  background: var(--line-strong);
  appearance: none;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

kbd {
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 11px;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.results {
  display: none;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.results.show {
  display: block;
}

.results-summary {
  margin: 0 0 12px;
}

.outputs {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.output {
  flex: 1 1 120px;
  min-width: 110px;
  max-width: 160px;
  margin: 0;
}

.output.wide {
  flex-basis: 100%;
  max-width: 100%;
}

.output img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: repeating-conic-gradient(#8884 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}

.output figcaption {
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
}

.output .button {
  width: 100%;
  padding: 8px;
  font-size: 13px;
}

.advanced {
  margin-top: 22px;
  padding: 2px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
}

.advanced > summary {
  padding: 12px 0;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.advanced > summary::-webkit-details-marker {
  display: none;
}

.advanced > summary::before {
  content: "▸  ";
  font-size: 11px;
}

.advanced[open] > summary::before {
  content: "▾  ";
}

.advanced h2 {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field {
  display: grid;
  grid-template-columns: 100px 1fr 46px;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field output {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.row-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.option-frames {
  margin: 4px 0 0;
}

.drop-zone {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: center;
}

.drop-zone.dropping {
  border-color: var(--accent);
  color: var(--ink);
}

@media (max-width: 400px) {
  .surface-frames button {
    padding-inline: 12px;
    font-size: 12px;
  }

  .field {
    grid-template-columns: 1fr 42px;
  }

  .field label {
    grid-column: 1 / -1;
    margin-bottom: -4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-frame {
    transition: none;
  }
}
