.character-preview {
  --preview-color: var(--preview-accent, var(--lime, #d9ff64));
  display: grid;
  gap: .65rem;
  width: 100%;
  min-width: 0;
  color: var(--text, #f3f2eb);
}

.character-preview [hidden] {
  display: none !important;
}

.character-preview .character-preview-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: clamp(200px, 25vw, 305px);
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--preview-color) 22%, #2c332b);
  border-radius: .62rem;
  background:
    radial-gradient(ellipse at 50% 48%, color-mix(in srgb, var(--preview-color) 14%, #171d17), transparent 67%),
    linear-gradient(180deg, #171c17, #0e120f 83%);
}

.character-preview .character-preview-stage::before {
  position: absolute;
  inset: auto 12% 8% 12%;
  height: 21%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--preview-color) 17%, #161b16), transparent 69%);
  pointer-events: none;
  content: "";
}

.character-preview .character-preview-stage-art {
  position: absolute;
  inset: 8% 14% 11%;
  width: 72%;
  height: 81%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.character-preview .character-preview-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: transparent;
  touch-action: pan-y;
  cursor: grab;
}

.character-preview .character-preview-canvas:active {
  cursor: grabbing;
}

.character-preview .character-preview-canvas:focus-visible {
  outline: 2px solid var(--lime, #d9ff64);
  outline-offset: -3px;
}

.character-preview .character-preview-controls {
  position: absolute;
  inset: auto .48rem .48rem;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  pointer-events: none;
}

.character-preview[data-renderer="art"] :is(.character-preview-controls, .character-preview-caption),
.character-preview:has(.character-preview-stage[data-renderer="art"]) :is(.character-preview-controls, .character-preview-caption) {
  display: none;
}

.character-preview .character-preview-controls button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .35rem .5rem;
  border: 1px solid #596153;
  border-radius: .37rem;
  background: #171c16ed;
  color: var(--text, #f3f2eb);
  font: 700 .875rem/1.25 var(--sans, sans-serif);
  pointer-events: auto;
  white-space: nowrap;
}

.character-preview .character-preview-controls button:enabled:hover {
  border-color: var(--lime, #d9ff64);
  color: var(--lime, #d9ff64);
}

.character-preview .character-preview-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .28rem .52rem;
  min-width: 0;
}

.character-preview .character-preview-name {
  color: var(--text, #f3f2eb);
  font: 780 1.04rem/1.4 var(--display, sans-serif);
  overflow-wrap: anywhere;
}

.character-preview .character-preview-element {
  max-width: 100%;
  padding: .13rem .45rem;
  border: 1px solid color-mix(in srgb, var(--preview-color) 43%, #333a30);
  border-radius: 999px;
  background: color-mix(in srgb, var(--preview-color) 11%, #181e17);
  color: var(--text, #f3f2eb);
  font-size: .875rem;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.character-preview .character-preview-caption {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted, #c0c9bb);
  font-size: .875rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

@media (max-width: 580px) {
  .character-preview .character-preview-stage {
    height: clamp(166px, 43vw, 190px);
  }
}

.entry-custom-option {
  min-width: 0;
  cursor: pointer;
  border-style: dashed;
  border-color: #78885d;
  color: #dfecc6;
}

.entry-custom-option :is(img, span) { pointer-events: none; }
.entry-custom-option:hover { border-color: #cdef8a; }
.is-customizing .entry-submit:disabled { opacity: .52; cursor: wait; }

.entry-avatar-editor {
  display: grid;
  gap: .8rem;
  min-width: 0;
}

.entry-picker.is-customizing .entry-picker-layout { align-items: start; }

.is-customizing .character-preview .character-preview-stage {
  height: clamp(265px, 31vw, 380px);
}

.entry-avatar-options {
  display: grid;
  gap: .7rem;
  min-width: 0;
}

.avatar-option-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.avatar-option-group legend {
  padding: 0;
  margin-bottom: .36rem;
  color: #e5ecd8;
  font-size: .87rem;
  font-weight: 760;
}

.avatar-option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .29rem;
}

.avatar-outfit-styles .avatar-option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.avatar-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.avatar-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  clip-path: inset(50%);
}

.avatar-option-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  align-content: center;
  gap: .13rem .28rem;
  min-height: 42px;
  height: 100%;
  padding: .21rem .18rem;
  border: 1px solid #4d594a;
  border-radius: .44rem;
  background: #252d24;
  color: #e4ebdb;
  font-size: clamp(.68rem, 1.3vw, .86rem);
  font-weight: 690;
  line-height: 1.2;
  text-align: center;
  word-break: keep-all;
}

.avatar-option:hover .avatar-option-chip { border-color: #939f7e; }
.avatar-option input:checked + .avatar-option-chip {
  border-color: #cde981;
  background: #3b482e;
  color: #f1f9d8;
}

.avatar-option input:focus-visible + .avatar-option-chip {
  outline: 2px solid var(--lime, #d9ff64);
  outline-offset: 2px;
}

.avatar-option-swatch {
  width: .82rem;
  height: .82rem;
  flex-shrink: 0;
  border: 1px solid #ffffff73;
  border-radius: 50%;
  background: var(--swatch);
}

.avatar-eye-styles .avatar-option-chip {
  display: grid;
  justify-items: center;
  align-content: center;
  row-gap: .18rem;
  min-height: 3.35rem;
  padding: .22rem .13rem;
}

.avatar-eye-icon {
  display: block;
  width: min(100%, 3.5rem);
  height: auto;
  pointer-events: none;
}

.avatar-eye-icon .eye-skin { fill: #edc8a7; }
.avatar-eye-icon .eye-white { fill: #fff6df; stroke: #795249; stroke-width: .42; }
.avatar-eye-icon .eye-iris { fill: #9e674e; }
.avatar-eye-icon .eye-pupil { fill: #392429; }
.avatar-eye-icon .eye-glint { fill: #fff8db; }
.avatar-eye-icon .eye-lash { fill: none; stroke: #372329; stroke-width: 2.14; stroke-linecap: round; }
.avatar-eye-icon .eye-closed { fill: #372329; stroke: #372329; stroke-width: .75; stroke-linejoin: round; }

.avatar-eye-styles .avatar-option input:checked + .avatar-option-chip .eye-skin { fill: #ffe4bb; }

@media (max-width: 740px) {
  .is-customizing .entry-character-preview {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-block: .23rem;
    background: #1c1f24;
  }

  .is-customizing .character-preview .character-preview-stage {
    height: clamp(156px, min(53vw, 27svh), 235px);
  }

  .entry-avatar-editor { gap: .64rem; }
  .entry-avatar-options { gap: .59rem; }
  .avatar-option input { scroll-margin-top: 26svh; }
  .avatar-option-chip { font-size: .74rem; }
  #entry-custom-back { padding-inline: .53rem; word-break: keep-all; font-size: .85rem; }
}
