/* Class colour from ChrClasses; registered so the stage light can glide between classes. */
@property --wow-tmog-class { syntax: '<color>'; inherits: true; initial-value: #8bc5ff; }
.wow-tmog {
  --wow-tmog-ink: var(--mcui-ink, #eff0f5);
  --wow-tmog-copy: var(--mcui-copy, #cfd3e2);
  --wow-tmog-panel: var(--mcui-reference, #202436);
  --wow-tmog-selected: var(--mcui-selected, #303650);
  --wow-tmog-tint: var(--mcui-tint, #8bc5ff);
  --wow-tmog-line: var(--mcui-line-strong, #eff0f53d);
  --wow-tmog-ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* Selected class ring: class colour, lifted toward ink so dark classes keep 3:1. */
  --wow-tmog-ring: color-mix(in oklab, var(--wow-tmog-class) 80%, var(--wow-tmog-ink));
  margin-block: 28px 0;
  transition: --wow-tmog-class 700ms var(--wow-tmog-ease);
  color: var(--wow-tmog-ink);
  font: inherit;
}
.wow-tmog *, .wow-tmog *::before, .wow-tmog *::after { box-sizing: border-box; }
/* Doubled attribute outranks component display rules. */
.wow-tmog [hidden][hidden] { display: none; }
.wow-tmog .wow-tmog__hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wow-tmog .wow-tmog__heading { margin-block: 0 16px; color: var(--wow-tmog-tint); font-size: 16px; font-weight: 700; line-height: 1.45; }

/* One character screen: controls frame the hero instead of stacking above it. */
.wow-tmog__screen {
  position: relative;
  display: grid;
  grid-template-rows: auto clamp(300px, 52vw, 440px) auto auto;
  overflow: clip;
  border-radius: var(--mcui-radius, 8px);
  background-color: var(--wow-tmog-panel);
  /* Class light behind the figure over a darker base; the floor pool is the stage's ::before. */
  background-image:
    radial-gradient(64% 52% at 50% 42%, color-mix(in oklab, var(--wow-tmog-class) 20%, transparent), transparent),
    linear-gradient(transparent 55%, rgb(0 0 0 / 0.32));
}

.wow-tmog .wow-tmog__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 12px 0; position: relative; z-index: 3; }
.wow-tmog button {
  min-block-size: 44px;
  padding-block: 10px;
  padding-inline: 16px;
  border: 0;
  border-radius: var(--mcui-radius-sm, 4px);
  color: var(--wow-tmog-ink);
  background: var(--wow-tmog-panel);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  cursor: pointer;
}
.wow-tmog button:focus-visible { outline: 2px solid var(--mcui-focus, #eff0f5); outline-offset: 2px; }
.wow-tmog button:active { scale: 0.96; }

/* Race: portrait chip that opens the picker. */
.wow-tmog .wow-tmog__race {
  display: flex;
  /* The store column is narrow; keep the race name on one line instead of shrinking the chip. */
  flex: none;
  white-space: nowrap;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.32);
  box-shadow: inset 0 0 0 1px var(--wow-tmog-line);
  font-size: 15px;
}
.wow-tmog .wow-tmog__race[aria-expanded="true"] { background: var(--wow-tmog-selected); }
/* Size in CSS: the store sanitizer drops SVG width/height attributes. */
.wow-tmog__chevron { flex: none; inline-size: 16px; block-size: 16px; color: var(--wow-tmog-copy); }
.wow-tmog__race[aria-expanded="true"] .wow-tmog__chevron { rotate: 180deg; }

/* Sprite cells: race portraits by column, row 0 male / 1 female; row 2 holds sex and faction art. */
.wow-tmog__portrait, .wow-tmog__glyph {
  --size: 36px;
  --row: 0;
  flex: none;
  inline-size: var(--size);
  block-size: var(--size);
  background-image: var(--wow-tmog-sprite);
  background-size: calc(var(--wow-tmog-columns) * var(--size)) calc(3 * var(--size));
  background-position: calc(var(--col) * var(--size) * -1) calc(var(--row) * var(--size) * -1);
}
.wow-tmog__portrait { border-radius: 6px; outline: 1px solid rgb(255 255 255 / 0.14); outline-offset: -1px; }
.wow-tmog[data-sex="1"] .wow-tmog__portrait { --row: 1; }
.wow-tmog__glyph { --size: 30px; --row: 2; border-radius: 50%; }

/* Two-way choices (sex, Dracthyr form) as one segmented control. */
.wow-tmog .wow-tmog__segment { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgb(0 0 0 / 0.32); box-shadow: inset 0 0 0 1px var(--wow-tmog-line); }
.wow-tmog .wow-tmog__sexes { margin-inline-start: auto; }
.wow-tmog .wow-tmog__toggle { min-inline-size: 44px; padding-inline: 12px; border-radius: 8px; background: transparent; color: var(--wow-tmog-copy); }
.wow-tmog .wow-tmog__toggle[aria-pressed="true"] { background: var(--wow-tmog-selected); color: var(--wow-tmog-ink); box-shadow: inset 0 0 0 1px var(--wow-tmog-line); }
.wow-tmog .wow-tmog__sex { display: grid; place-items: center; padding: 0; }
.wow-tmog__sex .wow-tmog__glyph { opacity: 0.55; transition: opacity 150ms ease-out; }
.wow-tmog__sex[aria-pressed="true"] .wow-tmog__glyph { opacity: 1; }

/* Hero area: poster, frozen frame and live model share it; the picker overlays it. */
.wow-tmog__stage { position: relative; display: grid; place-items: center; min-block-size: 0; }
/* Floor light under the feet. While a model loads it shrinks and recharges with real progress. */
.wow-tmog__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(30% 7% at 50% 92%, color-mix(in oklab, var(--wow-tmog-class) 42%, transparent), transparent);
  transform-origin: 50% 92%;
}
.wow-tmog__stage[data-charging]::before {
  scale: calc(0.25 + 0.75 * var(--wow-tmog-charge, 0)) 1;
  opacity: calc(0.35 + 0.65 * var(--wow-tmog-charge, 0));
}
.wow-tmog__poster, .wow-tmog__model, .wow-tmog__frame { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
.wow-tmog__poster { object-fit: contain; padding: 4px 12px 8px; }
.wow-tmog__frame { z-index: 1; object-fit: fill; pointer-events: none; }
.wow-tmog[data-view="live"] .wow-tmog__poster,
.wow-tmog:not([data-view="live"]) .wow-tmog__model,
.wow-tmog:not([data-switching]) .wow-tmog__frame { visibility: hidden; }
/* While the next look loads, the frozen frame dims so the wait reads as intentional. */
.wow-tmog__poster, .wow-tmog__frame { transition: filter 320ms var(--wow-tmog-ease); }
.wow-tmog__stage[aria-busy="true"] :is(.wow-tmog__poster, .wow-tmog__frame) {
  filter: saturate(0.4) brightness(0.7);
  transition-delay: 140ms;
}
.wow-tmog .wow-tmog__start {
  position: absolute;
  inset-block-end: 12px;
  z-index: 2;
  background: var(--wow-tmog-selected);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 16px rgb(0 0 0 / 0.35);
}

/* Race picker over the hero, grouped by faction like the game's creation screen. */
.wow-tmog .wow-tmog__races {
  position: absolute;
  inset: 4px 12px auto;
  max-block-size: calc(100% - 4px);
  z-index: 4;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--wow-tmog-panel) 90%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px var(--wow-tmog-line), 0 12px 32px rgb(0 0 0 / 0.45);
}
.wow-tmog .wow-tmog__faction { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--wow-tmog-copy); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.wow-tmog .wow-tmog__faction:not(:first-child) { margin-block-start: 16px; }
.wow-tmog__faction .wow-tmog__glyph { --size: 24px; border-radius: 0; }
.wow-tmog .wow-tmog__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 156px), 1fr)); gap: 4px; }
.wow-tmog .wow-tmog__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
  background: transparent;
  color: var(--wow-tmog-ink);
  font-size: 14px;
  font-weight: 600;
  text-align: start;
}
.wow-tmog .wow-tmog__option[aria-pressed="true"] { background: var(--wow-tmog-selected); box-shadow: inset 0 0 0 2px var(--wow-tmog-tint); }

/* Caption and class strip close the screen. */
.wow-tmog .wow-tmog__caption { margin: 0; padding: 4px 16px 0; text-align: center; font-size: 15px; line-height: 1.4; text-wrap: balance; }
.wow-tmog .wow-tmog__class-name { color: color-mix(in oklab, var(--wow-tmog-class) 60%, var(--wow-tmog-ink)); font-size: 18px; font-weight: 700; }
.wow-tmog .wow-tmog__set { display: block; color: var(--wow-tmog-copy); font-weight: 600; }
.wow-tmog .wow-tmog__choices {
  display: flex;
  justify-content: safe center;
  gap: 4px;
  padding: 10px 12px 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  /* Fade the edges so a scrolling strip on phones reads as more to swipe. */
  mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.wow-tmog__choices::-webkit-scrollbar { display: none; }
/* Concentric: 4px icon radius + 4px padding + 2px ring. */
.wow-tmog .wow-tmog__class {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: 46px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  scroll-snap-align: center;
}
.wow-tmog__class img { display: block; inline-size: 34px; block-size: 34px; border-radius: 4px; outline: 1px solid rgb(255 255 255 / 0.12); outline-offset: -1px; opacity: 0.72; transition: opacity 150ms ease-out; }
.wow-tmog .wow-tmog__class[aria-pressed="true"] { border-color: var(--wow-tmog-ring); background: rgb(0 0 0 / 0.32); }
.wow-tmog__class[aria-pressed="true"] img { opacity: 1; }

.wow-tmog .wow-tmog__status { margin-block: 8px 0; min-block-size: 23px; color: var(--wow-tmog-copy); font-size: 15px; line-height: 1.55; }
.wow-tmog .wow-tmog__status + .wow-tmog__status { margin-block-start: 0; }
@media (hover: hover) and (pointer: fine) {
  .wow-tmog .wow-tmog__race:hover, .wow-tmog .wow-tmog__toggle:hover, .wow-tmog .wow-tmog__option:hover, .wow-tmog .wow-tmog__class:hover { background: var(--wow-tmog-selected); }
  .wow-tmog .wow-tmog__start:hover { background: color-mix(in oklab, var(--wow-tmog-selected) 80%, var(--wow-tmog-ink)); }
  .wow-tmog__class:hover img, .wow-tmog__sex:hover .wow-tmog__glyph { opacity: 1; }
}
/* Press, chevron and floor-light motion only for readers who allow motion. */
@media (prefers-reduced-motion: no-preference) {
  .wow-tmog button { transition: scale 120ms ease-out; }
  .wow-tmog__chevron { transition: rotate 200ms var(--wow-tmog-ease); }
  .wow-tmog__stage::before { transition: scale 260ms var(--wow-tmog-ease), opacity 260ms var(--wow-tmog-ease); }
}
@media (prefers-reduced-motion: reduce) {
  .wow-tmog, .wow-tmog button, .wow-tmog__poster, .wow-tmog__frame, .wow-tmog__stage::before,
  .wow-tmog__chevron, .wow-tmog__class img, .wow-tmog__glyph { transition-duration: 0s; }
}
