:root {
  --bg: #070b16;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f8ff;
  --muted: rgba(235, 242, 255, 0.68);
  --line: rgba(255, 255, 255, 0.14);
  --pacto-blue: #176bff;
  --deep-blue: #071f5f;
  --ice-blue: #8fc4ff;
  --cyan: #36d9ff;
  --gold: #d7b46a;
  --jade: #54d0a0;
  --blue: #77a7ff;
  --coral: #ff766d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 8%, rgba(23, 107, 255, 0.34), transparent 34%),
    radial-gradient(circle at 84% 16%, rgba(54, 217, 255, 0.16), transparent 30%),
    radial-gradient(circle at 50% 92%, rgba(215, 180, 106, 0.08), transparent 30%),
    linear-gradient(135deg, #070b16 0%, #0c1740 44%, #061025 100%);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 44px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.brand-block {
  display: grid;
  gap: 6px;
}

.brand-block-left {
  justify-items: start;
  text-align: left;
}

.brand-block-left .eyebrow {
  margin-bottom: 0;
}

.title-block {
  text-align: right;
}

button.reset-flow-btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.reset-flow-btn .button-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.brand-logo {
  width: clamp(138px, 18vw, 210px);
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 34px rgba(23, 107, 255, 0.34));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--ice-blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4.5vw, 52px);
  line-height: 0.95;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.status-pill,
.toast {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.status-pill {
  flex: 0 0 auto;
  padding: 11px 16px;
  color: rgba(235, 242, 255, 0.84);
  font-size: 13px;
  text-align: center;
}

.stage-line {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(7, 11, 22, 0.76);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  overflow: hidden;
  transition: transform 180ms ease, color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.stage span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #090b0f;
  background: rgba(235, 242, 255, 0.72);
  font-size: 11px;
  font-weight: 900;
}

.stage strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage.active {
  color: var(--text);
  border-color: rgba(143, 196, 255, 0.48);
  background: linear-gradient(135deg, rgba(23, 107, 255, 0.24), rgba(54, 217, 255, 0.09));
}

.stage.active span {
  background: linear-gradient(135deg, var(--ice-blue), var(--cyan));
}

.stage.locked {
  cursor: not-allowed;
  opacity: 0.42;
}

.stage.locked:hover {
  transform: none;
  border-color: transparent;
  background: transparent;
}

.stage.complete span {
  background: var(--pacto-blue);
  color: #f5f8ff;
}

.stage.error span {
  background: var(--coral);
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}

.sidebar-stack {
  display: grid;
  align-content: start;
  gap: 12px;
}

.side-panel,
.step-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.side-panel {
  height: fit-content;
  padding: 16px;
}

.side-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 14px;
}

.side-panel-heading .eyebrow {
  margin-bottom: 4px;
}

.side-panel-heading h3 {
  margin: 0;
  font-size: 19px;
}

.side-panel-badge {
  padding: 6px 8px;
  border: 1px solid rgba(84, 208, 160, 0.28);
  border-radius: 999px;
  color: var(--jade);
  background: rgba(84, 208, 160, 0.08);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side-current-step {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.side-current-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(143, 196, 255, 0.26);
  border-radius: 13px;
  color: var(--cyan);
  background: rgba(23, 107, 255, 0.16);
}

.side-current-icon .lucide {
  width: 20px;
  height: 20px;
}

.side-current-step > div {
  min-width: 0;
}

.side-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.side-current-step strong {
  display: block;
  font-size: 18px;
}

.side-current-step em {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-progress-wrap {
  padding: 14px 0 15px;
  border-bottom: 1px solid var(--line);
}

.side-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.side-progress-meta strong {
  color: var(--cyan);
  font-size: 10px;
  text-align: right;
}

.side-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(3, 16, 54, 0.8);
}

.side-progress-track span {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pacto-blue), var(--cyan), var(--jade));
  transition: width 360ms ease;
}

.side-metrics {
  display: grid;
}

.metric {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.metric:last-child {
  border-bottom: 0;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-label .lucide {
  width: 14px;
  height: 14px;
  color: var(--ice-blue);
}

.metric strong {
  font-size: 20px;
}

.step-panel {
  position: relative;
  display: none;
  min-height: 620px;
  padding: clamp(18px, 3vw, 34px);
  animation: rise 360ms ease both;
}

.step-panel.active {
  display: block;
}

#step-videos.active {
  display: flex;
  flex-direction: column;
}

#step-videos .video-archive {
  flex: 0 0 auto;
  margin-top: 28px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-copy {
  max-width: 680px;
  margin-bottom: 24px;
}

.registration-panel-copy {
  max-width: 620px;
}

.registration-card,
.whatsapp-qr-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

.registration-card {
  display: grid;
  gap: 24px;
  padding: clamp(18px, 3vw, 30px);
}

.registration-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.registration-field-wide {
  grid-column: 1 / -1;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field > span,
.registration-choice legend {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.form-field input,
.form-field select {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--text);
  background: rgba(7, 11, 22, 0.5);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.form-field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ice-blue) 50%), linear-gradient(135deg, var(--ice-blue) 50%, transparent 50%);
  background-position: calc(100% - 19px) 22px, calc(100% - 14px) 22px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.form-field input::placeholder {
  color: rgba(235, 242, 255, 0.42);
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(54, 217, 255, 0.12);
}

.registration-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.registration-select {
  position: relative;
}

.registration-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: rgba(235, 242, 255, 0.58);
  background: rgba(7, 11, 22, 0.5);
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.registration-select-trigger svg {
  width: 18px;
  height: 18px;
  color: var(--ice-blue);
  transition: transform 180ms ease;
}

.registration-select-trigger.has-value {
  color: var(--text);
}

.registration-select.open .registration-select-trigger,
.registration-select-trigger:focus-visible {
  border-color: var(--cyan);
  outline: none;
  box-shadow: 0 0 0 3px rgba(54, 217, 255, 0.12);
}

.registration-select.open .registration-select-trigger svg {
  transform: rotate(180deg);
}

.registration-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 20;
  display: none;
  max-height: 360px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid rgba(143, 196, 255, 0.28);
  border-radius: 17px;
  background: rgba(12, 23, 64, 0.98);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(20px);
}

.registration-select.open .registration-select-menu {
  display: grid;
  gap: 4px;
}

.registration-select-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.registration-select-option:hover,
.registration-select-option:focus-visible,
.registration-select-option[aria-selected="true"] {
  border-color: rgba(54, 217, 255, 0.34);
  color: var(--text);
  background: rgba(54, 217, 255, 0.11);
  outline: none;
}

.registration-select-option > span:last-child {
  display: grid;
  gap: 2px;
}

.registration-select-option strong,
.registration-select-option em {
  display: block;
}

.registration-select-option strong {
  font-size: 13px;
}

.registration-select-option em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.registration-option-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(143, 196, 255, 0.25);
  border-radius: 10px;
  color: var(--ice-blue);
  background: rgba(23, 107, 255, 0.18);
}

.registration-option-icon svg {
  width: 17px;
  height: 17px;
}

.form-field option {
  color: #101a35;
}

.registration-choice {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.registration-choice legend {
  padding: 0;
}

.registration-choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 116px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.choice-option input {
  position: absolute;
  opacity: 0;
}

.choice-option:has(input:checked) {
  border-color: var(--cyan);
  color: var(--text);
  background: rgba(54, 217, 255, 0.12);
}

.choice-option:focus-within {
  box-shadow: 0 0 0 3px rgba(54, 217, 255, 0.12);
}

.registration-submit {
  justify-self: end;
  min-width: 210px;
}

.whatsapp-qr-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.whatsapp-qr-copy {
  max-width: 450px;
}

.whatsapp-qr-copy h3 {
  margin: 0 0 10px;
  font-size: clamp(20px, 2.5vw, 30px);
}

.whatsapp-qr-copy p:last-child {
  margin-bottom: 0;
}

.whatsapp-qr-frame {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
}

.whatsapp-qr-frame img {
  display: block;
  width: 200px;
  height: 200px;
}

.whatsapp-qr-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.whatsapp-qr-actions .primary-btn,
.whatsapp-qr-actions .secondary-btn {
  min-width: 220px;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading-row h2 {
  margin-bottom: 0;
}

.panel-heading-row .exercise-tools {
  flex: 0 0 auto;
}

.panel-copy-kicker {
  display: block;
}

.panel-copy-kicker .eyebrow {
  margin-bottom: 8px;
}

.upload-card {
  display: grid;
  gap: 18px;
}

.reference-heading,
.reference-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.reference-heading.compact {
  justify-content: flex-end;
}

.reference-heading strong,
.reference-summary strong {
  display: block;
  margin-bottom: 5px;
}

.reference-heading span,
.reference-summary span {
  color: var(--muted);
  font-size: 13px;
}

.reference-quality,
.reference-tip,
.slot-state {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(143, 196, 255, 0.26);
  border-radius: 999px;
  color: var(--ice-blue) !important;
  background: rgba(23, 107, 255, 0.1);
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reference-quality {
  position: absolute;
  top: clamp(18px, 3vw, 34px);
  right: clamp(18px, 3vw, 34px);
}

.reference-mode-control {
  position: absolute;
  top: calc(clamp(18px, 3vw, 34px) + 38px);
  right: clamp(18px, 3vw, 34px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reference-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 7px 4px 10px;
  border: 1px solid rgba(143, 196, 255, 0.26);
  border-radius: 999px;
  color: var(--ice-blue);
  background: rgba(23, 107, 255, 0.1);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.reference-mode-toggle:hover,
.reference-mode-toggle:focus-visible {
  border-color: rgba(54, 217, 255, 0.72);
  background: rgba(23, 107, 255, 0.2);
  transform: translateY(-1px);
}

.reference-switch {
  position: relative;
  display: block;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 180ms ease;
}

.reference-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 180ms ease, background 180ms ease;
}

.reference-mode-toggle[aria-checked="true"] .reference-switch {
  background: rgba(54, 217, 255, 0.38);
}

.reference-mode-toggle[aria-checked="true"] .reference-switch span {
  background: var(--cyan);
  transform: translateX(14px);
}

.reference-grid.simple-mode .reference-slot[hidden] {
  display: none;
}

.reference-grid:not(.simple-mode) .reference-slot[data-slot="body-front"] { order: 1; }
.reference-grid:not(.simple-mode) .reference-slot[data-slot="face-front"] { order: 2; }
.reference-grid:not(.simple-mode) .reference-slot[data-slot="clothing-logo"] { order: 3; }
.reference-grid:not(.simple-mode) .reference-slot[data-slot="body-back"] { order: 4; }
.reference-grid:not(.simple-mode) .reference-slot[data-slot="face-profile"] { order: 5; }
.reference-grid:not(.simple-mode) .reference-slot[data-slot="face-three-quarter"] { order: 6; }

.reference-grid.simple-mode .reference-slot[data-slot="body-front"] { order: 1; }
.reference-grid.simple-mode .reference-slot[data-slot="face-front"] { order: 2; }
.reference-grid.simple-mode .reference-slot[data-slot="clothing-logo"] { order: 3; }

.reference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.reference-slot {
  position: relative;
  min-width: 0;
  animation: slot-rise 420ms ease both;
}

.reference-slot:nth-child(2) { animation-delay: 40ms; }
.reference-slot:nth-child(3) { animation-delay: 80ms; }
.reference-slot:nth-child(4) { animation-delay: 120ms; }
.reference-slot:nth-child(5) { animation-delay: 160ms; }

@keyframes slot-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.reference-dropzone {
  display: grid;
  width: 100%;
  min-height: 276px;
  align-content: start;
  justify-items: center;
  gap: 8px;
  padding: 16px 14px 50px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--text);
  font: inherit;
  text-align: center;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.reference-dropzone:hover,
.reference-dropzone.dragging,
.reference-slot.has-file .reference-dropzone {
  transform: translateY(-3px);
  border-color: rgba(54, 217, 255, 0.62);
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.18), rgba(54, 217, 255, 0.07));
  box-shadow: 0 18px 40px rgba(23, 107, 255, 0.14);
}

.slot-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.slot-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #061025;
  background: linear-gradient(135deg, var(--ice-blue), var(--cyan));
  font-size: 10px;
}

.slot-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 8px 0 4px;
  overflow: hidden;
  border-radius: 26px;
  background: rgba(7, 31, 95, 0.8);
}

.slot-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(143, 196, 255, 0.42);
  border-radius: 18px;
  color: var(--ice-blue);
  font-size: 30px;
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.24), rgba(3, 20, 67, 0.5));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 10px 22px rgba(1, 14, 49, 0.22);
  transition: opacity 180ms ease, transform 180ms ease;
}

.slot-icon > .lucide {
  position: static !important;
  display: block !important;
  width: 38px;
  height: 38px;
  border: 0 !important;
  background: none !important;
  color: currentColor;
  stroke-width: 1.8;
  transform: none;
}

.slot-icon-detail {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 2px solid rgba(7, 31, 95, 0.96);
  border-radius: 8px;
  color: #061025;
  background: linear-gradient(135deg, var(--ice-blue), var(--cyan));
  box-shadow: 0 5px 12px rgba(1, 14, 49, 0.38);
}

.slot-icon-detail .lucide {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.orientation-back,
.orientation-profile,
.orientation-three-quarter {
  color: var(--text);
  background: linear-gradient(135deg, var(--pacto-blue), var(--cyan));
}

.orientation-detail {
  color: #061025;
  background: linear-gradient(135deg, var(--jade), var(--ice-blue));
}

.body-icon > .lucide {
  width: 40px;
  height: 40px;
}

.body-icon.back-icon > .lucide,
.face-icon.profile > .lucide {
  transform: scaleX(-1);
}

.face-icon.three-quarter > .lucide {
  transform: rotate(-9deg);
}

.slot-icon.hidden,
.slot-preview.hidden {
  display: none;
}

.slot-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-dropzone strong {
  font-size: 17px;
}

.reference-dropzone em {
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.slot-state {
  margin-top: 3px;
  padding: 5px 8px;
  color: var(--muted) !important;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.reference-slot.has-file .slot-state {
  color: var(--jade) !important;
  border-color: rgba(84, 208, 160, 0.34);
  background: rgba(84, 208, 160, 0.1);
}

.slot-camera {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(143, 196, 255, 0.26);
  border-radius: 999px;
  color: var(--text);
  background: rgba(7, 11, 22, 0.7);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.slot-camera:hover {
  transform: translateY(-2px);
  border-color: var(--ice-blue);
  background: rgba(23, 107, 255, 0.4);
}

.slot-camera .lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.slot-remove {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 126, 126, 0.36);
  border-radius: 999px;
  color: #ffb1b1;
  background: rgba(66, 11, 25, 0.78);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.slot-remove[hidden] {
  display: none;
}

.slot-remove:hover {
  transform: translateY(-2px);
  border-color: #ff8989;
  background: rgba(157, 32, 61, 0.78);
}

.slot-remove .lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.reference-summary {
  position: relative;
  display: grid;
  gap: 10px;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 13px 15px;
  border: 1px solid rgba(143, 196, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.reference-progress-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.reference-summary strong {
  color: var(--text);
}

.reference-summary.has-progress {
  border-color: rgba(84, 208, 160, 0.28);
  background: linear-gradient(115deg, rgba(84, 208, 160, 0.08), rgba(23, 107, 255, 0.08));
}

.reference-summary .reference-tip {
  color: var(--cyan) !important;
  border: 0;
  background: transparent;
  text-transform: none;
}

.reference-progress-track {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(143, 196, 255, 0.2);
  border-radius: 999px;
  background: rgba(3, 16, 54, 0.72);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.24);
}

.reference-progress-bar {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pacto-blue), var(--cyan), var(--jade));
  box-shadow: 0 0 18px rgba(54, 217, 255, 0.54);
  transition: width 720ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reference-progress-bar::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.58) 48%, transparent 76%);
  transform: translateX(-100%);
  animation: progress-sheen 2.5s ease-in-out infinite;
}

.reference-summary.is-complete {
  border-color: rgba(84, 208, 160, 0.55);
  box-shadow: 0 0 28px rgba(84, 208, 160, 0.12);
}

@keyframes progress-sheen {
  0%, 35% {
    transform: translateX(-100%);
  }
  70%, 100% {
    transform: translateX(100%);
  }
}

.dropzone,
.camera-option,
.preview-wrap,
.image-frame,
.video-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 28px;
  text-align: center;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.source-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.camera-option {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 28px;
  border: 1px solid var(--line);
  color: var(--text);
  text-align: center;
  background: rgba(255, 255, 255, 0.07);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dropzone.dragging,
.dropzone:hover,
.camera-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(143, 196, 255, 0.62);
  background: rgba(23, 107, 255, 0.14);
}

.dropzone.has-file {
  border-color: rgba(54, 217, 255, 0.42);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: #061025;
  background: linear-gradient(135deg, var(--ice-blue), var(--pacto-blue));
  font-size: 42px;
  font-weight: 300;
}

.dropzone strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.camera-option strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.dropzone em,
.camera-option em {
  color: var(--muted);
  font-style: normal;
}

.preview-wrap {
  min-height: 360px;
  overflow: hidden;
}

.preview-wrap img,
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-wrap.hidden,
.toast.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 850;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.primary-btn {
  border: 0;
  color: #f5f8ff;
  background: linear-gradient(135deg, var(--pacto-blue), var(--cyan));
  box-shadow: 0 20px 42px rgba(23, 107, 255, 0.28);
}

.primary-btn .button-icon {
  width: 18px;
  height: 18px;
  border: 0;
  transform: none;
  stroke-width: 2;
}

.icon-btn .lucide {
  width: 20px;
  height: 20px;
}

.secondary-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.primary-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.upload-card .primary-btn {
  grid-column: 1 / -1;
  justify-self: end;
  min-width: 220px;
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 5, 15, 0.8);
  backdrop-filter: blur(18px);
}

.camera-modal.hidden {
  display: none;
}

.camera-card {
  width: min(680px, 100%);
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(17, 33, 82, 0.98), rgba(7, 11, 22, 0.98));
  box-shadow: var(--shadow);
}

.camera-header,
.camera-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.camera-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.camera-header h2 {
  margin-bottom: 0;
}

.camera-device-status {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.camera-orientation-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 116px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(143, 196, 255, 0.28);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.camera-orientation-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(54, 217, 255, 0.68);
  background: rgba(54, 217, 255, 0.13);
}

.camera-orientation-btn[data-mode="portrait"] {
  border-color: rgba(54, 217, 255, 0.62);
  background: rgba(54, 217, 255, 0.16);
}

.camera-orientation-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.camera-orientation-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 28px;
  line-height: 1;
}

.camera-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: min(58vh, 480px);
  min-height: 220px;
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  aspect-ratio: var(--camera-frame-ratio, 4 / 3);
  background: #030712;
}

.camera-preview[data-orientation="portrait"] {
  width: min(100%, 420px);
  height: auto;
  min-height: 220px;
  margin-inline: auto;
}

.camera-preview video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform-origin: center;
}

.camera-placeholder {
  position: absolute;
  display: grid;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.camera-placeholder.hidden {
  display: none;
}

.camera-placeholder strong {
  color: var(--text);
}

.camera-actions {
  justify-content: flex-end;
}

.avatar-stage {
  display: grid;
  gap: 18px;
}

.background-picker {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid rgba(143, 196, 255, 0.2);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.1), rgba(255, 255, 255, 0.045));
}

.background-picker-header,
.background-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.background-picker-header h3 {
  margin: 0 0 5px;
  font-size: 21px;
}

.background-picker-header p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.background-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.background-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(143, 196, 255, 0.17);
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  background: rgba(7, 19, 55, 0.58);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.background-card:hover,
.background-card.selected {
  transform: translateY(-2px);
  border-color: rgba(54, 217, 255, 0.66);
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.22), rgba(54, 217, 255, 0.08));
  box-shadow: 0 14px 28px rgba(23, 107, 255, 0.14);
}

.background-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 15px;
  color: var(--ice-blue);
  background: linear-gradient(145deg, #173d86, #071332);
}

.background-art img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.background-art-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(135deg, rgba(5, 16, 48, 0.08), rgba(3, 8, 24, 0.44));
}

.background-art::before,
.background-art::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  filter: blur(1px);
}

.background-art::before {
  width: 70px;
  height: 70px;
  top: -34px;
  right: -24px;
  background: rgba(54, 217, 255, 0.24);
}

.background-art::after {
  width: 52px;
  height: 52px;
  bottom: -30px;
  left: -18px;
  background: rgba(23, 107, 255, 0.28);
}

.background-art.studio {
  background: linear-gradient(145deg, #386cc2, #172d68);
}

.background-art.gym {
  background: linear-gradient(145deg, #1c8a93, #073d61);
}

.background-art.cinematic {
  background: linear-gradient(145deg, #49357d, #11132e);
}

.background-art.outdoor {
  background: linear-gradient(145deg, #308b80, #144b5a);
}

.background-art .lucide {
  position: relative;
  z-index: 1;
  width: 25px;
  height: 25px;
  stroke-width: 1.8;
}

.background-card-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.background-card-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-card-copy em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #061025;
  background: var(--cyan);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 180ms ease, transform 180ms ease;
}

.background-check .lucide {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

.background-card.selected .background-check {
  opacity: 1;
  transform: scale(1);
}

.background-picker-footer {
  padding-top: 2px;
}

.background-picker-footer > span {
  color: var(--muted);
  font-size: 12px;
}

.environment-presets {
  border: 1px solid rgba(143, 196, 255, 0.18);
  border-radius: 18px;
  background: rgba(7, 19, 55, 0.28);
  overflow: hidden;
}

.environment-presets summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.environment-presets summary::-webkit-details-marker {
  display: none;
}

.environment-presets summary::after {
  content: "+";
  color: var(--cyan);
  font-size: 22px;
  line-height: 1;
}

.environment-presets[open] summary::after {
  content: "−";
}

.environment-presets summary strong,
.environment-presets summary em {
  display: block;
}

.environment-presets summary strong {
  margin-bottom: 3px;
  font-size: 15px;
}

.environment-presets summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.environment-presets-meta {
  margin-left: auto;
  color: var(--ice-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.environment-presets .background-grid {
  padding: 0 18px 18px;
}

.custom-environment-builder {
  display: block;
  padding: 0;
  border: 1px solid rgba(54, 217, 255, 0.26);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.14), rgba(255, 255, 255, 0.045));
  overflow: hidden;
}

.custom-environment-builder > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.custom-environment-builder > summary::-webkit-details-marker {
  display: none;
}

.custom-environment-builder > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 24px;
  line-height: 1;
}

.custom-environment-builder[open] > summary {
  border-bottom: 1px solid rgba(143, 196, 255, 0.16);
}

.custom-environment-builder[open] > summary::after {
  content: "−";
}

.custom-environment-summary-copy,
.custom-environment-summary-copy strong,
.custom-environment-summary-copy em {
  display: block;
}

.custom-environment-summary-copy strong {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 16px;
}

.custom-environment-summary-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.custom-environment-summary-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.custom-environment-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.custom-environment-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.custom-environment-heading h3 {
  margin: 0 0 6px;
  font-size: 21px;
}

.custom-environment-heading p:not(.eyebrow) {
  max-width: 580px;
  margin: 0;
  font-size: 13px;
}

.environment-heading-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
  flex: 0 0 auto;
}

.environment-image-limit {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.environment-mode-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.environment-reference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.environment-reference-slot {
  position: relative;
  min-width: 0;
}

.environment-reference-dropzone {
  display: grid;
  width: 100%;
  min-height: 220px;
  align-content: start;
  justify-items: center;
  gap: 8px;
  padding: 14px 12px 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  font: inherit;
  text-align: center;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.environment-reference-dropzone:hover,
.environment-reference-dropzone.dragging,
.environment-reference-slot.has-file .environment-reference-dropzone {
  transform: translateY(-2px);
  border-color: rgba(54, 217, 255, 0.62);
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.18), rgba(54, 217, 255, 0.07));
  box-shadow: 0 14px 28px rgba(23, 107, 255, 0.13);
}

.environment-slot-index {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: #061025;
  background: linear-gradient(135deg, var(--ice-blue), var(--cyan));
  font-size: 10px;
  font-weight: 900;
}

.environment-reference-slot .slot-camera.has-preview {
  color: var(--ice-blue);
}

.environment-slot-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 8px 0 4px;
  overflow: hidden;
  border-radius: 22px;
  color: var(--ice-blue);
  background: rgba(7, 31, 95, 0.8);
}

.environment-slot-visual > .lucide {
  width: 38px;
  height: 38px;
  stroke-width: 1.5;
}

.environment-slot-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 5, 15, 0.84);
  backdrop-filter: blur(18px);
}

.image-preview-modal.hidden {
  display: none;
}

.image-preview-card {
  width: min(980px, 100%);
  max-height: min(92vh, 900px);
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(17, 33, 82, 0.98), rgba(7, 11, 22, 0.98));
  box-shadow: var(--shadow);
}

.image-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.image-preview-header h2 {
  margin: 0;
}

.image-preview-frame {
  display: grid;
  place-items: center;
  min-height: 240px;
  max-height: 76vh;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #030712;
}

.image-preview-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 76vh;
  object-fit: contain;
}

.image-preview-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

#imagePreviewCounter {
  color: var(--ice-blue);
  font-weight: 800;
  white-space: nowrap;
}

.environment-reference-dropzone strong {
  font-size: 14px;
}

.environment-reference-dropzone em {
  min-height: 30px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
}

.environment-generation-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(143, 196, 255, 0.2);
  border-radius: 16px;
  background: rgba(7, 19, 55, 0.38);
}

.environment-generation-summary.has-progress {
  border-color: rgba(54, 217, 255, 0.34);
}

.environment-generation-summary.is-complete {
  border-color: rgba(84, 208, 160, 0.48);
}

.environment-generation-summary strong,
.environment-generation-summary span {
  display: block;
}

.environment-generation-summary strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.environment-generation-summary span {
  color: var(--muted);
  font-size: 12px;
}

.environment-generation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.environment-generation-progress {
  white-space: nowrap;
}

.custom-environment-result {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 12px;
  border: 1px solid rgba(84, 208, 160, 0.4);
  border-radius: 18px;
  background: rgba(84, 208, 160, 0.08);
}

.custom-environment-result-gallery {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 0.9fr));
  align-items: start;
  gap: 12px;
}

.custom-environment-result-art {
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 10px 10px 36px;
  border: 1px solid rgba(143, 196, 255, 0.18);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(7, 19, 55, 0.72), rgba(3, 12, 35, 0.92));
  cursor: zoom-in;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.custom-environment-result-art:hover,
.custom-environment-result-art:focus-visible {
  outline: none;
  border-color: rgba(84, 208, 160, 0.8);
  box-shadow: 0 0 0 3px rgba(84, 208, 160, 0.18);
  transform: translateY(-2px);
}

.custom-environment-result-art[data-environment-result="horizontal"] {
  aspect-ratio: 16 / 9;
}

.custom-environment-result-art[data-environment-result^="vertical"] {
  aspect-ratio: 9 / 16;
}

.custom-environment-result-art img {
  display: block;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.custom-environment-result-art figcaption {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--text);
  background: rgba(2, 5, 15, 0.68);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.custom-environment-result-copy {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.custom-environment-result-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.custom-environment-result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.custom-environment-result-copy .secondary-btn.selected {
  border-color: rgba(84, 208, 160, 0.7);
  color: #d6ffeb;
  background: rgba(84, 208, 160, 0.15);
}

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

.generation-note .lucide {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--ice-blue);
}

.generation-note.ready {
  color: var(--jade);
}

.generation-note.ready .lucide {
  color: var(--jade);
}

.image-frame {
  display: grid;
  place-items: center;
  min-height: min(58vw, 560px);
  overflow: hidden;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.image-frame.can-drop {
  cursor: pointer;
}

.image-frame.can-drop:hover,
.image-frame.drop-active {
  border-color: rgba(54, 217, 255, 0.72);
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.16), rgba(54, 217, 255, 0.1));
  box-shadow: 0 0 0 4px rgba(54, 217, 255, 0.08), 0 18px 44px rgba(23, 107, 255, 0.16);
}

.image-frame.ready {
  background: #f5f2e9;
}

.loader,
.video-loading,
.error-state,
.empty-state,
.video-error {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  padding: 24px;
  text-align: center;
}

.loader span,
.video-loading span {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--ice-blue);
  border-right-color: var(--cyan);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader em,
.video-loading em,
.video-error span,
.error-state span,
.empty-state {
  color: var(--muted);
  font-style: normal;
}

.avatar-progress-text {
  min-height: 1.5em;
}

.avatar-progress-text::after {
  content: "|";
  display: inline-block;
  margin-left: 3px;
  color: var(--cyan);
  animation: caret-blink 760ms steps(1, end) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.error-state,
.video-error {
  color: var(--coral);
}

.action-row,
.exercise-tools {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

@media (min-width: 641px) {
  .avatar-stage .action-row {
    flex-wrap: nowrap;
  }
}

.compact {
  min-height: 44px;
  padding-inline: 16px;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.exercise-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  aspect-ratio: 1 / 1;
  min-height: 0;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.exercise-card:hover,
.exercise-card.selected {
  transform: translateY(-3px);
  border-color: rgba(54, 217, 255, 0.68);
  background: linear-gradient(145deg, rgba(23, 107, 255, 0.18), rgba(54, 217, 255, 0.09));
}

.exercise-card.selected {
  border: 2px solid var(--cyan);
  box-shadow: 0 0 0 3px rgba(54, 217, 255, 0.14), 0 12px 28px rgba(1, 18, 58, 0.34);
}

.exercise-selected-check {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #2aa9ff;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 0 !important;
  line-height: 1;
  animation: exercise-check-in 180ms ease-out both;
}

.exercise-selected-check::before {
  content: "✓";
  color: currentColor;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.08em;
  transform: translateY(-1px);
}

@keyframes exercise-check-in {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.exercise-card span {
  font-size: 20px;
  font-weight: 900;
}

.exercise-card em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.45;
}

.exercise-icon {
  position: relative;
  width: 86px;
  height: 86px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.exercise-gif {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.exercise-gif img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.exercise-icon-fallback {
  display: grid;
  place-items: center;
}

.exercise-icon-fallback .exercise-icon {
  flex: 0 0 auto;
}

.exercise-icon span {
  position: absolute;
  display: block;
  background: linear-gradient(135deg, var(--ice-blue), var(--pacto-blue));
  border-radius: 999px;
}

.bench .bar {
  width: 66px;
  height: 6px;
  left: 10px;
  top: 25px;
}

.bench .pad {
  width: 52px;
  height: 12px;
  left: 18px;
  top: 45px;
}

.bench .base {
  width: 6px;
  height: 34px;
  left: 40px;
  top: 48px;
}

.squat .head {
  width: 18px;
  height: 18px;
  left: 34px;
  top: 12px;
}

.squat .body {
  width: 10px;
  height: 40px;
  left: 38px;
  top: 32px;
  transform: rotate(-18deg);
}

.squat .legs {
  width: 58px;
  height: 8px;
  left: 17px;
  top: 66px;
}

.curl .dumbbell {
  width: 58px;
  height: 10px;
  left: 14px;
  top: 24px;
}

.curl .arm {
  width: 12px;
  height: 48px;
  left: 38px;
  top: 30px;
  transform: rotate(26deg);
}

.press .weight.top {
  width: 56px;
  height: 10px;
  left: 15px;
  top: 16px;
}

.press .torso {
  width: 12px;
  height: 46px;
  left: 37px;
  top: 30px;
}

.press .weight.bottom {
  width: 46px;
  height: 10px;
  left: 20px;
  top: 66px;
}

.core .arc {
  width: 52px;
  height: 52px;
  left: 17px;
  top: 15px;
  border: 8px solid transparent;
  border-top-color: var(--ice-blue);
  border-right-color: var(--pacto-blue);
  background: transparent;
  transform: rotate(28deg);
}

.core .core-dot,
.hybrid .core-dot {
  width: 18px;
  height: 18px;
  left: 34px;
  top: 34px;
}

.core .mat {
  width: 58px;
  height: 8px;
  left: 14px;
  top: 68px;
}

.hybrid .diagonal {
  width: 12px;
  height: 58px;
  left: 37px;
  top: 22px;
  transform: rotate(-38deg);
}

.hybrid .weight.top {
  width: 58px;
  height: 10px;
  left: 14px;
  top: 16px;
}

.video-generation-status {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid rgba(84, 208, 160, 0.34);
  border-radius: 16px;
  color: var(--text);
  background: rgba(84, 208, 160, 0.1);
}

.video-generation-status > span:last-child {
  display: grid;
  gap: 4px;
}

.video-generation-status strong {
  font-size: 14px;
}

.video-generation-status em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.video-generation-spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 3px solid rgba(84, 208, 160, 0.25);
  border-top-color: var(--jade);
  border-radius: 50%;
  animation: video-generation-spin 900ms linear infinite;
}

@keyframes video-generation-spin {
  to {
    transform: rotate(360deg);
  }
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.video-card {
  padding: 14px;
  overflow: hidden;
}

.video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.video-head strong {
  font-size: 18px;
}

.video-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: #101218;
  background: var(--ice-blue);
  font-size: 12px;
  font-weight: 900;
}

.video-badge.success {
  background: var(--cyan);
}

.video-badge.fail {
  background: var(--coral);
}

.video-player {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 16px;
  background: #030507;
}

.video-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #030507;
}

.video-watermark {
  position: absolute;
  left: 4%;
  bottom: 4%;
  z-index: 1;
  width: min(29%, 118px);
  height: auto;
  opacity: 0.92;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
  pointer-events: none;
  user-select: none;
}

.video-delivery-status {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.video-delivery-status.success {
  color: var(--jade);
}

.video-delivery-status.error {
  color: var(--coral);
}

.video-archive {
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.025);
}

.video-archive summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 900;
}

.video-archive summary::-webkit-details-marker {
  display: none;
}

.video-archive summary::after {
  content: "+";
  color: var(--cyan);
  font-size: 22px;
  line-height: 1;
}

.video-archive[open] summary::after {
  content: "−";
}

.video-archive-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.video-archive > p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.video-archive .video-grid {
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(520px, calc(100vw - 32px));
  padding: 14px 18px;
  transform: translateX(-50%);
  color: var(--text);
}

.is-busy .primary-btn:not(:disabled) {
  filter: saturate(0.85);
}

@media (max-width: 920px) {
  .topbar,
  .workspace,
  .upload-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .side-panel {
    display: block;
  }

  .side-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .metric:last-child {
    border-right: 0;
  }

  .exercise-grid,
  .video-grid,
  .background-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1199px) and (orientation: landscape) {
  .shell {
    width: min(1180px, calc(100vw - 28px));
    padding-top: 30px;
    padding-bottom: 28px;
  }

  .topbar {
    display: flex;
    margin-bottom: 14px;
  }

  .brand-logo {
    width: 158px;
  }

  h1 {
    font-size: clamp(36px, 4.8vw, 48px);
  }

  .stage-line {
    top: 8px;
    gap: 7px;
    margin-bottom: 14px;
    padding: 7px;
  }

  .stage {
    min-height: 48px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .stage span {
    width: 26px;
    height: 26px;
  }

  .workspace {
    grid-template-columns: 214px minmax(0, 1fr);
    gap: 14px;
  }

  .side-panel {
    padding: 10px;
  }

  .metric {
    padding: 13px 12px;
  }

  .metric strong {
    font-size: 17px;
  }

  .step-panel {
    min-height: calc(100vh - 178px);
    padding: 22px;
  }

  .panel-copy {
    margin-bottom: 16px;
  }

  .panel-copy h2 {
    margin-bottom: 8px;
    font-size: clamp(25px, 3.2vw, 36px);
  }

  .panel-heading-row h2 {
    margin-bottom: 0;
  }

  .panel-copy p {
    margin-bottom: 0;
    font-size: 14px;
  }

  .reference-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .reference-dropzone {
    min-height: 238px;
    padding: 11px 9px 45px;
    gap: 6px;
    border-radius: 17px;
  }

  .slot-visual {
    width: 68px;
    height: 68px;
    margin: 4px 0 2px;
    border-radius: 20px;
  }

  .slot-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 23px;
  }

  .reference-dropzone strong {
    font-size: 15px;
  }

  .reference-dropzone em {
    min-height: 30px;
    font-size: 11px;
  }

  .slot-topline,
  .slot-state {
    font-size: 9px !important;
  }

  .slot-index {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }

  .slot-camera {
    right: 8px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    font-size: 10px;
  }

  .reference-summary {
    padding: 10px 12px;
  }
}

/* Tablet widths: keep the navigation readable and give the active workspace
   the full width instead of squeezing it beside the sidebar. This applies to
   both portrait and compact landscape iPad viewports. */
@media (min-width: 641px) and (max-width: 1199px) {
  .shell {
    width: min(calc(100vw - 32px), 960px);
    padding-top: 30px;
    padding-bottom: 40px;
  }

  .topbar {
    display: grid;
    gap: 14px;
  }

  .title-block {
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .step-panel {
    min-height: auto;
    padding: 26px;
  }

  .exercise-grid,
  .video-grid,
  .background-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reference-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* iPad/tablet portrait: use the available width for the progress metrics. */
@media (min-width: 641px) and (max-width: 1199px) and (orientation: portrait) {
  .side-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric {
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: 14px 12px;
  }

  .metric:last-child {
    border-right: 0;
  }

}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .title-block {
    flex: 1 1 180px;
  }

  .reset-flow-btn {
    margin-left: auto;
  }

  .stage-line {
    grid-template-columns: repeat(2, 1fr);
    position: static;
  }

  .side-panel,
  .exercise-grid,
  .video-grid,
  .reference-grid {
    grid-template-columns: 1fr;
  }

  .registration-form-grid,
  .whatsapp-qr-card {
    grid-template-columns: 1fr;
  }

  .registration-field-wide {
    grid-column: auto;
  }

  .registration-submit,
  .whatsapp-qr-actions .primary-btn,
  .whatsapp-qr-actions .secondary-btn {
    width: 100%;
  }

  .whatsapp-qr-actions {
    align-items: stretch;
  }

  .side-metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .upload-card .primary-btn,
  .action-row .primary-btn,
  .action-row .secondary-btn,
  .exercise-tools .primary-btn,
  .exercise-tools .secondary-btn {
    width: 100%;
  }

  .dropzone,
  .camera-option,
  .preview-wrap {
    min-height: 280px;
  }

  .reference-heading,
  .reference-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading-row {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .reference-mode-control {
    position: static;
    justify-content: flex-end;
    margin-top: 10px;
  }

  .reference-progress-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .background-picker-header,
  .background-picker-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .custom-environment-heading,
  .environment-generation-summary,
  .environment-generation-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .environment-heading-actions {
    width: 100%;
    justify-items: start;
  }

  .environment-reference-grid,
  .custom-environment-result,
  .custom-environment-result-gallery {
    grid-template-columns: 1fr;
  }

  .environment-generation-actions,
  .environment-generation-actions .primary-btn {
    width: 100%;
  }

  .environment-generation-actions .primary-btn {
    justify-content: center;
  }

  .custom-environment-result-art {
    min-height: 180px;
  }

  .background-picker-footer .primary-btn {
    width: 100%;
  }

  .background-grid {
    grid-template-columns: 1fr;
  }

  .source-options,
  .camera-actions {
    grid-template-columns: 1fr;
  }

  .camera-actions {
    display: flex;
    flex-direction: column;
  }

  .camera-actions .primary-btn,
  .camera-actions .secondary-btn {
    width: 100%;
  }
}
